diff --git a/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md b/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md index cb7ba717a44be..dba96ad7f2282 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md +++ b/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2023-09-22) + +- Azure Resource Manager Chaos client library for Java. This package contains Microsoft Azure SDK for Chaos Management SDK. Chaos Management Client. Package tag package-preview-2023-09. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added diff --git a/sdk/chaos/azure-resourcemanager-chaos/README.md b/sdk/chaos/azure-resourcemanager-chaos/README.md index 276eb185633e2..aff15322867fd 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/README.md +++ b/sdk/chaos/azure-resourcemanager-chaos/README.md @@ -2,7 +2,7 @@ Azure Resource Manager Chaos client library for Java. -This package contains Microsoft Azure SDK for Chaos Management SDK. Chaos Management Client. Package tag package-2023-04-15-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for Chaos Management SDK. Chaos Management Client. Package tag package-preview-2023-09. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-chaos - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md b/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md index ce96a0fcf0da7..40b6a9147acdb 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md +++ b/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md @@ -28,6 +28,10 @@ - [Start](#experiments_start) - [Update](#experiments_update) +## OperationStatuses + +- [Get](#operationstatuses_get) + ## TargetTypes - [Get](#targettypes_get) @@ -47,7 +51,7 @@ import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; /** Samples for Capabilities CreateOrUpdate. */ public final class CapabilitiesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CreateOrUpdateACapability.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/CreateUpdateCapability.json */ /** * Sample code: Create/update a Capability that extends a virtual machine Target resource. @@ -77,7 +81,7 @@ public final class CapabilitiesCreateOrUpdateSamples { /** Samples for Capabilities Delete. */ public final class CapabilitiesDeleteSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/DeleteACapability.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/DeleteCapability.json */ /** * Sample code: Delete a Capability that extends a virtual machine Target resource. @@ -106,7 +110,7 @@ public final class CapabilitiesDeleteSamples { /** Samples for Capabilities Get. */ public final class CapabilitiesGetSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetACapability.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetCapability.json */ /** * Sample code: Get a Capability that extends a virtual machine Target resource. @@ -135,7 +139,7 @@ public final class CapabilitiesGetSamples { /** Samples for Capabilities List. */ public final class CapabilitiesListSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListCapabilities.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListCapabilities.json */ /** * Sample code: List all Capabilities that extend a virtual machine Target resource. @@ -164,7 +168,7 @@ public final class CapabilitiesListSamples { /** Samples for CapabilityTypes Get. */ public final class CapabilityTypesGetSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetACapabilityType.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetCapabilityType.json */ /** * Sample code: Get a Capability Type for a virtual machine Target resource on westus2 location. @@ -186,7 +190,7 @@ public final class CapabilityTypesGetSamples { /** Samples for CapabilityTypes List. */ public final class CapabilityTypesListSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListCapabilityTypes.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListCapabilityTypes.json */ /** * Sample code: List all Capability Types for a virtual machine Target resource on westus2 location. @@ -206,7 +210,7 @@ public final class CapabilityTypesListSamples { /** Samples for Experiments Cancel. */ public final class ExperimentsCancelSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CancelAExperiment.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/CancelExperiment.json */ /** * Sample code: Cancel a running Experiment. @@ -214,7 +218,7 @@ public final class ExperimentsCancelSamples { * @param manager Entry point to ChaosManager. */ public static void cancelARunningExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().cancelWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + manager.experiments().cancel("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); } } ``` @@ -222,13 +226,13 @@ public final class ExperimentsCancelSamples { ### Experiments_CreateOrUpdate ```java -import com.azure.resourcemanager.chaos.models.Branch; +import com.azure.resourcemanager.chaos.models.ChaosExperimentBranch; +import com.azure.resourcemanager.chaos.models.ChaosExperimentStep; +import com.azure.resourcemanager.chaos.models.ChaosTargetListSelector; import com.azure.resourcemanager.chaos.models.ContinuousAction; import com.azure.resourcemanager.chaos.models.KeyValuePair; -import com.azure.resourcemanager.chaos.models.ListSelector; import com.azure.resourcemanager.chaos.models.ResourceIdentity; import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import com.azure.resourcemanager.chaos.models.Step; import com.azure.resourcemanager.chaos.models.TargetReference; import com.azure.resourcemanager.chaos.models.TargetReferenceType; import java.time.Duration; @@ -237,7 +241,7 @@ import java.util.Arrays; /** Samples for Experiments CreateOrUpdate. */ public final class ExperimentsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CreateOrUpdateAExperiment.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/CreateUpdateExperiment.json */ /** * Sample code: Create/update a Experiment in a resource group. @@ -253,12 +257,12 @@ public final class ExperimentsCreateOrUpdateSamples { .withSteps( Arrays .asList( - new Step() + new ChaosExperimentStep() .withName("step1") .withBranches( Arrays .asList( - new Branch() + new ChaosExperimentBranch() .withName("branch1") .withActions( Arrays @@ -276,7 +280,7 @@ public final class ExperimentsCreateOrUpdateSamples { .withSelectors( Arrays .asList( - new ListSelector() + new ChaosTargetListSelector() .withId("selector1") .withTargets( Arrays @@ -297,7 +301,7 @@ public final class ExperimentsCreateOrUpdateSamples { /** Samples for Experiments Delete. */ public final class ExperimentsDeleteSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/DeleteAExperiment.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/DeleteExperiment.json */ /** * Sample code: Delete a Experiment in a resource group. @@ -305,9 +309,7 @@ public final class ExperimentsDeleteSamples { * @param manager Entry point to ChaosManager. */ public static void deleteAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager - .experiments() - .deleteByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + manager.experiments().delete("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); } } ``` @@ -318,7 +320,7 @@ public final class ExperimentsDeleteSamples { /** Samples for Experiments GetByResourceGroup. */ public final class ExperimentsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperiment.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetExperiment.json */ /** * Sample code: Get a Experiment in a resource group. @@ -339,7 +341,7 @@ public final class ExperimentsGetByResourceGroupSamples { /** Samples for Experiments GetExecutionDetails. */ public final class ExperimentsGetExecutionDetailsSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperimentExecutionDetails.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetExperimentExecutionDetails.json */ /** * Sample code: Get experiment execution details. @@ -364,7 +366,7 @@ public final class ExperimentsGetExecutionDetailsSamples { /** Samples for Experiments GetStatus. */ public final class ExperimentsGetStatusSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperimentStatus.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetExperimentStatus.json */ /** * Sample code: Get the status of a Experiment. @@ -389,7 +391,7 @@ public final class ExperimentsGetStatusSamples { /** Samples for Experiments List. */ public final class ExperimentsListSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentsInASubscription.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListExperimentsInASubscription.json */ /** * Sample code: List all Experiments in a subscription. @@ -408,7 +410,7 @@ public final class ExperimentsListSamples { /** Samples for Experiments ListAllStatuses. */ public final class ExperimentsListAllStatusesSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentStatuses.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListExperimentStatuses.json */ /** * Sample code: List all statuses of a Experiment. @@ -427,7 +429,7 @@ public final class ExperimentsListAllStatusesSamples { /** Samples for Experiments ListByResourceGroup. */ public final class ExperimentsListByResourceGroupSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentsInAResourceGroup.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListExperimentsInAResourceGroup.json */ /** * Sample code: List all Experiments in a resource group. @@ -446,7 +448,7 @@ public final class ExperimentsListByResourceGroupSamples { /** Samples for Experiments ListExecutionDetails. */ public final class ExperimentsListExecutionDetailsSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentExecutionsDetails.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListExperimentExecutionsDetails.json */ /** * Sample code: List experiment executions details. @@ -465,7 +467,7 @@ public final class ExperimentsListExecutionDetailsSamples { /** Samples for Experiments Start. */ public final class ExperimentsStartSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/StartAExperiment.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/StartExperiment.json */ /** * Sample code: Start a Experiment. @@ -473,7 +475,7 @@ public final class ExperimentsStartSamples { * @param manager Entry point to ChaosManager. */ public static void startAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().startWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + manager.experiments().start("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); } } ``` @@ -491,14 +493,14 @@ import java.util.Map; /** Samples for Experiments Update. */ public final class ExperimentsUpdateSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/PatchExperiment.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/UpdateExperiment.json */ /** - * Sample code: Patch an Experiment in a resource group. + * Sample code: Update an Experiment in a resource group. * * @param manager Entry point to ChaosManager. */ - public static void patchAnExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + public static void updateAnExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { Experiment resource = manager .experiments() @@ -516,6 +518,7 @@ public final class ExperimentsUpdateSamples { .apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -529,13 +532,34 @@ public final class ExperimentsUpdateSamples { } ``` +### OperationStatuses_Get + +```java +/** Samples for OperationStatuses Get. */ +public final class OperationStatusesGetSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetOperationStatus.json + */ + /** + * Sample code: Get specific operation status. + * + * @param manager Entry point to ChaosManager. + */ + public static void getSpecificOperationStatus(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager + .operationStatuses() + .getWithResponse("West US", "713192d7-503f-477a-9cfe-4efc3ee2bd11", com.azure.core.util.Context.NONE); + } +} +``` + ### TargetTypes_Get ```java /** Samples for TargetTypes Get. */ public final class TargetTypesGetSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetATargetType.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetTargetType.json */ /** * Sample code: Get a Target Type for westus2 location. @@ -554,7 +578,7 @@ public final class TargetTypesGetSamples { /** Samples for TargetTypes List. */ public final class TargetTypesListSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListTargetTypes.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListTargetTypes.json */ /** * Sample code: List all Target Types for westus2 location. @@ -580,7 +604,7 @@ import java.util.Map; /** Samples for Targets CreateOrUpdate. */ public final class TargetsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CreateOrUpdateATarget.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/CreateUpdateTarget.json */ /** * Sample code: Create/update a Target that extends a virtual machine resource. @@ -610,6 +634,7 @@ public final class TargetsCreateOrUpdateSamples { com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -629,7 +654,7 @@ public final class TargetsCreateOrUpdateSamples { /** Samples for Targets Delete. */ public final class TargetsDeleteSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/DeleteATarget.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/DeleteTarget.json */ /** * Sample code: Delete a Target that extends a virtual machine resource. @@ -657,7 +682,7 @@ public final class TargetsDeleteSamples { /** Samples for Targets Get. */ public final class TargetsGetSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetATarget.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetTarget.json */ /** * Sample code: Get a Target that extends a virtual machine resource. @@ -685,7 +710,7 @@ public final class TargetsGetSamples { /** Samples for Targets List. */ public final class TargetsListSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListTargets.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListTargets.json */ /** * Sample code: List all Targets that extend a virtual machine resource. diff --git a/sdk/chaos/azure-resourcemanager-chaos/pom.xml b/sdk/chaos/azure-resourcemanager-chaos/pom.xml index 51484d27cbdf9..1aa2ba66d7fdf 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/pom.xml +++ b/sdk/chaos/azure-resourcemanager-chaos/pom.xml @@ -18,7 +18,7 @@ jar Microsoft Azure SDK for Chaos Management - This package contains Microsoft Azure SDK for Chaos Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Chaos Management Client. Package tag package-2023-04-15-preview. + This package contains Microsoft Azure SDK for Chaos Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Chaos Management Client. Package tag package-preview-2023-09. https://github.com/Azure/azure-sdk-for-java @@ -45,6 +45,7 @@ UTF-8 0 0 + true diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/ChaosManager.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/ChaosManager.java index 0a8981c49044c..34aef53ffbc8b 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/ChaosManager.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/ChaosManager.java @@ -28,12 +28,14 @@ import com.azure.resourcemanager.chaos.implementation.CapabilityTypesImpl; import com.azure.resourcemanager.chaos.implementation.ChaosManagementClientBuilder; import com.azure.resourcemanager.chaos.implementation.ExperimentsImpl; +import com.azure.resourcemanager.chaos.implementation.OperationStatusesImpl; import com.azure.resourcemanager.chaos.implementation.OperationsImpl; import com.azure.resourcemanager.chaos.implementation.TargetTypesImpl; import com.azure.resourcemanager.chaos.implementation.TargetsImpl; import com.azure.resourcemanager.chaos.models.Capabilities; import com.azure.resourcemanager.chaos.models.CapabilityTypes; import com.azure.resourcemanager.chaos.models.Experiments; +import com.azure.resourcemanager.chaos.models.OperationStatuses; import com.azure.resourcemanager.chaos.models.Operations; import com.azure.resourcemanager.chaos.models.TargetTypes; import com.azure.resourcemanager.chaos.models.Targets; @@ -58,6 +60,8 @@ public final class ChaosManager { private Targets targets; + private OperationStatuses operationStatuses; + private final ChaosManagementClient clientObject; private ChaosManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -353,8 +357,22 @@ public Targets targets() { } /** - * @return Wrapped service client ChaosManagementClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. + * Gets the resource collection API of OperationStatuses. + * + * @return Resource collection API of OperationStatuses. + */ + public OperationStatuses operationStatuses() { + if (this.operationStatuses == null) { + this.operationStatuses = new OperationStatusesImpl(clientObject.getOperationStatuses(), this); + } + return operationStatuses; + } + + /** + * Gets wrapped service client ChaosManagementClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client ChaosManagementClient. */ public ChaosManagementClient serviceClient() { return this.clientObject; diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ChaosManagementClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ChaosManagementClient.java index a0154a97764ed..2f6ac66073a1c 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ChaosManagementClient.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ChaosManagementClient.java @@ -85,4 +85,11 @@ public interface ChaosManagementClient { * @return the TargetsClient object. */ TargetsClient getTargets(); + + /** + * Gets the OperationStatusesClient object to access its operations. + * + * @return the OperationStatusesClient object. + */ + OperationStatusesClient getOperationStatuses(); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentsClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentsClient.java index a33fb3e5d4298..5cab88bf8e101 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentsClient.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentsClient.java @@ -8,11 +8,11 @@ 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.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner; +import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner; import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner; import com.azure.resourcemanager.chaos.models.ExperimentUpdate; @@ -72,6 +72,19 @@ public interface ExperimentsClient { PagedIterable listByResourceGroup( String resourceGroupName, Boolean running, String continuationToken, Context context); + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 experimentName); + /** * Delete a Experiment resource. * @@ -81,10 +94,10 @@ PagedIterable listByResourceGroup( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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}. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String resourceGroupName, String experimentName, Context context); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String experimentName, Context context); /** * Delete a Experiment resource. @@ -98,6 +111,19 @@ PagedIterable listByResourceGroup( @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String experimentName); + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @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 experimentName, Context context); + /** * Get a Experiment resource. * @@ -126,6 +152,21 @@ Response getByResourceGroupWithResponse( @ServiceMethod(returns = ReturnType.SINGLE) ExperimentInner getByResourceGroup(String resourceGroupName, String experimentName); + /** + * Create or update a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or 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 model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExperimentInner> beginCreateOrUpdate( + String resourceGroupName, String experimentName, ExperimentInner experiment); + /** * Create or update a Experiment resource. * @@ -136,10 +177,10 @@ Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Experiment resource along with {@link Response}. + * @return the {@link SyncPoller} for polling of model that represents a Experiment resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateWithResponse( + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExperimentInner> beginCreateOrUpdate( String resourceGroupName, String experimentName, ExperimentInner experiment, Context context); /** @@ -156,6 +197,37 @@ Response createOrUpdateWithResponse( @ServiceMethod(returns = ReturnType.SINGLE) ExperimentInner createOrUpdate(String resourceGroupName, String experimentName, ExperimentInner experiment); + /** + * Create or update a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or 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 model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExperimentInner createOrUpdate( + String resourceGroupName, String experimentName, ExperimentInner experiment, Context context); + + /** + * The operation to update an experiment. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment 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 model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExperimentInner> beginUpdate( + String resourceGroupName, String experimentName, ExperimentUpdate experiment); + /** * The operation to update an experiment. * @@ -166,10 +238,10 @@ Response createOrUpdateWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Experiment resource along with {@link Response}. + * @return the {@link SyncPoller} for polling of model that represents a Experiment resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse( + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExperimentInner> beginUpdate( String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context); /** @@ -186,6 +258,35 @@ Response updateWithResponse( @ServiceMethod(returns = ReturnType.SINGLE) ExperimentInner update(String resourceGroupName, String experimentName, ExperimentUpdate experiment); + /** + * The operation to update an experiment. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment operation. + * @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 model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExperimentInner update( + String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context); + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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> beginCancel(String resourceGroupName, String experimentName); + /** * Cancel a running Experiment resource. * @@ -195,24 +296,48 @@ Response updateWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the result of a cancel Experiment operation along with {@link Response}. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCancel(String resourceGroupName, String experimentName, Context context); + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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) - Response cancelWithResponse( - String resourceGroupName, String experimentName, Context context); + void cancel(String resourceGroupName, String experimentName); /** * Cancel a running Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. + * @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 model that represents the result of a cancel Experiment operation. */ @ServiceMethod(returns = ReturnType.SINGLE) - ExperimentCancelOperationResultInner cancel(String resourceGroupName, String experimentName); + void cancel(String resourceGroupName, String experimentName, Context context); + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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> beginStart(String resourceGroupName, String experimentName); /** * Start a Experiment resource. @@ -223,24 +348,35 @@ Response cancelWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the result of a start Experiment operation along with {@link Response}. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String experimentName, Context context); + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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) - Response startWithResponse( - String resourceGroupName, String experimentName, Context context); + void start(String resourceGroupName, String experimentName); /** * Start a Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. + * @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 model that represents the result of a start Experiment operation. */ @ServiceMethod(returns = ReturnType.SINGLE) - ExperimentStartOperationResultInner start(String resourceGroupName, String experimentName); + void start(String resourceGroupName, String experimentName, Context context); /** * Get a list of statuses of a Experiment resource. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/OperationStatusesClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/OperationStatusesClient.java new file mode 100644 index 0000000000000..b50d0814f55fa --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/OperationStatusesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner; + +/** An instance of this class provides access to all the operations defined in OperationStatusesClient. */ +public interface OperationStatusesClient { + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running azure asynchronous operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, String asyncOperationId, Context context); + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running azure asynchronous operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationStatusInner get(String location, String asyncOperationId); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentCancelOperationResultInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentCancelOperationResultInner.java deleted file mode 100644 index 051a70ae06f43..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentCancelOperationResultInner.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Model that represents the result of a cancel Experiment operation. */ -@Immutable -public final class ExperimentCancelOperationResultInner { - /* - * String of the Experiment name. - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * URL to retrieve the Experiment status. - */ - @JsonProperty(value = "statusUrl", access = JsonProperty.Access.WRITE_ONLY) - private String statusUrl; - - /** Creates an instance of ExperimentCancelOperationResultInner class. */ - public ExperimentCancelOperationResultInner() { - } - - /** - * Get the name property: String of the Experiment name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the statusUrl property: URL to retrieve the Experiment status. - * - * @return the statusUrl value. - */ - public String statusUrl() { - return this.statusUrl; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java index 6e8ea34c269d7..c18c4a2374363 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java @@ -8,9 +8,10 @@ import com.azure.core.management.Resource; import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.chaos.models.ChaosExperimentStep; +import com.azure.resourcemanager.chaos.models.ChaosTargetSelector; +import com.azure.resourcemanager.chaos.models.ProvisioningState; import com.azure.resourcemanager.chaos.models.ResourceIdentity; -import com.azure.resourcemanager.chaos.models.Selector; -import com.azure.resourcemanager.chaos.models.Step; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; import java.util.Map; @@ -30,6 +31,12 @@ public final class ExperimentInner extends Resource { @JsonProperty(value = "identity") private ResourceIdentity identity; + /* + * Most recent provisioning state for the given experiment resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + /* * The properties of the experiment resource. */ @@ -69,6 +76,15 @@ public ExperimentInner withIdentity(ResourceIdentity identity) { return this; } + /** + * Get the provisioningState property: Most recent provisioning state for the given experiment resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + /** * Get the innerProperties property: The properties of the experiment resource. * @@ -97,7 +113,7 @@ public ExperimentInner withTags(Map tags) { * * @return the steps value. */ - public List steps() { + public List steps() { return this.innerProperties() == null ? null : this.innerProperties().steps(); } @@ -107,7 +123,7 @@ public List steps() { * @param steps the steps value to set. * @return the ExperimentInner object itself. */ - public ExperimentInner withSteps(List steps) { + public ExperimentInner withSteps(List steps) { if (this.innerProperties() == null) { this.innerProperties = new ExperimentProperties(); } @@ -120,7 +136,7 @@ public ExperimentInner withSteps(List steps) { * * @return the selectors value. */ - public List selectors() { + public List selectors() { return this.innerProperties() == null ? null : this.innerProperties().selectors(); } @@ -130,7 +146,7 @@ public List selectors() { * @param selectors the selectors value to set. * @return the ExperimentInner object itself. */ - public ExperimentInner withSelectors(List selectors) { + public ExperimentInner withSelectors(List selectors) { if (this.innerProperties() == null) { this.innerProperties = new ExperimentProperties(); } @@ -138,31 +154,6 @@ public ExperimentInner withSelectors(List selectors) { return this; } - /** - * Get the startOnCreation property: A boolean value that indicates if experiment should be started on creation or - * not. - * - * @return the startOnCreation value. - */ - public Boolean startOnCreation() { - return this.innerProperties() == null ? null : this.innerProperties().startOnCreation(); - } - - /** - * Set the startOnCreation property: A boolean value that indicates if experiment should be started on creation or - * not. - * - * @param startOnCreation the startOnCreation value to set. - * @return the ExperimentInner object itself. - */ - public ExperimentInner withStartOnCreation(Boolean startOnCreation) { - if (this.innerProperties() == null) { - this.innerProperties = new ExperimentProperties(); - } - this.innerProperties().withStartOnCreation(startOnCreation); - return this; - } - /** * Validates the instance. * diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java index 81e0dcaf89e35..a14fb9386f880 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java @@ -6,8 +6,8 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.chaos.models.Selector; -import com.azure.resourcemanager.chaos.models.Step; +import com.azure.resourcemanager.chaos.models.ChaosExperimentStep; +import com.azure.resourcemanager.chaos.models.ChaosTargetSelector; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; @@ -18,19 +18,13 @@ public final class ExperimentProperties { * List of steps. */ @JsonProperty(value = "steps", required = true) - private List steps; + private List steps; /* * List of selectors. */ @JsonProperty(value = "selectors", required = true) - private List selectors; - - /* - * A boolean value that indicates if experiment should be started on creation or not. - */ - @JsonProperty(value = "startOnCreation") - private Boolean startOnCreation; + private List selectors; /** Creates an instance of ExperimentProperties class. */ public ExperimentProperties() { @@ -41,7 +35,7 @@ public ExperimentProperties() { * * @return the steps value. */ - public List steps() { + public List steps() { return this.steps; } @@ -51,7 +45,7 @@ public List steps() { * @param steps the steps value to set. * @return the ExperimentProperties object itself. */ - public ExperimentProperties withSteps(List steps) { + public ExperimentProperties withSteps(List steps) { this.steps = steps; return this; } @@ -61,7 +55,7 @@ public ExperimentProperties withSteps(List steps) { * * @return the selectors value. */ - public List selectors() { + public List selectors() { return this.selectors; } @@ -71,33 +65,11 @@ public List selectors() { * @param selectors the selectors value to set. * @return the ExperimentProperties object itself. */ - public ExperimentProperties withSelectors(List selectors) { + public ExperimentProperties withSelectors(List selectors) { this.selectors = selectors; return this; } - /** - * Get the startOnCreation property: A boolean value that indicates if experiment should be started on creation or - * not. - * - * @return the startOnCreation value. - */ - public Boolean startOnCreation() { - return this.startOnCreation; - } - - /** - * Set the startOnCreation property: A boolean value that indicates if experiment should be started on creation or - * not. - * - * @param startOnCreation the startOnCreation value to set. - * @return the ExperimentProperties object itself. - */ - public ExperimentProperties withStartOnCreation(Boolean startOnCreation) { - this.startOnCreation = startOnCreation; - return this; - } - /** * Validates the instance. * diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStartOperationResultInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStartOperationResultInner.java deleted file mode 100644 index 03dc806d31cd5..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStartOperationResultInner.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Model that represents the result of a start Experiment operation. */ -@Immutable -public final class ExperimentStartOperationResultInner { - /* - * String of the Experiment name. - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * URL to retrieve the Experiment status. - */ - @JsonProperty(value = "statusUrl", access = JsonProperty.Access.WRITE_ONLY) - private String statusUrl; - - /** Creates an instance of ExperimentStartOperationResultInner class. */ - public ExperimentStartOperationResultInner() { - } - - /** - * Get the name property: String of the Experiment name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the statusUrl property: URL to retrieve the Experiment status. - * - * @return the statusUrl value. - */ - public String statusUrl() { - return this.statusUrl; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java new file mode 100644 index 0000000000000..3468d9ffca75f --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The status of operation. */ +@Fluent +public final class OperationStatusInner { + /* + * The operation Id. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The operation name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The start time of the operation. + */ + @JsonProperty(value = "startTime") + private String startTime; + + /* + * The end time of the operation. + */ + @JsonProperty(value = "endTime") + private String endTime; + + /* + * The status of the operation. + */ + @JsonProperty(value = "status") + private String status; + + /* + * Error response + * + * The error detail of the operation if any. + */ + @JsonProperty(value = "error") + private ManagementError error; + + /** Creates an instance of OperationStatusInner class. */ + public OperationStatusInner() { + } + + /** + * Get the id property: The operation Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The operation Id. + * + * @param id the id value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: The operation name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The operation name. + * + * @param name the name value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the startTime property: The start time of the operation. + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start time of the operation. + * + * @param startTime the startTime value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: The end time of the operation. + * + * @return the endTime value. + */ + public String endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The end time of the operation. + * + * @param endTime the endTime value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withEndTime(String endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the status property: The status of the operation. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The status of the operation. + * + * @param status the status value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the error property: Error response + * + *

The error detail of the operation if any. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Set the error property: Error response + * + *

The error detail of the operation if any. + * + * @param error the error value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withError(ManagementError error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java index ed74ff20611a7..866e2f6186acd 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java @@ -137,7 +137,7 @@ public ChaosManagementClientImpl buildClient() { localSerializerAdapter, localDefaultPollInterval, localEnvironment, - subscriptionId, + this.subscriptionId, localEndpoint); return client; } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java index c07707c92a9db..50dbd8d26d262 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java @@ -26,6 +26,7 @@ import com.azure.resourcemanager.chaos.fluent.CapabilityTypesClient; import com.azure.resourcemanager.chaos.fluent.ChaosManagementClient; import com.azure.resourcemanager.chaos.fluent.ExperimentsClient; +import com.azure.resourcemanager.chaos.fluent.OperationStatusesClient; import com.azure.resourcemanager.chaos.fluent.OperationsClient; import com.azure.resourcemanager.chaos.fluent.TargetTypesClient; import com.azure.resourcemanager.chaos.fluent.TargetsClient; @@ -185,6 +186,18 @@ public TargetsClient getTargets() { return this.targets; } + /** The OperationStatusesClient object to access its operations. */ + private final OperationStatusesClient operationStatuses; + + /** + * Gets the OperationStatusesClient object to access its operations. + * + * @return the OperationStatusesClient object. + */ + public OperationStatusesClient getOperationStatuses() { + return this.operationStatuses; + } + /** * Initializes an instance of ChaosManagementClient client. * @@ -207,13 +220,14 @@ public TargetsClient getTargets() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2023-04-15-preview"; + this.apiVersion = "2023-09-01-preview"; this.capabilities = new CapabilitiesClientImpl(this); this.capabilityTypes = new CapabilityTypesClientImpl(this); this.experiments = new ExperimentsClientImpl(this); this.operations = new OperationsClientImpl(this); this.targetTypes = new TargetTypesClientImpl(this); this.targets = new TargetsClientImpl(this); + this.operationStatuses = new OperationStatusesClientImpl(this); } /** diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentCancelOperationResultImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentCancelOperationResultImpl.java deleted file mode 100644 index ab9f6c580516b..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentCancelOperationResultImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.implementation; - -import com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner; -import com.azure.resourcemanager.chaos.models.ExperimentCancelOperationResult; - -public final class ExperimentCancelOperationResultImpl implements ExperimentCancelOperationResult { - private ExperimentCancelOperationResultInner innerObject; - - private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; - - ExperimentCancelOperationResultImpl( - ExperimentCancelOperationResultInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String name() { - return this.innerModel().name(); - } - - public String statusUrl() { - return this.innerModel().statusUrl(); - } - - public ExperimentCancelOperationResultInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.chaos.ChaosManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java index d48f0bfa66a59..6681415751dd6 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java @@ -4,18 +4,16 @@ package com.azure.resourcemanager.chaos.implementation; -import com.azure.core.http.rest.Response; import com.azure.core.management.Region; import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; +import com.azure.resourcemanager.chaos.models.ChaosExperimentStep; +import com.azure.resourcemanager.chaos.models.ChaosTargetSelector; import com.azure.resourcemanager.chaos.models.Experiment; -import com.azure.resourcemanager.chaos.models.ExperimentCancelOperationResult; -import com.azure.resourcemanager.chaos.models.ExperimentStartOperationResult; import com.azure.resourcemanager.chaos.models.ExperimentUpdate; +import com.azure.resourcemanager.chaos.models.ProvisioningState; import com.azure.resourcemanager.chaos.models.ResourceIdentity; -import com.azure.resourcemanager.chaos.models.Selector; -import com.azure.resourcemanager.chaos.models.Step; import java.util.Collections; import java.util.List; import java.util.Map; @@ -58,8 +56,12 @@ public ResourceIdentity identity() { return this.innerModel().identity(); } - public List steps() { - List inner = this.innerModel().steps(); + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public List steps() { + List inner = this.innerModel().steps(); if (inner != null) { return Collections.unmodifiableList(inner); } else { @@ -67,8 +69,8 @@ public List steps() { } } - public List selectors() { - List inner = this.innerModel().selectors(); + public List selectors() { + List inner = this.innerModel().selectors(); if (inner != null) { return Collections.unmodifiableList(inner); } else { @@ -76,10 +78,6 @@ public List selectors() { } } - public Boolean startOnCreation() { - return this.innerModel().startOnCreation(); - } - public Region region() { return Region.fromName(this.regionName()); } @@ -116,8 +114,7 @@ public Experiment create() { serviceManager .serviceClient() .getExperiments() - .createOrUpdateWithResponse(resourceGroupName, experimentName, this.innerModel(), Context.NONE) - .getValue(); + .createOrUpdate(resourceGroupName, experimentName, this.innerModel(), Context.NONE); return this; } @@ -126,8 +123,7 @@ public Experiment create(Context context) { serviceManager .serviceClient() .getExperiments() - .createOrUpdateWithResponse(resourceGroupName, experimentName, this.innerModel(), context) - .getValue(); + .createOrUpdate(resourceGroupName, experimentName, this.innerModel(), context); return this; } @@ -147,8 +143,7 @@ public Experiment apply() { serviceManager .serviceClient() .getExperiments() - .updateWithResponse(resourceGroupName, experimentName, updateExperiment, Context.NONE) - .getValue(); + .update(resourceGroupName, experimentName, updateExperiment, Context.NONE); return this; } @@ -157,8 +152,7 @@ public Experiment apply(Context context) { serviceManager .serviceClient() .getExperiments() - .updateWithResponse(resourceGroupName, experimentName, updateExperiment, context) - .getValue(); + .update(resourceGroupName, experimentName, updateExperiment, context); return this; } @@ -189,20 +183,20 @@ public Experiment refresh(Context context) { return this; } - public Response cancelWithResponse(Context context) { - return serviceManager.experiments().cancelWithResponse(resourceGroupName, experimentName, context); + public void cancel() { + serviceManager.experiments().cancel(resourceGroupName, experimentName); } - public ExperimentCancelOperationResult cancel() { - return serviceManager.experiments().cancel(resourceGroupName, experimentName); + public void cancel(Context context) { + serviceManager.experiments().cancel(resourceGroupName, experimentName, context); } - public Response startWithResponse(Context context) { - return serviceManager.experiments().startWithResponse(resourceGroupName, experimentName, context); + public void start() { + serviceManager.experiments().start(resourceGroupName, experimentName); } - public ExperimentStartOperationResult start() { - return serviceManager.experiments().start(resourceGroupName, experimentName); + public void start(Context context) { + serviceManager.experiments().start(resourceGroupName, experimentName, context); } public ExperimentImpl withRegion(Region location) { @@ -215,12 +209,12 @@ public ExperimentImpl withRegion(String location) { return this; } - public ExperimentImpl withSteps(List steps) { + public ExperimentImpl withSteps(List steps) { this.innerModel().withSteps(steps); return this; } - public ExperimentImpl withSelectors(List selectors) { + public ExperimentImpl withSelectors(List selectors) { this.innerModel().withSelectors(selectors); return this; } @@ -240,11 +234,6 @@ public ExperimentImpl withIdentity(ResourceIdentity identity) { } } - public ExperimentImpl withStartOnCreation(Boolean startOnCreation) { - this.innerModel().withStartOnCreation(startOnCreation); - return this; - } - private boolean isInCreateMode() { return this.innerModel().id() == null; } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStartOperationResultImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStartOperationResultImpl.java deleted file mode 100644 index 8fa3ca1fcc2c6..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStartOperationResultImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.implementation; - -import com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner; -import com.azure.resourcemanager.chaos.models.ExperimentStartOperationResult; - -public final class ExperimentStartOperationResultImpl implements ExperimentStartOperationResult { - private ExperimentStartOperationResultInner innerObject; - - private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; - - ExperimentStartOperationResultImpl( - ExperimentStartOperationResultInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String name() { - return this.innerModel().name(); - } - - public String statusUrl() { - return this.innerModel().statusUrl(); - } - - public ExperimentStartOperationResultInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.chaos.ChaosManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java index dcf3d6a39bc9f..8fd267f90d45c 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java @@ -28,18 +28,21 @@ 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.chaos.fluent.ExperimentsClient; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner; import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner; import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner; import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsListResult; import com.azure.resourcemanager.chaos.models.ExperimentListResult; import com.azure.resourcemanager.chaos.models.ExperimentStatusListResult; import com.azure.resourcemanager.chaos.models.ExperimentUpdate; +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 ExperimentsClient. */ @@ -98,9 +101,9 @@ Mono> listByResourceGroup( @Headers({"Content-Type: application/json"}) @Delete( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") - @ExpectedResponses({200, 204}) + @ExpectedResponses({202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete( + Mono>> delete( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -126,9 +129,9 @@ Mono> getByResourceGroup( @Headers({"Content-Type: application/json"}) @Put( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") - @ExpectedResponses({200}) + @ExpectedResponses({201}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate( + Mono>> createOrUpdate( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -141,9 +144,9 @@ Mono> createOrUpdate( @Headers({"Content-Type: application/json"}) @Patch( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") - @ExpectedResponses({200}) + @ExpectedResponses({202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update( + Mono>> update( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -158,7 +161,7 @@ Mono> update( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> cancel( + Mono>> cancel( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -172,7 +175,7 @@ Mono> cancel( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> start( + Mono>> start( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -682,7 +685,7 @@ public PagedIterable listByResourceGroup( * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String experimentName) { + private Mono>> deleteWithResponseAsync(String resourceGroupName, String experimentName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -730,7 +733,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync( + private Mono>> deleteWithResponseAsync( String resourceGroupName, String experimentName, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -764,6 +767,78 @@ private Mono> deleteWithResponseAsync( context); } + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 experimentName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, experimentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @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 experimentName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, experimentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 experimentName) { + return this.beginDeleteAsync(resourceGroupName, experimentName).getSyncPoller(); + } + + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @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 experimentName, Context context) { + return this.beginDeleteAsync(resourceGroupName, experimentName, context).getSyncPoller(); + } + /** * Delete a Experiment resource. * @@ -776,7 +851,9 @@ private Mono> deleteWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String experimentName) { - return deleteWithResponseAsync(resourceGroupName, experimentName).flatMap(ignored -> Mono.empty()); + return beginDeleteAsync(resourceGroupName, experimentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -788,11 +865,13 @@ private Mono deleteAsync(String resourceGroupName, String experimentName) * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String resourceGroupName, String experimentName, Context context) { - return deleteWithResponseAsync(resourceGroupName, experimentName, context).block(); + private Mono deleteAsync(String resourceGroupName, String experimentName, Context context) { + return beginDeleteAsync(resourceGroupName, experimentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -806,7 +885,22 @@ public Response deleteWithResponse(String resourceGroupName, String experi */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String experimentName) { - deleteWithResponse(resourceGroupName, experimentName, Context.NONE); + deleteAsync(resourceGroupName, experimentName).block(); + } + + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @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 experimentName, Context context) { + deleteAsync(resourceGroupName, experimentName, context).block(); } /** @@ -964,7 +1058,7 @@ public ExperimentInner getByResourceGroup(String resourceGroupName, String exper * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync( + private Mono>> createOrUpdateWithResponseAsync( String resourceGroupName, String experimentName, ExperimentInner experiment) { if (this.client.getEndpoint() == null) { return Mono @@ -1021,7 +1115,7 @@ private Mono> createOrUpdateWithResponseAsync( * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync( + private Mono>> createOrUpdateWithResponseAsync( String resourceGroupName, String experimentName, ExperimentInner experiment, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -1061,6 +1155,91 @@ private Mono> createOrUpdateWithResponseAsync( context); } + /** + * Create or update a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or 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 model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ExperimentInner> beginCreateOrUpdateAsync( + String resourceGroupName, String experimentName, ExperimentInner experiment) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, experimentName, experiment); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ExperimentInner.class, + ExperimentInner.class, + this.client.getContext()); + } + + /** + * Create or update a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or 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 model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ExperimentInner> beginCreateOrUpdateAsync( + String resourceGroupName, String experimentName, ExperimentInner experiment, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, experimentName, experiment, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ExperimentInner.class, ExperimentInner.class, context); + } + + /** + * Create or update a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or 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 model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExperimentInner> beginCreateOrUpdate( + String resourceGroupName, String experimentName, ExperimentInner experiment) { + return this.beginCreateOrUpdateAsync(resourceGroupName, experimentName, experiment).getSyncPoller(); + } + + /** + * Create or update a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or 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 model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExperimentInner> beginCreateOrUpdate( + String resourceGroupName, String experimentName, ExperimentInner experiment, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, experimentName, experiment, context).getSyncPoller(); + } + /** * Create or update a Experiment resource. * @@ -1075,8 +1254,9 @@ private Mono> createOrUpdateWithResponseAsync( @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync( String resourceGroupName, String experimentName, ExperimentInner experiment) { - return createOrUpdateWithResponseAsync(resourceGroupName, experimentName, experiment) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + return beginCreateOrUpdateAsync(resourceGroupName, experimentName, experiment) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -1089,12 +1269,14 @@ private Mono createOrUpdateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Experiment resource along with {@link Response}. + * @return model that represents a Experiment resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse( + private Mono createOrUpdateAsync( String resourceGroupName, String experimentName, ExperimentInner experiment, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, experimentName, experiment, context).block(); + return beginCreateOrUpdateAsync(resourceGroupName, experimentName, experiment, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -1110,7 +1292,25 @@ public Response createOrUpdateWithResponse( */ @ServiceMethod(returns = ReturnType.SINGLE) public ExperimentInner createOrUpdate(String resourceGroupName, String experimentName, ExperimentInner experiment) { - return createOrUpdateWithResponse(resourceGroupName, experimentName, experiment, Context.NONE).getValue(); + return createOrUpdateAsync(resourceGroupName, experimentName, experiment).block(); + } + + /** + * Create or update a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or 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 model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExperimentInner createOrUpdate( + String resourceGroupName, String experimentName, ExperimentInner experiment, Context context) { + return createOrUpdateAsync(resourceGroupName, experimentName, experiment, context).block(); } /** @@ -1126,7 +1326,7 @@ public ExperimentInner createOrUpdate(String resourceGroupName, String experimen * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( + private Mono>> updateWithResponseAsync( String resourceGroupName, String experimentName, ExperimentUpdate experiment) { if (this.client.getEndpoint() == null) { return Mono @@ -1183,7 +1383,7 @@ private Mono> updateWithResponseAsync( * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( + private Mono>> updateWithResponseAsync( String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -1223,6 +1423,90 @@ private Mono> updateWithResponseAsync( context); } + /** + * The operation to update an experiment. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment 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 model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ExperimentInner> beginUpdateAsync( + String resourceGroupName, String experimentName, ExperimentUpdate experiment) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, experimentName, experiment); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ExperimentInner.class, + ExperimentInner.class, + this.client.getContext()); + } + + /** + * The operation to update an experiment. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment operation. + * @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 model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ExperimentInner> beginUpdateAsync( + String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, experimentName, experiment, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ExperimentInner.class, ExperimentInner.class, context); + } + + /** + * The operation to update an experiment. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment 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 model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExperimentInner> beginUpdate( + String resourceGroupName, String experimentName, ExperimentUpdate experiment) { + return this.beginUpdateAsync(resourceGroupName, experimentName, experiment).getSyncPoller(); + } + + /** + * The operation to update an experiment. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment operation. + * @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 model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExperimentInner> beginUpdate( + String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context) { + return this.beginUpdateAsync(resourceGroupName, experimentName, experiment, context).getSyncPoller(); + } + /** * The operation to update an experiment. * @@ -1237,8 +1521,9 @@ private Mono> updateWithResponseAsync( @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync( String resourceGroupName, String experimentName, ExperimentUpdate experiment) { - return updateWithResponseAsync(resourceGroupName, experimentName, experiment) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + return beginUpdateAsync(resourceGroupName, experimentName, experiment) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -1251,12 +1536,14 @@ private Mono updateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Experiment resource along with {@link Response}. + * @return model that represents a Experiment resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse( + private Mono updateAsync( String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context) { - return updateWithResponseAsync(resourceGroupName, experimentName, experiment, context).block(); + return beginUpdateAsync(resourceGroupName, experimentName, experiment, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -1272,7 +1559,25 @@ public Response updateWithResponse( */ @ServiceMethod(returns = ReturnType.SINGLE) public ExperimentInner update(String resourceGroupName, String experimentName, ExperimentUpdate experiment) { - return updateWithResponse(resourceGroupName, experimentName, experiment, Context.NONE).getValue(); + return updateAsync(resourceGroupName, experimentName, experiment).block(); + } + + /** + * The operation to update an experiment. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment operation. + * @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 model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExperimentInner update( + String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context) { + return updateAsync(resourceGroupName, experimentName, experiment, context).block(); } /** @@ -1283,12 +1588,10 @@ public ExperimentInner update(String resourceGroupName, String experimentName, E * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the result of a cancel Experiment operation along with {@link Response} on - * successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> cancelWithResponseAsync( - String resourceGroupName, String experimentName) { + private Mono>> cancelWithResponseAsync(String resourceGroupName, String experimentName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1333,11 +1636,10 @@ private Mono> cancelWithResponseA * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the result of a cancel Experiment operation along with {@link Response} on - * successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> cancelWithResponseAsync( + private Mono>> cancelWithResponseAsync( String resourceGroupName, String experimentName, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -1379,13 +1681,85 @@ private Mono> cancelWithResponseA * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the result of a cancel Experiment operation on successful completion of {@link - * Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCancelAsync(String resourceGroupName, String experimentName) { + Mono>> mono = cancelWithResponseAsync(resourceGroupName, experimentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @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> beginCancelAsync( + String resourceGroupName, String experimentName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = cancelWithResponseAsync(resourceGroupName, experimentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginCancel(String resourceGroupName, String experimentName) { + return this.beginCancelAsync(resourceGroupName, experimentName).getSyncPoller(); + } + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @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> beginCancel( + String resourceGroupName, String experimentName, Context context) { + return this.beginCancelAsync(resourceGroupName, experimentName, context).getSyncPoller(); + } + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 cancelAsync(String resourceGroupName, String experimentName) { - return cancelWithResponseAsync(resourceGroupName, experimentName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono cancelAsync(String resourceGroupName, String experimentName) { + return beginCancelAsync(resourceGroupName, experimentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -1397,12 +1771,27 @@ private Mono cancelAsync(String resourceGr * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the result of a cancel Experiment operation along with {@link Response}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response cancelWithResponse( - String resourceGroupName, String experimentName, Context context) { - return cancelWithResponseAsync(resourceGroupName, experimentName, context).block(); + private Mono cancelAsync(String resourceGroupName, String experimentName, Context context) { + return beginCancelAsync(resourceGroupName, experimentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 cancel(String resourceGroupName, String experimentName) { + cancelAsync(resourceGroupName, experimentName).block(); } /** @@ -1410,14 +1799,14 @@ public Response cancelWithResponse( * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. + * @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 model that represents the result of a cancel Experiment operation. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ExperimentCancelOperationResultInner cancel(String resourceGroupName, String experimentName) { - return cancelWithResponse(resourceGroupName, experimentName, Context.NONE).getValue(); + public void cancel(String resourceGroupName, String experimentName, Context context) { + cancelAsync(resourceGroupName, experimentName, context).block(); } /** @@ -1428,12 +1817,10 @@ public ExperimentCancelOperationResultInner cancel(String resourceGroupName, Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the result of a start Experiment operation along with {@link Response} on - * successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> startWithResponseAsync( - String resourceGroupName, String experimentName) { + private Mono>> startWithResponseAsync(String resourceGroupName, String experimentName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1478,11 +1865,10 @@ private Mono> startWithResponseAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the result of a start Experiment operation along with {@link Response} on - * successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> startWithResponseAsync( + private Mono>> startWithResponseAsync( String resourceGroupName, String experimentName, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -1524,13 +1910,83 @@ private Mono> startWithResponseAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the result of a start Experiment operation on successful completion of {@link - * Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync(String resourceGroupName, String experimentName) { + Mono>> mono = startWithResponseAsync(resourceGroupName, experimentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @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> beginStartAsync( + String resourceGroupName, String experimentName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = startWithResponseAsync(resourceGroupName, experimentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginStart(String resourceGroupName, String experimentName) { + return this.beginStartAsync(resourceGroupName, experimentName).getSyncPoller(); + } + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @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> beginStart( + String resourceGroupName, String experimentName, Context context) { + return this.beginStartAsync(resourceGroupName, experimentName, context).getSyncPoller(); + } + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 startAsync(String resourceGroupName, String experimentName) { - return startWithResponseAsync(resourceGroupName, experimentName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono startAsync(String resourceGroupName, String experimentName) { + return beginStartAsync(resourceGroupName, experimentName).last().flatMap(this.client::getLroFinalResultOrError); } /** @@ -1542,12 +1998,27 @@ private Mono startAsync(String resourceGrou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the result of a start Experiment operation along with {@link Response}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response startWithResponse( - String resourceGroupName, String experimentName, Context context) { - return startWithResponseAsync(resourceGroupName, experimentName, context).block(); + private Mono startAsync(String resourceGroupName, String experimentName, Context context) { + return beginStartAsync(resourceGroupName, experimentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 start(String resourceGroupName, String experimentName) { + startAsync(resourceGroupName, experimentName).block(); } /** @@ -1555,14 +2026,14 @@ public Response startWithResponse( * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. + * @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 model that represents the result of a start Experiment operation. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ExperimentStartOperationResultInner start(String resourceGroupName, String experimentName) { - return startWithResponse(resourceGroupName, experimentName, Context.NONE).getValue(); + public void start(String resourceGroupName, String experimentName, Context context) { + startAsync(resourceGroupName, experimentName, context).block(); } /** diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java index 66d80202a470f..b81ad91e4bbe7 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java @@ -10,15 +10,11 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.chaos.fluent.ExperimentsClient; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner; import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner; import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner; import com.azure.resourcemanager.chaos.models.Experiment; -import com.azure.resourcemanager.chaos.models.ExperimentCancelOperationResult; import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetails; -import com.azure.resourcemanager.chaos.models.ExperimentStartOperationResult; import com.azure.resourcemanager.chaos.models.ExperimentStatus; import com.azure.resourcemanager.chaos.models.Experiments; @@ -56,15 +52,14 @@ public PagedIterable listByResourceGroup( return Utils.mapPage(inner, inner1 -> new ExperimentImpl(inner1, this.manager())); } - public Response deleteByResourceGroupWithResponse( - String resourceGroupName, String experimentName, Context context) { - return this.serviceClient().deleteWithResponse(resourceGroupName, experimentName, context); - } - public void deleteByResourceGroup(String resourceGroupName, String experimentName) { this.serviceClient().delete(resourceGroupName, experimentName); } + public void delete(String resourceGroupName, String experimentName, Context context) { + this.serviceClient().delete(resourceGroupName, experimentName, context); + } + public Response getByResourceGroupWithResponse( String resourceGroupName, String experimentName, Context context) { Response inner = @@ -89,52 +84,20 @@ public Experiment getByResourceGroup(String resourceGroupName, String experiment } } - public Response cancelWithResponse( - String resourceGroupName, String experimentName, Context context) { - Response inner = - this.serviceClient().cancelWithResponse(resourceGroupName, experimentName, context); - if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), - new ExperimentCancelOperationResultImpl(inner.getValue(), this.manager())); - } else { - return null; - } + public void cancel(String resourceGroupName, String experimentName) { + this.serviceClient().cancel(resourceGroupName, experimentName); } - public ExperimentCancelOperationResult cancel(String resourceGroupName, String experimentName) { - ExperimentCancelOperationResultInner inner = this.serviceClient().cancel(resourceGroupName, experimentName); - if (inner != null) { - return new ExperimentCancelOperationResultImpl(inner, this.manager()); - } else { - return null; - } + public void cancel(String resourceGroupName, String experimentName, Context context) { + this.serviceClient().cancel(resourceGroupName, experimentName, context); } - public Response startWithResponse( - String resourceGroupName, String experimentName, Context context) { - Response inner = - this.serviceClient().startWithResponse(resourceGroupName, experimentName, context); - if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), - new ExperimentStartOperationResultImpl(inner.getValue(), this.manager())); - } else { - return null; - } + public void start(String resourceGroupName, String experimentName) { + this.serviceClient().start(resourceGroupName, experimentName); } - public ExperimentStartOperationResult start(String resourceGroupName, String experimentName) { - ExperimentStartOperationResultInner inner = this.serviceClient().start(resourceGroupName, experimentName); - if (inner != null) { - return new ExperimentStartOperationResultImpl(inner, this.manager()); - } else { - return null; - } + public void start(String resourceGroupName, String experimentName, Context context) { + this.serviceClient().start(resourceGroupName, experimentName, context); } public PagedIterable listAllStatuses(String resourceGroupName, String experimentName) { @@ -270,10 +233,10 @@ public void deleteById(String id) { new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'experiments'.", id))); } - this.deleteByResourceGroupWithResponse(resourceGroupName, experimentName, Context.NONE); + this.delete(resourceGroupName, experimentName, Context.NONE); } - public Response deleteByIdWithResponse(String id, Context context) { + public void deleteByIdWithResponse(String id, Context context) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER @@ -289,7 +252,7 @@ public Response deleteByIdWithResponse(String id, Context context) { new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'experiments'.", id))); } - return this.deleteByResourceGroupWithResponse(resourceGroupName, experimentName, context); + this.delete(resourceGroupName, experimentName, context); } private ExperimentsClient serviceClient() { diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java new file mode 100644 index 0000000000000..09adcaaa1102d --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner; +import com.azure.resourcemanager.chaos.models.OperationStatus; + +public final class OperationStatusImpl implements OperationStatus { + private OperationStatusInner innerObject; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + OperationStatusImpl(OperationStatusInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String startTime() { + return this.innerModel().startTime(); + } + + public String endTime() { + return this.innerModel().endTime(); + } + + public String status() { + return this.innerModel().status(); + } + + public ManagementError error() { + return this.innerModel().error(); + } + + public OperationStatusInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesClientImpl.java new file mode 100644 index 0000000000000..9fd0d252fbaa7 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesClientImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.chaos.fluent.OperationStatusesClient; +import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationStatusesClient. */ +public final class OperationStatusesClientImpl implements OperationStatusesClient { + /** The proxy service used to perform REST calls. */ + private final OperationStatusesService service; + + /** The service client containing this operation class. */ + private final ChaosManagementClientImpl client; + + /** + * Initializes an instance of OperationStatusesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationStatusesClientImpl(ChaosManagementClientImpl client) { + this.service = + RestProxy.create(OperationStatusesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ChaosManagementClientOperationStatuses to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ChaosManagementClien") + public interface OperationStatusesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/operationsStatuses/{asyncOperationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("asyncOperationId") String asyncOperationId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running azure asynchronous operation along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String asyncOperationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (asyncOperationId == null) { + return Mono + .error(new IllegalArgumentException("Parameter asyncOperationId 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + location, + asyncOperationId, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running azure asynchronous operation along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String asyncOperationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (asyncOperationId == null) { + return Mono + .error(new IllegalArgumentException("Parameter asyncOperationId 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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + location, + asyncOperationId, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running azure asynchronous operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String asyncOperationId) { + return getWithResponseAsync(location, asyncOperationId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running azure asynchronous operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, String asyncOperationId, Context context) { + return getWithResponseAsync(location, asyncOperationId, context).block(); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running azure asynchronous operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusInner get(String location, String asyncOperationId) { + return getWithResponse(location, asyncOperationId, Context.NONE).getValue(); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesImpl.java new file mode 100644 index 0000000000000..8ae63088b7b05 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.chaos.fluent.OperationStatusesClient; +import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner; +import com.azure.resourcemanager.chaos.models.OperationStatus; +import com.azure.resourcemanager.chaos.models.OperationStatuses; + +public final class OperationStatusesImpl implements OperationStatuses { + private static final ClientLogger LOGGER = new ClientLogger(OperationStatusesImpl.class); + + private final OperationStatusesClient innerClient; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + public OperationStatusesImpl( + OperationStatusesClient innerClient, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String location, String asyncOperationId, Context context) { + Response inner = + this.serviceClient().getWithResponse(location, asyncOperationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OperationStatus get(String location, String asyncOperationId) { + OperationStatusInner inner = this.serviceClient().get(location, asyncOperationId); + if (inner != null) { + return new OperationStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + private OperationStatusesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Action.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentAction.java similarity index 76% rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Action.java rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentAction.java index b66cd0a8ffc2d..5c2a51835a735 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Action.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentAction.java @@ -16,23 +16,23 @@ use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", - defaultImpl = Action.class) -@JsonTypeName("Action") + defaultImpl = ChaosExperimentAction.class) +@JsonTypeName("ChaosExperimentAction") @JsonSubTypes({ @JsonSubTypes.Type(name = "delay", value = DelayAction.class), @JsonSubTypes.Type(name = "discrete", value = DiscreteAction.class), @JsonSubTypes.Type(name = "continuous", value = ContinuousAction.class) }) @Fluent -public class Action { +public class ChaosExperimentAction { /* * String that represents a Capability URN. */ @JsonProperty(value = "name", required = true) private String name; - /** Creates an instance of Action class. */ - public Action() { + /** Creates an instance of ChaosExperimentAction class. */ + public ChaosExperimentAction() { } /** @@ -48,9 +48,9 @@ public String name() { * Set the name property: String that represents a Capability URN. * * @param name the name value to set. - * @return the Action object itself. + * @return the ChaosExperimentAction object itself. */ - public Action withName(String name) { + public ChaosExperimentAction withName(String name) { this.name = name; return this; } @@ -63,9 +63,10 @@ public Action withName(String name) { public void validate() { if (name() == null) { throw LOGGER - .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Action")); + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model ChaosExperimentAction")); } } - private static final ClientLogger LOGGER = new ClientLogger(Action.class); + private static final ClientLogger LOGGER = new ClientLogger(ChaosExperimentAction.class); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Branch.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentBranch.java similarity index 67% rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Branch.java rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentBranch.java index 6cb88d39d96ce..f2c7c9c6bc183 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Branch.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentBranch.java @@ -11,7 +11,7 @@ /** Model that represents a branch in the step. */ @Fluent -public final class Branch { +public final class ChaosExperimentBranch { /* * String of the branch name. */ @@ -22,10 +22,10 @@ public final class Branch { * List of actions. */ @JsonProperty(value = "actions", required = true) - private List actions; + private List actions; - /** Creates an instance of Branch class. */ - public Branch() { + /** Creates an instance of ChaosExperimentBranch class. */ + public ChaosExperimentBranch() { } /** @@ -41,9 +41,9 @@ public String name() { * Set the name property: String of the branch name. * * @param name the name value to set. - * @return the Branch object itself. + * @return the ChaosExperimentBranch object itself. */ - public Branch withName(String name) { + public ChaosExperimentBranch withName(String name) { this.name = name; return this; } @@ -53,7 +53,7 @@ public Branch withName(String name) { * * @return the actions value. */ - public List actions() { + public List actions() { return this.actions; } @@ -61,9 +61,9 @@ public List actions() { * Set the actions property: List of actions. * * @param actions the actions value to set. - * @return the Branch object itself. + * @return the ChaosExperimentBranch object itself. */ - public Branch withActions(List actions) { + public ChaosExperimentBranch withActions(List actions) { this.actions = actions; return this; } @@ -76,15 +76,17 @@ public Branch withActions(List actions) { public void validate() { if (name() == null) { throw LOGGER - .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Branch")); + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model ChaosExperimentBranch")); } if (actions() == null) { throw LOGGER - .logExceptionAsError(new IllegalArgumentException("Missing required property actions in model Branch")); + .logExceptionAsError( + new IllegalArgumentException("Missing required property actions in model ChaosExperimentBranch")); } else { actions().forEach(e -> e.validate()); } } - private static final ClientLogger LOGGER = new ClientLogger(Branch.class); + private static final ClientLogger LOGGER = new ClientLogger(ChaosExperimentBranch.class); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Step.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentStep.java similarity index 68% rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Step.java rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentStep.java index a8e01d2246e06..f8b09bda8fc63 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Step.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentStep.java @@ -11,7 +11,7 @@ /** Model that represents a step in the Experiment resource. */ @Fluent -public final class Step { +public final class ChaosExperimentStep { /* * String of the step name. */ @@ -22,10 +22,10 @@ public final class Step { * List of branches. */ @JsonProperty(value = "branches", required = true) - private List branches; + private List branches; - /** Creates an instance of Step class. */ - public Step() { + /** Creates an instance of ChaosExperimentStep class. */ + public ChaosExperimentStep() { } /** @@ -41,9 +41,9 @@ public String name() { * Set the name property: String of the step name. * * @param name the name value to set. - * @return the Step object itself. + * @return the ChaosExperimentStep object itself. */ - public Step withName(String name) { + public ChaosExperimentStep withName(String name) { this.name = name; return this; } @@ -53,7 +53,7 @@ public Step withName(String name) { * * @return the branches value. */ - public List branches() { + public List branches() { return this.branches; } @@ -61,9 +61,9 @@ public List branches() { * Set the branches property: List of branches. * * @param branches the branches value to set. - * @return the Step object itself. + * @return the ChaosExperimentStep object itself. */ - public Step withBranches(List branches) { + public ChaosExperimentStep withBranches(List branches) { this.branches = branches; return this; } @@ -76,15 +76,17 @@ public Step withBranches(List branches) { public void validate() { if (name() == null) { throw LOGGER - .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Step")); + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model ChaosExperimentStep")); } if (branches() == null) { throw LOGGER - .logExceptionAsError(new IllegalArgumentException("Missing required property branches in model Step")); + .logExceptionAsError( + new IllegalArgumentException("Missing required property branches in model ChaosExperimentStep")); } else { branches().forEach(e -> e.validate()); } } - private static final ClientLogger LOGGER = new ClientLogger(Step.class); + private static final ClientLogger LOGGER = new ClientLogger(ChaosExperimentStep.class); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Filter.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetFilter.java similarity index 73% rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Filter.java rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetFilter.java index de171a32c6939..725dd624f89dd 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Filter.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetFilter.java @@ -14,13 +14,13 @@ use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", - defaultImpl = Filter.class) -@JsonTypeName("Filter") -@JsonSubTypes({@JsonSubTypes.Type(name = "Simple", value = SimpleFilter.class)}) + defaultImpl = ChaosTargetFilter.class) +@JsonTypeName("ChaosTargetFilter") +@JsonSubTypes({@JsonSubTypes.Type(name = "Simple", value = ChaosTargetSimpleFilter.class)}) @Immutable -public class Filter { - /** Creates an instance of Filter class. */ - public Filter() { +public class ChaosTargetFilter { + /** Creates an instance of ChaosTargetFilter class. */ + public ChaosTargetFilter() { } /** diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ListSelector.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetListSelector.java similarity index 78% rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ListSelector.java rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetListSelector.java index 60dbb9084e660..86d992203dfce 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ListSelector.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetListSelector.java @@ -15,15 +15,15 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonTypeName("List") @Fluent -public final class ListSelector extends Selector { +public final class ChaosTargetListSelector extends ChaosTargetSelector { /* * List of Target references. */ @JsonProperty(value = "targets", required = true) private List targets; - /** Creates an instance of ListSelector class. */ - public ListSelector() { + /** Creates an instance of ChaosTargetListSelector class. */ + public ChaosTargetListSelector() { } /** @@ -39,23 +39,23 @@ public List targets() { * Set the targets property: List of Target references. * * @param targets the targets value to set. - * @return the ListSelector object itself. + * @return the ChaosTargetListSelector object itself. */ - public ListSelector withTargets(List targets) { + public ChaosTargetListSelector withTargets(List targets) { this.targets = targets; return this; } /** {@inheritDoc} */ @Override - public ListSelector withId(String id) { + public ChaosTargetListSelector withId(String id) { super.withId(id); return this; } /** {@inheritDoc} */ @Override - public ListSelector withFilter(Filter filter) { + public ChaosTargetListSelector withFilter(ChaosTargetFilter filter) { super.withFilter(filter); return this; } @@ -71,11 +71,11 @@ public void validate() { if (targets() == null) { throw LOGGER .logExceptionAsError( - new IllegalArgumentException("Missing required property targets in model ListSelector")); + new IllegalArgumentException("Missing required property targets in model ChaosTargetListSelector")); } else { targets().forEach(e -> e.validate()); } } - private static final ClientLogger LOGGER = new ClientLogger(ListSelector.class); + private static final ClientLogger LOGGER = new ClientLogger(ChaosTargetListSelector.class); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/QuerySelector.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetQuerySelector.java similarity index 74% rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/QuerySelector.java rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetQuerySelector.java index ce9014ce3401f..be471aaf91b9b 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/QuerySelector.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetQuerySelector.java @@ -15,7 +15,7 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonTypeName("Query") @Fluent -public final class QuerySelector extends Selector { +public final class ChaosTargetQuerySelector extends ChaosTargetSelector { /* * Azure Resource Graph (ARG) Query Language query for target resources. */ @@ -28,8 +28,8 @@ public final class QuerySelector extends Selector { @JsonProperty(value = "subscriptionIds", required = true) private List subscriptionIds; - /** Creates an instance of QuerySelector class. */ - public QuerySelector() { + /** Creates an instance of ChaosTargetQuerySelector class. */ + public ChaosTargetQuerySelector() { } /** @@ -45,9 +45,9 @@ public String queryString() { * Set the queryString property: Azure Resource Graph (ARG) Query Language query for target resources. * * @param queryString the queryString value to set. - * @return the QuerySelector object itself. + * @return the ChaosTargetQuerySelector object itself. */ - public QuerySelector withQueryString(String queryString) { + public ChaosTargetQuerySelector withQueryString(String queryString) { this.queryString = queryString; return this; } @@ -65,23 +65,23 @@ public List subscriptionIds() { * Set the subscriptionIds property: Subscription id list to scope resource query. * * @param subscriptionIds the subscriptionIds value to set. - * @return the QuerySelector object itself. + * @return the ChaosTargetQuerySelector object itself. */ - public QuerySelector withSubscriptionIds(List subscriptionIds) { + public ChaosTargetQuerySelector withSubscriptionIds(List subscriptionIds) { this.subscriptionIds = subscriptionIds; return this; } /** {@inheritDoc} */ @Override - public QuerySelector withId(String id) { + public ChaosTargetQuerySelector withId(String id) { super.withId(id); return this; } /** {@inheritDoc} */ @Override - public QuerySelector withFilter(Filter filter) { + public ChaosTargetQuerySelector withFilter(ChaosTargetFilter filter) { super.withFilter(filter); return this; } @@ -97,14 +97,16 @@ public void validate() { if (queryString() == null) { throw LOGGER .logExceptionAsError( - new IllegalArgumentException("Missing required property queryString in model QuerySelector")); + new IllegalArgumentException( + "Missing required property queryString in model ChaosTargetQuerySelector")); } if (subscriptionIds() == null) { throw LOGGER .logExceptionAsError( - new IllegalArgumentException("Missing required property subscriptionIds in model QuerySelector")); + new IllegalArgumentException( + "Missing required property subscriptionIds in model ChaosTargetQuerySelector")); } } - private static final ClientLogger LOGGER = new ClientLogger(QuerySelector.class); + private static final ClientLogger LOGGER = new ClientLogger(ChaosTargetQuerySelector.class); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Selector.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSelector.java similarity index 76% rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Selector.java rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSelector.java index 441ca3a984e3c..422350c2e38ac 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Selector.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSelector.java @@ -21,14 +21,14 @@ use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", - defaultImpl = Selector.class) -@JsonTypeName("Selector") + defaultImpl = ChaosTargetSelector.class) +@JsonTypeName("ChaosTargetSelector") @JsonSubTypes({ - @JsonSubTypes.Type(name = "List", value = ListSelector.class), - @JsonSubTypes.Type(name = "Query", value = QuerySelector.class) + @JsonSubTypes.Type(name = "List", value = ChaosTargetListSelector.class), + @JsonSubTypes.Type(name = "Query", value = ChaosTargetQuerySelector.class) }) @Fluent -public class Selector { +public class ChaosTargetSelector { /* * String of the selector ID. */ @@ -39,15 +39,15 @@ public class Selector { * Model that represents available filter types that can be applied to a targets list. */ @JsonProperty(value = "filter") - private Filter filter; + private ChaosTargetFilter filter; /* * Model that represents a selector in the Experiment resource. */ @JsonIgnore private Map additionalProperties; - /** Creates an instance of Selector class. */ - public Selector() { + /** Creates an instance of ChaosTargetSelector class. */ + public ChaosTargetSelector() { } /** @@ -63,9 +63,9 @@ public String id() { * Set the id property: String of the selector ID. * * @param id the id value to set. - * @return the Selector object itself. + * @return the ChaosTargetSelector object itself. */ - public Selector withId(String id) { + public ChaosTargetSelector withId(String id) { this.id = id; return this; } @@ -75,7 +75,7 @@ public Selector withId(String id) { * * @return the filter value. */ - public Filter filter() { + public ChaosTargetFilter filter() { return this.filter; } @@ -83,9 +83,9 @@ public Filter filter() { * Set the filter property: Model that represents available filter types that can be applied to a targets list. * * @param filter the filter value to set. - * @return the Selector object itself. + * @return the ChaosTargetSelector object itself. */ - public Selector withFilter(Filter filter) { + public ChaosTargetSelector withFilter(ChaosTargetFilter filter) { this.filter = filter; return this; } @@ -104,9 +104,9 @@ public Map additionalProperties() { * Set the additionalProperties property: Model that represents a selector in the Experiment resource. * * @param additionalProperties the additionalProperties value to set. - * @return the Selector object itself. + * @return the ChaosTargetSelector object itself. */ - public Selector withAdditionalProperties(Map additionalProperties) { + public ChaosTargetSelector withAdditionalProperties(Map additionalProperties) { this.additionalProperties = additionalProperties; return this; } @@ -127,12 +127,13 @@ void withAdditionalProperties(String key, Object value) { public void validate() { if (id() == null) { throw LOGGER - .logExceptionAsError(new IllegalArgumentException("Missing required property id in model Selector")); + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model ChaosTargetSelector")); } if (filter() != null) { filter().validate(); } } - private static final ClientLogger LOGGER = new ClientLogger(Selector.class); + private static final ClientLogger LOGGER = new ClientLogger(ChaosTargetSelector.class); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilter.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilter.java similarity index 76% rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilter.java rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilter.java index 46ff007cc7ab9..6f122cddcad79 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilter.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilter.java @@ -13,15 +13,15 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonTypeName("Simple") @Fluent -public final class SimpleFilter extends Filter { +public final class ChaosTargetSimpleFilter extends ChaosTargetFilter { /* * Model that represents the Simple filter parameters. */ @JsonProperty(value = "parameters") - private SimpleFilterParameters parameters; + private ChaosTargetSimpleFilterParameters parameters; - /** Creates an instance of SimpleFilter class. */ - public SimpleFilter() { + /** Creates an instance of ChaosTargetSimpleFilter class. */ + public ChaosTargetSimpleFilter() { } /** @@ -29,7 +29,7 @@ public SimpleFilter() { * * @return the parameters value. */ - public SimpleFilterParameters parameters() { + public ChaosTargetSimpleFilterParameters parameters() { return this.parameters; } @@ -37,9 +37,9 @@ public SimpleFilterParameters parameters() { * Set the parameters property: Model that represents the Simple filter parameters. * * @param parameters the parameters value to set. - * @return the SimpleFilter object itself. + * @return the ChaosTargetSimpleFilter object itself. */ - public SimpleFilter withParameters(SimpleFilterParameters parameters) { + public ChaosTargetSimpleFilter withParameters(ChaosTargetSimpleFilterParameters parameters) { this.parameters = parameters; return this; } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilterParameters.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilterParameters.java similarity index 77% rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilterParameters.java rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilterParameters.java index b3b08c559efe0..73e4ed26ad56c 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilterParameters.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilterParameters.java @@ -10,15 +10,15 @@ /** Model that represents the Simple filter parameters. */ @Fluent -public final class SimpleFilterParameters { +public final class ChaosTargetSimpleFilterParameters { /* * List of Azure availability zones to filter targets by. */ @JsonProperty(value = "zones") private List zones; - /** Creates an instance of SimpleFilterParameters class. */ - public SimpleFilterParameters() { + /** Creates an instance of ChaosTargetSimpleFilterParameters class. */ + public ChaosTargetSimpleFilterParameters() { } /** @@ -34,9 +34,9 @@ public List zones() { * Set the zones property: List of Azure availability zones to filter targets by. * * @param zones the zones value to set. - * @return the SimpleFilterParameters object itself. + * @return the ChaosTargetSimpleFilterParameters object itself. */ - public SimpleFilterParameters withZones(List zones) { + public ChaosTargetSimpleFilterParameters withZones(List zones) { this.zones = zones; return this; } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ContinuousAction.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ContinuousAction.java index b42856c08bfd0..a8abd196a3ae4 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ContinuousAction.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ContinuousAction.java @@ -16,7 +16,7 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonTypeName("continuous") @Fluent -public final class ContinuousAction extends Action { +public final class ContinuousAction extends ChaosExperimentAction { /* * ISO8601 formatted string that represents a duration. */ diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DelayAction.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DelayAction.java index b704318eccab5..5a6ac12c212b7 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DelayAction.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DelayAction.java @@ -15,7 +15,7 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonTypeName("delay") @Fluent -public final class DelayAction extends Action { +public final class DelayAction extends ChaosExperimentAction { /* * ISO8601 formatted string that represents a duration. */ diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DiscreteAction.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DiscreteAction.java index 148c4c785fe74..6eda3392ddab2 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DiscreteAction.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DiscreteAction.java @@ -15,7 +15,7 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonTypeName("discrete") @Fluent -public final class DiscreteAction extends Action { +public final class DiscreteAction extends ChaosExperimentAction { /* * List of key value pairs. */ diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiment.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiment.java index 6802361fc65b0..13394954bf23c 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiment.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiment.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.chaos.models; -import com.azure.core.http.rest.Response; import com.azure.core.management.Region; import com.azure.core.management.SystemData; import com.azure.core.util.Context; @@ -64,26 +63,25 @@ public interface Experiment { ResourceIdentity identity(); /** - * Gets the steps property: List of steps. + * Gets the provisioningState property: Most recent provisioning state for the given experiment resource. * - * @return the steps value. + * @return the provisioningState value. */ - List steps(); + ProvisioningState provisioningState(); /** - * Gets the selectors property: List of selectors. + * Gets the steps property: List of steps. * - * @return the selectors value. + * @return the steps value. */ - List selectors(); + List steps(); /** - * Gets the startOnCreation property: A boolean value that indicates if experiment should be started on creation or - * not. + * Gets the selectors property: List of selectors. * - * @return the startOnCreation value. + * @return the selectors value. */ - Boolean startOnCreation(); + List selectors(); /** * Gets the region of the resource. @@ -167,7 +165,7 @@ interface WithSteps { * @param steps List of steps. * @return the next definition stage. */ - WithSelectors withSteps(List steps); + WithSelectors withSteps(List steps); } /** The stage of the Experiment definition allowing to specify selectors. */ @@ -178,15 +176,14 @@ interface WithSelectors { * @param selectors List of selectors. * @return the next definition stage. */ - WithCreate withSelectors(List selectors); + WithCreate withSelectors(List selectors); } /** * The stage of the Experiment definition which contains all the minimum required properties for the resource to * be created, but also allows for any other optional properties to be specified. */ - interface WithCreate - extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithStartOnCreation { + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithIdentity { /** * Executes the create request. * @@ -224,18 +221,6 @@ interface WithIdentity { */ WithCreate withIdentity(ResourceIdentity identity); } - - /** The stage of the Experiment definition allowing to specify startOnCreation. */ - interface WithStartOnCreation { - /** - * Specifies the startOnCreation property: A boolean value that indicates if experiment should be started on - * creation or not.. - * - * @param startOnCreation A boolean value that indicates if experiment should be started on creation or not. - * @return the next definition stage. - */ - WithCreate withStartOnCreation(Boolean startOnCreation); - } } /** @@ -295,40 +280,36 @@ interface WithIdentity { /** * Cancel a running Experiment resource. * - * @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 model that represents the result of a cancel Experiment operation along with {@link Response}. */ - Response cancelWithResponse(Context context); + void cancel(); /** * Cancel a running Experiment resource. * + * @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 model that represents the result of a cancel Experiment operation. */ - ExperimentCancelOperationResult cancel(); + void cancel(Context context); /** * Start a Experiment resource. * - * @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 model that represents the result of a start Experiment operation along with {@link Response}. */ - Response startWithResponse(Context context); + void start(); /** * Start a Experiment resource. * + * @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 model that represents the result of a start Experiment operation. */ - ExperimentStartOperationResult start(); + void start(Context context); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentCancelOperationResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentCancelOperationResult.java deleted file mode 100644 index 863656108f975..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentCancelOperationResult.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.models; - -import com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner; - -/** An immutable client-side representation of ExperimentCancelOperationResult. */ -public interface ExperimentCancelOperationResult { - /** - * Gets the name property: String of the Experiment name. - * - * @return the name value. - */ - String name(); - - /** - * Gets the statusUrl property: URL to retrieve the Experiment status. - * - * @return the statusUrl value. - */ - String statusUrl(); - - /** - * Gets the inner com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner object. - * - * @return the inner object. - */ - ExperimentCancelOperationResultInner innerModel(); -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStartOperationResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStartOperationResult.java deleted file mode 100644 index 0db3964c30d31..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStartOperationResult.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.models; - -import com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner; - -/** An immutable client-side representation of ExperimentStartOperationResult. */ -public interface ExperimentStartOperationResult { - /** - * Gets the name property: String of the Experiment name. - * - * @return the name value. - */ - String name(); - - /** - * Gets the statusUrl property: URL to retrieve the Experiment status. - * - * @return the statusUrl value. - */ - String statusUrl(); - - /** - * Gets the inner com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner object. - * - * @return the inner object. - */ - ExperimentStartOperationResultInner innerModel(); -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiments.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiments.java index e5449ba5a57dd..f619dca00454c 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiments.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiments.java @@ -65,24 +65,23 @@ PagedIterable listByResourceGroup( * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. */ - Response deleteByResourceGroupWithResponse(String resourceGroupName, String experimentName, Context context); + void deleteByResourceGroup(String resourceGroupName, String experimentName); /** * Delete a Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. + * @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 deleteByResourceGroup(String resourceGroupName, String experimentName); + void delete(String resourceGroupName, String experimentName, Context context); /** * Get a Experiment resource. @@ -115,52 +114,46 @@ Response getByResourceGroupWithResponse( * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @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 model that represents the result of a cancel Experiment operation along with {@link Response}. */ - Response cancelWithResponse( - String resourceGroupName, String experimentName, Context context); + void cancel(String resourceGroupName, String experimentName); /** * Cancel a running Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. + * @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 model that represents the result of a cancel Experiment operation. */ - ExperimentCancelOperationResult cancel(String resourceGroupName, String experimentName); + void cancel(String resourceGroupName, String experimentName, Context context); /** * Start a Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @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 model that represents the result of a start Experiment operation along with {@link Response}. */ - Response startWithResponse( - String resourceGroupName, String experimentName, Context context); + void start(String resourceGroupName, String experimentName); /** * Start a Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. + * @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 model that represents the result of a start Experiment operation. */ - ExperimentStartOperationResult start(String resourceGroupName, String experimentName); + void start(String resourceGroupName, String experimentName, Context context); /** * Get a list of statuses of a Experiment resource. @@ -311,9 +304,8 @@ ExperimentExecutionDetails getExecutionDetails( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. */ - Response deleteByIdWithResponse(String id, Context context); + void deleteByIdWithResponse(String id, Context context); /** * Begins definition for a new Experiment resource. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatus.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatus.java new file mode 100644 index 0000000000000..cac9c6a2375d4 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatus.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner; + +/** An immutable client-side representation of OperationStatus. */ +public interface OperationStatus { + /** + * Gets the id property: The operation Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The operation name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the startTime property: The start time of the operation. + * + * @return the startTime value. + */ + String startTime(); + + /** + * Gets the endTime property: The end time of the operation. + * + * @return the endTime value. + */ + String endTime(); + + /** + * Gets the status property: The status of the operation. + * + * @return the status value. + */ + String status(); + + /** + * Gets the error property: Error response + * + *

The error detail of the operation if any. + * + * @return the error value. + */ + ManagementError error(); + + /** + * Gets the inner com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner object. + * + * @return the inner object. + */ + OperationStatusInner innerModel(); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatuses.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatuses.java new file mode 100644 index 0000000000000..3858ebd24b3c6 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatuses.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of OperationStatuses. */ +public interface OperationStatuses { + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running azure asynchronous operation along with {@link Response}. + */ + Response getWithResponse(String location, String asyncOperationId, Context context); + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running azure asynchronous operation. + */ + OperationStatus get(String location, String asyncOperationId); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ProvisioningState.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ProvisioningState.java new file mode 100644 index 0000000000000..845d724d149aa --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ProvisioningState.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Current provisioning state for a given Azure Chaos resource. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateSamples.java index f3a68b003d0d3..d53ef02c5f550 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateSamples.java @@ -9,7 +9,7 @@ /** Samples for Capabilities CreateOrUpdate. */ public final class CapabilitiesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CreateOrUpdateACapability.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/CreateUpdateCapability.json */ /** * Sample code: Create/update a Capability that extends a virtual machine Target resource. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteSamples.java index 75587cbcdcb0e..f43702f7b5c40 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for Capabilities Delete. */ public final class CapabilitiesDeleteSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/DeleteACapability.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/DeleteCapability.json */ /** * Sample code: Delete a Capability that extends a virtual machine Target resource. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetSamples.java index 42f149af0d170..4239433a9bf50 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetSamples.java @@ -7,7 +7,7 @@ /** Samples for Capabilities Get. */ public final class CapabilitiesGetSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetACapability.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetCapability.json */ /** * Sample code: Get a Capability that extends a virtual machine Target resource. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListSamples.java index 87bc7d69df5d7..34498ded97042 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListSamples.java @@ -7,7 +7,7 @@ /** Samples for Capabilities List. */ public final class CapabilitiesListSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListCapabilities.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListCapabilities.json */ /** * Sample code: List all Capabilities that extend a virtual machine Target resource. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetSamples.java index bdc3f6a3b1dd4..5b41f16a9ba49 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetSamples.java @@ -7,7 +7,7 @@ /** Samples for CapabilityTypes Get. */ public final class CapabilityTypesGetSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetACapabilityType.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetCapabilityType.json */ /** * Sample code: Get a Capability Type for a virtual machine Target resource on westus2 location. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListSamples.java index 8683c4461229c..2741b7dd7cf7b 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListSamples.java @@ -7,7 +7,7 @@ /** Samples for CapabilityTypes List. */ public final class CapabilityTypesListSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListCapabilityTypes.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListCapabilityTypes.json */ /** * Sample code: List all Capability Types for a virtual machine Target resource on westus2 location. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelSamples.java index 657bc092a19c7..3962087439eb8 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelSamples.java @@ -7,7 +7,7 @@ /** Samples for Experiments Cancel. */ public final class ExperimentsCancelSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CancelAExperiment.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/CancelExperiment.json */ /** * Sample code: Cancel a running Experiment. @@ -15,6 +15,6 @@ public final class ExperimentsCancelSamples { * @param manager Entry point to ChaosManager. */ public static void cancelARunningExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().cancelWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + manager.experiments().cancel("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateSamples.java index cf11afb85804d..332a551307aa0 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateSamples.java @@ -4,13 +4,13 @@ package com.azure.resourcemanager.chaos.generated; -import com.azure.resourcemanager.chaos.models.Branch; +import com.azure.resourcemanager.chaos.models.ChaosExperimentBranch; +import com.azure.resourcemanager.chaos.models.ChaosExperimentStep; +import com.azure.resourcemanager.chaos.models.ChaosTargetListSelector; import com.azure.resourcemanager.chaos.models.ContinuousAction; import com.azure.resourcemanager.chaos.models.KeyValuePair; -import com.azure.resourcemanager.chaos.models.ListSelector; import com.azure.resourcemanager.chaos.models.ResourceIdentity; import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import com.azure.resourcemanager.chaos.models.Step; import com.azure.resourcemanager.chaos.models.TargetReference; import com.azure.resourcemanager.chaos.models.TargetReferenceType; import java.time.Duration; @@ -19,7 +19,7 @@ /** Samples for Experiments CreateOrUpdate. */ public final class ExperimentsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CreateOrUpdateAExperiment.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/CreateUpdateExperiment.json */ /** * Sample code: Create/update a Experiment in a resource group. @@ -35,12 +35,12 @@ public static void createUpdateAExperimentInAResourceGroup(com.azure.resourceman .withSteps( Arrays .asList( - new Step() + new ChaosExperimentStep() .withName("step1") .withBranches( Arrays .asList( - new Branch() + new ChaosExperimentBranch() .withName("branch1") .withActions( Arrays @@ -58,7 +58,7 @@ public static void createUpdateAExperimentInAResourceGroup(com.azure.resourceman .withSelectors( Arrays .asList( - new ListSelector() + new ChaosTargetListSelector() .withId("selector1") .withTargets( Arrays diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsDeleteSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsDeleteSamples.java index 4779dffa41158..21a6620f063e5 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsDeleteSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for Experiments Delete. */ public final class ExperimentsDeleteSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/DeleteAExperiment.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/DeleteExperiment.json */ /** * Sample code: Delete a Experiment in a resource group. @@ -15,8 +15,6 @@ public final class ExperimentsDeleteSamples { * @param manager Entry point to ChaosManager. */ public static void deleteAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager - .experiments() - .deleteByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + manager.experiments().delete("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupSamples.java index 4f90f3fe33e0b..6bee3033ddb4b 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for Experiments GetByResourceGroup. */ public final class ExperimentsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperiment.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetExperiment.json */ /** * Sample code: Get a Experiment in a resource group. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionDetailsSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionDetailsSamples.java index 2918e65b9f666..ae7c050faa9b4 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionDetailsSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionDetailsSamples.java @@ -7,7 +7,7 @@ /** Samples for Experiments GetExecutionDetails. */ public final class ExperimentsGetExecutionDetailsSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperimentExecutionDetails.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetExperimentExecutionDetails.json */ /** * Sample code: Get experiment execution details. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetStatusSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetStatusSamples.java index 5750f91f66580..35c4dd5883476 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetStatusSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetStatusSamples.java @@ -7,7 +7,7 @@ /** Samples for Experiments GetStatus. */ public final class ExperimentsGetStatusSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperimentStatus.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetExperimentStatus.json */ /** * Sample code: Get the status of a Experiment. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllStatusesSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllStatusesSamples.java index 84bef54c007cc..e8405b849f8c8 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllStatusesSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllStatusesSamples.java @@ -7,7 +7,7 @@ /** Samples for Experiments ListAllStatuses. */ public final class ExperimentsListAllStatusesSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentStatuses.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListExperimentStatuses.json */ /** * Sample code: List all statuses of a Experiment. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupSamples.java index 87ea28d68f7a3..59c5d3d02ea15 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for Experiments ListByResourceGroup. */ public final class ExperimentsListByResourceGroupSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentsInAResourceGroup.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListExperimentsInAResourceGroup.json */ /** * Sample code: List all Experiments in a resource group. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListExecutionDetailsSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListExecutionDetailsSamples.java index 854508c20af0c..25c7c339af424 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListExecutionDetailsSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListExecutionDetailsSamples.java @@ -7,7 +7,7 @@ /** Samples for Experiments ListExecutionDetails. */ public final class ExperimentsListExecutionDetailsSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentExecutionsDetails.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListExperimentExecutionsDetails.json */ /** * Sample code: List experiment executions details. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListSamples.java index 7f374c5e47c1f..9bb635ec93763 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListSamples.java @@ -7,7 +7,7 @@ /** Samples for Experiments List. */ public final class ExperimentsListSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentsInASubscription.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListExperimentsInASubscription.json */ /** * Sample code: List all Experiments in a subscription. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsStartSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsStartSamples.java index 15a6f369df75e..37a7c83856295 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsStartSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsStartSamples.java @@ -7,7 +7,7 @@ /** Samples for Experiments Start. */ public final class ExperimentsStartSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/StartAExperiment.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/StartExperiment.json */ /** * Sample code: Start a Experiment. @@ -15,6 +15,6 @@ public final class ExperimentsStartSamples { * @param manager Entry point to ChaosManager. */ public static void startAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().startWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + manager.experiments().start("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsUpdateSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsUpdateSamples.java index b3162a23ef9c6..dbfcb1577106e 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsUpdateSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsUpdateSamples.java @@ -14,14 +14,14 @@ /** Samples for Experiments Update. */ public final class ExperimentsUpdateSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/PatchExperiment.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/UpdateExperiment.json */ /** - * Sample code: Patch an Experiment in a resource group. + * Sample code: Update an Experiment in a resource group. * * @param manager Entry point to ChaosManager. */ - public static void patchAnExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + public static void updateAnExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { Experiment resource = manager .experiments() @@ -39,6 +39,7 @@ public static void patchAnExperimentInAResourceGroup(com.azure.resourcemanager.c .apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetSamples.java new file mode 100644 index 0000000000000..52c89512477fa --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for OperationStatuses Get. */ +public final class OperationStatusesGetSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetOperationStatus.json + */ + /** + * Sample code: Get specific operation status. + * + * @param manager Entry point to ChaosManager. + */ + public static void getSpecificOperationStatus(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager + .operationStatuses() + .getWithResponse("West US", "713192d7-503f-477a-9cfe-4efc3ee2bd11", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetSamples.java index 817789237b798..910f975f0a4f0 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetSamples.java @@ -7,7 +7,7 @@ /** Samples for TargetTypes Get. */ public final class TargetTypesGetSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetATargetType.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetTargetType.json */ /** * Sample code: Get a Target Type for westus2 location. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesListSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesListSamples.java index b69d5234b52d7..1ebfcd2e00316 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesListSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesListSamples.java @@ -7,7 +7,7 @@ /** Samples for TargetTypes List. */ public final class TargetTypesListSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListTargetTypes.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListTargetTypes.json */ /** * Sample code: List all Target Types for westus2 location. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateSamples.java index eae54a3598b11..f4763991187e0 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateSamples.java @@ -14,7 +14,7 @@ /** Samples for Targets CreateOrUpdate. */ public final class TargetsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CreateOrUpdateATarget.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/CreateUpdateTarget.json */ /** * Sample code: Create/update a Target that extends a virtual machine resource. @@ -44,6 +44,7 @@ public static void createUpdateATargetThatExtendsAVirtualMachineResource( com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteSamples.java index 6297b0552cdba..867feb89a1601 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for Targets Delete. */ public final class TargetsDeleteSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/DeleteATarget.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/DeleteTarget.json */ /** * Sample code: Delete a Target that extends a virtual machine resource. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsGetSamples.java index 6c4cdd6b39db0..18109ee85f270 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsGetSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for Targets Get. */ public final class TargetsGetSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetATarget.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/GetTarget.json */ /** * Sample code: Get a Target that extends a virtual machine resource. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsListSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsListSamples.java index d0f8820df417c..ea55162914ea4 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsListSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsListSamples.java @@ -7,7 +7,7 @@ /** Samples for Targets List. */ public final class TargetsListSamples { /* - * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListTargets.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-09-01-preview/examples/ListTargets.json */ /** * Sample code: List all Targets that extend a virtual machine resource. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ActionTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ActionTests.java deleted file mode 100644 index ce0c80c9c7b23..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ActionTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.Action; -import org.junit.jupiter.api.Assertions; - -public final class ActionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Action model = BinaryData.fromString("{\"type\":\"Action\",\"name\":\"ucww\"}").toObject(Action.class); - Assertions.assertEquals("ucww", model.name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Action model = new Action().withName("ucww"); - model = BinaryData.fromObject(model).toObject(Action.class); - Assertions.assertEquals("ucww", model.name()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/BranchTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/BranchTests.java deleted file mode 100644 index 0d5821eff7f68..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/BranchTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.Action; -import com.azure.resourcemanager.chaos.models.Branch; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class BranchTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Branch model = - BinaryData - .fromString( - "{\"name\":\"uhashsfwx\",\"actions\":[{\"type\":\"Action\",\"name\":\"owzxcu\"},{\"type\":\"Action\",\"name\":\"i\"},{\"type\":\"Action\",\"name\":\"jooxdjebw\"}]}") - .toObject(Branch.class); - Assertions.assertEquals("uhashsfwx", model.name()); - Assertions.assertEquals("owzxcu", model.actions().get(0).name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Branch model = - new Branch() - .withName("uhashsfwx") - .withActions( - Arrays - .asList( - new Action().withName("owzxcu"), - new Action().withName("i"), - new Action().withName("jooxdjebw"))); - model = BinaryData.fromObject(model).toObject(Branch.class); - Assertions.assertEquals("uhashsfwx", model.name()); - Assertions.assertEquals("owzxcu", model.actions().get(0).name()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index 243890d92386e..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; -import com.azure.resourcemanager.chaos.models.Capability; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class CapabilitiesCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"publisher\":\"mhairsbrgzdwmsw\",\"targetType\":\"pqwd\",\"description\":\"gicccnxqhuex\",\"parametersSchema\":\"ttlstvlzywemhz\",\"urn\":\"csdtclusiypbs\"},\"id\":\"gytguslfead\",\"name\":\"ygqukyhejh\",\"type\":\"isxgfp\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Capability response = - manager - .capabilities() - .createOrUpdateWithResponse( - "wpusdsttwvogv", - "bejdcn", - "qqmoaku", - "gm", - "zr", - "rdgrtw", - new CapabilityInner(), - com.azure.core.util.Context.NONE) - .getValue(); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteWithResponseMockTests.java deleted file mode 100644 index 363326342f5b8..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteWithResponseMockTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class CapabilitiesDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager - .capabilities() - .deleteWithResponse( - "owtlmnguxawqald", - "yuuximerqfobwyzn", - "bykutw", - "fhpagmhrskdsnf", - "sd", - "akgtdlmkkzevdlh", - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetWithResponseMockTests.java deleted file mode 100644 index 46fbb0c731e0c..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetWithResponseMockTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.Capability; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class CapabilitiesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"publisher\":\"oqouicybxarzgszu\",\"targetType\":\"x\",\"description\":\"q\",\"parametersSchema\":\"idoamciodhkha\",\"urn\":\"khnzbonlw\"},\"id\":\"toego\",\"name\":\"dwbwhkszzcmrvexz\",\"type\":\"vbtqgsfraoyzk\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Capability response = - manager - .capabilities() - .getWithResponse( - "oefki", - "rvtp", - "qujmqlgkf", - "tndoaongbjc", - "tujitcjedft", - "waezkojvd", - com.azure.core.util.Context.NONE) - .getValue(); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListMockTests.java deleted file mode 100644 index 36c4d3f313999..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListMockTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.Capability; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class CapabilitiesListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"publisher\":\"kgjubgdknnqvsazn\",\"targetType\":\"tor\",\"description\":\"sgsahmkycgr\",\"parametersSchema\":\"wjue\",\"urn\":\"eburu\"},\"id\":\"dmovsm\",\"name\":\"l\",\"type\":\"wabm\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager - .capabilities() - .list("vglsbjjca", "vxb", "t", "udutnco", "mr", "xqtvcofu", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityInnerTests.java deleted file mode 100644 index 46b73882dea59..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityInnerTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; - -public final class CapabilityInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityInner model = - BinaryData - .fromString( - "{\"properties\":{\"publisher\":\"mparcryuanzw\",\"targetType\":\"zdxtayrlhmwhf\",\"description\":\"rqobmtuk\",\"parametersSchema\":\"ryrtihfxtijbpzv\",\"urn\":\"wzsymglzufcy\"},\"id\":\"kohdbiha\",\"name\":\"ufhfcbjysa\",\"type\":\"ithxqhabifpi\"}") - .toObject(CapabilityInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityInner model = new CapabilityInner(); - model = BinaryData.fromObject(model).toObject(CapabilityInner.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityListResultTests.java deleted file mode 100644 index c81a42399e57d..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityListResultTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.CapabilityListResult; - -public final class CapabilityListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"publisher\":\"vgjxpybczm\",\"targetType\":\"mtz\",\"description\":\"bsphrupidgsybbe\",\"parametersSchema\":\"ph\",\"urn\":\"cmsxaobhdxbm\"},\"id\":\"qioqjzehtbmu\",\"name\":\"p\",\"type\":\"wnoi\"},{\"properties\":{\"publisher\":\"rxybqsoq\",\"targetType\":\"gkdmb\",\"description\":\"zlobcufpd\",\"parametersSchema\":\"rbt\",\"urn\":\"qjnqglhqgnufoooj\"},\"id\":\"wifsq\",\"name\":\"saagdf\",\"type\":\"glzlhjxrifkwmrv\"},{\"properties\":{\"publisher\":\"zntocipaouajps\",\"targetType\":\"cmpoyfdkfogkny\",\"description\":\"ofjdde\",\"parametersSchema\":\"rd\",\"urn\":\"pewnw\"},\"id\":\"eitjz\",\"name\":\"flusarhmof\",\"type\":\"qhsmyurkdtml\"}],\"nextLink\":\"ekuksjtx\"}") - .toObject(CapabilityListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityListResult model = new CapabilityListResult(); - model = BinaryData.fromObject(model).toObject(CapabilityListResult.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityPropertiesTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityPropertiesTests.java deleted file mode 100644 index a40c0f86e689a..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityPropertiesTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.CapabilityProperties; - -public final class CapabilityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityProperties model = - BinaryData - .fromString( - "{\"publisher\":\"wczbys\",\"targetType\":\"pqxu\",\"description\":\"vyq\",\"parametersSchema\":\"wby\",\"urn\":\"k\"}") - .toObject(CapabilityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityProperties model = new CapabilityProperties(); - model = BinaryData.fromObject(model).toObject(CapabilityProperties.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypeInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypeInnerTests.java deleted file mode 100644 index 35b9529de72b4..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypeInnerTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeInner; -import org.junit.jupiter.api.Assertions; - -public final class CapabilityTypeInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityTypeInner model = - BinaryData - .fromString( - "{\"location\":\"huticndvkao\",\"properties\":{\"publisher\":\"i\",\"targetType\":\"yhxhu\",\"displayName\":\"k\",\"description\":\"yxolniwp\",\"parametersSchema\":\"ukjfkgiawxklr\",\"urn\":\"lwckbasyypnddhs\",\"kind\":\"bacphejko\",\"azureRbacActions\":[\"qgoulznd\",\"i\",\"wyqkgfgibm\"],\"azureRbacDataActions\":[\"akeqs\",\"xybz\"],\"runtimeProperties\":{\"kind\":\"dqytbciqfouflmm\"}},\"id\":\"kzsmodm\",\"name\":\"lougpbkw\",\"type\":\"mutduqktaps\"}") - .toObject(CapabilityTypeInner.class); - Assertions.assertEquals("huticndvkao", model.location()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityTypeInner model = new CapabilityTypeInner().withLocation("huticndvkao"); - model = BinaryData.fromObject(model).toObject(CapabilityTypeInner.class); - Assertions.assertEquals("huticndvkao", model.location()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypeListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypeListResultTests.java deleted file mode 100644 index e5e3f3b7faf8c..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypeListResultTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.CapabilityTypeListResult; - -public final class CapabilityTypeListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityTypeListResult model = - BinaryData - .fromString( - "{\"value\":[{\"location\":\"jgrtfwvukxga\",\"properties\":{\"publisher\":\"cs\",\"targetType\":\"s\",\"displayName\":\"nyejhkryhtnap\",\"description\":\"wlokjyem\",\"parametersSchema\":\"vnipjox\",\"urn\":\"nchgej\",\"kind\":\"odmailzyd\",\"azureRbacActions\":[\"jwyahuxinpmqnja\"],\"azureRbacDataActions\":[\"xj\",\"prozvcputegjvwmf\",\"atscmd\",\"pjhulsuuvmkj\"],\"runtimeProperties\":{\"kind\":\"rwfndiod\"}},\"id\":\"pslwejdpvw\",\"name\":\"yoqpsoaccta\",\"type\":\"akl\"},{\"location\":\"hbcryffdfdosyge\",\"properties\":{\"publisher\":\"ojakhmsbzjhcrze\",\"targetType\":\"phlxa\",\"displayName\":\"thqt\",\"description\":\"qjbpfzfsin\",\"parametersSchema\":\"v\",\"urn\":\"jrwzox\",\"kind\":\"tfell\",\"azureRbacActions\":[\"zitonpeqfpjkjl\",\"ofpdvh\"],\"azureRbacDataActions\":[\"xypininmayhuybbk\",\"odepoogin\",\"vamih\"],\"runtimeProperties\":{\"kind\":\"narxzxtheotus\"}},\"id\":\"vyevcciqi\",\"name\":\"nhungbw\",\"type\":\"zrnf\"},{\"location\":\"gispemvtzfkufubl\",\"properties\":{\"publisher\":\"xqeofjaeqjhqjba\",\"targetType\":\"msmjqulngsntn\",\"displayName\":\"bkzgcwrwclx\",\"description\":\"rljdouskcqv\",\"parametersSchema\":\"cr\",\"urn\":\"dkwt\",\"kind\":\"xbnjbiksq\",\"azureRbacActions\":[\"ssainqpjwnzll\",\"fmppe\"],\"azureRbacDataActions\":[\"mgxsab\",\"yqduujit\"],\"runtimeProperties\":{\"kind\":\"zdzevndh\"}},\"id\":\"rwpdappdsbdkvwrw\",\"name\":\"feusnhut\",\"type\":\"eltmrldhugjzzdat\"}],\"nextLink\":\"hocdgeab\"}") - .toObject(CapabilityTypeListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityTypeListResult model = new CapabilityTypeListResult(); - model = BinaryData.fromObject(model).toObject(CapabilityTypeListResult.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypePropertiesRuntimePropertiesTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypePropertiesRuntimePropertiesTests.java deleted file mode 100644 index eea6de5793390..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypePropertiesRuntimePropertiesTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesRuntimeProperties; - -public final class CapabilityTypePropertiesRuntimePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityTypePropertiesRuntimeProperties model = - BinaryData - .fromString("{\"kind\":\"uhmuouqfprwzwbn\"}") - .toObject(CapabilityTypePropertiesRuntimeProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityTypePropertiesRuntimeProperties model = new CapabilityTypePropertiesRuntimeProperties(); - model = BinaryData.fromObject(model).toObject(CapabilityTypePropertiesRuntimeProperties.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypePropertiesTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypePropertiesTests.java deleted file mode 100644 index b71a9ea9af7f4..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypePropertiesTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeProperties; -import com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesRuntimeProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class CapabilityTypePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityTypeProperties model = - BinaryData - .fromString( - "{\"publisher\":\"gcue\",\"targetType\":\"umkdosvqwhbmd\",\"displayName\":\"bjf\",\"description\":\"gmbmbexppbh\",\"parametersSchema\":\"qrolfpf\",\"urn\":\"algbquxigjyjg\",\"kind\":\"aoyfhrtxilnerkuj\",\"azureRbacActions\":[\"l\",\"juvf\",\"awrlyx\"],\"azureRbacDataActions\":[\"cpr\",\"nwbxgjvtbvpyssz\"],\"runtimeProperties\":{\"kind\":\"uj\"}}") - .toObject(CapabilityTypeProperties.class); - Assertions.assertEquals("l", model.azureRbacActions().get(0)); - Assertions.assertEquals("cpr", model.azureRbacDataActions().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityTypeProperties model = - new CapabilityTypeProperties() - .withAzureRbacActions(Arrays.asList("l", "juvf", "awrlyx")) - .withAzureRbacDataActions(Arrays.asList("cpr", "nwbxgjvtbvpyssz")) - .withRuntimeProperties(new CapabilityTypePropertiesRuntimeProperties()); - model = BinaryData.fromObject(model).toObject(CapabilityTypeProperties.class); - Assertions.assertEquals("l", model.azureRbacActions().get(0)); - Assertions.assertEquals("cpr", model.azureRbacDataActions().get(0)); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetWithResponseMockTests.java deleted file mode 100644 index 7c2792d51d76d..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetWithResponseMockTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.CapabilityType; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class CapabilityTypesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"location\":\"budurgkakmo\",\"properties\":{\"publisher\":\"jjklff\",\"targetType\":\"ouw\",\"displayName\":\"gzrf\",\"description\":\"eyebizikayuhql\",\"parametersSchema\":\"bs\",\"urn\":\"bqwrvtldgm\",\"kind\":\"gvmpipaslthaqfx\",\"azureRbacActions\":[\"wutwbdsre\",\"pdrhne\",\"yowqkdwytisibir\"],\"azureRbacDataActions\":[\"ikpzimejza\",\"lfzxiavrmbzonoki\"],\"runtimeProperties\":{\"kind\":\"q\"}},\"id\":\"irgzp\",\"name\":\"rlazszrnw\",\"type\":\"iin\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - CapabilityType response = - manager - .capabilityTypes() - .getWithResponse("jivfxzsjabib", "ystawfsdjpvkvp", "jxbkzbzkdvn", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("budurgkakmo", response.location()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListMockTests.java deleted file mode 100644 index 923eb083647da..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListMockTests.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.CapabilityType; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class CapabilityTypesListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"location\":\"ujzra\",\"properties\":{\"publisher\":\"w\",\"targetType\":\"r\",\"displayName\":\"swibyr\",\"description\":\"l\",\"parametersSchema\":\"shfwpracstwity\",\"urn\":\"evxccedcp\",\"kind\":\"dyodnwzxltj\",\"azureRbacActions\":[\"hlt\",\"ugcxnavvwxq\",\"byqunyow\"],\"azureRbacDataActions\":[\"mdjrkvfgbvfvp\",\"bodacizsjq\",\"hkr\",\"ibdeibq\"],\"runtimeProperties\":{\"kind\":\"kghv\"}},\"id\":\"ndzwmkrefa\",\"name\":\"pjorwkqnyhg\",\"type\":\"ij\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.capabilityTypes().list("lolp", "vk", "r", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ujzra", response.iterator().next().location()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/DelayActionTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/DelayActionTests.java deleted file mode 100644 index 0f89985b10bb8..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/DelayActionTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.DelayAction; -import java.time.Duration; -import org.junit.jupiter.api.Assertions; - -public final class DelayActionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DelayAction model = - BinaryData - .fromString("{\"type\":\"delay\",\"duration\":\"PT114H40M51S\",\"name\":\"qoaxoruzfgs\"}") - .toObject(DelayAction.class); - Assertions.assertEquals("qoaxoruzfgs", model.name()); - Assertions.assertEquals(Duration.parse("PT114H40M51S"), model.duration()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DelayAction model = new DelayAction().withName("qoaxoruzfgs").withDuration(Duration.parse("PT114H40M51S")); - model = BinaryData.fromObject(model).toObject(DelayAction.class); - Assertions.assertEquals("qoaxoruzfgs", model.name()); - Assertions.assertEquals(Duration.parse("PT114H40M51S"), model.duration()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentCancelOperationResultInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentCancelOperationResultInnerTests.java deleted file mode 100644 index 3293201e1cd1f..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentCancelOperationResultInnerTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner; - -public final class ExperimentCancelOperationResultInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentCancelOperationResultInner model = - BinaryData - .fromString("{\"name\":\"kpycgklwndnhjd\",\"statusUrl\":\"whvylw\"}") - .toObject(ExperimentCancelOperationResultInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentCancelOperationResultInner model = new ExperimentCancelOperationResultInner(); - model = BinaryData.fromObject(model).toObject(ExperimentCancelOperationResultInner.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsInnerTests.java deleted file mode 100644 index f06010ff8196f..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsInnerTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; - -public final class ExperimentExecutionDetailsInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentExecutionDetailsInner model = - BinaryData - .fromString( - "{\"type\":\"bkdmo\",\"id\":\"postmgrcfbunrm\",\"name\":\"jhhkxbp\",\"properties\":{\"experimentId\":\"mjh\",\"status\":\"j\",\"failureReason\":\"gudivkrtswbxqz\",\"createdDateTime\":\"2021-10-26T13:42:02Z\",\"lastActionDateTime\":\"2021-01-16T06:43:01Z\",\"startDateTime\":\"2021-04-01T03:47:56Z\",\"stopDateTime\":\"2021-07-06T14:56:49Z\",\"runInformation\":{\"steps\":[{\"stepName\":\"ivetvtcq\",\"stepId\":\"tdo\",\"status\":\"cbxvwvxyslqbh\",\"branches\":[{},{},{}]},{\"stepName\":\"blytk\",\"stepId\":\"mpew\",\"status\":\"fbkrvrnsvs\",\"branches\":[{},{}]}]}}}") - .toObject(ExperimentExecutionDetailsInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentExecutionDetailsInner model = new ExperimentExecutionDetailsInner(); - model = BinaryData.fromObject(model).toObject(ExperimentExecutionDetailsInner.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsListResultTests.java deleted file mode 100644 index 112d5bd3a7871..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsListResultTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsListResult; - -public final class ExperimentExecutionDetailsListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentExecutionDetailsListResult model = - BinaryData - .fromString( - "{\"value\":[{\"type\":\"wroyqbexrmcq\",\"id\":\"ycnojvknmefqsg\",\"name\":\"ah\",\"properties\":{\"experimentId\":\"y\",\"status\":\"pvgqzcjrvxdjzlm\",\"failureReason\":\"xkvugfhzov\",\"createdDateTime\":\"2021-04-06T17:45:34Z\",\"lastActionDateTime\":\"2021-08-30T15:15:07Z\",\"startDateTime\":\"2021-08-29T21:49:24Z\",\"stopDateTime\":\"2021-02-16T01:55:44Z\",\"runInformation\":{\"steps\":[{}]}}},{\"type\":\"rnxipei\",\"id\":\"jzuaejxdultskzbb\",\"name\":\"zumveekgpwo\",\"properties\":{\"experimentId\":\"kfpbs\",\"status\":\"ofd\",\"failureReason\":\"uusdttouwa\",\"createdDateTime\":\"2021-08-12T22:43:04Z\",\"lastActionDateTime\":\"2021-11-05T01:57:54Z\",\"startDateTime\":\"2021-09-30T23:19:15Z\",\"stopDateTime\":\"2021-03-07T10:01:38Z\",\"runInformation\":{\"steps\":[{}]}}},{\"type\":\"bxwyjsflhhcaa\",\"id\":\"jixisxyawjoyaqcs\",\"name\":\"jpkiidzyexznelix\",\"properties\":{\"experimentId\":\"ztfolhbnxk\",\"status\":\"laulppg\",\"failureReason\":\"tpnapnyiropuhpig\",\"createdDateTime\":\"2021-05-18T16:57:02Z\",\"lastActionDateTime\":\"2021-06-13T20:05:29Z\",\"startDateTime\":\"2021-09-08T14:57:52Z\",\"stopDateTime\":\"2021-09-24T06:30:02Z\",\"runInformation\":{\"steps\":[{},{},{}]}}},{\"type\":\"jvc\",\"id\":\"ynqwwncwzzhxgk\",\"name\":\"mgucna\",\"properties\":{\"experimentId\":\"eoellwptfdygp\",\"status\":\"b\",\"failureReason\":\"ceopzfqrhhuaopp\",\"createdDateTime\":\"2021-12-04T10:32:02Z\",\"lastActionDateTime\":\"2021-11-26T20:29:16Z\",\"startDateTime\":\"2021-08-22T01:14:41Z\",\"stopDateTime\":\"2021-02-19T08:33:13Z\",\"runInformation\":{\"steps\":[{},{}]}}}],\"nextLink\":\"xcto\"}") - .toObject(ExperimentExecutionDetailsListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentExecutionDetailsListResult model = new ExperimentExecutionDetailsListResult(); - model = BinaryData.fromObject(model).toObject(ExperimentExecutionDetailsListResult.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsPropertiesRunInformationTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsPropertiesRunInformationTests.java deleted file mode 100644 index b9a1d40035e4e..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsPropertiesRunInformationTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation; - -public final class ExperimentExecutionDetailsPropertiesRunInformationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentExecutionDetailsPropertiesRunInformation model = - BinaryData - .fromString( - "{\"steps\":[{\"stepName\":\"thuma\",\"stepId\":\"lbg\",\"status\":\"duiertgcc\",\"branches\":[{\"branchName\":\"olpsslqlf\",\"branchId\":\"dnbbglzps\",\"status\":\"ydmcwyhzdxssa\",\"actions\":[{},{},{},{}]},{\"branchName\":\"nvdfznuda\",\"branchId\":\"vxzbncb\",\"status\":\"lpstdbhhxsrzdz\",\"actions\":[{},{},{}]},{\"branchName\":\"scdntnevf\",\"branchId\":\"jmygtdsslswtmwer\",\"status\":\"fzp\",\"actions\":[{},{},{}]}]},{\"stepName\":\"mwabnetshhszhedp\",\"stepId\":\"wiwubm\",\"status\":\"besldnkwwtppjflc\",\"branches\":[{\"branchName\":\"okonzmnsikvmkqz\",\"branchId\":\"qkdltfz\",\"status\":\"hhvh\",\"actions\":[{}]},{\"branchName\":\"odkwobd\",\"branchId\":\"xtibqdxbxwakbog\",\"status\":\"ndlkzgxhurip\",\"actions\":[{},{}]},{\"branchName\":\"dxunkbebxmubyyn\",\"branchId\":\"lrb\",\"status\":\"koievseo\",\"actions\":[{}]},{\"branchName\":\"l\",\"branchId\":\"muwlauwzizxbm\",\"status\":\"cjefuzmu\",\"actions\":[{},{},{}]}]}]}") - .toObject(ExperimentExecutionDetailsPropertiesRunInformation.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentExecutionDetailsPropertiesRunInformation model = - new ExperimentExecutionDetailsPropertiesRunInformation(); - model = BinaryData.fromObject(model).toObject(ExperimentExecutionDetailsPropertiesRunInformation.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsPropertiesTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsPropertiesTests.java deleted file mode 100644 index 2c0484cfdefcc..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsPropertiesTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsProperties; - -public final class ExperimentExecutionDetailsPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentExecutionDetailsProperties model = - BinaryData - .fromString( - "{\"experimentId\":\"hxcr\",\"status\":\"fovasr\",\"failureReason\":\"v\",\"createdDateTime\":\"2021-07-10T06:08:41Z\",\"lastActionDateTime\":\"2021-03-07T17:24:46Z\",\"startDateTime\":\"2021-11-17T10:32:18Z\",\"stopDateTime\":\"2021-05-02T16:44:33Z\",\"runInformation\":{\"steps\":[{\"stepName\":\"rxbpyb\",\"stepId\":\"fbjfdtwssotftpvj\",\"status\":\"exilzznfqqnvwpmq\",\"branches\":[{\"branchName\":\"oujmkcjhwqytj\",\"branchId\":\"bnw\",\"status\":\"wgdrjervnaenqp\",\"actions\":[{},{},{},{}]},{\"branchName\":\"doy\",\"branchId\":\"ifthnz\",\"status\":\"dslgnayqigynduh\",\"actions\":[{},{},{}]}]}]}}") - .toObject(ExperimentExecutionDetailsProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentExecutionDetailsProperties model = new ExperimentExecutionDetailsProperties(); - model = BinaryData.fromObject(model).toObject(ExperimentExecutionDetailsProperties.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentInnerTests.java deleted file mode 100644 index 1784f51e727f0..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentInnerTests.java +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; -import com.azure.resourcemanager.chaos.models.Action; -import com.azure.resourcemanager.chaos.models.Branch; -import com.azure.resourcemanager.chaos.models.Filter; -import com.azure.resourcemanager.chaos.models.ResourceIdentity; -import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import com.azure.resourcemanager.chaos.models.Selector; -import com.azure.resourcemanager.chaos.models.Step; -import com.azure.resourcemanager.chaos.models.UserAssignedIdentity; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ExperimentInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentInner model = - BinaryData - .fromString( - "{\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"udwtiukbl\":{\"principalId\":\"a61f533d-4cb4-48c5-b497-037970f7a5e4\",\"clientId\":\"a2b0ed87-2549-4a89-a548-e0201ea73b97\"},\"kpoc\":{\"principalId\":\"42cfbeff-7124-4ed5-9328-09adb1b652ac\",\"clientId\":\"dfd5c108-4321-42c2-a063-44f4503fa5fa\"},\"z\":{\"principalId\":\"a42405b6-1569-4569-ad74-4ffedceb4851\",\"clientId\":\"206e8550-f951-4176-b6b6-464869be91a1\"}},\"principalId\":\"o\",\"tenantId\":\"ukgjnpiucgygevq\"},\"properties\":{\"steps\":[{\"name\":\"typmrbpizcdrqjsd\",\"branches\":[{\"name\":\"dnfyhxdeoejzicwi\",\"actions\":[{\"type\":\"Action\",\"name\":\"jttgzf\"},{\"type\":\"Action\",\"name\":\"ishc\"},{\"type\":\"Action\",\"name\":\"khaj\"}]},{\"name\":\"eyeam\",\"actions\":[{\"type\":\"Action\",\"name\":\"hagalpbuxwgipwh\"}]},{\"name\":\"nowkgshw\",\"actions\":[{\"type\":\"Action\",\"name\":\"kix\"},{\"type\":\"Action\",\"name\":\"bin\"},{\"type\":\"Action\",\"name\":\"eputtmrywnuzoqf\"}]},{\"name\":\"iyqzrnk\",\"actions\":[{\"type\":\"Action\",\"name\":\"vyxlwhzlsicohoqq\"},{\"type\":\"Action\",\"name\":\"wvl\"},{\"type\":\"Action\",\"name\":\"yav\"},{\"type\":\"Action\",\"name\":\"hheunmmqhgyx\"}]}]},{\"name\":\"konocu\",\"branches\":[{\"name\":\"klyaxuconu\",\"actions\":[{\"type\":\"Action\",\"name\":\"zf\"},{\"type\":\"Action\",\"name\":\"beypewrmjmw\"}]},{\"name\":\"vjektcxsenh\",\"actions\":[{\"type\":\"Action\",\"name\":\"rsffrzpwvlqdqgbi\"}]},{\"name\":\"ylihkaetckt\",\"actions\":[{\"type\":\"Action\",\"name\":\"civfsnkymuctq\"},{\"type\":\"Action\",\"name\":\"jf\"},{\"type\":\"Action\",\"name\":\"ebrjcxe\"}]}]},{\"name\":\"fuwutttxf\",\"branches\":[{\"name\":\"rbirphxe\",\"actions\":[{\"type\":\"Action\",\"name\":\"yva\"}]},{\"name\":\"fnljky\",\"actions\":[{\"type\":\"Action\",\"name\":\"j\"},{\"type\":\"Action\",\"name\":\"uujqgidokgjljyo\"},{\"type\":\"Action\",\"name\":\"gvcl\"},{\"type\":\"Action\",\"name\":\"bgsncghkjeszzhb\"}]},{\"name\":\"jhtxfvgxbfsmxne\",\"actions\":[{\"type\":\"Action\",\"name\":\"pvecxgodeb\"},{\"type\":\"Action\",\"name\":\"qkkrb\"},{\"type\":\"Action\",\"name\":\"pukgriwflzlfb\"},{\"type\":\"Action\",\"name\":\"zpuzycisp\"}]},{\"name\":\"qzahmgkbrp\",\"actions\":[{\"type\":\"Action\",\"name\":\"dhibnuq\"}]}]},{\"name\":\"kpikadrgvt\",\"branches\":[{\"name\":\"gnbuy\",\"actions\":[{\"type\":\"Action\",\"name\":\"ijggmebfsiar\"},{\"type\":\"Action\",\"name\":\"utrc\"}]}]}],\"selectors\":[{\"type\":\"Selector\",\"id\":\"na\",\"filter\":{\"type\":\"Filter\"},\"\":{\"bh\":\"datajrunmpxtt\"}},{\"type\":\"Selector\",\"id\":\"bnlankxmyskpb\",\"filter\":{\"type\":\"Filter\"},\"\":{\"lqidyby\":\"datatkcxywnytnrsy\",\"haaxdbabphl\":\"dataczfc\",\"yazttbtwwrqpue\":\"datarqlfktsthsucocmn\",\"xibxujwbhqwalm\":\"datackzywbiexzfeyue\"}}],\"startOnCreation\":false},\"location\":\"oxaepd\",\"tags\":{\"bavxbniwdjswzt\":\"ancuxrhd\",\"xbzpfzab\":\"dbpgnxytxhp\"},\"id\":\"lcuhxwtctyqiklb\",\"name\":\"ovplw\",\"type\":\"bhvgy\"}") - .toObject(ExperimentInner.class); - Assertions.assertEquals("oxaepd", model.location()); - Assertions.assertEquals("ancuxrhd", model.tags().get("bavxbniwdjswzt")); - Assertions.assertEquals(ResourceIdentityType.NONE, model.identity().type()); - Assertions.assertEquals("typmrbpizcdrqjsd", model.steps().get(0).name()); - Assertions.assertEquals("dnfyhxdeoejzicwi", model.steps().get(0).branches().get(0).name()); - Assertions.assertEquals("jttgzf", model.steps().get(0).branches().get(0).actions().get(0).name()); - Assertions.assertEquals("na", model.selectors().get(0).id()); - Assertions.assertEquals(false, model.startOnCreation()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentInner model = - new ExperimentInner() - .withLocation("oxaepd") - .withTags(mapOf("bavxbniwdjswzt", "ancuxrhd", "xbzpfzab", "dbpgnxytxhp")) - .withIdentity( - new ResourceIdentity() - .withType(ResourceIdentityType.NONE) - .withUserAssignedIdentities( - mapOf( - "udwtiukbl", - new UserAssignedIdentity(), - "kpoc", - new UserAssignedIdentity(), - "z", - new UserAssignedIdentity()))) - .withSteps( - Arrays - .asList( - new Step() - .withName("typmrbpizcdrqjsd") - .withBranches( - Arrays - .asList( - new Branch() - .withName("dnfyhxdeoejzicwi") - .withActions( - Arrays - .asList( - new Action().withName("jttgzf"), - new Action().withName("ishc"), - new Action().withName("khaj"))), - new Branch() - .withName("eyeam") - .withActions(Arrays.asList(new Action().withName("hagalpbuxwgipwh"))), - new Branch() - .withName("nowkgshw") - .withActions( - Arrays - .asList( - new Action().withName("kix"), - new Action().withName("bin"), - new Action().withName("eputtmrywnuzoqf"))), - new Branch() - .withName("iyqzrnk") - .withActions( - Arrays - .asList( - new Action().withName("vyxlwhzlsicohoqq"), - new Action().withName("wvl"), - new Action().withName("yav"), - new Action().withName("hheunmmqhgyx"))))), - new Step() - .withName("konocu") - .withBranches( - Arrays - .asList( - new Branch() - .withName("klyaxuconu") - .withActions( - Arrays - .asList( - new Action().withName("zf"), - new Action().withName("beypewrmjmw"))), - new Branch() - .withName("vjektcxsenh") - .withActions(Arrays.asList(new Action().withName("rsffrzpwvlqdqgbi"))), - new Branch() - .withName("ylihkaetckt") - .withActions( - Arrays - .asList( - new Action().withName("civfsnkymuctq"), - new Action().withName("jf"), - new Action().withName("ebrjcxe"))))), - new Step() - .withName("fuwutttxf") - .withBranches( - Arrays - .asList( - new Branch() - .withName("rbirphxe") - .withActions(Arrays.asList(new Action().withName("yva"))), - new Branch() - .withName("fnljky") - .withActions( - Arrays - .asList( - new Action().withName("j"), - new Action().withName("uujqgidokgjljyo"), - new Action().withName("gvcl"), - new Action().withName("bgsncghkjeszzhb"))), - new Branch() - .withName("jhtxfvgxbfsmxne") - .withActions( - Arrays - .asList( - new Action().withName("pvecxgodeb"), - new Action().withName("qkkrb"), - new Action().withName("pukgriwflzlfb"), - new Action().withName("zpuzycisp"))), - new Branch() - .withName("qzahmgkbrp") - .withActions(Arrays.asList(new Action().withName("dhibnuq"))))), - new Step() - .withName("kpikadrgvt") - .withBranches( - Arrays - .asList( - new Branch() - .withName("gnbuy") - .withActions( - Arrays - .asList( - new Action().withName("ijggmebfsiar"), - new Action().withName("utrc"))))))) - .withSelectors( - Arrays - .asList( - new Selector() - .withId("na") - .withFilter(new Filter()) - .withAdditionalProperties(mapOf("type", "Selector")), - new Selector() - .withId("bnlankxmyskpb") - .withFilter(new Filter()) - .withAdditionalProperties(mapOf("type", "Selector")))) - .withStartOnCreation(false); - model = BinaryData.fromObject(model).toObject(ExperimentInner.class); - Assertions.assertEquals("oxaepd", model.location()); - Assertions.assertEquals("ancuxrhd", model.tags().get("bavxbniwdjswzt")); - Assertions.assertEquals(ResourceIdentityType.NONE, model.identity().type()); - Assertions.assertEquals("typmrbpizcdrqjsd", model.steps().get(0).name()); - Assertions.assertEquals("dnfyhxdeoejzicwi", model.steps().get(0).branches().get(0).name()); - Assertions.assertEquals("jttgzf", model.steps().get(0).branches().get(0).actions().get(0).name()); - Assertions.assertEquals("na", model.selectors().get(0).id()); - Assertions.assertEquals(false, model.startOnCreation()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentListResultTests.java deleted file mode 100644 index 6dd342d32aa78..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentListResultTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.ExperimentListResult; - -public final class ExperimentListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentListResult model = - BinaryData - .fromString( - "{\"value\":[{\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"a\":{\"principalId\":\"d694953e-da23-4a8d-b5a3-ef1669e288a2\",\"clientId\":\"cbb943cc-5830-4289-9a2f-da96d0b3054a\"},\"fizuckyf\":{\"principalId\":\"ee5be475-8484-4b37-b4a1-0ffbb9314704\",\"clientId\":\"c0be5ec7-b9cc-47cd-8c95-8efb8ab6bef1\"}},\"principalId\":\"rfidfvzwdz\",\"tenantId\":\"tymw\"},\"properties\":{\"steps\":[{\"name\":\"dkfthwxmnt\",\"branches\":[{\"name\":\"waopvkmijcmmxd\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"Selector\",\"id\":\"fufsrpymzi\",\"filter\":{\"type\":\"Filter\"},\"\":{\"wmdwzjeiachboo\":\"datazcxtbzsgfyccsn\",\"ypyqrimzinp\":\"dataflnrosfqpteehzz\",\"dqxhcrmnohjtckwh\":\"dataswjdkirso\",\"gr\":\"datasoifiyipjxsqw\"}},{\"type\":\"Selector\",\"id\":\"bznorcjxvsnby\",\"filter\":{\"type\":\"Filter\"},\"\":{\"cyshurzafbljjgp\":\"datanmoc\"}}],\"startOnCreation\":false},\"location\":\"qcjm\",\"tags\":{\"bqidtqaj\":\"a\",\"khbzhfepgzg\":\"yulpkudjkr\",\"zloc\":\"e\"},\"id\":\"scpai\",\"name\":\"rhhbcs\",\"type\":\"l\"},{\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"odxobnbdxkqpxok\":{\"principalId\":\"1f099396-1006-4d2d-9f92-72e1a6060dff\",\"clientId\":\"bcc6c36d-0eb9-4fcb-8fb9-0fb41a5b5d27\"},\"onpimexgstxg\":{\"principalId\":\"05ee082d-e1d1-4fc6-81d0-95dbe012f24c\",\"clientId\":\"db5b4bf4-f0b0-4027-b4f8-feda2cc97fd9\"},\"dg\":{\"principalId\":\"494cc7dc-ef6d-47c6-badb-66d55deb9331\",\"clientId\":\"3e73a6d8-5ec7-4c9e-a09b-66416fbf57a4\"}},\"principalId\":\"ajrmvdjwzrlovmc\",\"tenantId\":\"hijco\"},\"properties\":{\"steps\":[{\"name\":\"ctbzaq\",\"branches\":[{\"name\":\"sycbkbfk\",\"actions\":[]},{\"name\":\"ukdkexxppofmxa\",\"actions\":[]},{\"name\":\"c\",\"actions\":[]}]},{\"name\":\"jpgd\",\"branches\":[{\"name\":\"ocjjxhvpmouexh\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"Selector\",\"id\":\"xibqeojnx\",\"filter\":{\"type\":\"Filter\"},\"\":{\"btwnpzaoqvuhrhcf\":\"dataddntwndei\",\"pyeicxm\":\"datacyddglmjthjqk\"}},{\"type\":\"Selector\",\"id\":\"ciwqvhk\",\"filter\":{\"type\":\"Filter\"},\"\":{\"og\":\"dataigdtopbob\",\"w\":\"datam\",\"a\":\"dataa\",\"iotkftutqxl\":\"datahrzayvvtpgvdf\"}}],\"startOnCreation\":true},\"location\":\"lefgugnxk\",\"tags\":{\"tthzrvqd\":\"qmi\",\"ehoqfbowskan\":\"abhjybi\"},\"id\":\"ktzlcuiywg\",\"name\":\"ywgndrv\",\"type\":\"nhzgpphrcgyn\"},{\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"m\":{\"principalId\":\"476e19ab-99eb-40d4-afdf-b8b3c91159ee\",\"clientId\":\"fbbd8d1e-0d13-48d9-89a8-770ebfc1179e\"},\"ofsx\":{\"principalId\":\"f7142431-862f-40ab-9a70-4341d6d34c60\",\"clientId\":\"661e2bcc-d2f9-4563-a367-0b8fddde9665\"}},\"principalId\":\"evgbmqjq\",\"tenantId\":\"c\"},\"properties\":{\"steps\":[{\"name\":\"mivkwlzuvcc\",\"branches\":[{\"name\":\"nfnbacfionlebxe\",\"actions\":[]},{\"name\":\"qgtz\",\"actions\":[]}]},{\"name\":\"dpnqbq\",\"branches\":[{\"name\":\"xrjfeallnwsub\",\"actions\":[]},{\"name\":\"snjampmng\",\"actions\":[]},{\"name\":\"zscxaqwo\",\"actions\":[]},{\"name\":\"chcbonqvpkvlrxnj\",\"actions\":[]}]},{\"name\":\"ase\",\"branches\":[{\"name\":\"heoflokeyyienjbd\",\"actions\":[]},{\"name\":\"wtgrhpdjpj\",\"actions\":[]},{\"name\":\"masxazjpqyegu\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"Selector\",\"id\":\"hb\",\"filter\":{\"type\":\"Filter\"},\"\":{\"zvdudgwdslfhotwm\":\"datajj\"}},{\"type\":\"Selector\",\"id\":\"ynpwlbj\",\"filter\":{\"type\":\"Filter\"},\"\":{\"nltyfsoppusuesnz\":\"datacftadeh\",\"xzdmohctb\":\"datadejbavo\"}},{\"type\":\"Selector\",\"id\":\"vudwx\",\"filter\":{\"type\":\"Filter\"},\"\":{\"gujjugwdkcglh\":\"datavo\",\"ofqweykhmenevfye\":\"datalazjdyggdtjixhbk\",\"dcsi\":\"datafwhybcibvy\"}},{\"type\":\"Selector\",\"id\":\"ynnaam\",\"filter\":{\"type\":\"Filter\"},\"\":{\"iqscjeypv\":\"dataeh\",\"gm\":\"dataezrkgqhcjrefo\",\"yyvxyqjpkcattpn\":\"dataqsl\",\"v\":\"datajcrcczsqpjhvmda\"}}],\"startOnCreation\":true},\"location\":\"ounqecano\",\"tags\":{\"rpmopjmc\":\"pfhyhl\"},\"id\":\"atuokthfuiu\",\"name\":\"odsfcpkvxodpuozm\",\"type\":\"zydagfuaxbezyiuo\"},{\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"wz\":{\"principalId\":\"553b7af2-caea-4f7e-8708-4113725c7e0f\",\"clientId\":\"6a91372d-f022-4b5e-b1ac-17c2039d1263\"},\"sm\":{\"principalId\":\"119fde70-223d-49d1-bf05-b90bfb53bec6\",\"clientId\":\"4a9ebd2a-94a3-4b14-b4f6-9d9d2b55d834\"},\"reximoryocfs\":{\"principalId\":\"fec08330-339f-4701-abd7-ff1a32043da5\",\"clientId\":\"b401908a-87e9-4d08-b905-ef423a7b1d96\"}},\"principalId\":\"s\",\"tenantId\":\"ddystkiiuxhqy\"},\"properties\":{\"steps\":[{\"name\":\"xorrqnb\",\"branches\":[{\"name\":\"czvyifq\",\"actions\":[]},{\"name\":\"vkd\",\"actions\":[]}]},{\"name\":\"jsllrmv\",\"branches\":[{\"name\":\"f\",\"actions\":[]}]},{\"name\":\"atkpnp\",\"branches\":[{\"name\":\"exxbczwtr\",\"actions\":[]},{\"name\":\"wiqzbqjvsovmyo\",\"actions\":[]},{\"name\":\"acspkwl\",\"actions\":[]}]},{\"name\":\"zdobpxjmflbvvnch\",\"branches\":[{\"name\":\"cciw\",\"actions\":[]},{\"name\":\"zjuqkhrsaj\",\"actions\":[]},{\"name\":\"wkuofoskghsauu\",\"actions\":[]},{\"name\":\"mjmvxieduugidyjr\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"Selector\",\"id\":\"byao\",\"filter\":{\"type\":\"Filter\"},\"\":{\"slkevle\":\"datacsonpclhoco\"}}],\"startOnCreation\":false},\"location\":\"fbuhfmvfaxkffe\",\"tags\":{\"m\":\"hl\"},\"id\":\"zy\",\"name\":\"shxmzsbbzoggigrx\",\"type\":\"burvjxxjnspy\"}],\"nextLink\":\"tko\"}") - .toObject(ExperimentListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentListResult model = new ExperimentListResult(); - model = BinaryData.fromObject(model).toObject(ExperimentListResult.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentPropertiesTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentPropertiesTests.java deleted file mode 100644 index b1dc96cbb73ed..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentPropertiesTests.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentProperties; -import com.azure.resourcemanager.chaos.models.Action; -import com.azure.resourcemanager.chaos.models.Branch; -import com.azure.resourcemanager.chaos.models.Filter; -import com.azure.resourcemanager.chaos.models.Selector; -import com.azure.resourcemanager.chaos.models.Step; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ExperimentPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentProperties model = - BinaryData - .fromString( - "{\"steps\":[{\"name\":\"bbaumnyquped\",\"branches\":[{\"name\":\"jn\",\"actions\":[{\"type\":\"Action\",\"name\":\"ckhsmtxpsieb\"},{\"type\":\"Action\",\"name\":\"fhvpesaps\"},{\"type\":\"Action\",\"name\":\"rdqmhjjdhtldwkyz\"}]},{\"name\":\"uutkncw\",\"actions\":[{\"type\":\"Action\",\"name\":\"wsvlxotogtwrupqs\"},{\"type\":\"Action\",\"name\":\"vnm\"},{\"type\":\"Action\",\"name\":\"cykvceo\"}]},{\"name\":\"eil\",\"actions\":[{\"type\":\"Action\",\"name\":\"notyfjfcnjbkcn\"},{\"type\":\"Action\",\"name\":\"dhbt\"},{\"type\":\"Action\",\"name\":\"kphywpnvjto\"}]},{\"name\":\"nermcl\",\"actions\":[{\"type\":\"Action\",\"name\":\"lphox\"},{\"type\":\"Action\",\"name\":\"scrpabgyepsbjt\"}]}]}],\"selectors\":[{\"type\":\"Selector\",\"id\":\"qugxywpmueefjzwf\",\"filter\":{\"type\":\"Filter\"},\"\":{\"xtccmg\":\"datajidsuyonobglaoc\",\"wfudwpzntxhdzhl\":\"dataudxytlmoyrx\",\"hckfrlhrx\":\"dataqj\"}}],\"startOnCreation\":false}") - .toObject(ExperimentProperties.class); - Assertions.assertEquals("bbaumnyquped", model.steps().get(0).name()); - Assertions.assertEquals("jn", model.steps().get(0).branches().get(0).name()); - Assertions.assertEquals("ckhsmtxpsieb", model.steps().get(0).branches().get(0).actions().get(0).name()); - Assertions.assertEquals("qugxywpmueefjzwf", model.selectors().get(0).id()); - Assertions.assertEquals(false, model.startOnCreation()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentProperties model = - new ExperimentProperties() - .withSteps( - Arrays - .asList( - new Step() - .withName("bbaumnyquped") - .withBranches( - Arrays - .asList( - new Branch() - .withName("jn") - .withActions( - Arrays - .asList( - new Action().withName("ckhsmtxpsieb"), - new Action().withName("fhvpesaps"), - new Action().withName("rdqmhjjdhtldwkyz"))), - new Branch() - .withName("uutkncw") - .withActions( - Arrays - .asList( - new Action().withName("wsvlxotogtwrupqs"), - new Action().withName("vnm"), - new Action().withName("cykvceo"))), - new Branch() - .withName("eil") - .withActions( - Arrays - .asList( - new Action().withName("notyfjfcnjbkcn"), - new Action().withName("dhbt"), - new Action().withName("kphywpnvjto"))), - new Branch() - .withName("nermcl") - .withActions( - Arrays - .asList( - new Action().withName("lphox"), - new Action().withName("scrpabgyepsbjt"))))))) - .withSelectors( - Arrays - .asList( - new Selector() - .withId("qugxywpmueefjzwf") - .withFilter(new Filter()) - .withAdditionalProperties(mapOf("type", "Selector")))) - .withStartOnCreation(false); - model = BinaryData.fromObject(model).toObject(ExperimentProperties.class); - Assertions.assertEquals("bbaumnyquped", model.steps().get(0).name()); - Assertions.assertEquals("jn", model.steps().get(0).branches().get(0).name()); - Assertions.assertEquals("ckhsmtxpsieb", model.steps().get(0).branches().get(0).actions().get(0).name()); - Assertions.assertEquals("qugxywpmueefjzwf", model.selectors().get(0).id()); - Assertions.assertEquals(false, model.startOnCreation()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentStartOperationResultInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentStartOperationResultInnerTests.java deleted file mode 100644 index f3c44a5518fcc..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentStartOperationResultInnerTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner; - -public final class ExperimentStartOperationResultInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentStartOperationResultInner model = - BinaryData - .fromString("{\"name\":\"tdhxujznbmpowuwp\",\"statusUrl\":\"qlveualupjmkh\"}") - .toObject(ExperimentStartOperationResultInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentStartOperationResultInner model = new ExperimentStartOperationResultInner(); - model = BinaryData.fromObject(model).toObject(ExperimentStartOperationResultInner.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentStatusInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentStatusInnerTests.java deleted file mode 100644 index 0cff857fd16a7..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentStatusInnerTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner; - -public final class ExperimentStatusInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentStatusInner model = - BinaryData - .fromString( - "{\"type\":\"zjuzgwyz\",\"id\":\"txon\",\"name\":\"ts\",\"properties\":{\"status\":\"cbpwxqpsrknft\",\"createdDateUtc\":\"2021-04-20T10:14:36Z\",\"endDateUtc\":\"2021-01-01T20:16:55Z\"}}") - .toObject(ExperimentStatusInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentStatusInner model = new ExperimentStatusInner(); - model = BinaryData.fromObject(model).toObject(ExperimentStatusInner.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentStatusListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentStatusListResultTests.java deleted file mode 100644 index f21726586306b..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentStatusListResultTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.ExperimentStatusListResult; - -public final class ExperimentStatusListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentStatusListResult model = - BinaryData - .fromString( - "{\"value\":[{\"type\":\"bcswsrt\",\"id\":\"iplrbpbewtghfgb\",\"name\":\"gw\",\"properties\":{\"status\":\"lvqhjkbegibtnmx\",\"createdDateUtc\":\"2021-04-16T06:52:16Z\",\"endDateUtc\":\"2021-03-05T02:51:46Z\"}}],\"nextLink\":\"loayqcgw\"}") - .toObject(ExperimentStatusListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentStatusListResult model = new ExperimentStatusListResult(); - model = BinaryData.fromObject(model).toObject(ExperimentStatusListResult.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentStatusPropertiesTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentStatusPropertiesTests.java deleted file mode 100644 index 3629658444e0f..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentStatusPropertiesTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusProperties; - -public final class ExperimentStatusPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentStatusProperties model = - BinaryData - .fromString( - "{\"status\":\"hprwmdyv\",\"createdDateUtc\":\"2021-07-01T04:16:54Z\",\"endDateUtc\":\"2021-07-25T12:29:44Z\"}") - .toObject(ExperimentStatusProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentStatusProperties model = new ExperimentStatusProperties(); - model = BinaryData.fromObject(model).toObject(ExperimentStatusProperties.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentUpdateTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentUpdateTests.java deleted file mode 100644 index 5b13428e765d9..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentUpdateTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.ExperimentUpdate; -import com.azure.resourcemanager.chaos.models.ResourceIdentity; -import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import com.azure.resourcemanager.chaos.models.UserAssignedIdentity; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ExperimentUpdateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentUpdate model = - BinaryData - .fromString( - "{\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"it\":{\"principalId\":\"c1000e40-cee2-4311-b04e-e94747e05df2\",\"clientId\":\"147b9e75-fe91-49c9-b34f-5121d73c6b63\"},\"jawgqwg\":{\"principalId\":\"ab61a5da-1f68-4580-84f9-7d0dbb3c39a1\",\"clientId\":\"8744a7df-7546-485d-b3a1-c096cb036fad\"}},\"principalId\":\"ni\",\"tenantId\":\"x\"}}") - .toObject(ExperimentUpdate.class); - Assertions.assertEquals(ResourceIdentityType.USER_ASSIGNED, model.identity().type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentUpdate model = - new ExperimentUpdate() - .withIdentity( - new ResourceIdentity() - .withType(ResourceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf("it", new UserAssignedIdentity(), "jawgqwg", new UserAssignedIdentity()))); - model = BinaryData.fromObject(model).toObject(ExperimentUpdate.class); - Assertions.assertEquals(ResourceIdentityType.USER_ASSIGNED, model.identity().type()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelWithResponseMockTests.java deleted file mode 100644 index 043aa45b9f925..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelWithResponseMockTests.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.ExperimentCancelOperationResult; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ExperimentsCancelWithResponseMockTests { - @Test - public void testCancelWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{\"name\":\"xkk\",\"statusUrl\":\"h\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(202); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ExperimentCancelOperationResult response = - manager - .experiments() - .cancelWithResponse("sgogczhonnxk", "lgnyhmo", com.azure.core.util.Context.NONE) - .getValue(); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index 47326d7582c92..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.Branch; -import com.azure.resourcemanager.chaos.models.Experiment; -import com.azure.resourcemanager.chaos.models.Filter; -import com.azure.resourcemanager.chaos.models.ResourceIdentity; -import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import com.azure.resourcemanager.chaos.models.Selector; -import com.azure.resourcemanager.chaos.models.Step; -import com.azure.resourcemanager.chaos.models.UserAssignedIdentity; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ExperimentsCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"fgmblrrilbywdxsm\":{\"principalId\":\"6981a6ea-7d5f-43e8-a7e5-588b5fc19ebd\",\"clientId\":\"4800dd1a-97e6-4b07-81ad-e83847e391ab\"}},\"principalId\":\"cwrwfs\",\"tenantId\":\"fnynszqujizdvoqy\"},\"properties\":{\"steps\":[{\"name\":\"byowbblgyavutp\",\"branches\":[{\"name\":\"joxoism\",\"actions\":[]},{\"name\":\"ksbpimlqoljx\",\"actions\":[]}]},{\"name\":\"cgxxlxs\",\"branches\":[{\"name\":\"gcvizqzdwlvwlyou\",\"actions\":[]},{\"name\":\"fgfb\",\"actions\":[]}]},{\"name\":\"jub\",\"branches\":[{\"name\":\"hgkfmin\",\"actions\":[]}]},{\"name\":\"g\",\"branches\":[{\"name\":\"zfttsttktlahb\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"Selector\",\"id\":\"ctxtgzukxi\",\"filter\":{\"type\":\"Filter\"},\"\":{\"qqxhrnxrxcpj\":\"datatg\",\"dzf\":\"dataisavok\",\"atnwxyiopi\":\"dataazivjlfrqttbajl\"}},{\"type\":\"Selector\",\"id\":\"kqqfk\",\"filter\":{\"type\":\"Filter\"},\"\":{\"ibrxkp\":\"dataxkdmligo\",\"bteoybf\":\"dataloazuruocbgoo\",\"jgslordilmyww\":\"datajxakv\"}},{\"type\":\"Selector\",\"id\":\"kgkxn\",\"filter\":{\"type\":\"Filter\"},\"\":{\"yvudtjuewbci\":\"datab\",\"xccybvpa\":\"dataxuuwhcj\"}},{\"type\":\"Selector\",\"id\":\"akkud\",\"filter\":{\"type\":\"Filter\"},\"\":{\"stcyohpfkyrkdbd\":\"datawjplma\",\"nobaiyhddviacegf\":\"dataiogsjkmnwq\"}}],\"startOnCreation\":true},\"location\":\"tfpmvmemfnczdw\",\"tags\":{\"db\":\"alxlllchp\"},\"id\":\"evwrdnhfuk\",\"name\":\"vsjcswsmystuluqy\",\"type\":\"fcvlerch\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Experiment response = - manager - .experiments() - .define("hmkxmaehvbb") - .withRegion("sivfomilo") - .withExistingResourceGroup("eydbsd") - .withSteps( - Arrays - .asList( - new Step() - .withName("tgk") - .withBranches( - Arrays - .asList( - new Branch().withName("tvdxeclzedqb").withActions(Arrays.asList()), - new Branch().withName("vh").withActions(Arrays.asList()), - new Branch().withName("lhpl").withActions(Arrays.asList()))), - new Step() - .withName("dqkdlwwqfbu") - .withBranches( - Arrays.asList(new Branch().withName("kxtrq").withActions(Arrays.asList()))))) - .withSelectors( - Arrays - .asList( - new Selector() - .withId("smlmbtxhwgfwsrta") - .withFilter(new Filter()) - .withAdditionalProperties(mapOf("type", "Selector")), - new Selector() - .withId("qgzsles") - .withFilter(new Filter()) - .withAdditionalProperties(mapOf("type", "Selector")), - new Selector() - .withId("ewzcjznmwcp") - .withFilter(new Filter()) - .withAdditionalProperties(mapOf("type", "Selector")), - new Selector() - .withId("w") - .withFilter(new Filter()) - .withAdditionalProperties(mapOf("type", "Selector")))) - .withTags(mapOf("dieuzaofj", "dufiq", "otcubi", "hvcyyysfg")) - .withIdentity( - new ResourceIdentity() - .withType(ResourceIdentityType.SYSTEM_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "n", - new UserAssignedIdentity(), - "axkgx", - new UserAssignedIdentity(), - "ckpyklyhplu", - new UserAssignedIdentity()))) - .withStartOnCreation(false) - .create(); - - Assertions.assertEquals("tfpmvmemfnczdw", response.location()); - Assertions.assertEquals("alxlllchp", response.tags().get("db")); - Assertions.assertEquals(ResourceIdentityType.NONE, response.identity().type()); - Assertions.assertEquals("byowbblgyavutp", response.steps().get(0).name()); - Assertions.assertEquals("joxoism", response.steps().get(0).branches().get(0).name()); - Assertions.assertEquals("ctxtgzukxi", response.selectors().get(0).id()); - Assertions.assertEquals(true, response.startOnCreation()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsDeleteByResourceGroupWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsDeleteByResourceGroupWithResponseMockTests.java deleted file mode 100644 index cf6fe4809dad4..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsDeleteByResourceGroupWithResponseMockTests.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ExperimentsDeleteByResourceGroupWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager - .experiments() - .deleteByResourceGroupWithResponse("tmmjihyeozph", "wau", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupWithResponseMockTests.java deleted file mode 100644 index 2e1d19da88a17..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupWithResponseMockTests.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.Experiment; -import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ExperimentsGetByResourceGroupWithResponseMockTests { - @Test - public void testGetByResourceGroupWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"hojujbypelmcuv\":{\"principalId\":\"9151e949-2c21-426f-abce-12c7400f217f\",\"clientId\":\"89c26f2a-1891-48ed-a922-34da940492e4\"},\"bjx\":{\"principalId\":\"21310cad-a62d-4c74-a0b6-3431369872d4\",\"clientId\":\"84b97f4c-56da-4844-b613-5ce0881ac388\"},\"n\":{\"principalId\":\"4337f343-9ed0-4d83-b3ac-d1427c752f37\",\"clientId\":\"6f3e5a61-5997-47a6-a0d9-6bd2ba0ac851\"}},\"principalId\":\"r\",\"tenantId\":\"o\"},\"properties\":{\"steps\":[{\"name\":\"ttpkiwkkbnujrywv\",\"branches\":[{\"name\":\"lbfpncurd\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"Selector\",\"id\":\"wiithtywub\",\"filter\":{\"type\":\"Filter\"},\"\":{\"qknfd\":\"datah\",\"ihxumwctondzj\":\"datatwjchrdg\",\"fdlwg\":\"datauu\",\"gseinq\":\"dataytsbwtovv\"}}],\"startOnCreation\":true},\"location\":\"fxqknpirgneptt\",\"tags\":{\"mqnrojlpijnkr\":\"sniffc\",\"zronasxift\":\"frddhcrati\"},\"id\":\"zq\",\"name\":\"zh\",\"type\":\"tw\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Experiment response = - manager - .experiments() - .getByResourceGroupWithResponse("qncygupkvi", "mdscwxqupev", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("fxqknpirgneptt", response.location()); - Assertions.assertEquals("sniffc", response.tags().get("mqnrojlpijnkr")); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); - Assertions.assertEquals("ttpkiwkkbnujrywv", response.steps().get(0).name()); - Assertions.assertEquals("lbfpncurd", response.steps().get(0).branches().get(0).name()); - Assertions.assertEquals("wiithtywub", response.selectors().get(0).id()); - Assertions.assertEquals(true, response.startOnCreation()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionDetailsWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionDetailsWithResponseMockTests.java deleted file mode 100644 index e5f9388f7908b..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionDetailsWithResponseMockTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetails; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ExperimentsGetExecutionDetailsWithResponseMockTests { - @Test - public void testGetExecutionDetailsWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"type\":\"jv\",\"id\":\"imwkslircizj\",\"name\":\"ydfce\",\"properties\":{\"experimentId\":\"lhvygdyftu\",\"status\":\"twnawjslbiwkojgc\",\"failureReason\":\"tsf\",\"createdDateTime\":\"2021-10-17T10:06:27Z\",\"lastActionDateTime\":\"2021-07-03T06:16:35Z\",\"startDateTime\":\"2021-03-07T16:28:02Z\",\"stopDateTime\":\"2021-03-23T01:57:59Z\",\"runInformation\":{\"steps\":[{\"stepName\":\"rn\",\"stepId\":\"x\",\"status\":\"uwrykqgaifmvikl\",\"branches\":[{}]},{\"stepName\":\"khbejdznxc\",\"stepId\":\"srhnjivo\",\"status\":\"tnovqfzgemjdftul\",\"branches\":[{},{}]},{\"stepName\":\"ucea\",\"stepId\":\"mczuo\",\"status\":\"jw\",\"branches\":[{},{}]},{\"stepName\":\"ioknssxmoj\",\"stepId\":\"vpkjpr\",\"status\":\"wcfzqljyxgt\",\"branches\":[{}]}]}}}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ExperimentExecutionDetails response = - manager - .experiments() - .getExecutionDetailsWithResponse("ih", "jqgwzp", "fqntcyp", com.azure.core.util.Context.NONE) - .getValue(); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetStatusWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetStatusWithResponseMockTests.java deleted file mode 100644 index 2ed0efcd18184..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetStatusWithResponseMockTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.ExperimentStatus; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ExperimentsGetStatusWithResponseMockTests { - @Test - public void testGetStatusWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"type\":\"uyovw\",\"id\":\"bkfezzxscyhwzdgi\",\"name\":\"jbzbomvzzbtdcq\",\"properties\":{\"status\":\"iyujviylwdshfs\",\"createdDateUtc\":\"2021-10-02T20:28:41Z\",\"endDateUtc\":\"2021-10-15T12:19:25Z\"}}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ExperimentStatus response = - manager - .experiments() - .getStatusWithResponse("omtbghhavgrvkff", "vjzhpjbib", "jmfxumvf", com.azure.core.util.Context.NONE) - .getValue(); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllStatusesMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllStatusesMockTests.java deleted file mode 100644 index ef3e9303cf02e..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllStatusesMockTests.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.ExperimentStatus; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ExperimentsListAllStatusesMockTests { - @Test - public void testListAllStatuses() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"type\":\"zejntps\",\"id\":\"gioilqu\",\"name\":\"ydxtqm\",\"properties\":{\"status\":\"xorgg\",\"createdDateUtc\":\"2021-04-30T10:21:51Z\",\"endDateUtc\":\"2021-04-20T02:01Z\"}}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.experiments().listAllStatuses("rtkfawnopq", "ikyzirtxdy", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupMockTests.java deleted file mode 100644 index de214104968e8..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupMockTests.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.Experiment; -import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ExperimentsListByResourceGroupMockTests { - @Test - public void testListByResourceGroup() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"egxuvwzf\":{\"principalId\":\"da161d78-ceb8-493f-9d63-bd293c67a9d7\",\"clientId\":\"8593d58d-2ab7-4555-8cf4-bdd8dce1e247\"},\"lmctlpd\":{\"principalId\":\"655b6693-b1d9-475f-8bd0-4e041a8c52af\",\"clientId\":\"0d139c1e-327d-460e-9d22-5c4e25708cbf\"},\"tvgbmhrixkwmy\":{\"principalId\":\"74be79ee-70d8-411d-be02-a93159dba7d0\",\"clientId\":\"2f7ab16a-eda0-4e1f-9fe6-530b35ab4f50\"},\"jvegrhbpnaixexcc\":{\"principalId\":\"91aed7d7-9704-4376-bc1a-a760e3fe20b1\",\"clientId\":\"a765f368-dd76-4d56-ab35-eb7db505bcd4\"}},\"principalId\":\"reaxhcexdr\",\"tenantId\":\"qahqkghtpwijn\"},\"properties\":{\"steps\":[{\"name\":\"jsvfycxzbfvoowv\",\"branches\":[{\"name\":\"mtg\",\"actions\":[]},{\"name\":\"qp\",\"actions\":[]},{\"name\":\"y\",\"actions\":[]}]},{\"name\":\"s\",\"branches\":[{\"name\":\"on\",\"actions\":[]},{\"name\":\"myhgfipnsxkmc\",\"actions\":[]},{\"name\":\"a\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"Selector\",\"id\":\"rrjreafxtsgu\",\"filter\":{\"type\":\"Filter\"},\"\":{\"xwslolbqpv\":\"datalik\",\"crpw\":\"datazlmvfelfktgp\",\"brnjwmw\":\"dataxeznoi\"}},{\"type\":\"Selector\",\"id\":\"pn\",\"filter\":{\"type\":\"Filter\"},\"\":{\"gzxnfaazpxdtnk\":\"dataejjoqkagfhsxtta\",\"wuenvr\":\"datamkqjj\"}}],\"startOnCreation\":false},\"location\":\"ou\",\"tags\":{\"xqtnq\":\"rebqaaysjk\"},\"id\":\"tezlwff\",\"name\":\"iakp\",\"type\":\"pqqmted\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.experiments().listByResourceGroup("uhbxvvy", true, "s", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ou", response.iterator().next().location()); - Assertions.assertEquals("rebqaaysjk", response.iterator().next().tags().get("xqtnq")); - Assertions.assertEquals(ResourceIdentityType.USER_ASSIGNED, response.iterator().next().identity().type()); - Assertions.assertEquals("jsvfycxzbfvoowv", response.iterator().next().steps().get(0).name()); - Assertions.assertEquals("mtg", response.iterator().next().steps().get(0).branches().get(0).name()); - Assertions.assertEquals("rrjreafxtsgu", response.iterator().next().selectors().get(0).id()); - Assertions.assertEquals(false, response.iterator().next().startOnCreation()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListExecutionDetailsMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListExecutionDetailsMockTests.java deleted file mode 100644 index d5cf83de372b0..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListExecutionDetailsMockTests.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetails; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ExperimentsListExecutionDetailsMockTests { - @Test - public void testListExecutionDetails() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"type\":\"otmrfhir\",\"id\":\"ymoxoftpipiwyczu\",\"name\":\"a\",\"properties\":{\"experimentId\":\"jlihhyus\",\"status\":\"kasdvlm\",\"failureReason\":\"dgzxulucvpamrsr\",\"createdDateTime\":\"2021-12-07T21:14:58Z\",\"lastActionDateTime\":\"2021-03-05T11:45:05Z\",\"startDateTime\":\"2021-04-24T08:08:26Z\",\"stopDateTime\":\"2021-08-09T16:10:18Z\",\"runInformation\":{\"steps\":[{\"stepName\":\"ytxifqjzgxmrh\",\"stepId\":\"lw\",\"status\":\"esutrgjupauutpw\",\"branches\":[{},{},{},{}]}]}}}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.experiments().listExecutionDetails("ye", "rymsgaojfmw", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListMockTests.java deleted file mode 100644 index 738ebdd5cb5bb..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListMockTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.Experiment; -import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ExperimentsListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"flsjc\":{\"principalId\":\"4c7cbc3d-2c6e-4727-90a1-2ea9cc668963\",\"clientId\":\"afc8e789-a7dc-4f45-b17c-935e06e1b82e\"},\"zfjvfbgofe\":{\"principalId\":\"51256333-c15d-4f4c-a031-9c3f734caccc\",\"clientId\":\"bb3f4b67-5151-454c-a2db-cce7d9187729\"},\"grqmqhldvrii\":{\"principalId\":\"175e5096-c854-4e01-946d-940bbdd2b69d\",\"clientId\":\"9681afac-8c36-4d6e-bf43-abf10867808f\"},\"nalghfkvtvsexso\":{\"principalId\":\"1910718a-d2d1-428c-b5e8-c8f657406e06\",\"clientId\":\"4d435627-1e68-4c9c-aa27-ea75fb2fd655\"}},\"principalId\":\"el\",\"tenantId\":\"hhahhxvrhmzkwpjg\"},\"properties\":{\"steps\":[{\"name\":\"spughftqsxhq\",\"branches\":[{\"name\":\"j\",\"actions\":[]},{\"name\":\"ukndxdigrjgu\",\"actions\":[]},{\"name\":\"fzdm\",\"actions\":[]}]},{\"name\":\"yqtfihwh\",\"branches\":[{\"name\":\"tzingamvpph\",\"actions\":[]}]},{\"name\":\"szqzudphqamv\",\"branches\":[{\"name\":\"fwynwcvtbvkay\",\"actions\":[]},{\"name\":\"mtnvyq\",\"actions\":[]}]},{\"name\":\"atkzwpcnpw\",\"branches\":[{\"name\":\"jaesgvvsccya\",\"actions\":[]},{\"name\":\"g\",\"actions\":[]},{\"name\":\"qfhwyg\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"Selector\",\"id\":\"vdnkfxusem\",\"filter\":{\"type\":\"Filter\"},\"\":{\"svuo\":\"datamuhapfcqdpsqxqv\",\"mfe\":\"datamgccelvezrypq\",\"ob\":\"datakerqwkyh\"}},{\"type\":\"Selector\",\"id\":\"pg\",\"filter\":{\"type\":\"Filter\"},\"\":{\"ccsnjvcdwxlpq\":\"dataowepbqpcrfkb\"}}],\"startOnCreation\":false},\"location\":\"tn\",\"tags\":{\"dhtmdvypgikd\":\"jsyingwfqatm\",\"hlhkjoqrvqqaatj\":\"szywkbirryu\"},\"id\":\"nrvgoupmfiibfgg\",\"name\":\"ioolvrwxkvtkkgll\",\"type\":\"wjygvjayvblmhvk\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.experiments().list(true, "pwp", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("tn", response.iterator().next().location()); - Assertions.assertEquals("jsyingwfqatm", response.iterator().next().tags().get("dhtmdvypgikd")); - Assertions.assertEquals(ResourceIdentityType.USER_ASSIGNED, response.iterator().next().identity().type()); - Assertions.assertEquals("spughftqsxhq", response.iterator().next().steps().get(0).name()); - Assertions.assertEquals("j", response.iterator().next().steps().get(0).branches().get(0).name()); - Assertions.assertEquals("vdnkfxusem", response.iterator().next().selectors().get(0).id()); - Assertions.assertEquals(false, response.iterator().next().startOnCreation()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsStartWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsStartWithResponseMockTests.java deleted file mode 100644 index 64411fae9d610..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsStartWithResponseMockTests.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.ExperimentStartOperationResult; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ExperimentsStartWithResponseMockTests { - @Test - public void testStartWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{\"name\":\"nsvbuswdv\",\"statusUrl\":\"ybycnunvj\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(202); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ExperimentStartOperationResult response = - manager - .experiments() - .startWithResponse("rghxjb", "hqxvcxgfrpdsofbs", com.azure.core.util.Context.NONE) - .getValue(); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/FilterTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/FilterTests.java deleted file mode 100644 index 991b41981fce2..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/FilterTests.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.Filter; - -public final class FilterTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Filter model = BinaryData.fromString("{\"type\":\"Filter\"}").toObject(Filter.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Filter model = new Filter(); - model = BinaryData.fromObject(model).toObject(Filter.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ListSelectorTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ListSelectorTests.java deleted file mode 100644 index cae3c1379937d..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ListSelectorTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.Filter; -import com.azure.resourcemanager.chaos.models.ListSelector; -import com.azure.resourcemanager.chaos.models.TargetReference; -import com.azure.resourcemanager.chaos.models.TargetReferenceType; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ListSelectorTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ListSelector model = - BinaryData - .fromString( - "{\"type\":\"List\",\"targets\":[{\"type\":\"ChaosTarget\",\"id\":\"lcvydy\"},{\"type\":\"ChaosTarget\",\"id\":\"tdooaoj\"}],\"id\":\"niodkooeb\",\"filter\":{\"type\":\"Filter\"},\"\":{\"vdkcrodtj\":\"datahemms\",\"lfoakg\":\"datanfwjlfltkacjvefk\"}}") - .toObject(ListSelector.class); - Assertions.assertEquals("niodkooeb", model.id()); - Assertions.assertEquals(TargetReferenceType.CHAOS_TARGET, model.targets().get(0).type()); - Assertions.assertEquals("lcvydy", model.targets().get(0).id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ListSelector model = - new ListSelector() - .withId("niodkooeb") - .withFilter(new Filter()) - .withTargets( - Arrays - .asList( - new TargetReference().withType(TargetReferenceType.CHAOS_TARGET).withId("lcvydy"), - new TargetReference().withType(TargetReferenceType.CHAOS_TARGET).withId("tdooaoj"))); - model = BinaryData.fromObject(model).toObject(ListSelector.class); - Assertions.assertEquals("niodkooeb", model.id()); - Assertions.assertEquals(TargetReferenceType.CHAOS_TARGET, model.targets().get(0).type()); - Assertions.assertEquals("lcvydy", model.targets().get(0).id()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationDisplayTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationDisplayTests.java deleted file mode 100644 index 0901257abf493..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationDisplayTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.OperationDisplay; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationDisplay model = - BinaryData - .fromString( - "{\"provider\":\"crkvcikhnv\",\"resource\":\"mqg\",\"operation\":\"queziky\",\"description\":\"gxk\"}") - .toObject(OperationDisplay.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = new OperationDisplay(); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationInnerTests.java deleted file mode 100644 index b52a85b77253f..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationInnerTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.OperationInner; -import com.azure.resourcemanager.chaos.models.OperationDisplay; - -public final class OperationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationInner model = - BinaryData - .fromString( - "{\"name\":\"abikns\",\"isDataAction\":false,\"display\":{\"provider\":\"xbldtlwwrlkdmtn\",\"resource\":\"ok\",\"operation\":\"llxdyhgs\",\"description\":\"cogjltdtbn\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") - .toObject(OperationInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationInner model = new OperationInner().withDisplay(new OperationDisplay()); - model = BinaryData.fromObject(model).toObject(OperationInner.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationListResultTests.java deleted file mode 100644 index 2e2dbd89789b7..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationListResultTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.OperationListResult; - -public final class OperationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationListResult model = - BinaryData - .fromString( - "{\"value\":[{\"name\":\"wifto\",\"isDataAction\":true,\"display\":{\"provider\":\"uvksgplsaknynfsy\",\"resource\":\"jphuopxodlqi\",\"operation\":\"torzih\",\"description\":\"osjswsr\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"pzbchck\",\"isDataAction\":true,\"display\":{\"provider\":\"ox\",\"resource\":\"suiizynkedyat\",\"operation\":\"yhqmibzyhwi\",\"description\":\"mypyynpcdpu\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"z\"}") - .toObject(OperationListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationListResult model = new OperationListResult(); - model = BinaryData.fromObject(model).toObject(OperationListResult.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/QuerySelectorTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/QuerySelectorTests.java deleted file mode 100644 index 3060354b6f502..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/QuerySelectorTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.Filter; -import com.azure.resourcemanager.chaos.models.QuerySelector; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class QuerySelectorTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - QuerySelector model = - BinaryData - .fromString( - "{\"type\":\"Query\",\"queryString\":\"blylsyxkqjnsj\",\"subscriptionIds\":[\"vti\"],\"id\":\"gxsds\",\"filter\":{\"type\":\"Filter\"},\"\":{\"icvi\":\"datapsbzkfzbeyvpn\",\"jjxd\":\"datav\",\"ztzp\":\"datarbuukzclewyhmlwp\"}}") - .toObject(QuerySelector.class); - Assertions.assertEquals("gxsds", model.id()); - Assertions.assertEquals("blylsyxkqjnsj", model.queryString()); - Assertions.assertEquals("vti", model.subscriptionIds().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - QuerySelector model = - new QuerySelector() - .withId("gxsds") - .withFilter(new Filter()) - .withQueryString("blylsyxkqjnsj") - .withSubscriptionIds(Arrays.asList("vti")); - model = BinaryData.fromObject(model).toObject(QuerySelector.class); - Assertions.assertEquals("gxsds", model.id()); - Assertions.assertEquals("blylsyxkqjnsj", model.queryString()); - Assertions.assertEquals("vti", model.subscriptionIds().get(0)); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ResourceIdentityTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ResourceIdentityTests.java deleted file mode 100644 index c3e3fa007ec9b..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ResourceIdentityTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.ResourceIdentity; -import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import com.azure.resourcemanager.chaos.models.UserAssignedIdentity; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ResourceIdentityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ResourceIdentity model = - BinaryData - .fromString( - "{\"type\":\"None\",\"userAssignedIdentities\":{\"mkfssxqukkfplgm\":{\"principalId\":\"6999b89d-259f-44cf-ad3c-6d5076e3df83\",\"clientId\":\"326a00cb-dd9f-43b5-9b3f-416045e6fc59\"},\"nkjzkdeslpvlop\":{\"principalId\":\"3e8374dc-0257-4d89-a7ff-a9bd17a713d7\",\"clientId\":\"a9819cbc-ee4b-42dc-b115-cf907ae81f14\"}},\"principalId\":\"yighxpk\",\"tenantId\":\"zb\"}") - .toObject(ResourceIdentity.class); - Assertions.assertEquals(ResourceIdentityType.NONE, model.type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceIdentity model = - new ResourceIdentity() - .withType(ResourceIdentityType.NONE) - .withUserAssignedIdentities( - mapOf("mkfssxqukkfplgm", new UserAssignedIdentity(), "nkjzkdeslpvlop", new UserAssignedIdentity())); - model = BinaryData.fromObject(model).toObject(ResourceIdentity.class); - Assertions.assertEquals(ResourceIdentityType.NONE, model.type()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/SelectorTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/SelectorTests.java deleted file mode 100644 index 3c8d1d3090adc..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/SelectorTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.Filter; -import com.azure.resourcemanager.chaos.models.Selector; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class SelectorTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Selector model = - BinaryData - .fromString( - "{\"type\":\"Selector\",\"id\":\"vo\",\"filter\":{\"type\":\"Filter\"},\"\":{\"jrwjueiotwm\":\"dataeuecivyhzceuoj\"}}") - .toObject(Selector.class); - Assertions.assertEquals("vo", model.id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Selector model = - new Selector().withId("vo").withFilter(new Filter()).withAdditionalProperties(mapOf("type", "Selector")); - model = BinaryData.fromObject(model).toObject(Selector.class); - Assertions.assertEquals("vo", model.id()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/SimpleFilterParametersTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/SimpleFilterParametersTests.java deleted file mode 100644 index 36134b883bd4c..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/SimpleFilterParametersTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.SimpleFilterParameters; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class SimpleFilterParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SimpleFilterParameters model = - BinaryData - .fromString("{\"zones\":[\"jaltolmnc\",\"sobqw\",\"sdbnwdcfhucqdpf\"]}") - .toObject(SimpleFilterParameters.class); - Assertions.assertEquals("jaltolmnc", model.zones().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SimpleFilterParameters model = - new SimpleFilterParameters().withZones(Arrays.asList("jaltolmnc", "sobqw", "sdbnwdcfhucqdpf")); - model = BinaryData.fromObject(model).toObject(SimpleFilterParameters.class); - Assertions.assertEquals("jaltolmnc", model.zones().get(0)); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/SimpleFilterTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/SimpleFilterTests.java deleted file mode 100644 index 51953d40b2d9a..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/SimpleFilterTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.SimpleFilter; -import com.azure.resourcemanager.chaos.models.SimpleFilterParameters; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class SimpleFilterTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SimpleFilter model = - BinaryData - .fromString( - "{\"type\":\"Simple\",\"parameters\":{\"zones\":[\"ckw\",\"fz\",\"whxxbuyqax\",\"feqztppriol\"]}}") - .toObject(SimpleFilter.class); - Assertions.assertEquals("ckw", model.parameters().zones().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SimpleFilter model = - new SimpleFilter() - .withParameters( - new SimpleFilterParameters().withZones(Arrays.asList("ckw", "fz", "whxxbuyqax", "feqztppriol"))); - model = BinaryData.fromObject(model).toObject(SimpleFilter.class); - Assertions.assertEquals("ckw", model.parameters().zones().get(0)); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/StepStatusTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/StepStatusTests.java deleted file mode 100644 index b810f5ac48c6e..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/StepStatusTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.StepStatus; - -public final class StepStatusTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - StepStatus model = - BinaryData - .fromString( - "{\"stepName\":\"tdum\",\"stepId\":\"p\",\"status\":\"ebmnzbtbhjpglk\",\"branches\":[{\"branchName\":\"dneu\",\"branchId\":\"fphsdyhtozfikdow\",\"status\":\"uuvxz\",\"actions\":[{\"actionName\":\"ithhqzon\",\"actionId\":\"ggbhcohfwds\",\"status\":\"ka\",\"startTime\":\"2021-05-13T01:39:31Z\",\"endTime\":\"2021-03-15T03:19:59Z\",\"targets\":[{},{},{}]},{\"actionName\":\"acffgdkzzewkfvhq\",\"actionId\":\"a\",\"status\":\"vpnpp\",\"startTime\":\"2021-10-20T12:14:16Z\",\"endTime\":\"2021-03-21T05:49:29Z\",\"targets\":[{},{},{}]},{\"actionName\":\"hdlxyjrxsagafcn\",\"actionId\":\"gwq\",\"status\":\"nedgfbc\",\"startTime\":\"2021-07-29T10:41:12Z\",\"endTime\":\"2021-05-31T02:02:01Z\",\"targets\":[{},{},{},{}]},{\"actionName\":\"eqdcv\",\"actionId\":\"hvoodsotbobzd\",\"status\":\"cjwvn\",\"startTime\":\"2021-06-06T16:32:33Z\",\"endTime\":\"2021-11-29T05:13:59Z\",\"targets\":[{}]}]},{\"branchName\":\"cxrslpmutwuoe\",\"branchId\":\"pkhjwni\",\"status\":\"sluicpdggkzz\",\"actions\":[{\"actionName\":\"mpaxmodfvuefywsb\",\"actionId\":\"vmwy\",\"status\":\"fouyf\",\"startTime\":\"2021-03-21T19:22:18Z\",\"endTime\":\"2021-01-14T19:12:22Z\",\"targets\":[{},{},{},{}]},{\"actionName\":\"yzvqt\",\"actionId\":\"ubex\",\"status\":\"zksmondj\",\"startTime\":\"2021-10-31T06:50:30Z\",\"endTime\":\"2021-06-21T21:58:07Z\",\"targets\":[{},{},{},{}]},{\"actionName\":\"mg\",\"actionId\":\"pkwhojvpa\",\"status\":\"gxysmocmbqfqvm\",\"startTime\":\"2021-03-02T11:08:18Z\",\"endTime\":\"2021-10-15T15:22:20Z\",\"targets\":[{},{},{}]},{\"actionName\":\"helxprglya\",\"actionId\":\"dckcbc\",\"status\":\"jrjxgciqibrhosx\",\"startTime\":\"2021-10-09T16:21:07Z\",\"endTime\":\"2021-07-12T05:33:05Z\",\"targets\":[{}]}]}]}") - .toObject(StepStatus.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - StepStatus model = new StepStatus(); - model = BinaryData.fromObject(model).toObject(StepStatus.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/StepTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/StepTests.java deleted file mode 100644 index 9ff1ab7b0debd..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/StepTests.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.Action; -import com.azure.resourcemanager.chaos.models.Branch; -import com.azure.resourcemanager.chaos.models.Step; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class StepTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Step model = - BinaryData - .fromString( - "{\"name\":\"yvpycanuzbpzk\",\"branches\":[{\"name\":\"kuwbcrnwb\",\"actions\":[{\"type\":\"Action\",\"name\":\"hhseyv\"},{\"type\":\"Action\",\"name\":\"us\"},{\"type\":\"Action\",\"name\":\"tslhspkdeem\"},{\"type\":\"Action\",\"name\":\"ofmxagkvtmelmqkr\"}]},{\"name\":\"ahvljuaha\",\"actions\":[{\"type\":\"Action\",\"name\":\"hcdhmdual\"},{\"type\":\"Action\",\"name\":\"exq\"}]},{\"name\":\"vfadmws\",\"actions\":[{\"type\":\"Action\",\"name\":\"r\"},{\"type\":\"Action\",\"name\":\"vxpvgomz\"},{\"type\":\"Action\",\"name\":\"fmisg\"}]},{\"name\":\"bnbbeldawkz\",\"actions\":[{\"type\":\"Action\",\"name\":\"liourqhak\"}]}]}") - .toObject(Step.class); - Assertions.assertEquals("yvpycanuzbpzk", model.name()); - Assertions.assertEquals("kuwbcrnwb", model.branches().get(0).name()); - Assertions.assertEquals("hhseyv", model.branches().get(0).actions().get(0).name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Step model = - new Step() - .withName("yvpycanuzbpzk") - .withBranches( - Arrays - .asList( - new Branch() - .withName("kuwbcrnwb") - .withActions( - Arrays - .asList( - new Action().withName("hhseyv"), - new Action().withName("us"), - new Action().withName("tslhspkdeem"), - new Action().withName("ofmxagkvtmelmqkr"))), - new Branch() - .withName("ahvljuaha") - .withActions( - Arrays.asList(new Action().withName("hcdhmdual"), new Action().withName("exq"))), - new Branch() - .withName("vfadmws") - .withActions( - Arrays - .asList( - new Action().withName("r"), - new Action().withName("vxpvgomz"), - new Action().withName("fmisg"))), - new Branch() - .withName("bnbbeldawkz") - .withActions(Arrays.asList(new Action().withName("liourqhak"))))); - model = BinaryData.fromObject(model).toObject(Step.class); - Assertions.assertEquals("yvpycanuzbpzk", model.name()); - Assertions.assertEquals("kuwbcrnwb", model.branches().get(0).name()); - Assertions.assertEquals("hhseyv", model.branches().get(0).actions().get(0).name()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetInnerTests.java deleted file mode 100644 index c1daa9a9f480d..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetInnerTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.TargetInner; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class TargetInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TargetInner model = - BinaryData - .fromString( - "{\"location\":\"wzsyyceuzs\",\"properties\":{\"ytdw\":\"databjudpfrxtrthzv\"},\"id\":\"qbrqubpaxhexiili\",\"name\":\"pdtii\",\"type\":\"q\"}") - .toObject(TargetInner.class); - Assertions.assertEquals("wzsyyceuzs", model.location()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetInner model = - new TargetInner().withLocation("wzsyyceuzs").withProperties(mapOf("ytdw", "databjudpfrxtrthzv")); - model = BinaryData.fromObject(model).toObject(TargetInner.class); - Assertions.assertEquals("wzsyyceuzs", model.location()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetListResultTests.java deleted file mode 100644 index 6385cf4acceff..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetListResultTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.TargetListResult; - -public final class TargetListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TargetListResult model = - BinaryData - .fromString( - "{\"value\":[{\"location\":\"xllrxcyjm\",\"properties\":{\"hhyxxrw\":\"datadsuvarmywdmjsjqb\"},\"id\":\"yc\",\"name\":\"duhpk\",\"type\":\"kgymareqnajxqug\"},{\"location\":\"ycubeddgs\",\"properties\":{\"i\":\"datafwqmzqalkrmn\"},\"id\":\"pxacqqudfn\",\"name\":\"yxbaaabjyvayf\",\"type\":\"imrzrtuzqog\"}],\"nextLink\":\"xnevfdnwn\"}") - .toObject(TargetListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetListResult model = new TargetListResult(); - model = BinaryData.fromObject(model).toObject(TargetListResult.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetReferenceTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetReferenceTests.java deleted file mode 100644 index c72d0b847dd0a..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetReferenceTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.TargetReference; -import com.azure.resourcemanager.chaos.models.TargetReferenceType; -import org.junit.jupiter.api.Assertions; - -public final class TargetReferenceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TargetReference model = - BinaryData.fromString("{\"type\":\"ChaosTarget\",\"id\":\"fpagaowpulp\"}").toObject(TargetReference.class); - Assertions.assertEquals(TargetReferenceType.CHAOS_TARGET, model.type()); - Assertions.assertEquals("fpagaowpulp", model.id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetReference model = new TargetReference().withType(TargetReferenceType.CHAOS_TARGET).withId("fpagaowpulp"); - model = BinaryData.fromObject(model).toObject(TargetReference.class); - Assertions.assertEquals(TargetReferenceType.CHAOS_TARGET, model.type()); - Assertions.assertEquals("fpagaowpulp", model.id()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeInnerTests.java deleted file mode 100644 index 8a541eb0485a1..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeInnerTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.TargetTypeInner; -import org.junit.jupiter.api.Assertions; - -public final class TargetTypeInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TargetTypeInner model = - BinaryData - .fromString( - "{\"location\":\"mszkkfo\",\"properties\":{\"displayName\":\"eyfkzikfja\",\"description\":\"eaivxwczel\",\"propertiesSchema\":\"irels\",\"resourceTypes\":[\"enwabfatk\",\"ddxbjhwuaanoz\"]},\"id\":\"osphyoul\",\"name\":\"jrvxaglrv\",\"type\":\"mjwosytx\"}") - .toObject(TargetTypeInner.class); - Assertions.assertEquals("mszkkfo", model.location()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetTypeInner model = new TargetTypeInner().withLocation("mszkkfo"); - model = BinaryData.fromObject(model).toObject(TargetTypeInner.class); - Assertions.assertEquals("mszkkfo", model.location()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeListResultTests.java deleted file mode 100644 index 51f7ccc4ade63..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeListResultTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.TargetTypeListResult; - -public final class TargetTypeListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TargetTypeListResult model = - BinaryData - .fromString( - "{\"value\":[{\"location\":\"melwuipiccjz\",\"properties\":{\"displayName\":\"ivgvvcna\",\"description\":\"hyrnxxmu\",\"propertiesSchema\":\"dndrdvstkwqqtche\",\"resourceTypes\":[\"fmtdaaygdvwvgp\",\"ohgwxrtfudxepxg\",\"qagvrvm\"]},\"id\":\"pkukghi\",\"name\":\"dblx\",\"type\":\"wi\"}],\"nextLink\":\"njhf\"}") - .toObject(TargetTypeListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetTypeListResult model = new TargetTypeListResult(); - model = BinaryData.fromObject(model).toObject(TargetTypeListResult.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypePropertiesTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypePropertiesTests.java deleted file mode 100644 index ed3cdb1ef1c9b..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypePropertiesTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.fluent.models.TargetTypeProperties; - -public final class TargetTypePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TargetTypeProperties model = - BinaryData - .fromString( - "{\"displayName\":\"cskfcktqumiekk\",\"description\":\"zikhl\",\"propertiesSchema\":\"jhdgqggebdunyga\",\"resourceTypes\":[\"db\"]}") - .toObject(TargetTypeProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetTypeProperties model = new TargetTypeProperties(); - model = BinaryData.fromObject(model).toObject(TargetTypeProperties.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetWithResponseMockTests.java deleted file mode 100644 index 377b78914dbc6..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetWithResponseMockTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.TargetType; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TargetTypesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"location\":\"rkjpvdwxfzwii\",\"properties\":{\"displayName\":\"zjb\",\"description\":\"zsxjrkambtrneg\",\"propertiesSchema\":\"nvuqeqvldspa\",\"resourceTypes\":[\"bkkd\",\"flvestmjlxrrilo\",\"apeewchpxlkt\",\"kuziycsle\"]},\"id\":\"ufuztcktyhjtq\",\"name\":\"dcgzul\",\"type\":\"mmrqz\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - TargetType response = - manager - .targetTypes() - .getWithResponse("uajlyj", "lvofqzhvfcibyfmo", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("rkjpvdwxfzwii", response.location()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesListMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesListMockTests.java deleted file mode 100644 index 2e11eb2785b77..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesListMockTests.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.TargetType; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TargetTypesListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"location\":\"ddrihpf\",\"properties\":{\"displayName\":\"qcaaewdaomdjvl\",\"description\":\"x\",\"propertiesSchema\":\"zb\",\"resourceTypes\":[\"geivsiykzkdncj\",\"xonbzoggculapz\"]},\"id\":\"y\",\"name\":\"pgogtqxepny\",\"type\":\"b\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.targetTypes().list("qbmfpjbabwidf", "xsspuunnoxyhk", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ddrihpf", response.iterator().next().location()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index 8d4a4a118be0d..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.fluent.models.TargetInner; -import com.azure.resourcemanager.chaos.models.Target; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TargetsCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"location\":\"faxvxil\",\"properties\":{\"hnze\":\"datatg\"},\"id\":\"qxtjjfzqlqhyca\",\"name\":\"odggx\",\"type\":\"beesmieknlra\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Target response = - manager - .targets() - .createOrUpdateWithResponse( - "ymbrnysuxmpraf", - "g", - "khocxvdfffwaf", - "roud", - "spave", - new TargetInner() - .withLocation("vkbunzozudh") - .withProperties(mapOf("bzydvfvfcj", "datagkmoyxcdyuibhmfd")), - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("faxvxil", response.location()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteWithResponseMockTests.java deleted file mode 100644 index 3d42aa00371b2..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TargetsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager - .targets() - .deleteWithResponse( - "hzvhxnkomtkubo", - "ppnvdxz", - "hihfrbbcevqagtlt", - "hlfkqojpy", - "vgtrdcnifmzzs", - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsGetWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsGetWithResponseMockTests.java deleted file mode 100644 index d0a7d51049a1c..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsGetWithResponseMockTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.Target; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TargetsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"location\":\"digumbnr\",\"properties\":{\"ezwwv\":\"datauzzptjazysdz\",\"kphhq\":\"dataiqyuvvfo\",\"luwmncst\":\"dataikvylauya\"},\"id\":\"ijf\",\"name\":\"bvpoekrsgsgbdhu\",\"type\":\"qgnjdgkynscli\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Target response = - manager - .targets() - .getWithResponse("iayz", "iykhy", "wf", "jlb", "xqvkjlmxhomdyn", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("digumbnr", response.location()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsListMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsListMockTests.java deleted file mode 100644 index e17ea1d4cad82..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsListMockTests.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.chaos.ChaosManager; -import com.azure.resourcemanager.chaos.models.Target; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TargetsListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"location\":\"wytpzdmovz\",\"properties\":{\"wzqa\":\"datava\",\"gzuriglaecxndt\":\"dataf\"},\"id\":\"cokpv\",\"name\":\"mlqtmldgxob\",\"type\":\"irclnpk\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ChaosManager manager = - ChaosManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.targets().list("rr", "vpglydz", "krvq", "ev", "oepry", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("wytpzdmovz", response.iterator().next().location()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/UserAssignedIdentityTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/UserAssignedIdentityTests.java deleted file mode 100644 index 64ca03406fdb8..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/UserAssignedIdentityTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.chaos.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.chaos.models.UserAssignedIdentity; - -public final class UserAssignedIdentityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UserAssignedIdentity model = - BinaryData - .fromString( - "{\"principalId\":\"f0587e23-7bf1-4453-bbb9-ab410faf672c\",\"clientId\":\"94a39a62-5bd2-4857-bd90-537aa9ca7742\"}") - .toObject(UserAssignedIdentity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UserAssignedIdentity model = new UserAssignedIdentity(); - model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); - } -}