diff --git a/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md b/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md index cb7ba717a44be..f66edace1e511 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-10-20) + +- 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-11. 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..37d91d51bb905 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-2023-11. 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}) @@ -45,7 +45,7 @@ Azure Management Libraries require a `TokenCredential` implementation for authen ### Authentication -By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. +By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. @@ -94,7 +94,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS [docs]: https://azure.github.io/azure-sdk-for-java/ -[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ [azure_subscription]: https://azure.microsoft.com/free/ [azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity [azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty diff --git a/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md b/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md index ce96a0fcf0da7..37981e984b2c9 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md +++ b/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md @@ -18,16 +18,19 @@ - [Cancel](#experiments_cancel) - [CreateOrUpdate](#experiments_createorupdate) - [Delete](#experiments_delete) +- [ExecutionDetails](#experiments_executiondetails) - [GetByResourceGroup](#experiments_getbyresourcegroup) -- [GetExecutionDetails](#experiments_getexecutiondetails) -- [GetStatus](#experiments_getstatus) +- [GetExecution](#experiments_getexecution) - [List](#experiments_list) -- [ListAllStatuses](#experiments_listallstatuses) +- [ListAllExecutions](#experiments_listallexecutions) - [ListByResourceGroup](#experiments_listbyresourcegroup) -- [ListExecutionDetails](#experiments_listexecutiondetails) - [Start](#experiments_start) - [Update](#experiments_update) +## OperationStatuses + +- [Get](#operationstatuses_get) + ## TargetTypes - [Get](#targettypes_get) @@ -47,7 +50,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/stable/2023-11-01/examples/CreateUpdateCapability.json */ /** * Sample code: Create/update a Capability that extends a virtual machine Target resource. @@ -77,7 +80,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/stable/2023-11-01/examples/DeleteCapability.json */ /** * Sample code: Delete a Capability that extends a virtual machine Target resource. @@ -106,7 +109,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/stable/2023-11-01/examples/GetCapability.json */ /** * Sample code: Get a Capability that extends a virtual machine Target resource. @@ -135,7 +138,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/stable/2023-11-01/examples/ListCapabilities.json */ /** * Sample code: List all Capabilities that extend a virtual machine Target resource. @@ -164,7 +167,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/stable/2023-11-01/examples/GetCapabilityType.json */ /** * Sample code: Get a Capability Type for a virtual machine Target resource on westus2 location. @@ -186,7 +189,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/stable/2023-11-01/examples/ListCapabilityTypes.json */ /** * Sample code: List all Capability Types for a virtual machine Target resource on westus2 location. @@ -206,7 +209,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/stable/2023-11-01/examples/CancelExperiment.json */ /** * Sample code: Cancel a running Experiment. @@ -214,7 +217,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); } } ``` @@ -237,7 +240,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/stable/2023-11-01/examples/CreateUpdateExperiment.json */ /** * Sample code: Create/update a Experiment in a resource group. @@ -297,7 +300,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/stable/2023-11-01/examples/DeleteExperiment.json */ /** * Sample code: Delete a Experiment in a resource group. @@ -305,79 +308,77 @@ 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); } } ``` -### Experiments_GetByResourceGroup +### Experiments_ExecutionDetails ```java -/** Samples for Experiments GetByResourceGroup. */ -public final class ExperimentsGetByResourceGroupSamples { +/** Samples for Experiments ExecutionDetails. */ +public final class ExperimentsExecutionDetailsSamples { /* - * 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/stable/2023-11-01/examples/DetailsExperiment.json */ /** - * Sample code: Get a Experiment in a resource group. + * Sample code: Get experiment execution details. * * @param manager Entry point to ChaosManager. */ - public static void getAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + public static void getExperimentExecutionDetails(com.azure.resourcemanager.chaos.ChaosManager manager) { manager .experiments() - .getByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + .executionDetailsWithResponse( + "exampleRG", + "exampleExperiment", + "f24500ad-744e-4a26-864b-b76199eac333", + com.azure.core.util.Context.NONE); } } ``` -### Experiments_GetExecutionDetails +### Experiments_GetByResourceGroup ```java -/** Samples for Experiments GetExecutionDetails. */ -public final class ExperimentsGetExecutionDetailsSamples { +/** Samples for Experiments GetByResourceGroup. */ +public final class ExperimentsGetByResourceGroupSamples { /* - * 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/stable/2023-11-01/examples/GetExperiment.json */ /** - * Sample code: Get experiment execution details. + * Sample code: Get a Experiment in a resource group. * * @param manager Entry point to ChaosManager. */ - public static void getExperimentExecutionDetails(com.azure.resourcemanager.chaos.ChaosManager manager) { + public static void getAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { manager .experiments() - .getExecutionDetailsWithResponse( - "exampleRG", - "exampleExperiment", - "f24500ad-744e-4a26-864b-b76199eac333", - com.azure.core.util.Context.NONE); + .getByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); } } ``` -### Experiments_GetStatus +### Experiments_GetExecution ```java -/** Samples for Experiments GetStatus. */ -public final class ExperimentsGetStatusSamples { +/** Samples for Experiments GetExecution. */ +public final class ExperimentsGetExecutionSamples { /* - * 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/stable/2023-11-01/examples/GetExperimentExecution.json */ /** - * Sample code: Get the status of a Experiment. + * Sample code: Get the execution of a Experiment. * * @param manager Entry point to ChaosManager. */ - public static void getTheStatusOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + public static void getTheExecutionOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { manager .experiments() - .getStatusWithResponse( + .getExecutionWithResponse( "exampleRG", "exampleExperiment", - "50734542-2e64-4e08-814c-cc0e7475f7e4", + "f24500ad-744e-4a26-864b-b76199eac333", com.azure.core.util.Context.NONE); } } @@ -389,7 +390,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/stable/2023-11-01/examples/ListExperimentsInASubscription.json */ /** * Sample code: List all Experiments in a subscription. @@ -402,21 +403,21 @@ public final class ExperimentsListSamples { } ``` -### Experiments_ListAllStatuses +### Experiments_ListAllExecutions ```java -/** Samples for Experiments ListAllStatuses. */ -public final class ExperimentsListAllStatusesSamples { +/** Samples for Experiments ListAllExecutions. */ +public final class ExperimentsListAllExecutionsSamples { /* - * 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/stable/2023-11-01/examples/ListExperimentExecutions.json */ /** - * Sample code: List all statuses of a Experiment. + * Sample code: List all executions of an Experiment. * * @param manager Entry point to ChaosManager. */ - public static void listAllStatusesOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().listAllStatuses("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + public static void listAllExecutionsOfAnExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().listAllExecutions("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); } } ``` @@ -427,7 +428,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/stable/2023-11-01/examples/ListExperimentsInAResourceGroup.json */ /** * Sample code: List all Experiments in a resource group. @@ -440,32 +441,13 @@ public final class ExperimentsListByResourceGroupSamples { } ``` -### Experiments_ListExecutionDetails - -```java -/** 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 - */ - /** - * Sample code: List experiment executions details. - * - * @param manager Entry point to ChaosManager. - */ - public static void listExperimentExecutionsDetails(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().listExecutionDetails("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); - } -} -``` - ### Experiments_Start ```java /** 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/stable/2023-11-01/examples/StartExperiment.json */ /** * Sample code: Start a Experiment. @@ -473,7 +455,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 +473,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/stable/2023-11-01/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 +498,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 +512,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/stable/2023-11-01/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/stable/2023-11-01/examples/GetTargetType.json */ /** * Sample code: Get a Target Type for westus2 location. @@ -554,7 +558,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/stable/2023-11-01/examples/ListTargetTypes.json */ /** * Sample code: List all Target Types for westus2 location. @@ -580,7 +584,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/stable/2023-11-01/examples/CreateUpdateTarget.json */ /** * Sample code: Create/update a Target that extends a virtual machine resource. @@ -610,6 +614,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 +634,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/stable/2023-11-01/examples/DeleteTarget.json */ /** * Sample code: Delete a Target that extends a virtual machine resource. @@ -657,7 +662,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/stable/2023-11-01/examples/GetTarget.json */ /** * Sample code: Get a Target that extends a virtual machine resource. @@ -685,7 +690,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/stable/2023-11-01/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 12891901ccbae..0413f119c87ca 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-2023-11. 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..56331d02861f7 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; @@ -52,6 +54,8 @@ public final class ChaosManager { private Experiments experiments; + private OperationStatuses operationStatuses; + private Operations operations; private TargetTypes targetTypes; @@ -316,6 +320,18 @@ public Experiments experiments() { return experiments; } + /** + * 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 the resource collection API of Operations. * @@ -353,8 +369,10 @@ public Targets targets() { } /** - * @return Wrapped service client ChaosManagementClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. + * 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..2aaac5167d493 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 @@ -65,6 +65,13 @@ public interface ChaosManagementClient { */ ExperimentsClient getExperiments(); + /** + * Gets the OperationStatusesClient object to access its operations. + * + * @return the OperationStatusesClient object. + */ + OperationStatusesClient getOperationStatuses(); + /** * Gets the OperationsClient object to access its operations. * 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..ba81f716b0782 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,12 +8,12 @@ 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.ExperimentExecutionInner; 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; /** An instance of this class provides access to all the operations defined in ExperimentsClient. */ @@ -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); /** @@ -187,19 +259,20 @@ Response updateWithResponse( ExperimentInner update(String resourceGroupName, String experimentName, ExperimentUpdate experiment); /** - * Cancel a running Experiment resource. + * 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 the result of a cancel Experiment operation along with {@link Response}. + * @return model that represents a Experiment resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response cancelWithResponse( - String resourceGroupName, String experimentName, Context context); + ExperimentInner update( + String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context); /** * Cancel a running Experiment resource. @@ -209,13 +282,13 @@ 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 cancel Experiment operation. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) - ExperimentCancelOperationResultInner cancel(String resourceGroupName, String experimentName); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCancel(String resourceGroupName, String experimentName); /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. @@ -223,40 +296,51 @@ 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> 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 startWithResponse( - String resourceGroupName, String experimentName, Context context); + void cancel(String resourceGroupName, String experimentName); /** - * Start a Experiment resource. + * 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 start Experiment operation. */ @ServiceMethod(returns = ReturnType.SINGLE) - ExperimentStartOperationResultInner start(String resourceGroupName, String experimentName); + void cancel(String resourceGroupName, String experimentName, Context context); /** - * Get a list of statuses of a Experiment resource. + * 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 a list of statuses of a Experiment resource as paginated response with {@link PagedIterable}. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listAllStatuses(String resourceGroupName, String experimentName); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String experimentName); /** - * Get a list of statuses of a Experiment resource. + * Start a Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. @@ -264,58 +348,51 @@ Response startWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of statuses of a Experiment resource as paginated response with {@link PagedIterable}. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listAllStatuses( - String resourceGroupName, String experimentName, Context context); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String experimentName, Context context); /** - * Get a status of a Experiment resource. + * Start a Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param statusId GUID that represents a Experiment status. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a status of a Experiment resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getStatusWithResponse( - String resourceGroupName, String experimentName, String statusId, Context context); + void start(String resourceGroupName, String experimentName); /** - * Get a status of a Experiment resource. + * Start a Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param statusId GUID that represents a Experiment status. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a status of a Experiment resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - ExperimentStatusInner getStatus(String resourceGroupName, String experimentName, String statusId); + void start(String resourceGroupName, String experimentName, Context context); /** - * Get a list of execution details of a Experiment resource. + * Get a list of executions of an 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 a list of execution details of a Experiment resource as paginated response with {@link PagedIterable}. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listExecutionDetails( - String resourceGroupName, String experimentName); + PagedIterable listAllExecutions(String resourceGroupName, String experimentName); /** - * Get a list of execution details of a Experiment resource. + * Get a list of executions of an Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. @@ -323,40 +400,70 @@ PagedIterable listExecutionDetails( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of execution details of a Experiment resource as paginated response with {@link PagedIterable}. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listExecutionDetails( + PagedIterable listAllExecutions( String resourceGroupName, String experimentName, Context context); /** - * Get an execution detail of a Experiment resource. + * Get an execution of an Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @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 an execution of an Experiment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getExecutionWithResponse( + String resourceGroupName, String experimentName, String executionId, Context context); + + /** + * Get an execution of an Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @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 an execution of an Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExperimentExecutionInner getExecution(String resourceGroupName, String experimentName, String executionId); + + /** + * Execution details of an experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param executionId GUID that represents a Experiment execution detail. * @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 an execution detail of a Experiment resource along with {@link Response}. + * @return model that represents the execution details of an Experiment along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getExecutionDetailsWithResponse( - String resourceGroupName, String experimentName, String executionDetailsId, Context context); + Response executionDetailsWithResponse( + String resourceGroupName, String experimentName, String executionId, Context context); /** - * Get an execution detail of a Experiment resource. + * Execution details of an experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param executionId GUID that represents a Experiment execution detail. * @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 an execution detail of a Experiment resource. + * @return model that represents the execution details of an Experiment. */ @ServiceMethod(returns = ReturnType.SINGLE) - ExperimentExecutionDetailsInner getExecutionDetails( - String resourceGroupName, String experimentName, String executionDetailsId); + ExperimentExecutionDetailsInner executionDetails( + String resourceGroupName, String experimentName, String executionId); } 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/ExperimentExecutionDetailsInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsInner.java index 0df49eb47164c..c8b4c2738e167 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsInner.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsInner.java @@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; -/** Model that represents the execution details of a Experiment. */ +/** Model that represents the execution details of an Experiment. */ @Immutable public final class ExperimentExecutionDetailsInner { /* @@ -76,24 +76,6 @@ private ExperimentExecutionDetailsProperties innerProperties() { return this.innerProperties; } - /** - * Get the experimentId property: The id of the experiment. - * - * @return the experimentId value. - */ - public String experimentId() { - return this.innerProperties() == null ? null : this.innerProperties().experimentId(); - } - - /** - * Get the status property: The value of the status of the experiment execution. - * - * @return the status value. - */ - public String status() { - return this.innerProperties() == null ? null : this.innerProperties().status(); - } - /** * Get the failureReason property: The reason why the execution failed. * @@ -104,48 +86,48 @@ public String failureReason() { } /** - * Get the createdDateTime property: String that represents the created date time. + * Get the lastActionAt property: String that represents the last action date time. * - * @return the createdDateTime value. + * @return the lastActionAt value. */ - public OffsetDateTime createdDateTime() { - return this.innerProperties() == null ? null : this.innerProperties().createdDateTime(); + public OffsetDateTime lastActionAt() { + return this.innerProperties() == null ? null : this.innerProperties().lastActionAt(); } /** - * Get the lastActionDateTime property: String that represents the last action date time. + * Get the runInformation property: The information of the experiment run. * - * @return the lastActionDateTime value. + * @return the runInformation value. */ - public OffsetDateTime lastActionDateTime() { - return this.innerProperties() == null ? null : this.innerProperties().lastActionDateTime(); + public ExperimentExecutionDetailsPropertiesRunInformation runInformation() { + return this.innerProperties() == null ? null : this.innerProperties().runInformation(); } /** - * Get the startDateTime property: String that represents the start date time. + * Get the status property: The status of the execution. * - * @return the startDateTime value. + * @return the status value. */ - public OffsetDateTime startDateTime() { - return this.innerProperties() == null ? null : this.innerProperties().startDateTime(); + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); } /** - * Get the stopDateTime property: String that represents the stop date time. + * Get the startedAt property: String that represents the start date time. * - * @return the stopDateTime value. + * @return the startedAt value. */ - public OffsetDateTime stopDateTime() { - return this.innerProperties() == null ? null : this.innerProperties().stopDateTime(); + public OffsetDateTime startedAt() { + return this.innerProperties() == null ? null : this.innerProperties().startedAt(); } /** - * Get the runInformation property: The information of the experiment run. + * Get the stoppedAt property: String that represents the stop date time. * - * @return the runInformation value. + * @return the stoppedAt value. */ - public ExperimentExecutionDetailsPropertiesRunInformation runInformation() { - return this.innerProperties() == null ? null : this.innerProperties().runInformation(); + public OffsetDateTime stoppedAt() { + return this.innerProperties() == null ? null : this.innerProperties().stoppedAt(); } /** diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java index 4ef82667e0726..785f78ecb7432 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java @@ -9,50 +9,20 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; -/** Model that represents the Experiment execution details properties model. */ +/** Model that represents the extended properties of an experiment execution. */ @Immutable -public final class ExperimentExecutionDetailsProperties { - /* - * The id of the experiment. - */ - @JsonProperty(value = "experimentId", access = JsonProperty.Access.WRITE_ONLY) - private String experimentId; - - /* - * The value of the status of the experiment execution. - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - +public final class ExperimentExecutionDetailsProperties extends ExperimentExecutionProperties { /* * The reason why the execution failed. */ @JsonProperty(value = "failureReason", access = JsonProperty.Access.WRITE_ONLY) private String failureReason; - /* - * String that represents the created date time. - */ - @JsonProperty(value = "createdDateTime", access = JsonProperty.Access.WRITE_ONLY) - private OffsetDateTime createdDateTime; - /* * String that represents the last action date time. */ - @JsonProperty(value = "lastActionDateTime", access = JsonProperty.Access.WRITE_ONLY) - private OffsetDateTime lastActionDateTime; - - /* - * String that represents the start date time. - */ - @JsonProperty(value = "startDateTime", access = JsonProperty.Access.WRITE_ONLY) - private OffsetDateTime startDateTime; - - /* - * String that represents the stop date time. - */ - @JsonProperty(value = "stopDateTime", access = JsonProperty.Access.WRITE_ONLY) - private OffsetDateTime stopDateTime; + @JsonProperty(value = "lastActionAt", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastActionAt; /* * The information of the experiment run. @@ -64,24 +34,6 @@ public final class ExperimentExecutionDetailsProperties { public ExperimentExecutionDetailsProperties() { } - /** - * Get the experimentId property: The id of the experiment. - * - * @return the experimentId value. - */ - public String experimentId() { - return this.experimentId; - } - - /** - * Get the status property: The value of the status of the experiment execution. - * - * @return the status value. - */ - public String status() { - return this.status; - } - /** * Get the failureReason property: The reason why the execution failed. * @@ -92,39 +44,12 @@ public String failureReason() { } /** - * Get the createdDateTime property: String that represents the created date time. - * - * @return the createdDateTime value. - */ - public OffsetDateTime createdDateTime() { - return this.createdDateTime; - } - - /** - * Get the lastActionDateTime property: String that represents the last action date time. - * - * @return the lastActionDateTime value. - */ - public OffsetDateTime lastActionDateTime() { - return this.lastActionDateTime; - } - - /** - * Get the startDateTime property: String that represents the start date time. - * - * @return the startDateTime value. - */ - public OffsetDateTime startDateTime() { - return this.startDateTime; - } - - /** - * Get the stopDateTime property: String that represents the stop date time. + * Get the lastActionAt property: String that represents the last action date time. * - * @return the stopDateTime value. + * @return the lastActionAt value. */ - public OffsetDateTime stopDateTime() { - return this.stopDateTime; + public OffsetDateTime lastActionAt() { + return this.lastActionAt; } /** @@ -141,7 +66,9 @@ public ExperimentExecutionDetailsPropertiesRunInformation runInformation() { * * @throws IllegalArgumentException thrown if the instance is not valid. */ + @Override public void validate() { + super.validate(); if (runInformation() != null) { runInformation().validate(); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStatusInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionInner.java similarity index 73% rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStatusInner.java rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionInner.java index 9d65b12242b61..59ad9f95d129f 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStatusInner.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionInner.java @@ -8,9 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; -/** Model that represents the status of a Experiment. */ +/** Model that represents the execution of a Experiment. */ @Immutable -public final class ExperimentStatusInner { +public final class ExperimentExecutionInner { /* * String of the resource type. */ @@ -33,10 +33,10 @@ public final class ExperimentStatusInner { * The properties of experiment execution status. */ @JsonProperty(value = "properties") - private ExperimentStatusProperties innerProperties; + private ExperimentExecutionProperties innerProperties; - /** Creates an instance of ExperimentStatusInner class. */ - public ExperimentStatusInner() { + /** Creates an instance of ExperimentExecutionInner class. */ + public ExperimentExecutionInner() { } /** @@ -71,12 +71,12 @@ public String name() { * * @return the innerProperties value. */ - private ExperimentStatusProperties innerProperties() { + private ExperimentExecutionProperties innerProperties() { return this.innerProperties; } /** - * Get the status property: String that represents the status of a Experiment. + * Get the status property: The status of the execution. * * @return the status value. */ @@ -85,21 +85,21 @@ public String status() { } /** - * Get the createdDateUtc property: String that represents the created date time of a Experiment. + * Get the startedAt property: String that represents the start date time. * - * @return the createdDateUtc value. + * @return the startedAt value. */ - public OffsetDateTime createdDateUtc() { - return this.innerProperties() == null ? null : this.innerProperties().createdDateUtc(); + public OffsetDateTime startedAt() { + return this.innerProperties() == null ? null : this.innerProperties().startedAt(); } /** - * Get the endDateUtc property: String that represents the end date time of a Experiment. + * Get the stoppedAt property: String that represents the stop date time. * - * @return the endDateUtc value. + * @return the stoppedAt value. */ - public OffsetDateTime endDateUtc() { - return this.innerProperties() == null ? null : this.innerProperties().endDateUtc(); + public OffsetDateTime stoppedAt() { + return this.innerProperties() == null ? null : this.innerProperties().stoppedAt(); } /** diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionProperties.java new file mode 100644 index 0000000000000..2a71fd31e3417 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionProperties.java @@ -0,0 +1,70 @@ +// 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; +import java.time.OffsetDateTime; + +/** Model that represents the execution properties of an Experiment. */ +@Immutable +public class ExperimentExecutionProperties { + /* + * The status of the execution. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * String that represents the start date time. + */ + @JsonProperty(value = "startedAt", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startedAt; + + /* + * String that represents the stop date time. + */ + @JsonProperty(value = "stoppedAt", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime stoppedAt; + + /** Creates an instance of ExperimentExecutionProperties class. */ + public ExperimentExecutionProperties() { + } + + /** + * Get the status property: The status of the execution. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the startedAt property: String that represents the start date time. + * + * @return the startedAt value. + */ + public OffsetDateTime startedAt() { + return this.startedAt; + } + + /** + * Get the stoppedAt property: String that represents the stop date time. + * + * @return the stoppedAt value. + */ + public OffsetDateTime stoppedAt() { + return this.stoppedAt; + } + + /** + * 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..128305d875e43 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,6 +8,7 @@ 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.ProvisioningState; import com.azure.resourcemanager.chaos.models.ResourceIdentity; import com.azure.resourcemanager.chaos.models.Selector; import com.azure.resourcemanager.chaos.models.Step; @@ -92,6 +93,15 @@ public ExperimentInner withTags(Map tags) { return this; } + /** + * Get the provisioningState property: Most recent provisioning state for the given experiment resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + /** * Get the steps property: List of steps. * @@ -138,31 +148,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..a3f5ec09e8a3d 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,6 +6,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.chaos.models.ProvisioningState; import com.azure.resourcemanager.chaos.models.Selector; import com.azure.resourcemanager.chaos.models.Step; import com.fasterxml.jackson.annotation.JsonProperty; @@ -14,6 +15,12 @@ /** Model that represents the Experiment properties model. */ @Fluent public final class ExperimentProperties { + /* + * Most recent provisioning state for the given experiment resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + /* * List of steps. */ @@ -26,16 +33,19 @@ public final class ExperimentProperties { @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; - /** Creates an instance of ExperimentProperties class. */ public ExperimentProperties() { } + /** + * 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 steps property: List of steps. * @@ -76,28 +86,6 @@ public ExperimentProperties 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.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/ExperimentStatusProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStatusProperties.java deleted file mode 100644 index cef7dca7b1fbb..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStatusProperties.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.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; - -/** Model that represents the Experiment status properties model. */ -@Immutable -public final class ExperimentStatusProperties { - /* - * String that represents the status of a Experiment. - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /* - * String that represents the created date time of a Experiment. - */ - @JsonProperty(value = "createdDateUtc", access = JsonProperty.Access.WRITE_ONLY) - private OffsetDateTime createdDateUtc; - - /* - * String that represents the end date time of a Experiment. - */ - @JsonProperty(value = "endDateUtc", access = JsonProperty.Access.WRITE_ONLY) - private OffsetDateTime endDateUtc; - - /** Creates an instance of ExperimentStatusProperties class. */ - public ExperimentStatusProperties() { - } - - /** - * Get the status property: String that represents the status of a Experiment. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Get the createdDateUtc property: String that represents the created date time of a Experiment. - * - * @return the createdDateUtc value. - */ - public OffsetDateTime createdDateUtc() { - return this.createdDateUtc; - } - - /** - * Get the endDateUtc property: String that represents the end date time of a Experiment. - * - * @return the endDateUtc value. - */ - public OffsetDateTime endDateUtc() { - return this.endDateUtc; - } - - /** - * 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..cffdad3b65792 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; @@ -149,6 +150,18 @@ public ExperimentsClient getExperiments() { return this.experiments; } + /** 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; + } + /** The OperationsClient object to access its operations. */ private final OperationsClient operations; @@ -207,10 +220,11 @@ public TargetsClient getTargets() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2023-04-15-preview"; + this.apiVersion = "2023-11-01"; this.capabilities = new CapabilitiesClientImpl(this); this.capabilityTypes = new CapabilityTypesClientImpl(this); this.experiments = new ExperimentsClientImpl(this); + this.operationStatuses = new OperationStatusesClientImpl(this); this.operations = new OperationsClientImpl(this); this.targetTypes = new TargetTypesClientImpl(this); this.targets = new TargetsClientImpl(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/ExperimentExecutionDetailsImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionDetailsImpl.java index abb9d17a9c4b1..9e53868c14023 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionDetailsImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionDetailsImpl.java @@ -32,36 +32,28 @@ public String name() { return this.innerModel().name(); } - public String experimentId() { - return this.innerModel().experimentId(); - } - - public String status() { - return this.innerModel().status(); - } - public String failureReason() { return this.innerModel().failureReason(); } - public OffsetDateTime createdDateTime() { - return this.innerModel().createdDateTime(); + public OffsetDateTime lastActionAt() { + return this.innerModel().lastActionAt(); } - public OffsetDateTime lastActionDateTime() { - return this.innerModel().lastActionDateTime(); + public ExperimentExecutionDetailsPropertiesRunInformation runInformation() { + return this.innerModel().runInformation(); } - public OffsetDateTime startDateTime() { - return this.innerModel().startDateTime(); + public String status() { + return this.innerModel().status(); } - public OffsetDateTime stopDateTime() { - return this.innerModel().stopDateTime(); + public OffsetDateTime startedAt() { + return this.innerModel().startedAt(); } - public ExperimentExecutionDetailsPropertiesRunInformation runInformation() { - return this.innerModel().runInformation(); + public OffsetDateTime stoppedAt() { + return this.innerModel().stoppedAt(); } public ExperimentExecutionDetailsInner innerModel() { diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStatusImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionImpl.java similarity index 58% rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStatusImpl.java rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionImpl.java index 491789a838555..6b494ead16fa5 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStatusImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionImpl.java @@ -4,17 +4,17 @@ package com.azure.resourcemanager.chaos.implementation; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner; -import com.azure.resourcemanager.chaos.models.ExperimentStatus; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner; +import com.azure.resourcemanager.chaos.models.ExperimentExecution; import java.time.OffsetDateTime; -public final class ExperimentStatusImpl implements ExperimentStatus { - private ExperimentStatusInner innerObject; +public final class ExperimentExecutionImpl implements ExperimentExecution { + private ExperimentExecutionInner innerObject; private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; - ExperimentStatusImpl( - ExperimentStatusInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + ExperimentExecutionImpl( + ExperimentExecutionInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -35,15 +35,15 @@ public String status() { return this.innerModel().status(); } - public OffsetDateTime createdDateUtc() { - return this.innerModel().createdDateUtc(); + public OffsetDateTime startedAt() { + return this.innerModel().startedAt(); } - public OffsetDateTime endDateUtc() { - return this.innerModel().endDateUtc(); + public OffsetDateTime stoppedAt() { + return this.innerModel().stoppedAt(); } - public ExperimentStatusInner innerModel() { + public ExperimentExecutionInner innerModel() { return this.innerObject; } 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..25a5f5d055e05 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,15 +4,13 @@ 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.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; @@ -58,6 +56,10 @@ public ResourceIdentity identity() { return this.innerModel().identity(); } + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + public List steps() { List inner = this.innerModel().steps(); if (inner != null) { @@ -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) { @@ -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..467c951c9313c 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,20 @@ 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.ExperimentExecutionInner; 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.ExperimentExecutionListResult; 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 +100,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 +128,9 @@ Mono> getByResourceGroup( @Headers({"Content-Type: application/json"}) @Put( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") - @ExpectedResponses({200}) + @ExpectedResponses({200, 201}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate( + Mono>> createOrUpdate( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -141,9 +143,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 +160,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,21 +174,7 @@ Mono> cancel( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> start( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("experimentName") String experimentName, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listAllStatuses( + Mono>> start( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -197,45 +185,45 @@ Mono> listAllStatuses( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses/{statusId}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getStatus( + Mono> listAllExecutions( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("experimentName") String experimentName, - @PathParam("statusId") String statusId, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listExecutionDetails( + Mono> getExecution( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("experimentName") String experimentName, + @PathParam("executionId") String executionId, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails/{executionDetailsId}") + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}/getExecutionDetails") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getExecutionDetails( + Mono> executionDetails( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("experimentName") String experimentName, - @PathParam("executionDetailsId") String executionDetailsId, + @PathParam("executionId") String executionId, @HeaderParam("Accept") String accept, Context context); @@ -263,17 +251,7 @@ Mono> listNext( @Get("{nextLink}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listAllStatusesNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listExecutionDetailsNext( + Mono> listAllExecutionsNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, @@ -682,7 +660,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 +708,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 +742,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 +826,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 +840,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 +860,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 +1033,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 +1090,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 +1130,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 +1229,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 +1244,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 +1267,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 +1301,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 +1358,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 +1398,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 +1496,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 +1511,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 +1534,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 +1563,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 +1611,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 +1656,15 @@ 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.SINGLE) - private Mono cancelAsync(String resourceGroupName, String experimentName) { - return cancelWithResponseAsync(resourceGroupName, experimentName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @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()); } /** @@ -1397,12 +1676,16 @@ 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 the {@link PollerFlux} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response cancelWithResponse( + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCancelAsync( String resourceGroupName, String experimentName, Context context) { - return cancelWithResponseAsync(resourceGroupName, experimentName, context).block(); + context = this.client.mergeContext(context); + Mono>> mono = cancelWithResponseAsync(resourceGroupName, experimentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); } /** @@ -1413,172 +1696,106 @@ public Response cancelWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ExperimentCancelOperationResultInner cancel(String resourceGroupName, String experimentName) { - return cancelWithResponse(resourceGroupName, experimentName, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCancel(String resourceGroupName, String experimentName) { + return this.beginCancelAsync(resourceGroupName, experimentName).getSyncPoller(); } /** - * Start a Experiment resource. + * 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 model that represents the result of a start Experiment operation along with {@link Response} on - * successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> startWithResponseAsync( - String resourceGroupName, String experimentName) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (experimentName == null) { - return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .start( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - experimentName, - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCancel( + String resourceGroupName, String experimentName, Context context) { + return this.beginCancelAsync(resourceGroupName, experimentName, context).getSyncPoller(); } /** - * Start a Experiment resource. + * 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 model that represents the result of a start Experiment operation along with {@link Response} on - * successful completion of {@link Mono}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> startWithResponseAsync( - String resourceGroupName, String experimentName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (experimentName == null) { - return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .start( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - experimentName, - accept, - context); + private Mono cancelAsync(String resourceGroupName, String experimentName) { + return beginCancelAsync(resourceGroupName, experimentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * Start a Experiment resource. + * 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 model that represents the result of a start Experiment operation on successful completion of {@link - * Mono}. + * @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 cancelAsync(String resourceGroupName, String experimentName, Context context) { + return beginCancelAsync(resourceGroupName, experimentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * Start a Experiment resource. + * 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 model that represents the result of a start Experiment operation along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response startWithResponse( - String resourceGroupName, String experimentName, Context context) { - return startWithResponseAsync(resourceGroupName, experimentName, context).block(); + public void cancel(String resourceGroupName, String experimentName) { + cancelAsync(resourceGroupName, experimentName).block(); } /** - * Start a Experiment resource. + * 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 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 cancel(String resourceGroupName, String experimentName, Context context) { + cancelAsync(resourceGroupName, experimentName, context).block(); } /** - * Get a list of statuses of a Experiment resource. + * 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 list of statuses of a Experiment resource along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllStatusesSinglePageAsync( - String resourceGroupName, String experimentName) { + private Mono>> startWithResponseAsync(String resourceGroupName, String experimentName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1603,7 +1820,7 @@ private Mono> listAllStatusesSinglePageAsyn .withContext( context -> service - .listAllStatuses( + .start( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), @@ -1611,20 +1828,11 @@ private Mono> listAllStatusesSinglePageAsyn experimentName, accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get a list of statuses of a Experiment resource. + * Start a Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. @@ -1632,11 +1840,10 @@ private Mono> listAllStatusesSinglePageAsyn * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of statuses of a Experiment resource along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllStatusesSinglePageAsync( + private Mono>> startWithResponseAsync( String resourceGroupName, String experimentName, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -1660,44 +1867,37 @@ private Mono> listAllStatusesSinglePageAsyn final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listAllStatuses( + .start( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, experimentName, accept, - context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + context); } /** - * Get a list of statuses of a Experiment resource. + * 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 list of statuses of a Experiment resource as paginated response with {@link PagedFlux}. + * @return the {@link PollerFlux} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAllStatusesAsync(String resourceGroupName, String experimentName) { - return new PagedFlux<>( - () -> listAllStatusesSinglePageAsync(resourceGroupName, experimentName), - nextLink -> listAllStatusesNextSinglePageAsync(nextLink)); + @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()); } /** - * Get a list of statuses of a Experiment resource. + * Start a Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. @@ -1705,33 +1905,35 @@ private PagedFlux listAllStatusesAsync(String resourceGro * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of statuses of a Experiment resource as paginated response with {@link PagedFlux}. + * @return the {@link PollerFlux} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAllStatusesAsync( + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync( String resourceGroupName, String experimentName, Context context) { - return new PagedFlux<>( - () -> listAllStatusesSinglePageAsync(resourceGroupName, experimentName, context), - nextLink -> listAllStatusesNextSinglePageAsync(nextLink, 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); } /** - * Get a list of statuses of a Experiment resource. + * 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 list of statuses of a Experiment resource as paginated response with {@link PagedIterable}. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listAllStatuses(String resourceGroupName, String experimentName) { - return new PagedIterable<>(listAllStatusesAsync(resourceGroupName, experimentName)); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceGroupName, String experimentName) { + return this.beginStartAsync(resourceGroupName, experimentName).getSyncPoller(); } /** - * Get a list of statuses of a Experiment resource. + * Start a Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. @@ -1739,28 +1941,90 @@ public PagedIterable listAllStatuses(String resourceGroup * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of statuses of a Experiment resource as paginated response with {@link PagedIterable}. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listAllStatuses( + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart( String resourceGroupName, String experimentName, Context context) { - return new PagedIterable<>(listAllStatusesAsync(resourceGroupName, experimentName, 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 beginStartAsync(resourceGroupName, experimentName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String experimentName, Context context) { + return beginStartAsync(resourceGroupName, experimentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * Get a status of a Experiment resource. + * Start a Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param statusId GUID that represents a Experiment status. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 status of a Experiment resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getStatusWithResponseAsync( - String resourceGroupName, String experimentName, String statusId) { + public void start(String resourceGroupName, String experimentName) { + startAsync(resourceGroupName, experimentName).block(); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceGroupName, String experimentName, Context context) { + startAsync(resourceGroupName, experimentName, context).block(); + } + + /** + * Get a list of executions of an 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 list of executions of an Experiment resource along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllExecutionsSinglePageAsync( + String resourceGroupName, String experimentName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1780,41 +2044,46 @@ private Mono> getStatusWithResponseAsync( if (experimentName == null) { return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); } - if (statusId == null) { - return Mono.error(new IllegalArgumentException("Parameter statusId is required and cannot be null.")); - } final String accept = "application/json"; return FluxUtil .withContext( context -> service - .getStatus( + .listAllExecutions( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, experimentName, - statusId, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get a status of a Experiment resource. + * Get a list of executions of an Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param statusId GUID that represents a Experiment status. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a status of a Experiment resource along with {@link Response} on successful completion of {@link Mono}. + * @return a list of executions of an Experiment resource along with {@link PagedResponse} on successful completion + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getStatusWithResponseAsync( - String resourceGroupName, String experimentName, String statusId, Context context) { + private Mono> listAllExecutionsSinglePageAsync( + String resourceGroupName, String experimentName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1834,89 +2103,112 @@ private Mono> getStatusWithResponseAsync( if (experimentName == null) { return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); } - if (statusId == null) { - return Mono.error(new IllegalArgumentException("Parameter statusId is required and cannot be null.")); - } final String accept = "application/json"; context = this.client.mergeContext(context); return service - .getStatus( + .listAllExecutions( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, experimentName, - statusId, accept, - context); + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); } /** - * Get a status of a Experiment resource. + * Get a list of executions of an Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param statusId GUID that represents a Experiment status. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 status of a Experiment resource on successful completion of {@link Mono}. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getStatusAsync( - String resourceGroupName, String experimentName, String statusId) { - return getStatusWithResponseAsync(resourceGroupName, experimentName, statusId) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllExecutionsAsync( + String resourceGroupName, String experimentName) { + return new PagedFlux<>( + () -> listAllExecutionsSinglePageAsync(resourceGroupName, experimentName), + nextLink -> listAllExecutionsNextSinglePageAsync(nextLink)); } /** - * Get a status of a Experiment resource. + * Get a list of executions of an Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param statusId GUID that represents a Experiment status. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a status of a Experiment resource along with {@link Response}. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getStatusWithResponse( - String resourceGroupName, String experimentName, String statusId, Context context) { - return getStatusWithResponseAsync(resourceGroupName, experimentName, statusId, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllExecutionsAsync( + String resourceGroupName, String experimentName, Context context) { + return new PagedFlux<>( + () -> listAllExecutionsSinglePageAsync(resourceGroupName, experimentName, context), + nextLink -> listAllExecutionsNextSinglePageAsync(nextLink, context)); } /** - * Get a status of a Experiment resource. + * Get a list of executions of an Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param statusId GUID that represents a Experiment status. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 status of a Experiment resource. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ExperimentStatusInner getStatus(String resourceGroupName, String experimentName, String statusId) { - return getStatusWithResponse(resourceGroupName, experimentName, statusId, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAllExecutions(String resourceGroupName, String experimentName) { + return new PagedIterable<>(listAllExecutionsAsync(resourceGroupName, experimentName)); } /** - * Get a list of execution details of a Experiment resource. + * Get a list of executions of an 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 a list of execution details of a Experiment resource along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAllExecutions( + String resourceGroupName, String experimentName, Context context) { + return new PagedIterable<>(listAllExecutionsAsync(resourceGroupName, experimentName, context)); + } + + /** + * Get an execution of an Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of an Experiment resource along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listExecutionDetailsSinglePageAsync( - String resourceGroupName, String experimentName) { + private Mono> getExecutionWithResponseAsync( + String resourceGroupName, String experimentName, String executionId) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1936,46 +2228,42 @@ private Mono> listExecutionDetail if (experimentName == null) { return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); } + if (executionId == null) { + return Mono.error(new IllegalArgumentException("Parameter executionId is required and cannot be null.")); + } final String accept = "application/json"; return FluxUtil .withContext( context -> service - .listExecutionDetails( + .getExecution( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, experimentName, + executionId, accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get a list of execution details of a Experiment resource. + * Get an execution of an Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of execution details of a Experiment resource along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return an execution of an Experiment resource along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listExecutionDetailsSinglePageAsync( - String resourceGroupName, String experimentName, Context context) { + private Mono> getExecutionWithResponseAsync( + String resourceGroupName, String experimentName, String executionId, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1995,113 +2283,90 @@ private Mono> listExecutionDetail if (experimentName == null) { return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); } + if (executionId == null) { + return Mono.error(new IllegalArgumentException("Parameter executionId is required and cannot be null.")); + } final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listExecutionDetails( + .getExecution( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, experimentName, + executionId, accept, - context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + context); } /** - * Get a list of execution details of a Experiment resource. + * Get an execution of an Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of execution details of a Experiment resource as paginated response with {@link PagedFlux}. + * @return an execution of an Experiment resource on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listExecutionDetailsAsync( - String resourceGroupName, String experimentName) { - return new PagedFlux<>( - () -> listExecutionDetailsSinglePageAsync(resourceGroupName, experimentName), - nextLink -> listExecutionDetailsNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getExecutionAsync( + String resourceGroupName, String experimentName, String executionId) { + return getExecutionWithResponseAsync(resourceGroupName, experimentName, executionId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Get a list of execution details of a Experiment resource. + * Get an execution of an Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of execution details of a Experiment resource as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listExecutionDetailsAsync( - String resourceGroupName, String experimentName, Context context) { - return new PagedFlux<>( - () -> listExecutionDetailsSinglePageAsync(resourceGroupName, experimentName, context), - nextLink -> listExecutionDetailsNextSinglePageAsync(nextLink, context)); - } - - /** - * Get a list of execution details of 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 list of execution details of a Experiment resource as paginated response with {@link PagedIterable}. + * @return an execution of an Experiment resource along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listExecutionDetails( - String resourceGroupName, String experimentName) { - return new PagedIterable<>(listExecutionDetailsAsync(resourceGroupName, experimentName)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getExecutionWithResponse( + String resourceGroupName, String experimentName, String executionId, Context context) { + return getExecutionWithResponseAsync(resourceGroupName, experimentName, executionId, context).block(); } /** - * Get a list of execution details of a Experiment resource. + * Get an execution of an 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. + * @param executionId GUID that represents a Experiment execution detail. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of execution details of a Experiment resource as paginated response with {@link PagedIterable}. + * @return an execution of an Experiment resource. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listExecutionDetails( - String resourceGroupName, String experimentName, Context context) { - return new PagedIterable<>(listExecutionDetailsAsync(resourceGroupName, experimentName, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public ExperimentExecutionInner getExecution(String resourceGroupName, String experimentName, String executionId) { + return getExecutionWithResponse(resourceGroupName, experimentName, executionId, Context.NONE).getValue(); } /** - * Get an execution detail of a Experiment resource. + * Execution details of an experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param executionId GUID that represents a Experiment execution detail. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an execution detail of a Experiment resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return model that represents the execution details of an Experiment along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getExecutionDetailsWithResponseAsync( - String resourceGroupName, String experimentName, String executionDetailsId) { + private Mono> executionDetailsWithResponseAsync( + String resourceGroupName, String experimentName, String executionId) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -2121,43 +2386,42 @@ private Mono> getExecutionDetailsWithR if (experimentName == null) { return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); } - if (executionDetailsId == null) { - return Mono - .error(new IllegalArgumentException("Parameter executionDetailsId is required and cannot be null.")); + if (executionId == null) { + return Mono.error(new IllegalArgumentException("Parameter executionId is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service - .getExecutionDetails( + .executionDetails( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, experimentName, - executionDetailsId, + executionId, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get an execution detail of a Experiment resource. + * Execution details of an experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param executionId GUID that represents a Experiment execution detail. * @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 an execution detail of a Experiment resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return model that represents the execution details of an Experiment along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getExecutionDetailsWithResponseAsync( - String resourceGroupName, String experimentName, String executionDetailsId, Context context) { + private Mono> executionDetailsWithResponseAsync( + String resourceGroupName, String experimentName, String executionId, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -2177,77 +2441,74 @@ private Mono> getExecutionDetailsWithR if (experimentName == null) { return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); } - if (executionDetailsId == null) { - return Mono - .error(new IllegalArgumentException("Parameter executionDetailsId is required and cannot be null.")); + if (executionId == null) { + return Mono.error(new IllegalArgumentException("Parameter executionId is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service - .getExecutionDetails( + .executionDetails( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, experimentName, - executionDetailsId, + executionId, accept, context); } /** - * Get an execution detail of a Experiment resource. + * Execution details of an experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param executionId GUID that represents a Experiment execution detail. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an execution detail of a Experiment resource on successful completion of {@link Mono}. + * @return model that represents the execution details of an Experiment on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getExecutionDetailsAsync( - String resourceGroupName, String experimentName, String executionDetailsId) { - return getExecutionDetailsWithResponseAsync(resourceGroupName, experimentName, executionDetailsId) + private Mono executionDetailsAsync( + String resourceGroupName, String experimentName, String executionId) { + return executionDetailsWithResponseAsync(resourceGroupName, experimentName, executionId) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Get an execution detail of a Experiment resource. + * Execution details of an experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param executionId GUID that represents a Experiment execution detail. * @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 an execution detail of a Experiment resource along with {@link Response}. + * @return model that represents the execution details of an Experiment along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getExecutionDetailsWithResponse( - String resourceGroupName, String experimentName, String executionDetailsId, Context context) { - return getExecutionDetailsWithResponseAsync(resourceGroupName, experimentName, executionDetailsId, context) - .block(); + public Response executionDetailsWithResponse( + String resourceGroupName, String experimentName, String executionId, Context context) { + return executionDetailsWithResponseAsync(resourceGroupName, experimentName, executionId, context).block(); } /** - * Get an execution detail of a Experiment resource. + * Execution details of an experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param executionId GUID that represents a Experiment execution detail. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an execution detail of a Experiment resource. + * @return model that represents the execution details of an Experiment. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ExperimentExecutionDetailsInner getExecutionDetails( - String resourceGroupName, String experimentName, String executionDetailsId) { - return getExecutionDetailsWithResponse(resourceGroupName, experimentName, executionDetailsId, Context.NONE) - .getValue(); + public ExperimentExecutionDetailsInner executionDetails( + String resourceGroupName, String experimentName, String executionId) { + return executionDetailsWithResponse(resourceGroupName, experimentName, executionId, Context.NONE).getValue(); } /** @@ -2408,88 +2669,11 @@ private Mono> listNextSinglePageAsync(String next * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 list of Experiment statuses and a link for pagination along with {@link - * PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllStatusesNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listAllStatusesNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a list of Experiment statuses and a link for pagination along with {@link - * PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllStatusesNextSinglePageAsync( - String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listAllStatusesNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a list of Experiment execution details and a link for pagination along with {@link + * @return model that represents a list of Experiment executions and a link for pagination along with {@link * PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listExecutionDetailsNextSinglePageAsync( - String nextLink) { + private Mono> listAllExecutionsNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -2501,9 +2685,8 @@ private Mono> listExecutionDetail } final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.listExecutionDetailsNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( + .withContext(context -> service.listAllExecutionsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( res -> new PagedResponseBase<>( res.getRequest(), @@ -2524,11 +2707,11 @@ private Mono> listExecutionDetail * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 list of Experiment execution details and a link for pagination along with {@link + * @return model that represents a list of Experiment executions and a link for pagination along with {@link * PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listExecutionDetailsNextSinglePageAsync( + private Mono> listAllExecutionsNextSinglePageAsync( String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); @@ -2542,7 +2725,7 @@ private Mono> listExecutionDetail final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listExecutionDetailsNext(nextLink, this.client.getEndpoint(), accept, context) + .listAllExecutionsNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( 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..cc81637e23b15 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,16 +10,12 @@ 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.ExperimentExecutionInner; 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.ExperimentExecution; 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; public final class ExperimentsImpl implements 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,111 +84,64 @@ 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) { - PagedIterable inner = - this.serviceClient().listAllStatuses(resourceGroupName, experimentName); - return Utils.mapPage(inner, inner1 -> new ExperimentStatusImpl(inner1, this.manager())); + public PagedIterable listAllExecutions(String resourceGroupName, String experimentName) { + PagedIterable inner = + this.serviceClient().listAllExecutions(resourceGroupName, experimentName); + return Utils.mapPage(inner, inner1 -> new ExperimentExecutionImpl(inner1, this.manager())); } - public PagedIterable listAllStatuses( + public PagedIterable listAllExecutions( String resourceGroupName, String experimentName, Context context) { - PagedIterable inner = - this.serviceClient().listAllStatuses(resourceGroupName, experimentName, context); - return Utils.mapPage(inner, inner1 -> new ExperimentStatusImpl(inner1, this.manager())); + PagedIterable inner = + this.serviceClient().listAllExecutions(resourceGroupName, experimentName, context); + return Utils.mapPage(inner, inner1 -> new ExperimentExecutionImpl(inner1, this.manager())); } - public Response getStatusWithResponse( - String resourceGroupName, String experimentName, String statusId, Context context) { - Response inner = - this.serviceClient().getStatusWithResponse(resourceGroupName, experimentName, statusId, context); + public Response getExecutionWithResponse( + String resourceGroupName, String experimentName, String executionId, Context context) { + Response inner = + this.serviceClient().getExecutionWithResponse(resourceGroupName, experimentName, executionId, context); if (inner != null) { return new SimpleResponse<>( inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ExperimentStatusImpl(inner.getValue(), this.manager())); + new ExperimentExecutionImpl(inner.getValue(), this.manager())); } else { return null; } } - public ExperimentStatus getStatus(String resourceGroupName, String experimentName, String statusId) { - ExperimentStatusInner inner = this.serviceClient().getStatus(resourceGroupName, experimentName, statusId); + public ExperimentExecution getExecution(String resourceGroupName, String experimentName, String executionId) { + ExperimentExecutionInner inner = + this.serviceClient().getExecution(resourceGroupName, experimentName, executionId); if (inner != null) { - return new ExperimentStatusImpl(inner, this.manager()); + return new ExperimentExecutionImpl(inner, this.manager()); } else { return null; } } - public PagedIterable listExecutionDetails( - String resourceGroupName, String experimentName) { - PagedIterable inner = - this.serviceClient().listExecutionDetails(resourceGroupName, experimentName); - return Utils.mapPage(inner, inner1 -> new ExperimentExecutionDetailsImpl(inner1, this.manager())); - } - - public PagedIterable listExecutionDetails( - String resourceGroupName, String experimentName, Context context) { - PagedIterable inner = - this.serviceClient().listExecutionDetails(resourceGroupName, experimentName, context); - return Utils.mapPage(inner, inner1 -> new ExperimentExecutionDetailsImpl(inner1, this.manager())); - } - - public Response getExecutionDetailsWithResponse( - String resourceGroupName, String experimentName, String executionDetailsId, Context context) { + public Response executionDetailsWithResponse( + String resourceGroupName, String experimentName, String executionId, Context context) { Response inner = - this - .serviceClient() - .getExecutionDetailsWithResponse(resourceGroupName, experimentName, executionDetailsId, context); + this.serviceClient().executionDetailsWithResponse(resourceGroupName, experimentName, executionId, context); if (inner != null) { return new SimpleResponse<>( inner.getRequest(), @@ -205,10 +153,10 @@ public Response getExecutionDetailsWithResponse( } } - public ExperimentExecutionDetails getExecutionDetails( - String resourceGroupName, String experimentName, String executionDetailsId) { + public ExperimentExecutionDetails executionDetails( + String resourceGroupName, String experimentName, String executionId) { ExperimentExecutionDetailsInner inner = - this.serviceClient().getExecutionDetails(resourceGroupName, experimentName, executionDetailsId); + this.serviceClient().executionDetails(resourceGroupName, experimentName, executionId); if (inner != null) { return new ExperimentExecutionDetailsImpl(inner, this.manager()); } else { @@ -270,10 +218,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 +237,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/implementation/Utils.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/Utils.java index a5c97173501ee..2ea1ef1f8be78 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/Utils.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/Utils.java @@ -20,6 +20,9 @@ import reactor.core.publisher.Flux; final class Utils { + private Utils() { + } + static String getValueFromIdByName(String id, String name) { if (id == null) { return null; @@ -60,7 +63,7 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri segments.add(idSegment); idItrReverted.forEachRemaining(segments::add); Collections.reverse(segments); - if (segments.size() > 0 && segments.get(0).isEmpty()) { + if (!segments.isEmpty() && segments.get(0).isEmpty()) { segments.remove(0); } return String.join("/", segments); @@ -74,7 +77,7 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri } static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl(pageIterable, mapper); + return new PagedIterableImpl<>(pageIterable, mapper); } private static final class PagedIterableImpl extends PagedIterable { @@ -133,30 +136,27 @@ public Stream> streamByPage(String continuationToken, int prefe @Override public Iterator iterator() { - return new IteratorImpl(pagedIterable.iterator(), mapper); + return new IteratorImpl<>(pagedIterable.iterator(), mapper); } @Override public Iterable> iterableByPage() { - return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); } @Override public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl, PagedResponse>( - pagedIterable.iterableByPage(continuationToken), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); } @Override public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl, PagedResponse>( - pagedIterable.iterableByPage(preferredPageSize), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); } @Override public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl, PagedResponse>( - pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); } } @@ -198,7 +198,7 @@ private IterableImpl(Iterable iterable, Function mapper) { @Override public Iterator iterator() { - return new IteratorImpl(iterable.iterator(), mapper); + return new IteratorImpl<>(iterable.iterator(), mapper); } } } 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/Action.java index b66cd0a8ffc2d..2c9c65f5ff387 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/Action.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; -/** Model that represents the base action model. */ +/** Model that represents the base action model. 9 total per experiment. */ @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, 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/Branch.java index 6cb88d39d96ce..0a6541b4478fd 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/Branch.java @@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** Model that represents a branch in the step. */ +/** Model that represents a branch in the step. 9 total per experiment. */ @Fluent public final class Branch { /* 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..6ce4af25f02b1 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; @@ -63,6 +62,13 @@ public interface Experiment { */ ResourceIdentity identity(); + /** + * Gets the provisioningState property: Most recent provisioning state for the given experiment resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + /** * Gets the steps property: List of steps. * @@ -77,14 +83,6 @@ public interface Experiment { */ List selectors(); - /** - * Gets the startOnCreation property: A boolean value that indicates if experiment should be started on creation or - * not. - * - * @return the startOnCreation value. - */ - Boolean startOnCreation(); - /** * Gets the region of the resource. * @@ -185,8 +183,7 @@ interface WithSelectors { * 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/ExperimentStatus.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecution.java similarity index 56% rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStatus.java rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecution.java index 2924619daa9e7..4ddba48804ac2 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStatus.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecution.java @@ -4,11 +4,11 @@ package com.azure.resourcemanager.chaos.models; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner; import java.time.OffsetDateTime; -/** An immutable client-side representation of ExperimentStatus. */ -public interface ExperimentStatus { +/** An immutable client-side representation of ExperimentExecution. */ +public interface ExperimentExecution { /** * Gets the type property: String of the resource type. * @@ -31,30 +31,30 @@ public interface ExperimentStatus { String name(); /** - * Gets the status property: String that represents the status of a Experiment. + * Gets the status property: The status of the execution. * * @return the status value. */ String status(); /** - * Gets the createdDateUtc property: String that represents the created date time of a Experiment. + * Gets the startedAt property: String that represents the start date time. * - * @return the createdDateUtc value. + * @return the startedAt value. */ - OffsetDateTime createdDateUtc(); + OffsetDateTime startedAt(); /** - * Gets the endDateUtc property: String that represents the end date time of a Experiment. + * Gets the stoppedAt property: String that represents the stop date time. * - * @return the endDateUtc value. + * @return the stoppedAt value. */ - OffsetDateTime endDateUtc(); + OffsetDateTime stoppedAt(); /** - * Gets the inner com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner object. + * Gets the inner com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner object. * * @return the inner object. */ - ExperimentStatusInner innerModel(); + ExperimentExecutionInner innerModel(); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetails.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetails.java index 7c9b3f5f1e47e..67895a8e836da 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetails.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetails.java @@ -30,20 +30,6 @@ public interface ExperimentExecutionDetails { */ String name(); - /** - * Gets the experimentId property: The id of the experiment. - * - * @return the experimentId value. - */ - String experimentId(); - - /** - * Gets the status property: The value of the status of the experiment execution. - * - * @return the status value. - */ - String status(); - /** * Gets the failureReason property: The reason why the execution failed. * @@ -52,39 +38,39 @@ public interface ExperimentExecutionDetails { String failureReason(); /** - * Gets the createdDateTime property: String that represents the created date time. + * Gets the lastActionAt property: String that represents the last action date time. * - * @return the createdDateTime value. + * @return the lastActionAt value. */ - OffsetDateTime createdDateTime(); + OffsetDateTime lastActionAt(); /** - * Gets the lastActionDateTime property: String that represents the last action date time. + * Gets the runInformation property: The information of the experiment run. * - * @return the lastActionDateTime value. + * @return the runInformation value. */ - OffsetDateTime lastActionDateTime(); + ExperimentExecutionDetailsPropertiesRunInformation runInformation(); /** - * Gets the startDateTime property: String that represents the start date time. + * Gets the status property: The status of the execution. * - * @return the startDateTime value. + * @return the status value. */ - OffsetDateTime startDateTime(); + String status(); /** - * Gets the stopDateTime property: String that represents the stop date time. + * Gets the startedAt property: String that represents the start date time. * - * @return the stopDateTime value. + * @return the startedAt value. */ - OffsetDateTime stopDateTime(); + OffsetDateTime startedAt(); /** - * Gets the runInformation property: The information of the experiment run. + * Gets the stoppedAt property: String that represents the stop date time. * - * @return the runInformation value. + * @return the stoppedAt value. */ - ExperimentExecutionDetailsPropertiesRunInformation runInformation(); + OffsetDateTime stoppedAt(); /** * Gets the inner com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner object. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionListResult.java similarity index 64% rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsListResult.java rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionListResult.java index 9b96e10d36b84..69997a14cbb45 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsListResult.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionListResult.java @@ -5,40 +5,40 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** Model that represents a list of Experiment execution details and a link for pagination. */ +/** Model that represents a list of Experiment executions and a link for pagination. */ @Immutable -public final class ExperimentExecutionDetailsListResult { +public final class ExperimentExecutionListResult { /* - * List of Experiment execution details. + * List of Experiment executions. */ @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) - private List value; + private List value; /* - * URL to retrieve the next page of Experiment execution details. + * URL to retrieve the next page of Experiment executions. */ @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; - /** Creates an instance of ExperimentExecutionDetailsListResult class. */ - public ExperimentExecutionDetailsListResult() { + /** Creates an instance of ExperimentExecutionListResult class. */ + public ExperimentExecutionListResult() { } /** - * Get the value property: List of Experiment execution details. + * Get the value property: List of Experiment executions. * * @return the value value. */ - public List value() { + public List value() { return this.value; } /** - * Get the nextLink property: URL to retrieve the next page of Experiment execution details. + * Get the nextLink property: URL to retrieve the next page of Experiment executions. * * @return the nextLink value. */ 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/ExperimentStatusListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStatusListResult.java deleted file mode 100644 index 465ebd010b07f..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStatusListResult.java +++ /dev/null @@ -1,59 +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.core.annotation.Immutable; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Model that represents a list of Experiment statuses and a link for pagination. */ -@Immutable -public final class ExperimentStatusListResult { - /* - * List of Experiment statuses. - */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) - private List value; - - /* - * URL to retrieve the next page of Experiment statuses. - */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) - private String nextLink; - - /** Creates an instance of ExperimentStatusListResult class. */ - public ExperimentStatusListResult() { - } - - /** - * Get the value property: List of Experiment statuses. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Get the nextLink property: URL to retrieve the next page of Experiment statuses. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } -} 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..8505040f5fbd6 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,67 +114,61 @@ 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. + * Get a list of executions of an 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 a list of statuses of a Experiment resource as paginated response with {@link PagedIterable}. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. */ - PagedIterable listAllStatuses(String resourceGroupName, String experimentName); + PagedIterable listAllExecutions(String resourceGroupName, String experimentName); /** - * Get a list of statuses of a Experiment resource. + * Get a list of executions of an Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. @@ -183,92 +176,66 @@ Response startWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of statuses of a Experiment resource as paginated response with {@link PagedIterable}. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. */ - PagedIterable listAllStatuses(String resourceGroupName, String experimentName, Context context); + PagedIterable listAllExecutions( + String resourceGroupName, String experimentName, Context context); /** - * Get a status of a Experiment resource. + * Get an execution of an Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param statusId GUID that represents a Experiment status. + * @param executionId GUID that represents a Experiment execution detail. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a status of a Experiment resource along with {@link Response}. + * @return an execution of an Experiment resource along with {@link Response}. */ - Response getStatusWithResponse( - String resourceGroupName, String experimentName, String statusId, Context context); + Response getExecutionWithResponse( + String resourceGroupName, String experimentName, String executionId, Context context); /** - * Get a status of a Experiment resource. + * Get an execution of an Experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param statusId GUID that represents a Experiment status. + * @param executionId GUID that represents a Experiment execution detail. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a status of a Experiment resource. + * @return an execution of an Experiment resource. */ - ExperimentStatus getStatus(String resourceGroupName, String experimentName, String statusId); - - /** - * Get a list of execution details of 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 a list of execution details of a Experiment resource as paginated response with {@link PagedIterable}. - */ - PagedIterable listExecutionDetails(String resourceGroupName, String experimentName); - - /** - * Get a list of execution details of 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 a list of execution details of a Experiment resource as paginated response with {@link PagedIterable}. - */ - PagedIterable listExecutionDetails( - String resourceGroupName, String experimentName, Context context); + ExperimentExecution getExecution(String resourceGroupName, String experimentName, String executionId); /** - * Get an execution detail of a Experiment resource. + * Execution details of an experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param executionId GUID that represents a Experiment execution detail. * @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 an execution detail of a Experiment resource along with {@link Response}. + * @return model that represents the execution details of an Experiment along with {@link Response}. */ - Response getExecutionDetailsWithResponse( - String resourceGroupName, String experimentName, String executionDetailsId, Context context); + Response executionDetailsWithResponse( + String resourceGroupName, String experimentName, String executionId, Context context); /** - * Get an execution detail of a Experiment resource. + * Execution details of an experiment resource. * * @param resourceGroupName String that represents an Azure resource group. * @param experimentName String that represents a Experiment resource name. - * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param executionId GUID that represents a Experiment execution detail. * @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 an execution detail of a Experiment resource. + * @return model that represents the execution details of an Experiment. */ - ExperimentExecutionDetails getExecutionDetails( - String resourceGroupName, String experimentName, String executionDetailsId); + ExperimentExecutionDetails executionDetails(String resourceGroupName, String experimentName, String executionId); /** * Get a Experiment resource. @@ -311,9 +278,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/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/proxy-config.json b/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/proxy-config.json new file mode 100644 index 0000000000000..f87b72c22e1d8 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/proxy-config.json @@ -0,0 +1 @@ +[ [ "com.azure.resourcemanager.chaos.implementation.CapabilitiesClientImpl$CapabilitiesService" ], [ "com.azure.resourcemanager.chaos.implementation.CapabilityTypesClientImpl$CapabilityTypesService" ], [ "com.azure.resourcemanager.chaos.implementation.ExperimentsClientImpl$ExperimentsService" ], [ "com.azure.resourcemanager.chaos.implementation.OperationStatusesClientImpl$OperationStatusesService" ], [ "com.azure.resourcemanager.chaos.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.chaos.implementation.TargetTypesClientImpl$TargetTypesService" ], [ "com.azure.resourcemanager.chaos.implementation.TargetsClientImpl$TargetsService" ] ] \ No newline at end of file diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/reflect-config.json b/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/reflect-config.json new file mode 100644 index 0000000000000..da5c89d0dd203 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/reflect-config.json @@ -0,0 +1,271 @@ +[ { + "name" : "com.azure.resourcemanager.chaos.models.CapabilityListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.CapabilityInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.CapabilityProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.CapabilityTypeListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesRuntimeProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.ExperimentListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.ResourceIdentity", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.UserAssignedIdentity", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.Step", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.Branch", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.Action", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.Selector", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.Filter", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.ExperimentUpdate", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.ExperimentExecutionListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.StepStatus", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.BranchStatus", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.ActionStatus", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.ExperimentExecutionActionTargetDetailsProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.ExperimentExecutionActionTargetDetailsError", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.OperationListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.OperationInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.OperationDisplay", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.TargetTypeListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.TargetTypeInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.TargetTypeProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.TargetListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.fluent.models.TargetInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.DelayAction", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.DiscreteAction", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.KeyValuePair", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.ContinuousAction", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.ListSelector", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.TargetReference", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.QuerySelector", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.SimpleFilter", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.SimpleFilterParameters", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.ProvisioningState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.SelectorType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.FilterType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.Origin", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.ActionType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.TargetReferenceType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.chaos.models.ResourceIdentityType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +} ] \ No newline at end of file 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..bff7d610edc17 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/stable/2023-11-01/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..c0711247e7786 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/stable/2023-11-01/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..c9fcb72d1c84c 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/stable/2023-11-01/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..e9877ec3e950f 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/stable/2023-11-01/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..f6ccf64f5fe37 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/stable/2023-11-01/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..3d6fb9271308d 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/stable/2023-11-01/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..11882ad7b0021 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/stable/2023-11-01/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..4c6b3ed13928d 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 @@ -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/stable/2023-11-01/examples/CreateUpdateExperiment.json */ /** * Sample code: Create/update a Experiment in a resource group. 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..bfc219fab7b09 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/stable/2023-11-01/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/ExperimentsGetExecutionDetailsSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsSamples.java similarity index 75% rename from sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionDetailsSamples.java rename to sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsSamples.java index 2918e65b9f666..5fef1f0dba905 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/ExperimentsExecutionDetailsSamples.java @@ -4,10 +4,10 @@ package com.azure.resourcemanager.chaos.generated; -/** Samples for Experiments GetExecutionDetails. */ -public final class ExperimentsGetExecutionDetailsSamples { +/** Samples for Experiments ExecutionDetails. */ +public final class ExperimentsExecutionDetailsSamples { /* - * 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/stable/2023-11-01/examples/DetailsExperiment.json */ /** * Sample code: Get experiment execution details. @@ -17,7 +17,7 @@ public final class ExperimentsGetExecutionDetailsSamples { public static void getExperimentExecutionDetails(com.azure.resourcemanager.chaos.ChaosManager manager) { manager .experiments() - .getExecutionDetailsWithResponse( + .executionDetailsWithResponse( "exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", 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..890dfb7f8d88a 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/stable/2023-11-01/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/ExperimentsGetStatusSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionSamples.java similarity index 55% rename from sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetStatusSamples.java rename to sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionSamples.java index 5750f91f66580..28f28dd3c4e90 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/ExperimentsGetExecutionSamples.java @@ -4,23 +4,23 @@ package com.azure.resourcemanager.chaos.generated; -/** Samples for Experiments GetStatus. */ -public final class ExperimentsGetStatusSamples { +/** Samples for Experiments GetExecution. */ +public final class ExperimentsGetExecutionSamples { /* - * 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/stable/2023-11-01/examples/GetExperimentExecution.json */ /** - * Sample code: Get the status of a Experiment. + * Sample code: Get the execution of a Experiment. * * @param manager Entry point to ChaosManager. */ - public static void getTheStatusOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + public static void getTheExecutionOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { manager .experiments() - .getStatusWithResponse( + .getExecutionWithResponse( "exampleRG", "exampleExperiment", - "50734542-2e64-4e08-814c-cc0e7475f7e4", + "f24500ad-744e-4a26-864b-b76199eac333", com.azure.core.util.Context.NONE); } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllExecutionsSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllExecutionsSamples.java new file mode 100644 index 0000000000000..e7f7cb140fcfe --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllExecutionsSamples.java @@ -0,0 +1,20 @@ +// 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 Experiments ListAllExecutions. */ +public final class ExperimentsListAllExecutionsSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2023-11-01/examples/ListExperimentExecutions.json + */ + /** + * Sample code: List all executions of an Experiment. + * + * @param manager Entry point to ChaosManager. + */ + public static void listAllExecutionsOfAnExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().listAllExecutions("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + } +} 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 deleted file mode 100644 index 84bef54c007cc..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllStatusesSamples.java +++ /dev/null @@ -1,20 +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; - -/** 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 - */ - /** - * Sample code: List all statuses of a Experiment. - * - * @param manager Entry point to ChaosManager. - */ - public static void listAllStatusesOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().listAllStatuses("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); - } -} 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..2f36631b04eb6 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/stable/2023-11-01/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 deleted file mode 100644 index 854508c20af0c..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListExecutionDetailsSamples.java +++ /dev/null @@ -1,20 +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; - -/** 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 - */ - /** - * Sample code: List experiment executions details. - * - * @param manager Entry point to ChaosManager. - */ - public static void listExperimentExecutionsDetails(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().listExecutionDetails("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); - } -} 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..46c0dd24b7cf2 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/stable/2023-11-01/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..f1624202c0f89 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/stable/2023-11-01/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..f5127f1918eb6 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/stable/2023-11-01/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..a9b80b0a21670 --- /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/stable/2023-11-01/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..6486c6f7d0e7c 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/stable/2023-11-01/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..4a09189e47ec3 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/stable/2023-11-01/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..afc02f4e79eb4 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/stable/2023-11-01/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..27de7a2fc06be 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/stable/2023-11-01/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..1866fd6292961 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/stable/2023-11-01/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..464c96b1aa65c 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/stable/2023-11-01/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); - } -}