diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 88ab7db4457a0..e10e87be62e71 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -92,6 +92,9 @@ # PRLabel: %azure-spring /sdk/cosmos/azure-spring-data-cosmos-test/ @kushagraThapar @FabianMeiswinkel @backwind1233 @chenrujun @hui1110 @netyyyy @saragluna @stliu @yiliuTo @xinlian12 @moarychan @aayush3011 @simorenoh @fangjian0423 +# PRLabel: %Load Testing +/sdk/loadtestservice/ @Harshan01 @abranj1219 + # ServiceLabel: %Device Update for IoT Hub %Service Attention /sdk/deviceupdate/ @dpokluda diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index fbb5adfa6c975..94844f49e5471 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -167,6 +167,7 @@ com.azure:azure-verticals-agrifood-farming;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-xml;1.0.0-beta.1;1.0.0-beta.2 com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-communication-email;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-developer-loadtesting;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-identity-providers-core;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-identity-providers-jdbc-mysql;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-identity-providers-jdbc-postgresql;1.0.0-beta.1;1.0.0-beta.2 diff --git a/sdk/loadtestservice/azure-developer-loadtesting/CHANGELOG.md b/sdk/loadtestservice/azure-developer-loadtesting/CHANGELOG.md new file mode 100644 index 0000000000000..c520be8dd49c1 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +- Initial preview release of Azure LoadTestingClient client library for Java. This package contains Microsoft Azure LoadTestingClient client library. diff --git a/sdk/loadtestservice/azure-developer-loadtesting/README.md b/sdk/loadtestservice/azure-developer-loadtesting/README.md new file mode 100644 index 0000000000000..545fda349dd07 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/README.md @@ -0,0 +1,289 @@ +# Azure Load Testing client library for Java + +Azure Load Testing provides client library in Java to the user by which they can interact natively with Azure Load Testing service. Azure Load Testing is a fully managed load-testing service that enables you to generate high-scale load. The service simulates traffic for your applications, regardless of where they're hosted. Developers, testers, and quality assurance (QA) engineers can use it to optimize application performance, scalability, or capacity + +This package contains Microsoft Azure Developer LoadTesting client library. + +## Documentation + +Various documentation is available to help you get started + + +- [API reference documentation][api_reference_doc] +- [Product Documentation][product_documentation] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] +- Azure Load Testing resource + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure:azure-developer-loadtesting;current}) +```xml + + com.azure + azure-developer-loadtesting + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Authentication + +[Azure Identity][azure_identity] package provides the default implementation for authenticating the client. + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java java-readme-sample-auth +// ensure the user, service principal or managed identity used has Loadtesting Contributor role for the resource +TokenCredential credential = new DefaultAzureCredentialBuilder() + .build(); +// create client using DefaultAzureCredential +LoadTestingClient client = new LoadTestingClientBuilder() + .credential(credential) + .endpoint("") + .buildClient(); +LoadTestAdministrationClient adminClient = client.getLoadTestAdministrationClient(); +TestRunClient testRunClient = client.getLoadTestRunClient(); +``` + +## Key concepts + +The following components make up the Azure Load Testing service. The Azure Load Test client library for Java allows you to interact with each of these components through the use of clients. There are two top-level clients which are the main entry points for the library + +- `LoadTestingClient` + +- `LoadTestingAsyncClient` + +The two clients have similar methods in them except the methods in the async client are async as well. + +The top-level clients have two sub-clients + +- `LoadTestAdministration` + +- `TestRun` + +These sub-clients are used for managing and using different components of the service. + +### Load Test Administration Client + +The `LoadTestAdministration` sub-clients is used to administer and configure the load tests, app components and metrics. + +#### Test + +A test specifies the test script, and configuration settings for running a load test. You can create one or more tests in an Azure Load Testing resource. + +#### App Component + +When you run a load test for an Azure-hosted application, you can monitor resource metrics for the different Azure application components (server-side metrics). While the load test runs, and after completion of the test, you can monitor and analyze the resource metrics in the Azure Load Testing dashboard. + +#### Metrics + +During a load test, Azure Load Testing collects metrics about the test execution. There are two types of metrics: + +1. Client-side metrics give you details reported by the test engine. These metrics include the number of virtual users, the request response time, the number of failed requests, or the number of requests per second. + +2. Server-side metrics are available for Azure-hosted applications and provide information about your Azure application components. Metrics can be for the number of database reads, the type of HTTP responses, or container resource consumption. + +### Test Run Client + +The `TestRun` sub-clients is used to start and stop test runs corresponding to a load test. A test run represents one execution of a load test. It collects the logs associated with running the Apache JMeter script, the load test YAML configuration, the list of app components to monitor, and the results of the test. + +### Data-Plane Endpoint + +Data-plane of Azure Load Testing resources is addressable using the following URL format: + +`00000000-0000-0000-0000-000000000000.aaa.cnt-prod.loadtesting.azure.com` + +The first GUID `00000000-0000-0000-0000-000000000000` is the unique identifier used for accessing the Azure Load Testing resource. This is followed by `aaa` which is the Azure region of the resource. + +The data-plane endpoint is obtained from Control Plane APIs. + +**Example:** `1234abcd-12ab-12ab-12ab-123456abcdef.eus.cnt-prod.loadtesting.azure.com` + +In the above example, `eus` represents the Azure region `East US`. + +## Examples + +### Creating a Load Test + +```java java-readme-sample-createTest +LoadTestingClient client = new LoadTestingClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("") + .buildClient(); + +// construct Test object using nested String:Object Maps +Map testMap = new HashMap(); +testMap.put("displayName", "Sample Display Name"); +testMap.put("description", "Sample Description"); + +// loadTestConfig describes the number of test engines to generate load +Map loadTestConfigMap = new HashMap(); +loadTestConfigMap.put("engineInstances", 1); +testMap.put("loadTestConfig", loadTestConfigMap); + +// environmentVariables are plain-text data passed to test engines +Map envVarMap = new HashMap(); +envVarMap.put("a", "b"); +envVarMap.put("x", "y"); +testMap.put("environmentVariables", envVarMap); + +// secrets are secure data sent using Azure Key Vault +Map secretMap = new HashMap(); +Map sampleSecretMap = new HashMap(); +sampleSecretMap.put("value", "https://samplevault.vault.azure.net/secrets/samplesecret/f113f91fd4c44a368049849c164db827"); +sampleSecretMap.put("type", "AKV_SECRET_URI"); +secretMap.put("sampleSecret", sampleSecretMap); +testMap.put("secrets", secretMap); + +// passFailCriteria define the conditions to conclude the test as success +Map passFailMap = new HashMap(); +Map passFailMetrics = new HashMap(); +Map samplePassFailMetric = new HashMap(); +samplePassFailMetric.put("clientmetric", "response_time_ms"); +samplePassFailMetric.put("aggregate", "percentage"); +samplePassFailMetric.put("condition", ">"); +samplePassFailMetric.put("value", "20"); +samplePassFailMetric.put("action", "continue"); +passFailMetrics.put("fefd759d-7fe8-4f83-8b6d-aeebe0f491fe", samplePassFailMetric); +passFailMap.put("passFailMetrics", passFailMetrics); +testMap.put("passFailCriteria", passFailMap); + +// convert the object Map to JSON BinaryData +BinaryData test = BinaryData.fromObject(testMap); + +// receive response with BinaryData content +Response testOutResponse = client.getLoadTestAdministrationClient().createOrUpdateTestWithResponse("test12345", test, null); +System.out.println(testOutResponse.getValue().toString()); +``` + +### Uploading .jmx file to a Load Test + +```java java-readme-sample-uploadTestFile +LoadTestingClient client = new LoadTestingClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("") + .buildClient(); + +// extract file contents to BinaryData +BinaryData fileData = BinaryData.fromFile(new File("path/to/file").toPath()); + +// receive response with BinaryData content +Response fileUrlOut = client.getLoadTestAdministrationClient().uploadTestFileWithResponse("test12345", "file12345", "sample-file.jmx", fileData, null); +System.out.println(fileUrlOut.getValue().toString()); +``` + +### Running a Load Test + +```java java-readme-sample-runTest +LoadTestingClient client = new LoadTestingClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("") + .buildClient(); + +// construct Test Run object using nested String:Object Maps +Map testRunMap = new HashMap(); +testRunMap.put("testId", "test12345"); +testRunMap.put("displayName", "SDK-Created-TestRun"); + +// convert the object Map to JSON BinaryData +BinaryData testRun = BinaryData.fromObject(testRunMap); + +// receive response with BinaryData content +Response testRunOut = client.getLoadTestRunClient().createOrUpdateTestRunWithResponse("testrun12345", testRun, null); +System.out.println(testRunOut.getValue().toString()); + +// wait for test to reach terminal state +JsonNode testRunJson = null; +String testStatus = null, startDateTime = null, endDateTime = null; +while (testStatus == null || (testStatus != "DONE" && testStatus != "CANCELLED" && testStatus != "FAILED")) { + testRunOut = client.getLoadTestRunClient().getTestRunWithResponse("testrun12345", null); + // parse JSON and read status value + try { + testRunJson = new ObjectMapper().readTree(testRunOut.getValue().toString()); + testStatus = testRunJson.get("status").asText(); + } catch (JsonProcessingException e) { + System.out.println("Error processing JSON response"); + // handle error condition + } + + // wait and check test status every 5 seconds + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + // handle interruption + } +} + +startDateTime = testRunJson.get("startDateTime").asText(); +endDateTime = testRunJson.get("endDateTime").asText(); + +// construct Test Run Client Metrics object using nested String:Object Maps +Map clientMetricsMap = new HashMap(); +List requestSamplersList = new ArrayList(); +requestSamplersList.add("Homepage"); +clientMetricsMap.put("requestSamplers", requestSamplersList); + +List errorsList = new ArrayList(); +errorsList.add("500"); +clientMetricsMap.put("errors", errorsList); + +List percentilesList = new ArrayList(); +percentilesList.add("95"); +clientMetricsMap.put("percentiles", percentilesList); + +clientMetricsMap.put("groupByInterval", "10s"); +clientMetricsMap.put("startTime", startDateTime); +clientMetricsMap.put("endTime", endDateTime); + +// convert the object Map to JSON BinaryData +BinaryData clientMetrics = BinaryData.fromObject(clientMetricsMap); + +// fetch client metrics +Response clientMetricsOut = client.getLoadTestRunClient().getTestRunClientMetricsWithResponse("testrun12345", clientMetrics, null); +System.out.println(clientMetricsOut.getValue().toString()); +``` + +## Troubleshooting + +Azure SDKs for Java offer a consistent logging story to help aid in troubleshooting application errors and expedite +their resolution. The logs produced will capture the flow of an application before reaching the terminal state to help +locate the root issue. View the [logging][logging] wiki for guidance about enabling logging. + +## Next steps + +Azure Loading Testing Java SDK samples are available to you in the SDK's GitHub repository. These samples provide example code for additional scenarios commonly encountered. + + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + + + +[api_reference_doc]: https://docs.microsoft.com/rest/api/loadtesting/ +[product_documentation]: https://azure.microsoft.com/services/load-testing/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[logging]: https://github.com/Azure/azure-sdk-for-java/wiki/Logging-in-Azure-SDK diff --git a/sdk/loadtestservice/azure-developer-loadtesting/pom.xml b/sdk/loadtestservice/azure-developer-loadtesting/pom.xml new file mode 100644 index 0000000000000..b780ac7de0616 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/pom.xml @@ -0,0 +1,79 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure + azure-developer-loadtesting + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for LoadTestingClient Management + This package contains Microsoft Azure LoadTestingClient client library. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.33.0 + + + com.azure + azure-core-http-netty + 1.12.6 + + + org.junit.jupiter + junit-jupiter-engine + 5.8.2 + test + + + org.mockito + mockito-core + 4.5.1 + test + + + com.azure + azure-core-test + 1.12.1 + test + + + com.azure + azure-identity + 1.6.1 + test + + + diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationAsyncClient.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationAsyncClient.java new file mode 100644 index 0000000000000..b38dd8dfefffa --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationAsyncClient.java @@ -0,0 +1,1038 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. +package com.azure.developer.loadtesting; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.developer.loadtesting.implementation.LoadTestAdministrationsImpl; +import com.azure.developer.loadtesting.implementation.util.MultipartHelper; +import java.io.IOException; +import java.util.Random; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous LoadTestingClient type. */ +public final class LoadTestAdministrationAsyncClient { + + private static final Random RANDOM = new Random(); + + @Generated private final LoadTestAdministrationsImpl serviceClient; + + /** + * Initializes an instance of LoadTestAdministrationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + LoadTestAdministrationAsyncClient(LoadTestAdministrationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Associate an App Component (Azure resource) to a test or test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param body App Component model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Components model along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateAppComponentsWithResponse( + String name, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateAppComponentsWithResponseAsync(name, body, requestOptions); + } + + /** + * Delete an App Component. + * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteAppComponentWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.deleteAppComponentWithResponseAsync(name, requestOptions); + } + + /** + * Get App Component details by App Component name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Component details by App Component name along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAppComponentByNameWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.getAppComponentByNameWithResponseAsync(name, requestOptions); + } + + /** + * Get App Components for a test or a test run by its name. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
testRunIdStringNo[Required, if testId is not provided] Test run Id.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Components for a test or a test run by its name along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAppComponentWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAppComponentWithResponseAsync(requestOptions); + } + + /** + * Configure server metrics for a test or test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Server metrics configuration model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics config model along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateServerMetricsConfigWithResponse( + String name, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateServerMetricsConfigWithResponseAsync(name, body, requestOptions); + } + + /** + * Get server metrics configuration by its name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics configuration by its name along with {@link Response} on successful completion of {@link + * Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServerMetricsByNameWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.getServerMetricsByNameWithResponseAsync(name, requestOptions); + } + + /** + * Delete server metrics configuration by its name. + * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteServerMetricsWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.deleteServerMetricsWithResponseAsync(name, requestOptions); + } + + /** + * Get server metrics configuration for a test or test run by its name. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
testRunIdStringNo[Required, if testId is not provided] Test run Id.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics configuration for a test or test run by its name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServerMetricsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getServerMetricsWithResponseAsync(requestOptions); + } + + /** + * Get all default server metrics configuration for supported resource types. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     defaultMetrics (Optional): {
+     *         String (Optional): [
+     *              (Optional){
+     *                 metricnamespace: String (Optional)
+     *                 aggregation: String (Optional)
+     *                 name (Optional): {
+     *                     value: String (Optional)
+     *                     localizedValue: String (Optional)
+     *                 }
+     *                 unit: String (Optional)
+     *                 displayDescription: String (Optional)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all default server metrics configuration for supported resource types along with {@link Response} on + * successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServerDefaultMetricsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getServerDefaultMetricsWithResponseAsync(requestOptions); + } + + /** + * Get all supported resource types for App Components(Azure resource types). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all supported resource types for App Components(Azure resource types) along with {@link Response} on + * successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSupportedResourceTypeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listSupportedResourceTypeWithResponseAsync(requestOptions); + } + + /** + * Create a new test or Update an existing test. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Load test model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test model along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateTestWithResponse( + String testId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateTestWithResponseAsync(testId, body, requestOptions); + } + + /** + * Delete a test by its name. + * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteLoadTestWithResponse(String testId, RequestOptions requestOptions) { + return this.serviceClient.deleteLoadTestWithResponseAsync(testId, requestOptions); + } + + /** + * Get load test details by test name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test details by test name along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getLoadTestWithResponse(String testId, RequestOptions requestOptions) { + return this.serviceClient.getLoadTestWithResponseAsync(testId, requestOptions); + } + + /** + * Upload input file for a given test name. File size can't be more than 50 MB. Existing file with same name for the + * given test will be overwritten. File should be provided in the request body as multipart/form-data. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fileTypeIntegerNoInteger representation of the file type (0 = JMX_FILE, 1 = USER_PROPERTIES, 2 = ADDITIONAL_ARTIFACTS).
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param file The file to be uploaded. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return fileUrl Model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> uploadTestFileWithResponse( + String testId, String fileId, BinaryData file, RequestOptions requestOptions) { + return this.serviceClient.uploadTestFileWithResponseAsync(testId, fileId, file, requestOptions); + } + + /** + * Upload input file for a given test name. File size can't be more than 50 MB. Existing file with same name for the + * given test will be overwritten. File should be provided in the request body as multipart/form-data. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fileTypeIntegerNoInteger representation of the file type (0 = JMX_FILE, 1 = USER_PROPERTIES, 2 = ADDITIONAL_ARTIFACTS).
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Request Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileName Name of test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param file The file to be uploaded. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws IOException thrown if the multipart/form-data body cannot be constructed from file. + * @return fileUrl Model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadTestFileWithResponse( + String testId, String fileId, String fileName, BinaryData file, RequestOptions requestOptions) + throws IOException { + String boundary = MultipartHelper.getMultipartBoundary(String.format("%6x", RANDOM.nextInt(0x1000000))); + if (requestOptions == null) { + requestOptions = new RequestOptions(); + } + requestOptions.setHeader("Content-Type", "multipart/form-data;boundary=" + boundary); + BinaryData multipartBody = MultipartHelper.createMultipartBodyFromFile(fileName, file, boundary); + return this.serviceClient.uploadTestFileWithResponseAsync(testId, fileId, multipartBody, requestOptions); + } + + /** + * Get test file by the file name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test file by the file name along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestFileWithResponse( + String testId, String fileId, RequestOptions requestOptions) { + return this.serviceClient.getTestFileWithResponseAsync(testId, fileId, requestOptions); + } + + /** + * Delete file by the file name for a test. + * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteTestFileWithResponse( + String testId, String fileId, RequestOptions requestOptions) { + return this.serviceClient.deleteTestFileWithResponseAsync(testId, fileId, requestOptions); + } + + /** + * Get all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderByStringNoSort on one of the field - lastModifiedDateTime, displayName, createdBy in (field asc/desc) format. eg: displayName asc.
searchStringNoFilter search based on searchable fields - testId, createdBy.
lastUpdatedStartTimeOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
lastUpdatedEndTimeOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
continuationTokenStringNoContinuation token to get the next page of response.
maxPageSizeIntegerNoNumber of results in response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testId: String (Optional)
+     *             description: String (Optional)
+     *             displayName: String (Optional)
+     *             resourceId: String (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             inputArtifacts (Optional): {
+     *                 configUrl (Optional): {
+     *                     url: String (Optional)
+     *                     fileId: String (Optional)
+     *                     filename: String (Optional)
+     *                     fileType: String(0/1/2) (Optional)
+     *                     expireTime: OffsetDateTime (Optional)
+     *                     validationStatus: String (Optional)
+     *                 }
+     *                 testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                 userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                 inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                 additionalUrls (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             subnetId: String (Optional)
+     *             keyvaultReferenceIdentityType: String (Optional)
+     *             keyvaultReferenceIdentityId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName} as + * paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listLoadTestSearch(RequestOptions requestOptions) { + return this.serviceClient.listLoadTestSearchAsync(requestOptions); + } + + /** + * Get all test files. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
continuationTokenStringNoContinuation token to get the next page of response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test files as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux getAllTestFiles(String testId, RequestOptions requestOptions) { + return this.serviceClient.getAllTestFilesAsync(testId, requestOptions); + } + + /** + * List all test files. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
continuationTokenStringNoContinuation token to get the next page of response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test files as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestFiles(String testId, RequestOptions requestOptions) { + return this.serviceClient.getAllTestFilesAsync(testId, requestOptions); + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationClient.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationClient.java new file mode 100644 index 0000000000000..80bf703ae9db8 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationClient.java @@ -0,0 +1,1018 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. +package com.azure.developer.loadtesting; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import java.io.IOException; + +/** Initializes a new instance of the synchronous LoadTestingClient type. */ +public final class LoadTestAdministrationClient { + + @Generated private final LoadTestAdministrationAsyncClient client; + + /** + * Initializes an instance of LoadTestAdministrationClient class. + * + * @param client the async client. + */ + @Generated + LoadTestAdministrationClient(LoadTestAdministrationAsyncClient client) { + this.client = client; + } + + /** + * Associate an App Component (Azure resource) to a test or test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param body App Component model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Components model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateAppComponentsWithResponse( + String name, BinaryData body, RequestOptions requestOptions) { + return this.client.createOrUpdateAppComponentsWithResponse(name, body, requestOptions).block(); + } + + /** + * Delete an App Component. + * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteAppComponentWithResponse(String name, RequestOptions requestOptions) { + return this.client.deleteAppComponentWithResponse(name, requestOptions).block(); + } + + /** + * Get App Component details by App Component name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Component details by App Component name along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAppComponentByNameWithResponse(String name, RequestOptions requestOptions) { + return this.client.getAppComponentByNameWithResponse(name, requestOptions).block(); + } + + /** + * Get App Components for a test or a test run by its name. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
testRunIdStringNo[Required, if testId is not provided] Test run Id.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Components for a test or a test run by its name along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAppComponentWithResponse(RequestOptions requestOptions) { + return this.client.getAppComponentWithResponse(requestOptions).block(); + } + + /** + * Configure server metrics for a test or test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Server metrics configuration model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics config model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateServerMetricsConfigWithResponse( + String name, BinaryData body, RequestOptions requestOptions) { + return this.client.createOrUpdateServerMetricsConfigWithResponse(name, body, requestOptions).block(); + } + + /** + * Get server metrics configuration by its name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics configuration by its name along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getServerMetricsByNameWithResponse(String name, RequestOptions requestOptions) { + return this.client.getServerMetricsByNameWithResponse(name, requestOptions).block(); + } + + /** + * Delete server metrics configuration by its name. + * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteServerMetricsWithResponse(String name, RequestOptions requestOptions) { + return this.client.deleteServerMetricsWithResponse(name, requestOptions).block(); + } + + /** + * Get server metrics configuration for a test or test run by its name. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
testRunIdStringNo[Required, if testId is not provided] Test run Id.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics configuration for a test or test run by its name along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getServerMetricsWithResponse(RequestOptions requestOptions) { + return this.client.getServerMetricsWithResponse(requestOptions).block(); + } + + /** + * Get all default server metrics configuration for supported resource types. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     defaultMetrics (Optional): {
+     *         String (Optional): [
+     *              (Optional){
+     *                 metricnamespace: String (Optional)
+     *                 aggregation: String (Optional)
+     *                 name (Optional): {
+     *                     value: String (Optional)
+     *                     localizedValue: String (Optional)
+     *                 }
+     *                 unit: String (Optional)
+     *                 displayDescription: String (Optional)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all default server metrics configuration for supported resource types along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getServerDefaultMetricsWithResponse(RequestOptions requestOptions) { + return this.client.getServerDefaultMetricsWithResponse(requestOptions).block(); + } + + /** + * Get all supported resource types for App Components(Azure resource types). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all supported resource types for App Components(Azure resource types) along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listSupportedResourceTypeWithResponse(RequestOptions requestOptions) { + return this.client.listSupportedResourceTypeWithResponse(requestOptions).block(); + } + + /** + * Create a new test or Update an existing test. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Load test model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateTestWithResponse( + String testId, BinaryData body, RequestOptions requestOptions) { + return this.client.createOrUpdateTestWithResponse(testId, body, requestOptions).block(); + } + + /** + * Delete a test by its name. + * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteLoadTestWithResponse(String testId, RequestOptions requestOptions) { + return this.client.deleteLoadTestWithResponse(testId, requestOptions).block(); + } + + /** + * Get load test details by test name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test details by test name along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getLoadTestWithResponse(String testId, RequestOptions requestOptions) { + return this.client.getLoadTestWithResponse(testId, requestOptions).block(); + } + + /** + * Upload input file for a given test name. File size can't be more than 50 MB. Existing file with same name for the + * given test will be overwritten. File should be provided in the request body as multipart/form-data. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fileTypeIntegerNoInteger representation of the file type (0 = JMX_FILE, 1 = USER_PROPERTIES, 2 = ADDITIONAL_ARTIFACTS).
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param file The file to be uploaded. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return fileUrl Model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response uploadTestFileWithResponse( + String testId, String fileId, BinaryData file, RequestOptions requestOptions) { + return this.client.uploadTestFileWithResponse(testId, fileId, file, requestOptions).block(); + } + + /** + * Upload input file for a given test name. File size can't be more than 50 MB. Existing file with same name for the + * given test will be overwritten. File should be provided in the request body as multipart/form-data. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fileTypeIntegerNoInteger representation of the file type (0 = JMX_FILE, 1 = USER_PROPERTIES, 2 = ADDITIONAL_ARTIFACTS).
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Request Body Schema + * + *

{@code
+     * BinaryData
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileName Name of test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param file The file to be uploaded. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws IOException thrown if the multipart/form-data body cannot be constructed from file. + * @return fileUrl Model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadTestFileWithResponse( + String testId, String fileId, String fileName, BinaryData file, RequestOptions requestOptions) + throws IOException { + return this.client.uploadTestFileWithResponse(testId, fileId, fileName, file, requestOptions).block(); + } + + /** + * Get test file by the file name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test file by the file name along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestFileWithResponse(String testId, String fileId, RequestOptions requestOptions) { + return this.client.getTestFileWithResponse(testId, fileId, requestOptions).block(); + } + + /** + * Delete file by the file name for a test. + * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteTestFileWithResponse(String testId, String fileId, RequestOptions requestOptions) { + return this.client.deleteTestFileWithResponse(testId, fileId, requestOptions).block(); + } + + /** + * Get all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderByStringNoSort on one of the field - lastModifiedDateTime, displayName, createdBy in (field asc/desc) format. eg: displayName asc.
searchStringNoFilter search based on searchable fields - testId, createdBy.
lastUpdatedStartTimeOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
lastUpdatedEndTimeOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
continuationTokenStringNoContinuation token to get the next page of response.
maxPageSizeIntegerNoNumber of results in response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testId: String (Optional)
+     *             description: String (Optional)
+     *             displayName: String (Optional)
+     *             resourceId: String (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             inputArtifacts (Optional): {
+     *                 configUrl (Optional): {
+     *                     url: String (Optional)
+     *                     fileId: String (Optional)
+     *                     filename: String (Optional)
+     *                     fileType: String(0/1/2) (Optional)
+     *                     expireTime: OffsetDateTime (Optional)
+     *                     validationStatus: String (Optional)
+     *                 }
+     *                 testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                 userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                 inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                 additionalUrls (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             subnetId: String (Optional)
+     *             keyvaultReferenceIdentityType: String (Optional)
+     *             keyvaultReferenceIdentityId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName} as + * paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLoadTestSearch(RequestOptions requestOptions) { + return new PagedIterable<>(this.client.listLoadTestSearch(requestOptions)); + } + + /** + * Get all test files. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
continuationTokenStringNoContinuation token to get the next page of response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test files as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getAllTestFiles(String testId, RequestOptions requestOptions) { + return new PagedIterable<>(this.client.getAllTestFiles(testId, requestOptions)); + } + + /** + * List all test files. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
continuationTokenStringNoContinuation token to get the next page of response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test files as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestFiles(String testId, RequestOptions requestOptions) { + return new PagedIterable<>(this.client.listTestFiles(testId, requestOptions)); + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingAsyncClient.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingAsyncClient.java new file mode 100644 index 0000000000000..3476b051a1a23 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingAsyncClient.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.developer.loadtesting; + +import com.azure.core.annotation.ServiceClient; +import com.azure.developer.loadtesting.implementation.LoadTestingClientImpl; + +/** Initializes a new instance of the asynchronous LoadTestingClient type. */ +@ServiceClient(builder = LoadTestingClientBuilder.class, isAsync = true) +public final class LoadTestingAsyncClient { + + /** + * {@link LoadTestAdministrationAsyncClient} contains AppComponent, ServerMetrics and + * Test operations. + */ + private final LoadTestAdministrationAsyncClient administration; + + /** + * {@link TestRunAsyncClient} involves operations for running a test + */ + private final TestRunAsyncClient testRun; + + /** + * Initializes an instance of LoadTestingAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + LoadTestingAsyncClient(LoadTestingClientImpl serviceClient) { + this.administration = new LoadTestAdministrationAsyncClient(serviceClient.getLoadTestAdministrations()); + this.testRun = new TestRunAsyncClient(serviceClient.getTestRuns()); + } + + /** + * Returns the instance of LoadTestAdministrationAsyncClient class. + * + * @return {@link LoadTestAdministrationAsyncClient} object. + */ + public LoadTestAdministrationAsyncClient getLoadTestAdministrationAsyncClient() { + return this.administration; + } + + /** + * Returns the instance of TestRunAsyncClient class. + * + * @return {@link TestRunAsyncClient} object. + */ + public TestRunAsyncClient getLoadTestRunAsyncClient() { + return this.testRun; + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingClient.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingClient.java new file mode 100644 index 0000000000000..3b175f833813a --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingClient.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.developer.loadtesting; + +import com.azure.core.annotation.ServiceClient; + +/** Initializes a new instance of the synchronous LoadTestingClient type. */ +@ServiceClient(builder = LoadTestingClientBuilder.class) +public final class LoadTestingClient { + + /** + * {@link LoadTestAdministrationClient} contains AppComponent, ServerMetrics and + * Test operations. + */ + private final LoadTestAdministrationClient administration; + + /** + * {@link TestRunClient} involves operations for running a test + */ + private final TestRunClient testRun; + + /** + * Initializes an instance of LoadTestingClient class. + * + * @param serviceClient the service client implementation. + */ + LoadTestingClient(LoadTestingAsyncClient client) { + this.administration = new LoadTestAdministrationClient(client.getLoadTestAdministrationAsyncClient()); + this.testRun = new TestRunClient(client.getLoadTestRunAsyncClient()); + } + + /** + * Returns the instance of LoadTestAdministrationClient class. + * + * @return {@link LoadTestAdministrationClient} object. + */ + public LoadTestAdministrationClient getLoadTestAdministrationClient() { + return this.administration; + } + + /** + * Returns the instance of TestRunClient class. + * + * @return {@link TestRunClient} object. + */ + public TestRunClient getLoadTestRunClient() { + return this.testRun; + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingClientBuilder.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingClientBuilder.java new file mode 100644 index 0000000000000..ab7e002018831 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingClientBuilder.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.developer.loadtesting; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.client.traits.TokenCredentialTrait; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.developer.loadtesting.implementation.LoadTestingClientImpl; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** A builder for creating a new instance of the TestRunClient type. */ +@ServiceClientBuilder(serviceClients = {LoadTestingClient.class, LoadTestingAsyncClient.class}) +public final class LoadTestingClientBuilder + implements HttpTrait, + ConfigurationTrait, + TokenCredentialTrait, + EndpointTrait { + + private static final String SDK_NAME = "name"; + + private static final String SDK_VERSION = "version"; + + private static final String[] DEFAULT_SCOPES = new String[] {"https://cnt-prod.loadtesting.azure.com/.default"}; + + private final Map properties = CoreUtils.getProperties("azure-developer-loadtesting.properties"); + + private final List pipelinePolicies; + + /** Create an instance of the LoadTestingClientBuilder. */ + public LoadTestingClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP pipeline to send requests through. + */ + private HttpPipeline pipeline; + + /** {@inheritDoc}. */ + @Override + public LoadTestingClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + private HttpClient httpClient; + + /** {@inheritDoc}. */ + @Override + public LoadTestingClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + private HttpLogOptions httpLogOptions; + + /** {@inheritDoc}. */ + @Override + public LoadTestingClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + private ClientOptions clientOptions; + + /** {@inheritDoc}. */ + @Override + public LoadTestingClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + private RetryOptions retryOptions; + + /** {@inheritDoc}. */ + @Override + public LoadTestingClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** {@inheritDoc}. */ + @Override + public LoadTestingClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + private Configuration configuration; + + /** {@inheritDoc}. */ + @Override + public LoadTestingClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The TokenCredential used for authentication. + */ + private TokenCredential tokenCredential; + + /** {@inheritDoc}. */ + @Override + public LoadTestingClientBuilder credential(TokenCredential tokenCredential) { + this.tokenCredential = tokenCredential; + return this; + } + + /* + * The service endpoint + */ + private String endpoint; + + /** {@inheritDoc}. */ + @Override + public LoadTestingClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + private LoadTestingServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the LoadTestingClientBuilder. + */ + public LoadTestingClientBuilder serviceVersion(LoadTestingServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the LoadTestingClientBuilder. + */ + public LoadTestingClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of LoadTestingClientImpl with the provided parameters. + * + * @return an instance of LoadTestingClientImpl. + */ + private LoadTestingClientImpl buildInnerClient() { + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + LoadTestingServiceVersion localServiceVersion = + (serviceVersion != null) ? serviceVersion : LoadTestingServiceVersion.getLatest(); + LoadTestingClientImpl client = + new LoadTestingClientImpl( + localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, localServiceVersion); + return client; + } + + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + if (httpLogOptions == null) { + httpLogOptions = new HttpLogOptions(); + } + if (clientOptions == null) { + clientOptions = new ClientOptions(); + } + List policies = new ArrayList<>(); + String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = new HttpHeaders(); + clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + policies.add(new CookiePolicy()); + if (tokenCredential != null) { + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(clientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of LoadTestingAsyncClient class. + * + * @return an instance of LoadTestingAsyncClient. + */ + public LoadTestingAsyncClient buildAsyncClient() { + return new LoadTestingAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of LoadTestingClient class. + * + * @return an instance of LoadTestingClient. + */ + public LoadTestingClient buildClient() { + return new LoadTestingClient(new LoadTestingAsyncClient(buildInnerClient())); + } +} + diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingServiceVersion.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingServiceVersion.java new file mode 100644 index 0000000000000..2a568e5538a32 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingServiceVersion.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.developer.loadtesting; + +import com.azure.core.util.ServiceVersion; + +/** Service version of LoadTestingClient. */ +public enum LoadTestingServiceVersion implements ServiceVersion { + /** Enum value 2022-06-01-preview. */ + V2022_06_01_PREVIEW("2022-06-01-preview"); + + private final String version; + + LoadTestingServiceVersion(String version) { + this.version = version; + } + + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link LoadTestingServiceVersion}. + */ + public static LoadTestingServiceVersion getLatest() { + return V2022_06_01_PREVIEW; + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestRunAsyncClient.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestRunAsyncClient.java new file mode 100644 index 0000000000000..c0be6a21b527c --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestRunAsyncClient.java @@ -0,0 +1,756 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. +package com.azure.developer.loadtesting; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.developer.loadtesting.implementation.TestRunsImpl; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous LoadTestingClient type. */ +public final class TestRunAsyncClient { + + @Generated private final TestRunsImpl serviceClient; + + /** + * Initializes an instance of TestRunAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TestRunAsyncClient(TestRunsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Delete a test run by its name. + * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteTestRunWithResponse(String testRunId, RequestOptions requestOptions) { + return this.serviceClient.deleteTestRunWithResponseAsync(testRunId, requestOptions); + } + + /** + * Get test run details by name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test run details by name along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestRunWithResponse(String testRunId, RequestOptions requestOptions) { + return this.serviceClient.getTestRunWithResponseAsync(testRunId, requestOptions); + } + + /** + * Get test run file by file name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test run file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test run file by file name along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestRunFileWithResponse( + String testRunId, String fileId, RequestOptions requestOptions) { + return this.serviceClient.getTestRunFileWithResponseAsync(testRunId, fileId, requestOptions); + } + + /** + * Stop test run by name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test run model along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stopTestRunWithResponse(String testRunId, RequestOptions requestOptions) { + return this.serviceClient.stopTestRunWithResponseAsync(testRunId, requestOptions); + } + + /** + * Get all client metrics for a load test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     requestSamplers (Optional): [
+     *         String (Optional)
+     *     ]
+     *     errors (Optional): [
+     *         String (Optional)
+     *     ]
+     *     percentiles (Optional): [
+     *         String (Optional)
+     *     ]
+     *     groupByInterval: String (Optional)
+     *     startTime: OffsetDateTime (Required)
+     *     endTime: OffsetDateTime (Required)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     timeSeries (Optional): {
+     *         activeUsers (Optional): {
+     *             String (Optional): [
+     *                  (Optional){
+     *                     timestamp: OffsetDateTime (Optional)
+     *                     value: Double (Optional)
+     *                 }
+     *             ]
+     *         }
+     *         responseTime (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         throughput (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         errors (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Client metrics request model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all client metrics for a load test run along with {@link Response} on successful completion of {@link + * Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestRunClientMetricsWithResponse( + String testRunId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.getTestRunClientMetricsWithResponseAsync(testRunId, body, requestOptions); + } + + /** + * Get all filters that are supported for client metrics for a given load test run. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     filters (Optional): {
+     *         requestSamplerValues (Optional): [
+     *             String (Optional)
+     *         ]
+     *         errorFiltersValues (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     timeRange (Optional): {
+     *         startTime: OffsetDateTime (Optional)
+     *         endTime: OffsetDateTime (Optional)
+     *     }
+     * }
+     * }
+ * + * @param testRunId Unique name for load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all filters that are supported for client metrics for a given load test run along with {@link Response} + * on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestRunClientMetricsFiltersWithResponse( + String testRunId, RequestOptions requestOptions) { + return this.serviceClient.getTestRunClientMetricsFiltersWithResponseAsync(testRunId, requestOptions); + } + + /** + * Create and start a new test run with the given name. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
oldTestRunIdStringNoExisting test run Id that should be rerun.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Load test run model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test run model along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateTestRunWithResponse( + String testRunId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateTestRunWithResponseAsync(testRunId, body, requestOptions); + } + + /** + * Get all test runs with given filters. + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderByStringNoSort on one of the field - status, displayName, executedDateTime in (field asc/desc) format. eg: displayName asc.
continuationTokenStringNoContinuation token to get the next page of response.
searchStringNoFilter search based on searchable fields - description, executedUser.
executionFromOffsetDateTimeNoThe end DateTime(ISO 8601 literal format) of test-run execution time filter range.
executionToOffsetDateTimeNoThe start DateTime(ISO 8601 literal format) of test-run execution time filter range.
statusStringNoComma separated list of test run status, value can be - "ACCEPTED", "NOTSTARTED","PROVISIONING","PROVISIONED","CONFIGURING", + * "CONFIGURED","EXECUTING","EXECUTED","DEPROVISIONING","DEPROVISIONED","DONE","CANCELLED","FAILED".
maxPageSizeIntegerNoNumber of results in response.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testRunId: String (Optional)
+     *             displayName: String (Optional)
+     *             testId: String (Optional)
+     *             resourceId: String (Optional)
+     *             description: String (Optional)
+     *             status: String (Optional)
+     *             startDateTime: OffsetDateTime (Optional)
+     *             endDateTime: OffsetDateTime (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             testResult: String (Optional)
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             testArtifacts (Optional): {
+     *                 inputArtifacts (Required): {
+     *                     configUrl (Optional): {
+     *                         url: String (Optional)
+     *                         fileId: String (Optional)
+     *                         filename: String (Optional)
+     *                         fileType: String(0/1/2) (Optional)
+     *                         expireTime: OffsetDateTime (Optional)
+     *                         validationStatus: String (Optional)
+     *                     }
+     *                     testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                     userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                     inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                     additionalUrls (Optional): [
+     *                         (recursive schema, see above)
+     *                     ]
+     *                 }
+     *                 outputArtifacts (Optional): {
+     *                     resultUrl (Optional): (recursive schema, see resultUrl above)
+     *                     logsUrl (Optional): (recursive schema, see logsUrl above)
+     *                 }
+     *             }
+     *             executedDateTime: OffsetDateTime (Optional)
+     *             vusers: Integer (Optional)
+     *             testRunStatistics (Optional): {
+     *                 String (Optional): {
+     *                     transaction: String (Optional)
+     *                     sampleCount: Double (Optional)
+     *                     errorCount: Double (Optional)
+     *                     errorPct: Double (Optional)
+     *                     meanResTime: Double (Optional)
+     *                     medianResTime: Double (Optional)
+     *                     maxResTime: Double (Optional)
+     *                     minResTime: Double (Optional)
+     *                     pct1ResTime: Double (Optional)
+     *                     pct2ResTime: Double (Optional)
+     *                     pct3ResTime: Double (Optional)
+     *                     throughput: Double (Optional)
+     *                     receivedKBytesPerSec: Double (Optional)
+     *                     sentKBytesPerSec: Double (Optional)
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             portalUrl: String (Optional)
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             duration: Long (Optional)
+     *             subnetId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test runs with given filters as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestRunsSearch(RequestOptions requestOptions) { + return this.serviceClient.listTestRunsSearchAsync(requestOptions); + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestRunClient.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestRunClient.java new file mode 100644 index 0000000000000..6efc6c671ab85 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestRunClient.java @@ -0,0 +1,752 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. +package com.azure.developer.loadtesting; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** Initializes a new instance of the synchronous LoadTestingClient type. */ +public final class TestRunClient { + + @Generated private final TestRunAsyncClient client; + + /** + * Initializes an instance of TestRunClient class. + * + * @param client the async client. + */ + @Generated + TestRunClient(TestRunAsyncClient client) { + this.client = client; + } + + /** + * Delete a test run by its name. + * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteTestRunWithResponse(String testRunId, RequestOptions requestOptions) { + return this.client.deleteTestRunWithResponse(testRunId, requestOptions).block(); + } + + /** + * Get test run details by name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test run details by name along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestRunWithResponse(String testRunId, RequestOptions requestOptions) { + return this.client.getTestRunWithResponse(testRunId, requestOptions).block(); + } + + /** + * Get test run file by file name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test run file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test run file by file name along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestRunFileWithResponse( + String testRunId, String fileId, RequestOptions requestOptions) { + return this.client.getTestRunFileWithResponse(testRunId, fileId, requestOptions).block(); + } + + /** + * Stop test run by name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test run model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stopTestRunWithResponse(String testRunId, RequestOptions requestOptions) { + return this.client.stopTestRunWithResponse(testRunId, requestOptions).block(); + } + + /** + * Get all client metrics for a load test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     requestSamplers (Optional): [
+     *         String (Optional)
+     *     ]
+     *     errors (Optional): [
+     *         String (Optional)
+     *     ]
+     *     percentiles (Optional): [
+     *         String (Optional)
+     *     ]
+     *     groupByInterval: String (Optional)
+     *     startTime: OffsetDateTime (Required)
+     *     endTime: OffsetDateTime (Required)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     timeSeries (Optional): {
+     *         activeUsers (Optional): {
+     *             String (Optional): [
+     *                  (Optional){
+     *                     timestamp: OffsetDateTime (Optional)
+     *                     value: Double (Optional)
+     *                 }
+     *             ]
+     *         }
+     *         responseTime (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         throughput (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         errors (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Client metrics request model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all client metrics for a load test run along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestRunClientMetricsWithResponse( + String testRunId, BinaryData body, RequestOptions requestOptions) { + return this.client.getTestRunClientMetricsWithResponse(testRunId, body, requestOptions).block(); + } + + /** + * Get all filters that are supported for client metrics for a given load test run. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     filters (Optional): {
+     *         requestSamplerValues (Optional): [
+     *             String (Optional)
+     *         ]
+     *         errorFiltersValues (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     timeRange (Optional): {
+     *         startTime: OffsetDateTime (Optional)
+     *         endTime: OffsetDateTime (Optional)
+     *     }
+     * }
+     * }
+ * + * @param testRunId Unique name for load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all filters that are supported for client metrics for a given load test run along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestRunClientMetricsFiltersWithResponse( + String testRunId, RequestOptions requestOptions) { + return this.client.getTestRunClientMetricsFiltersWithResponse(testRunId, requestOptions).block(); + } + + /** + * Create and start a new test run with the given name. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
oldTestRunIdStringNoExisting test run Id that should be rerun.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Load test run model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test run model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateTestRunWithResponse( + String testRunId, BinaryData body, RequestOptions requestOptions) { + return this.client.createOrUpdateTestRunWithResponse(testRunId, body, requestOptions).block(); + } + + /** + * Get all test runs with given filters. + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderByStringNoSort on one of the field - status, displayName, executedDateTime in (field asc/desc) format. eg: displayName asc.
continuationTokenStringNoContinuation token to get the next page of response.
searchStringNoFilter search based on searchable fields - description, executedUser.
executionFromOffsetDateTimeNoThe end DateTime(ISO 8601 literal format) of test-run execution time filter range.
executionToOffsetDateTimeNoThe start DateTime(ISO 8601 literal format) of test-run execution time filter range.
statusStringNoComma separated list of test run status, value can be - "ACCEPTED", "NOTSTARTED","PROVISIONING","PROVISIONED","CONFIGURING", + * "CONFIGURED","EXECUTING","EXECUTED","DEPROVISIONING","DEPROVISIONED","DONE","CANCELLED","FAILED".
maxPageSizeIntegerNoNumber of results in response.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testRunId: String (Optional)
+     *             displayName: String (Optional)
+     *             testId: String (Optional)
+     *             resourceId: String (Optional)
+     *             description: String (Optional)
+     *             status: String (Optional)
+     *             startDateTime: OffsetDateTime (Optional)
+     *             endDateTime: OffsetDateTime (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             testResult: String (Optional)
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             testArtifacts (Optional): {
+     *                 inputArtifacts (Required): {
+     *                     configUrl (Optional): {
+     *                         url: String (Optional)
+     *                         fileId: String (Optional)
+     *                         filename: String (Optional)
+     *                         fileType: String(0/1/2) (Optional)
+     *                         expireTime: OffsetDateTime (Optional)
+     *                         validationStatus: String (Optional)
+     *                     }
+     *                     testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                     userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                     inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                     additionalUrls (Optional): [
+     *                         (recursive schema, see above)
+     *                     ]
+     *                 }
+     *                 outputArtifacts (Optional): {
+     *                     resultUrl (Optional): (recursive schema, see resultUrl above)
+     *                     logsUrl (Optional): (recursive schema, see logsUrl above)
+     *                 }
+     *             }
+     *             executedDateTime: OffsetDateTime (Optional)
+     *             vusers: Integer (Optional)
+     *             testRunStatistics (Optional): {
+     *                 String (Optional): {
+     *                     transaction: String (Optional)
+     *                     sampleCount: Double (Optional)
+     *                     errorCount: Double (Optional)
+     *                     errorPct: Double (Optional)
+     *                     meanResTime: Double (Optional)
+     *                     medianResTime: Double (Optional)
+     *                     maxResTime: Double (Optional)
+     *                     minResTime: Double (Optional)
+     *                     pct1ResTime: Double (Optional)
+     *                     pct2ResTime: Double (Optional)
+     *                     pct3ResTime: Double (Optional)
+     *                     throughput: Double (Optional)
+     *                     receivedKBytesPerSec: Double (Optional)
+     *                     sentKBytesPerSec: Double (Optional)
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             portalUrl: String (Optional)
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             duration: Long (Optional)
+     *             subnetId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test runs with given filters as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestRunsSearch(RequestOptions requestOptions) { + return new PagedIterable<>(this.client.listTestRunsSearch(requestOptions)); + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestAdministrationsImpl.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestAdministrationsImpl.java new file mode 100644 index 0000000000000..4882926c33a75 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestAdministrationsImpl.java @@ -0,0 +1,4083 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.developer.loadtesting.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LoadTestAdministrations. */ +public final class LoadTestAdministrationsImpl { + /** The proxy service used to perform REST calls. */ + private final LoadTestAdministrationsService service; + + /** The service client containing this operation class. */ + private final LoadTestingClientImpl client; + + /** + * Initializes an instance of LoadTestAdministrationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LoadTestAdministrationsImpl(LoadTestingClientImpl client) { + this.service = + RestProxy.create( + LoadTestAdministrationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for LoadTestingClientLoadTestAdministrations to be used by the proxy + * service to perform REST calls. + */ + @Host("https://{Endpoint}") + @ServiceInterface(name = "LoadTestingClientLoa") + private interface LoadTestAdministrationsService { + @Patch("/appcomponents/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrUpdateAppComponents( + @HostParam("Endpoint") String endpoint, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/merge-patch+json") BinaryData body, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Delete("/appcomponents/{name}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteAppComponent( + @HostParam("Endpoint") String endpoint, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/appcomponents/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAppComponentByName( + @HostParam("Endpoint") String endpoint, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/appcomponents") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAppComponent( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Patch("/serverMetricsConfig/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrUpdateServerMetricsConfig( + @HostParam("Endpoint") String endpoint, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/merge-patch+json") BinaryData body, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/serverMetricsConfig/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getServerMetricsByName( + @HostParam("Endpoint") String endpoint, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Delete("/serverMetricsConfig/{name}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteServerMetrics( + @HostParam("Endpoint") String endpoint, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/serverMetricsConfig") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getServerMetrics( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/serverMetricsConfig/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getServerDefaultMetrics( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/serverMetricsConfig/supportedResourceTypes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listSupportedResourceType( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Patch("/loadtests/{testId}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrUpdateTest( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("testId") String testId, + @BodyParam("application/merge-patch+json") BinaryData body, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Delete("/loadtests/{testId}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteLoadTest( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("testId") String testId, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/loadtests/{testId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getLoadTest( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("testId") String testId, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/loadtests/sortAndFilter") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listLoadTestSearch( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + // @Multipart not supported by RestProxy + @Put("/loadtests/{testId}/files/{fileId}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> uploadTestFile( + @HostParam("Endpoint") String endpoint, + @PathParam("testId") String testId, + @PathParam("fileId") String fileId, + @QueryParam("api-version") String apiVersion, + @BodyParam("multipart/form-data") BinaryData file, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/loadtests/{testId}/files/{fileId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTestFile( + @HostParam("Endpoint") String endpoint, + @PathParam("testId") String testId, + @PathParam("fileId") String fileId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Delete("/loadtests/{testId}/files/{fileId}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteTestFile( + @HostParam("Endpoint") String endpoint, + @PathParam("testId") String testId, + @PathParam("fileId") String fileId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/loadtests/{testId}/files") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAllTestFiles( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("testId") String testId, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listLoadTestSearchNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("Endpoint") String endpoint, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAllTestFilesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("Endpoint") String endpoint, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + } + + /** + * Associate an App Component (Azure resource) to a test or test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param body App Component model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Components model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateAppComponentsWithResponseAsync( + String name, BinaryData body, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.createOrUpdateAppComponents( + this.client.getEndpoint(), + name, + this.client.getServiceVersion().getVersion(), + body, + accept, + requestOptions, + context)); + } + + /** + * Associate an App Component (Azure resource) to a test or test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param body App Component model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Components model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateAppComponentsWithResponseAsync( + String name, BinaryData body, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.createOrUpdateAppComponents( + this.client.getEndpoint(), + name, + this.client.getServiceVersion().getVersion(), + body, + accept, + requestOptions, + context); + } + + /** + * Associate an App Component (Azure resource) to a test or test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param body App Component model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Components model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateAppComponentsWithResponse( + String name, BinaryData body, RequestOptions requestOptions) { + return createOrUpdateAppComponentsWithResponseAsync(name, body, requestOptions).block(); + } + + /** + * Delete an App Component. + * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteAppComponentWithResponseAsync(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.deleteAppComponent( + this.client.getEndpoint(), + name, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Delete an App Component. + * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteAppComponentWithResponseAsync( + String name, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.deleteAppComponent( + this.client.getEndpoint(), + name, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Delete an App Component. + * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteAppComponentWithResponse(String name, RequestOptions requestOptions) { + return deleteAppComponentWithResponseAsync(name, requestOptions).block(); + } + + /** + * Get App Component details by App Component name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Component details by App Component name along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAppComponentByNameWithResponseAsync( + String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getAppComponentByName( + this.client.getEndpoint(), + name, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Get App Component details by App Component name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Component details by App Component name along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAppComponentByNameWithResponseAsync( + String name, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getAppComponentByName( + this.client.getEndpoint(), + name, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Get App Component details by App Component name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name of the App Component, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Component details by App Component name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAppComponentByNameWithResponse(String name, RequestOptions requestOptions) { + return getAppComponentByNameWithResponseAsync(name, requestOptions).block(); + } + + /** + * Get App Components for a test or a test run by its name. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
testRunIdStringNo[Required, if testId is not provided] Test run Id.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Components for a test or a test run by its name along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAppComponentWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getAppComponent( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Get App Components for a test or a test run by its name. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
testRunIdStringNo[Required, if testId is not provided] Test run Id.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Components for a test or a test run by its name along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAppComponentWithResponseAsync(RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getAppComponent( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Get App Components for a test or a test run by its name. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
testRunIdStringNo[Required, if testId is not provided] Test run Id.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resourceId: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     name: String (Optional)
+     *     value (Required): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Required)
+     *             resourceType: String (Required)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return app Components for a test or a test run by its name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAppComponentWithResponse(RequestOptions requestOptions) { + return getAppComponentWithResponseAsync(requestOptions).block(); + } + + /** + * Configure server metrics for a test or test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Server metrics configuration model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics config model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateServerMetricsConfigWithResponseAsync( + String name, BinaryData body, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.createOrUpdateServerMetricsConfig( + this.client.getEndpoint(), + name, + this.client.getServiceVersion().getVersion(), + body, + accept, + requestOptions, + context)); + } + + /** + * Configure server metrics for a test or test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Server metrics configuration model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics config model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateServerMetricsConfigWithResponseAsync( + String name, BinaryData body, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.createOrUpdateServerMetricsConfig( + this.client.getEndpoint(), + name, + this.client.getServiceVersion().getVersion(), + body, + accept, + requestOptions, + context); + } + + /** + * Configure server metrics for a test or test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Server metrics configuration model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics config model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateServerMetricsConfigWithResponse( + String name, BinaryData body, RequestOptions requestOptions) { + return createOrUpdateServerMetricsConfigWithResponseAsync(name, body, requestOptions).block(); + } + + /** + * Get server metrics configuration by its name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics configuration by its name along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServerMetricsByNameWithResponseAsync( + String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getServerMetricsByName( + this.client.getEndpoint(), + name, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Get server metrics configuration by its name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics configuration by its name along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServerMetricsByNameWithResponseAsync( + String name, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getServerMetricsByName( + this.client.getEndpoint(), + name, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Get server metrics configuration by its name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics configuration by its name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getServerMetricsByNameWithResponse(String name, RequestOptions requestOptions) { + return getServerMetricsByNameWithResponseAsync(name, requestOptions).block(); + } + + /** + * Delete server metrics configuration by its name. + * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteServerMetricsWithResponseAsync(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.deleteServerMetrics( + this.client.getEndpoint(), + name, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Delete server metrics configuration by its name. + * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteServerMetricsWithResponseAsync( + String name, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.deleteServerMetrics( + this.client.getEndpoint(), + name, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Delete server metrics configuration by its name. + * + * @param name Unique name for server metrics, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteServerMetricsWithResponse(String name, RequestOptions requestOptions) { + return deleteServerMetricsWithResponseAsync(name, requestOptions).block(); + } + + /** + * Get server metrics configuration for a test or test run by its name. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
testRunIdStringNo[Required, if testId is not provided] Test run Id.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics configuration for a test or test run by its name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServerMetricsWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getServerMetrics( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Get server metrics configuration for a test or test run by its name. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
testRunIdStringNo[Required, if testId is not provided] Test run Id.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics configuration for a test or test run by its name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServerMetricsWithResponseAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getServerMetrics( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Get server metrics configuration for a test or test run by its name. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
testRunIdStringNo[Required, if testId is not provided] Test run Id.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String (Optional)
+     *     testId: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Optional): {
+     *             id: String (Optional)
+     *             resourceId: String (Required)
+     *             metricnamespace: String (Required)
+     *             displayDescription: String (Optional)
+     *             name (Required): {
+     *                 value: String (Required)
+     *                 localizedValue: String (Required)
+     *             }
+     *             aggregation: String (Required)
+     *             unit: String (Optional)
+     *             resourceType: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return server metrics configuration for a test or test run by its name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getServerMetricsWithResponse(RequestOptions requestOptions) { + return getServerMetricsWithResponseAsync(requestOptions).block(); + } + + /** + * Get all default server metrics configuration for supported resource types. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     defaultMetrics (Optional): {
+     *         String (Optional): [
+     *              (Optional){
+     *                 metricnamespace: String (Optional)
+     *                 aggregation: String (Optional)
+     *                 name (Optional): {
+     *                     value: String (Optional)
+     *                     localizedValue: String (Optional)
+     *                 }
+     *                 unit: String (Optional)
+     *                 displayDescription: String (Optional)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all default server metrics configuration for supported resource types along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServerDefaultMetricsWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getServerDefaultMetrics( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Get all default server metrics configuration for supported resource types. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     defaultMetrics (Optional): {
+     *         String (Optional): [
+     *              (Optional){
+     *                 metricnamespace: String (Optional)
+     *                 aggregation: String (Optional)
+     *                 name (Optional): {
+     *                     value: String (Optional)
+     *                     localizedValue: String (Optional)
+     *                 }
+     *                 unit: String (Optional)
+     *                 displayDescription: String (Optional)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all default server metrics configuration for supported resource types along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServerDefaultMetricsWithResponseAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getServerDefaultMetrics( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Get all default server metrics configuration for supported resource types. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     defaultMetrics (Optional): {
+     *         String (Optional): [
+     *              (Optional){
+     *                 metricnamespace: String (Optional)
+     *                 aggregation: String (Optional)
+     *                 name (Optional): {
+     *                     value: String (Optional)
+     *                     localizedValue: String (Optional)
+     *                 }
+     *                 unit: String (Optional)
+     *                 displayDescription: String (Optional)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all default server metrics configuration for supported resource types along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getServerDefaultMetricsWithResponse(RequestOptions requestOptions) { + return getServerDefaultMetricsWithResponseAsync(requestOptions).block(); + } + + /** + * Get all supported resource types for App Components(Azure resource types). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all supported resource types for App Components(Azure resource types) along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSupportedResourceTypeWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.listSupportedResourceType( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Get all supported resource types for App Components(Azure resource types). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all supported resource types for App Components(Azure resource types) along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listSupportedResourceTypeWithResponseAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.listSupportedResourceType( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Get all supported resource types for App Components(Azure resource types). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all supported resource types for App Components(Azure resource types) along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listSupportedResourceTypeWithResponse(RequestOptions requestOptions) { + return listSupportedResourceTypeWithResponseAsync(requestOptions).block(); + } + + /** + * Create a new test or Update an existing test. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Load test model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateTestWithResponseAsync( + String testId, BinaryData body, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.createOrUpdateTest( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + testId, + body, + accept, + requestOptions, + context)); + } + + /** + * Create a new test or Update an existing test. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Load test model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateTestWithResponseAsync( + String testId, BinaryData body, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.createOrUpdateTest( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + testId, + body, + accept, + requestOptions, + context); + } + + /** + * Create a new test or Update an existing test. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Load test model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateTestWithResponse( + String testId, BinaryData body, RequestOptions requestOptions) { + return createOrUpdateTestWithResponseAsync(testId, body, requestOptions).block(); + } + + /** + * Delete a test by its name. + * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteLoadTestWithResponseAsync(String testId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.deleteLoadTest( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + testId, + accept, + requestOptions, + context)); + } + + /** + * Delete a test by its name. + * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteLoadTestWithResponseAsync( + String testId, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.deleteLoadTest( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + testId, + accept, + requestOptions, + context); + } + + /** + * Delete a test by its name. + * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteLoadTestWithResponse(String testId, RequestOptions requestOptions) { + return deleteLoadTestWithResponseAsync(testId, requestOptions).block(); + } + + /** + * Get load test details by test name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test details by test name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getLoadTestWithResponseAsync(String testId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getLoadTest( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + testId, + accept, + requestOptions, + context)); + } + + /** + * Get load test details by test name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test details by test name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getLoadTestWithResponseAsync( + String testId, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getLoadTest( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + testId, + accept, + requestOptions, + context); + } + + /** + * Get load test details by test name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     resourceId: String (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configUrl (Optional): {
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *         testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *         userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *         inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *         additionalUrls (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     subnetId: String (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test details by test name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getLoadTestWithResponse(String testId, RequestOptions requestOptions) { + return getLoadTestWithResponseAsync(testId, requestOptions).block(); + } + + /** + * Get all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderByStringNoSort on one of the field - lastModifiedDateTime, displayName, createdBy in (field asc/desc) format. eg: displayName asc.
searchStringNoFilter search based on searchable fields - testId, createdBy.
lastUpdatedStartTimeOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
lastUpdatedEndTimeOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
continuationTokenStringNoContinuation token to get the next page of response.
maxPageSizeIntegerNoNumber of results in response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testId: String (Optional)
+     *             description: String (Optional)
+     *             displayName: String (Optional)
+     *             resourceId: String (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             inputArtifacts (Optional): {
+     *                 configUrl (Optional): {
+     *                     url: String (Optional)
+     *                     fileId: String (Optional)
+     *                     filename: String (Optional)
+     *                     fileType: String(0/1/2) (Optional)
+     *                     expireTime: OffsetDateTime (Optional)
+     *                     validationStatus: String (Optional)
+     *                 }
+     *                 testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                 userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                 inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                 additionalUrls (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             subnetId: String (Optional)
+     *             keyvaultReferenceIdentityType: String (Optional)
+     *             keyvaultReferenceIdentityId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName} along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listLoadTestSearchSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.listLoadTestSearch( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderByStringNoSort on one of the field - lastModifiedDateTime, displayName, createdBy in (field asc/desc) format. eg: displayName asc.
searchStringNoFilter search based on searchable fields - testId, createdBy.
lastUpdatedStartTimeOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
lastUpdatedEndTimeOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
continuationTokenStringNoContinuation token to get the next page of response.
maxPageSizeIntegerNoNumber of results in response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testId: String (Optional)
+     *             description: String (Optional)
+     *             displayName: String (Optional)
+     *             resourceId: String (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             inputArtifacts (Optional): {
+     *                 configUrl (Optional): {
+     *                     url: String (Optional)
+     *                     fileId: String (Optional)
+     *                     filename: String (Optional)
+     *                     fileType: String(0/1/2) (Optional)
+     *                     expireTime: OffsetDateTime (Optional)
+     *                     validationStatus: String (Optional)
+     *                 }
+     *                 testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                 userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                 inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                 additionalUrls (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             subnetId: String (Optional)
+     *             keyvaultReferenceIdentityType: String (Optional)
+     *             keyvaultReferenceIdentityId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName} along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listLoadTestSearchSinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.listLoadTestSearch( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderByStringNoSort on one of the field - lastModifiedDateTime, displayName, createdBy in (field asc/desc) format. eg: displayName asc.
searchStringNoFilter search based on searchable fields - testId, createdBy.
lastUpdatedStartTimeOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
lastUpdatedEndTimeOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
continuationTokenStringNoContinuation token to get the next page of response.
maxPageSizeIntegerNoNumber of results in response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testId: String (Optional)
+     *             description: String (Optional)
+     *             displayName: String (Optional)
+     *             resourceId: String (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             inputArtifacts (Optional): {
+     *                 configUrl (Optional): {
+     *                     url: String (Optional)
+     *                     fileId: String (Optional)
+     *                     filename: String (Optional)
+     *                     fileType: String(0/1/2) (Optional)
+     *                     expireTime: OffsetDateTime (Optional)
+     *                     validationStatus: String (Optional)
+     *                 }
+     *                 testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                 userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                 inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                 additionalUrls (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             subnetId: String (Optional)
+     *             keyvaultReferenceIdentityType: String (Optional)
+     *             keyvaultReferenceIdentityId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName} as + * paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listLoadTestSearchAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE); + return new PagedFlux<>( + () -> listLoadTestSearchSinglePageAsync(requestOptions), + nextLink -> listLoadTestSearchNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Get all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderByStringNoSort on one of the field - lastModifiedDateTime, displayName, createdBy in (field asc/desc) format. eg: displayName asc.
searchStringNoFilter search based on searchable fields - testId, createdBy.
lastUpdatedStartTimeOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
lastUpdatedEndTimeOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
continuationTokenStringNoContinuation token to get the next page of response.
maxPageSizeIntegerNoNumber of results in response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testId: String (Optional)
+     *             description: String (Optional)
+     *             displayName: String (Optional)
+     *             resourceId: String (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             inputArtifacts (Optional): {
+     *                 configUrl (Optional): {
+     *                     url: String (Optional)
+     *                     fileId: String (Optional)
+     *                     filename: String (Optional)
+     *                     fileType: String(0/1/2) (Optional)
+     *                     expireTime: OffsetDateTime (Optional)
+     *                     validationStatus: String (Optional)
+     *                 }
+     *                 testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                 userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                 inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                 additionalUrls (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             subnetId: String (Optional)
+     *             keyvaultReferenceIdentityType: String (Optional)
+     *             keyvaultReferenceIdentityId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName} as + * paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listLoadTestSearchAsync(RequestOptions requestOptions, Context context) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE); + return new PagedFlux<>( + () -> listLoadTestSearchSinglePageAsync(requestOptions, context), + nextLink -> listLoadTestSearchNextSinglePageAsync(nextLink, requestOptionsForNextPage, context)); + } + + /** + * Get all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderByStringNoSort on one of the field - lastModifiedDateTime, displayName, createdBy in (field asc/desc) format. eg: displayName asc.
searchStringNoFilter search based on searchable fields - testId, createdBy.
lastUpdatedStartTimeOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
lastUpdatedEndTimeOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
continuationTokenStringNoContinuation token to get the next page of response.
maxPageSizeIntegerNoNumber of results in response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testId: String (Optional)
+     *             description: String (Optional)
+     *             displayName: String (Optional)
+     *             resourceId: String (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             inputArtifacts (Optional): {
+     *                 configUrl (Optional): {
+     *                     url: String (Optional)
+     *                     fileId: String (Optional)
+     *                     filename: String (Optional)
+     *                     fileType: String(0/1/2) (Optional)
+     *                     expireTime: OffsetDateTime (Optional)
+     *                     validationStatus: String (Optional)
+     *                 }
+     *                 testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                 userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                 inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                 additionalUrls (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             subnetId: String (Optional)
+     *             keyvaultReferenceIdentityType: String (Optional)
+     *             keyvaultReferenceIdentityId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName} as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLoadTestSearch(RequestOptions requestOptions) { + return new PagedIterable<>(listLoadTestSearchAsync(requestOptions)); + } + + /** + * Upload input file for a given test name. File size can't be more than 50 MB. Existing file with same name for the + * given test will be overwritten. File should be provided in the request body as multipart/form-data. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fileTypeIntegerNoInteger representation of the file type (0 = JMX_FILE, 1 = USER_PROPERTIES, 2 = ADDITIONAL_ARTIFACTS).
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param file The file to be uploaded. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return fileUrl Model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadTestFileWithResponseAsync( + String testId, String fileId, BinaryData file, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.uploadTestFile( + this.client.getEndpoint(), + testId, + fileId, + this.client.getServiceVersion().getVersion(), + file, + accept, + requestOptions, + context)); + } + + /** + * Upload input file for a given test name. File size can't be more than 50 MB. Existing file with same name for the + * given test will be overwritten. File should be provided in the request body as multipart/form-data. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fileTypeIntegerNoInteger representation of the file type (0 = JMX_FILE, 1 = USER_PROPERTIES, 2 = ADDITIONAL_ARTIFACTS).
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param file The file to be uploaded. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return fileUrl Model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadTestFileWithResponseAsync( + String testId, String fileId, BinaryData file, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.uploadTestFile( + this.client.getEndpoint(), + testId, + fileId, + this.client.getServiceVersion().getVersion(), + file, + accept, + requestOptions, + context); + } + + /** + * Upload input file for a given test name. File size can't be more than 50 MB. Existing file with same name for the + * given test will be overwritten. File should be provided in the request body as multipart/form-data. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fileTypeIntegerNoInteger representation of the file type (0 = JMX_FILE, 1 = USER_PROPERTIES, 2 = ADDITIONAL_ARTIFACTS).
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param file The file to be uploaded. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return fileUrl Model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadTestFileWithResponse( + String testId, String fileId, BinaryData file, RequestOptions requestOptions) { + return uploadTestFileWithResponseAsync(testId, fileId, file, requestOptions).block(); + } + + /** + * Get test file by the file name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test file by the file name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestFileWithResponseAsync( + String testId, String fileId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getTestFile( + this.client.getEndpoint(), + testId, + fileId, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Get test file by the file name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test file by the file name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestFileWithResponseAsync( + String testId, String fileId, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getTestFile( + this.client.getEndpoint(), + testId, + fileId, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Get test file by the file name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test file by the file name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestFileWithResponse(String testId, String fileId, RequestOptions requestOptions) { + return getTestFileWithResponseAsync(testId, fileId, requestOptions).block(); + } + + /** + * Delete file by the file name for a test. + * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteTestFileWithResponseAsync( + String testId, String fileId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.deleteTestFile( + this.client.getEndpoint(), + testId, + fileId, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Delete file by the file name for a test. + * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteTestFileWithResponseAsync( + String testId, String fileId, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.deleteTestFile( + this.client.getEndpoint(), + testId, + fileId, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Delete file by the file name for a test. + * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteTestFileWithResponse(String testId, String fileId, RequestOptions requestOptions) { + return deleteTestFileWithResponseAsync(testId, fileId, requestOptions).block(); + } + + /** + * Get all test files. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
continuationTokenStringNoContinuation token to get the next page of response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test files along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllTestFilesSinglePageAsync( + String testId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getAllTestFiles( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + testId, + accept, + requestOptions, + context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get all test files. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
continuationTokenStringNoContinuation token to get the next page of response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test files along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllTestFilesSinglePageAsync( + String testId, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getAllTestFiles( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + testId, + accept, + requestOptions, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get all test files. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
continuationTokenStringNoContinuation token to get the next page of response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test files as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getAllTestFilesAsync(String testId, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE); + return new PagedFlux<>( + () -> getAllTestFilesSinglePageAsync(testId, requestOptions), + nextLink -> getAllTestFilesNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Get all test files. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
continuationTokenStringNoContinuation token to get the next page of response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test files as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getAllTestFilesAsync(String testId, RequestOptions requestOptions, Context context) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE); + return new PagedFlux<>( + () -> getAllTestFilesSinglePageAsync(testId, requestOptions, context), + nextLink -> getAllTestFilesNextSinglePageAsync(nextLink, requestOptionsForNextPage, context)); + } + + /** + * Get all test files. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
continuationTokenStringNoContinuation token to get the next page of response.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test files as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getAllTestFiles(String testId, RequestOptions requestOptions) { + return new PagedIterable<>(getAllTestFilesAsync(testId, requestOptions)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testId: String (Optional)
+     *             description: String (Optional)
+     *             displayName: String (Optional)
+     *             resourceId: String (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             inputArtifacts (Optional): {
+     *                 configUrl (Optional): {
+     *                     url: String (Optional)
+     *                     fileId: String (Optional)
+     *                     filename: String (Optional)
+     *                     fileType: String(0/1/2) (Optional)
+     *                     expireTime: OffsetDateTime (Optional)
+     *                     validationStatus: String (Optional)
+     *                 }
+     *                 testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                 userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                 inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                 additionalUrls (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             subnetId: String (Optional)
+     *             keyvaultReferenceIdentityType: String (Optional)
+     *             keyvaultReferenceIdentityId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return list of Resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listLoadTestSearchNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.listLoadTestSearchNext( + nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testId: String (Optional)
+     *             description: String (Optional)
+     *             displayName: String (Optional)
+     *             resourceId: String (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             inputArtifacts (Optional): {
+     *                 configUrl (Optional): {
+     *                     url: String (Optional)
+     *                     fileId: String (Optional)
+     *                     filename: String (Optional)
+     *                     fileType: String(0/1/2) (Optional)
+     *                     expireTime: OffsetDateTime (Optional)
+     *                     validationStatus: String (Optional)
+     *                 }
+     *                 testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                 userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                 inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                 additionalUrls (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             subnetId: String (Optional)
+     *             keyvaultReferenceIdentityType: String (Optional)
+     *             keyvaultReferenceIdentityId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return list of Resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listLoadTestSearchNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.listLoadTestSearchNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllTestFilesNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getAllTestFilesNext( + nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             url: String (Optional)
+     *             fileId: String (Optional)
+     *             filename: String (Optional)
+     *             fileType: String(0/1/2) (Optional)
+     *             expireTime: OffsetDateTime (Optional)
+     *             validationStatus: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllTestFilesNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getAllTestFilesNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestingClientImpl.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestingClientImpl.java new file mode 100644 index 0000000000000..1019d4c2ad952 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestingClientImpl.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.developer.loadtesting.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.developer.loadtesting.LoadTestingServiceVersion; + +/** Initializes a new instance of the LoadTestingClient type. */ +public final class LoadTestingClientImpl { + /** URL to perform data plane API operations on the resource. */ + private final String endpoint; + + /** + * Gets URL to perform data plane API operations on the resource. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Service version. */ + private final LoadTestingServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public LoadTestingServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The LoadTestAdministrationsImpl object to access its operations. */ + private final LoadTestAdministrationsImpl loadTestAdministrations; + + /** + * Gets the LoadTestAdministrationsImpl object to access its operations. + * + * @return the LoadTestAdministrationsImpl object. + */ + public LoadTestAdministrationsImpl getLoadTestAdministrations() { + return this.loadTestAdministrations; + } + + /** The TestRunsImpl object to access its operations. */ + private final TestRunsImpl testRuns; + + /** + * Gets the TestRunsImpl object to access its operations. + * + * @return the TestRunsImpl object. + */ + public TestRunsImpl getTestRuns() { + return this.testRuns; + } + + /** + * Initializes an instance of LoadTestingClient client. + * + * @param endpoint URL to perform data plane API operations on the resource. + * @param serviceVersion Service version. + */ + public LoadTestingClientImpl(String endpoint, LoadTestingServiceVersion serviceVersion) { + this( + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(), + JacksonAdapter.createDefaultSerializerAdapter(), + endpoint, + serviceVersion); + } + + /** + * Initializes an instance of LoadTestingClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint URL to perform data plane API operations on the resource. + * @param serviceVersion Service version. + */ + public LoadTestingClientImpl(HttpPipeline httpPipeline, String endpoint, LoadTestingServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of LoadTestingClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint URL to perform data plane API operations on the resource. + * @param serviceVersion Service version. + */ + public LoadTestingClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + String endpoint, + LoadTestingServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.loadTestAdministrations = new LoadTestAdministrationsImpl(this); + this.testRuns = new TestRunsImpl(this); + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/TestRunsImpl.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/TestRunsImpl.java new file mode 100644 index 0000000000000..bd605590ef5bd --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/TestRunsImpl.java @@ -0,0 +1,3097 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.developer.loadtesting.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TestRuns. */ +public final class TestRunsImpl { + /** The proxy service used to perform REST calls. */ + private final TestRunsService service; + + /** The service client containing this operation class. */ + private final LoadTestingClientImpl client; + + /** + * Initializes an instance of TestRunsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestRunsImpl(LoadTestingClientImpl client) { + this.service = RestProxy.create(TestRunsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for LoadTestingClientTestRuns to be used by the proxy service to perform + * REST calls. + */ + @Host("https://{Endpoint}") + @ServiceInterface(name = "LoadTestingClientTes") + private interface TestRunsService { + @Delete("/testruns/{testRunId}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteTestRun( + @HostParam("Endpoint") String endpoint, + @PathParam("testRunId") String testRunId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Patch("/testruns/{testRunId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrUpdateTestRun( + @HostParam("Endpoint") String endpoint, + @PathParam("testRunId") String testRunId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/merge-patch+json") BinaryData body, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/testruns/{testRunId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTestRun( + @HostParam("Endpoint") String endpoint, + @PathParam("testRunId") String testRunId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/testruns/{testRunId}/files/{fileId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTestRunFile( + @HostParam("Endpoint") String endpoint, + @PathParam("testRunId") String testRunId, + @PathParam("fileId") String fileId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/testruns/sortAndFilter") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listTestRunsSearch( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Post("/testruns/{testRunId}:stop") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> stopTestRun( + @HostParam("Endpoint") String endpoint, + @PathParam("testRunId") String testRunId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Post("/testruns/{testRunId}/clientMetrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTestRunClientMetrics( + @HostParam("Endpoint") String endpoint, + @PathParam("testRunId") String testRunId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BinaryData body, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/testruns/{testRunId}/clientMetricsFilters") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTestRunClientMetricsFilters( + @HostParam("Endpoint") String endpoint, + @PathParam("testRunId") String testRunId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listTestRunsSearchNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("Endpoint") String endpoint, + @HeaderParam("Accept") String accept, + RequestOptions requestOptions, + Context context); + } + + /** + * Delete a test run by its name. + * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteTestRunWithResponseAsync(String testRunId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.deleteTestRun( + this.client.getEndpoint(), + testRunId, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Delete a test run by its name. + * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteTestRunWithResponseAsync( + String testRunId, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.deleteTestRun( + this.client.getEndpoint(), + testRunId, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Delete a test run by its name. + * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteTestRunWithResponse(String testRunId, RequestOptions requestOptions) { + return deleteTestRunWithResponseAsync(testRunId, requestOptions).block(); + } + + /** + * Create and start a new test run with the given name. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
oldTestRunIdStringNoExisting test run Id that should be rerun.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Load test run model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test run model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateTestRunWithResponseAsync( + String testRunId, BinaryData body, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.createOrUpdateTestRun( + this.client.getEndpoint(), + testRunId, + this.client.getServiceVersion().getVersion(), + body, + accept, + requestOptions, + context)); + } + + /** + * Create and start a new test run with the given name. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
oldTestRunIdStringNoExisting test run Id that should be rerun.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Load test run model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test run model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateTestRunWithResponseAsync( + String testRunId, BinaryData body, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.createOrUpdateTestRun( + this.client.getEndpoint(), + testRunId, + this.client.getServiceVersion().getVersion(), + body, + accept, + requestOptions, + context); + } + + /** + * Create and start a new test run with the given name. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
oldTestRunIdStringNoExisting test run Id that should be rerun.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Load test run model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test run model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateTestRunWithResponse( + String testRunId, BinaryData body, RequestOptions requestOptions) { + return createOrUpdateTestRunWithResponseAsync(testRunId, body, requestOptions).block(); + } + + /** + * Get test run details by name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test run details by name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestRunWithResponseAsync(String testRunId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getTestRun( + this.client.getEndpoint(), + testRunId, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Get test run details by name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test run details by name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestRunWithResponseAsync( + String testRunId, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getTestRun( + this.client.getEndpoint(), + testRunId, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Get test run details by name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test run details by name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestRunWithResponse(String testRunId, RequestOptions requestOptions) { + return getTestRunWithResponseAsync(testRunId, requestOptions).block(); + } + + /** + * Get test run file by file name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test run file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test run file by file name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestRunFileWithResponseAsync( + String testRunId, String fileId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getTestRunFile( + this.client.getEndpoint(), + testRunId, + fileId, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Get test run file by file name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test run file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test run file by file name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestRunFileWithResponseAsync( + String testRunId, String fileId, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getTestRunFile( + this.client.getEndpoint(), + testRunId, + fileId, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Get test run file by file name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     url: String (Optional)
+     *     fileId: String (Optional)
+     *     filename: String (Optional)
+     *     fileType: String(0/1/2) (Optional)
+     *     expireTime: OffsetDateTime (Optional)
+     *     validationStatus: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param fileId Unique identifier for test run file, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test run file by file name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestRunFileWithResponse( + String testRunId, String fileId, RequestOptions requestOptions) { + return getTestRunFileWithResponseAsync(testRunId, fileId, requestOptions).block(); + } + + /** + * Get all test runs with given filters. + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderByStringNoSort on one of the field - status, displayName, executedDateTime in (field asc/desc) format. eg: displayName asc.
continuationTokenStringNoContinuation token to get the next page of response.
searchStringNoFilter search based on searchable fields - description, executedUser.
executionFromOffsetDateTimeNoThe end DateTime(ISO 8601 literal format) of test-run execution time filter range.
executionToOffsetDateTimeNoThe start DateTime(ISO 8601 literal format) of test-run execution time filter range.
statusStringNoComma separated list of test run status, value can be - "ACCEPTED", "NOTSTARTED","PROVISIONING","PROVISIONED","CONFIGURING", + * "CONFIGURED","EXECUTING","EXECUTED","DEPROVISIONING","DEPROVISIONED","DONE","CANCELLED","FAILED".
maxPageSizeIntegerNoNumber of results in response.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testRunId: String (Optional)
+     *             displayName: String (Optional)
+     *             testId: String (Optional)
+     *             resourceId: String (Optional)
+     *             description: String (Optional)
+     *             status: String (Optional)
+     *             startDateTime: OffsetDateTime (Optional)
+     *             endDateTime: OffsetDateTime (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             testResult: String (Optional)
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             testArtifacts (Optional): {
+     *                 inputArtifacts (Required): {
+     *                     configUrl (Optional): {
+     *                         url: String (Optional)
+     *                         fileId: String (Optional)
+     *                         filename: String (Optional)
+     *                         fileType: String(0/1/2) (Optional)
+     *                         expireTime: OffsetDateTime (Optional)
+     *                         validationStatus: String (Optional)
+     *                     }
+     *                     testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                     userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                     inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                     additionalUrls (Optional): [
+     *                         (recursive schema, see above)
+     *                     ]
+     *                 }
+     *                 outputArtifacts (Optional): {
+     *                     resultUrl (Optional): (recursive schema, see resultUrl above)
+     *                     logsUrl (Optional): (recursive schema, see logsUrl above)
+     *                 }
+     *             }
+     *             executedDateTime: OffsetDateTime (Optional)
+     *             vusers: Integer (Optional)
+     *             testRunStatistics (Optional): {
+     *                 String (Optional): {
+     *                     transaction: String (Optional)
+     *                     sampleCount: Double (Optional)
+     *                     errorCount: Double (Optional)
+     *                     errorPct: Double (Optional)
+     *                     meanResTime: Double (Optional)
+     *                     medianResTime: Double (Optional)
+     *                     maxResTime: Double (Optional)
+     *                     minResTime: Double (Optional)
+     *                     pct1ResTime: Double (Optional)
+     *                     pct2ResTime: Double (Optional)
+     *                     pct3ResTime: Double (Optional)
+     *                     throughput: Double (Optional)
+     *                     receivedKBytesPerSec: Double (Optional)
+     *                     sentKBytesPerSec: Double (Optional)
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             portalUrl: String (Optional)
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             duration: Long (Optional)
+     *             subnetId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test runs with given filters along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listTestRunsSearchSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.listTestRunsSearch( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get all test runs with given filters. + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderByStringNoSort on one of the field - status, displayName, executedDateTime in (field asc/desc) format. eg: displayName asc.
continuationTokenStringNoContinuation token to get the next page of response.
searchStringNoFilter search based on searchable fields - description, executedUser.
executionFromOffsetDateTimeNoThe end DateTime(ISO 8601 literal format) of test-run execution time filter range.
executionToOffsetDateTimeNoThe start DateTime(ISO 8601 literal format) of test-run execution time filter range.
statusStringNoComma separated list of test run status, value can be - "ACCEPTED", "NOTSTARTED","PROVISIONING","PROVISIONED","CONFIGURING", + * "CONFIGURED","EXECUTING","EXECUTED","DEPROVISIONING","DEPROVISIONED","DONE","CANCELLED","FAILED".
maxPageSizeIntegerNoNumber of results in response.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testRunId: String (Optional)
+     *             displayName: String (Optional)
+     *             testId: String (Optional)
+     *             resourceId: String (Optional)
+     *             description: String (Optional)
+     *             status: String (Optional)
+     *             startDateTime: OffsetDateTime (Optional)
+     *             endDateTime: OffsetDateTime (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             testResult: String (Optional)
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             testArtifacts (Optional): {
+     *                 inputArtifacts (Required): {
+     *                     configUrl (Optional): {
+     *                         url: String (Optional)
+     *                         fileId: String (Optional)
+     *                         filename: String (Optional)
+     *                         fileType: String(0/1/2) (Optional)
+     *                         expireTime: OffsetDateTime (Optional)
+     *                         validationStatus: String (Optional)
+     *                     }
+     *                     testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                     userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                     inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                     additionalUrls (Optional): [
+     *                         (recursive schema, see above)
+     *                     ]
+     *                 }
+     *                 outputArtifacts (Optional): {
+     *                     resultUrl (Optional): (recursive schema, see resultUrl above)
+     *                     logsUrl (Optional): (recursive schema, see logsUrl above)
+     *                 }
+     *             }
+     *             executedDateTime: OffsetDateTime (Optional)
+     *             vusers: Integer (Optional)
+     *             testRunStatistics (Optional): {
+     *                 String (Optional): {
+     *                     transaction: String (Optional)
+     *                     sampleCount: Double (Optional)
+     *                     errorCount: Double (Optional)
+     *                     errorPct: Double (Optional)
+     *                     meanResTime: Double (Optional)
+     *                     medianResTime: Double (Optional)
+     *                     maxResTime: Double (Optional)
+     *                     minResTime: Double (Optional)
+     *                     pct1ResTime: Double (Optional)
+     *                     pct2ResTime: Double (Optional)
+     *                     pct3ResTime: Double (Optional)
+     *                     throughput: Double (Optional)
+     *                     receivedKBytesPerSec: Double (Optional)
+     *                     sentKBytesPerSec: Double (Optional)
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             portalUrl: String (Optional)
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             duration: Long (Optional)
+     *             subnetId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test runs with given filters along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listTestRunsSearchSinglePageAsync( + RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.listTestRunsSearch( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get all test runs with given filters. + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderByStringNoSort on one of the field - status, displayName, executedDateTime in (field asc/desc) format. eg: displayName asc.
continuationTokenStringNoContinuation token to get the next page of response.
searchStringNoFilter search based on searchable fields - description, executedUser.
executionFromOffsetDateTimeNoThe end DateTime(ISO 8601 literal format) of test-run execution time filter range.
executionToOffsetDateTimeNoThe start DateTime(ISO 8601 literal format) of test-run execution time filter range.
statusStringNoComma separated list of test run status, value can be - "ACCEPTED", "NOTSTARTED","PROVISIONING","PROVISIONED","CONFIGURING", + * "CONFIGURED","EXECUTING","EXECUTED","DEPROVISIONING","DEPROVISIONED","DONE","CANCELLED","FAILED".
maxPageSizeIntegerNoNumber of results in response.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testRunId: String (Optional)
+     *             displayName: String (Optional)
+     *             testId: String (Optional)
+     *             resourceId: String (Optional)
+     *             description: String (Optional)
+     *             status: String (Optional)
+     *             startDateTime: OffsetDateTime (Optional)
+     *             endDateTime: OffsetDateTime (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             testResult: String (Optional)
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             testArtifacts (Optional): {
+     *                 inputArtifacts (Required): {
+     *                     configUrl (Optional): {
+     *                         url: String (Optional)
+     *                         fileId: String (Optional)
+     *                         filename: String (Optional)
+     *                         fileType: String(0/1/2) (Optional)
+     *                         expireTime: OffsetDateTime (Optional)
+     *                         validationStatus: String (Optional)
+     *                     }
+     *                     testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                     userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                     inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                     additionalUrls (Optional): [
+     *                         (recursive schema, see above)
+     *                     ]
+     *                 }
+     *                 outputArtifacts (Optional): {
+     *                     resultUrl (Optional): (recursive schema, see resultUrl above)
+     *                     logsUrl (Optional): (recursive schema, see logsUrl above)
+     *                 }
+     *             }
+     *             executedDateTime: OffsetDateTime (Optional)
+     *             vusers: Integer (Optional)
+     *             testRunStatistics (Optional): {
+     *                 String (Optional): {
+     *                     transaction: String (Optional)
+     *                     sampleCount: Double (Optional)
+     *                     errorCount: Double (Optional)
+     *                     errorPct: Double (Optional)
+     *                     meanResTime: Double (Optional)
+     *                     medianResTime: Double (Optional)
+     *                     maxResTime: Double (Optional)
+     *                     minResTime: Double (Optional)
+     *                     pct1ResTime: Double (Optional)
+     *                     pct2ResTime: Double (Optional)
+     *                     pct3ResTime: Double (Optional)
+     *                     throughput: Double (Optional)
+     *                     receivedKBytesPerSec: Double (Optional)
+     *                     sentKBytesPerSec: Double (Optional)
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             portalUrl: String (Optional)
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             duration: Long (Optional)
+     *             subnetId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test runs with given filters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestRunsSearchAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE); + return new PagedFlux<>( + () -> listTestRunsSearchSinglePageAsync(requestOptions), + nextLink -> listTestRunsSearchNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Get all test runs with given filters. + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderByStringNoSort on one of the field - status, displayName, executedDateTime in (field asc/desc) format. eg: displayName asc.
continuationTokenStringNoContinuation token to get the next page of response.
searchStringNoFilter search based on searchable fields - description, executedUser.
executionFromOffsetDateTimeNoThe end DateTime(ISO 8601 literal format) of test-run execution time filter range.
executionToOffsetDateTimeNoThe start DateTime(ISO 8601 literal format) of test-run execution time filter range.
statusStringNoComma separated list of test run status, value can be - "ACCEPTED", "NOTSTARTED","PROVISIONING","PROVISIONED","CONFIGURING", + * "CONFIGURED","EXECUTING","EXECUTED","DEPROVISIONING","DEPROVISIONED","DONE","CANCELLED","FAILED".
maxPageSizeIntegerNoNumber of results in response.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testRunId: String (Optional)
+     *             displayName: String (Optional)
+     *             testId: String (Optional)
+     *             resourceId: String (Optional)
+     *             description: String (Optional)
+     *             status: String (Optional)
+     *             startDateTime: OffsetDateTime (Optional)
+     *             endDateTime: OffsetDateTime (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             testResult: String (Optional)
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             testArtifacts (Optional): {
+     *                 inputArtifacts (Required): {
+     *                     configUrl (Optional): {
+     *                         url: String (Optional)
+     *                         fileId: String (Optional)
+     *                         filename: String (Optional)
+     *                         fileType: String(0/1/2) (Optional)
+     *                         expireTime: OffsetDateTime (Optional)
+     *                         validationStatus: String (Optional)
+     *                     }
+     *                     testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                     userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                     inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                     additionalUrls (Optional): [
+     *                         (recursive schema, see above)
+     *                     ]
+     *                 }
+     *                 outputArtifacts (Optional): {
+     *                     resultUrl (Optional): (recursive schema, see resultUrl above)
+     *                     logsUrl (Optional): (recursive schema, see logsUrl above)
+     *                 }
+     *             }
+     *             executedDateTime: OffsetDateTime (Optional)
+     *             vusers: Integer (Optional)
+     *             testRunStatistics (Optional): {
+     *                 String (Optional): {
+     *                     transaction: String (Optional)
+     *                     sampleCount: Double (Optional)
+     *                     errorCount: Double (Optional)
+     *                     errorPct: Double (Optional)
+     *                     meanResTime: Double (Optional)
+     *                     medianResTime: Double (Optional)
+     *                     maxResTime: Double (Optional)
+     *                     minResTime: Double (Optional)
+     *                     pct1ResTime: Double (Optional)
+     *                     pct2ResTime: Double (Optional)
+     *                     pct3ResTime: Double (Optional)
+     *                     throughput: Double (Optional)
+     *                     receivedKBytesPerSec: Double (Optional)
+     *                     sentKBytesPerSec: Double (Optional)
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             portalUrl: String (Optional)
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             duration: Long (Optional)
+     *             subnetId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test runs with given filters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestRunsSearchAsync(RequestOptions requestOptions, Context context) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE); + return new PagedFlux<>( + () -> listTestRunsSearchSinglePageAsync(requestOptions, context), + nextLink -> listTestRunsSearchNextSinglePageAsync(nextLink, requestOptionsForNextPage, context)); + } + + /** + * Get all test runs with given filters. + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderByStringNoSort on one of the field - status, displayName, executedDateTime in (field asc/desc) format. eg: displayName asc.
continuationTokenStringNoContinuation token to get the next page of response.
searchStringNoFilter search based on searchable fields - description, executedUser.
executionFromOffsetDateTimeNoThe end DateTime(ISO 8601 literal format) of test-run execution time filter range.
executionToOffsetDateTimeNoThe start DateTime(ISO 8601 literal format) of test-run execution time filter range.
statusStringNoComma separated list of test run status, value can be - "ACCEPTED", "NOTSTARTED","PROVISIONING","PROVISIONED","CONFIGURING", + * "CONFIGURED","EXECUTING","EXECUTED","DEPROVISIONING","DEPROVISIONED","DONE","CANCELLED","FAILED".
maxPageSizeIntegerNoNumber of results in response.
testIdStringNoUnique name for load test, must be a valid URL character ^[a-z0-9_-]*$.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testRunId: String (Optional)
+     *             displayName: String (Optional)
+     *             testId: String (Optional)
+     *             resourceId: String (Optional)
+     *             description: String (Optional)
+     *             status: String (Optional)
+     *             startDateTime: OffsetDateTime (Optional)
+     *             endDateTime: OffsetDateTime (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             testResult: String (Optional)
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             testArtifacts (Optional): {
+     *                 inputArtifacts (Required): {
+     *                     configUrl (Optional): {
+     *                         url: String (Optional)
+     *                         fileId: String (Optional)
+     *                         filename: String (Optional)
+     *                         fileType: String(0/1/2) (Optional)
+     *                         expireTime: OffsetDateTime (Optional)
+     *                         validationStatus: String (Optional)
+     *                     }
+     *                     testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                     userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                     inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                     additionalUrls (Optional): [
+     *                         (recursive schema, see above)
+     *                     ]
+     *                 }
+     *                 outputArtifacts (Optional): {
+     *                     resultUrl (Optional): (recursive schema, see resultUrl above)
+     *                     logsUrl (Optional): (recursive schema, see logsUrl above)
+     *                 }
+     *             }
+     *             executedDateTime: OffsetDateTime (Optional)
+     *             vusers: Integer (Optional)
+     *             testRunStatistics (Optional): {
+     *                 String (Optional): {
+     *                     transaction: String (Optional)
+     *                     sampleCount: Double (Optional)
+     *                     errorCount: Double (Optional)
+     *                     errorPct: Double (Optional)
+     *                     meanResTime: Double (Optional)
+     *                     medianResTime: Double (Optional)
+     *                     maxResTime: Double (Optional)
+     *                     minResTime: Double (Optional)
+     *                     pct1ResTime: Double (Optional)
+     *                     pct2ResTime: Double (Optional)
+     *                     pct3ResTime: Double (Optional)
+     *                     throughput: Double (Optional)
+     *                     receivedKBytesPerSec: Double (Optional)
+     *                     sentKBytesPerSec: Double (Optional)
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             portalUrl: String (Optional)
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             duration: Long (Optional)
+     *             subnetId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all test runs with given filters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestRunsSearch(RequestOptions requestOptions) { + return new PagedIterable<>(listTestRunsSearchAsync(requestOptions)); + } + + /** + * Stop test run by name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test run model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stopTestRunWithResponseAsync(String testRunId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.stopTestRun( + this.client.getEndpoint(), + testRunId, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Stop test run by name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test run model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stopTestRunWithResponseAsync( + String testRunId, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.stopTestRun( + this.client.getEndpoint(), + testRunId, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Stop test run by name. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     resourceId: String (Optional)
+     *     description: String (Optional)
+     *     status: String (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     loadTestConfig (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *     }
+     *     testResult: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Optional): {
+     *                 clientmetric: String (Optional)
+     *                 aggregate: String (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String (Optional)
+     *             }
+     *         }
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Required): {
+     *             configUrl (Optional): {
+     *                 url: String (Optional)
+     *                 fileId: String (Optional)
+     *                 filename: String (Optional)
+     *                 fileType: String(0/1/2) (Optional)
+     *                 expireTime: OffsetDateTime (Optional)
+     *                 validationStatus: String (Optional)
+     *             }
+     *             testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *             userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *             inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *             additionalUrls (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultUrl (Optional): (recursive schema, see resultUrl above)
+     *             logsUrl (Optional): (recursive schema, see logsUrl above)
+     *         }
+     *     }
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     vusers: Integer (Optional)
+     *     testRunStatistics (Optional): {
+     *         String (Optional): {
+     *             transaction: String (Optional)
+     *             sampleCount: Double (Optional)
+     *             errorCount: Double (Optional)
+     *             errorPct: Double (Optional)
+     *             meanResTime: Double (Optional)
+     *             medianResTime: Double (Optional)
+     *             maxResTime: Double (Optional)
+     *             minResTime: Double (Optional)
+     *             pct1ResTime: Double (Optional)
+     *             pct2ResTime: Double (Optional)
+     *             pct3ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     portalUrl: String (Optional)
+     *     secrets (Optional): {
+     *         String (Optional): {
+     *             value: String (Optional)
+     *             type: String (Optional)
+     *         }
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Optional)
+     *     }
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return load test run model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stopTestRunWithResponse(String testRunId, RequestOptions requestOptions) { + return stopTestRunWithResponseAsync(testRunId, requestOptions).block(); + } + + /** + * Get all client metrics for a load test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     requestSamplers (Optional): [
+     *         String (Optional)
+     *     ]
+     *     errors (Optional): [
+     *         String (Optional)
+     *     ]
+     *     percentiles (Optional): [
+     *         String (Optional)
+     *     ]
+     *     groupByInterval: String (Optional)
+     *     startTime: OffsetDateTime (Required)
+     *     endTime: OffsetDateTime (Required)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     timeSeries (Optional): {
+     *         activeUsers (Optional): {
+     *             String (Optional): [
+     *                  (Optional){
+     *                     timestamp: OffsetDateTime (Optional)
+     *                     value: Double (Optional)
+     *                 }
+     *             ]
+     *         }
+     *         responseTime (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         throughput (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         errors (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Client metrics request model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all client metrics for a load test run along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestRunClientMetricsWithResponseAsync( + String testRunId, BinaryData body, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getTestRunClientMetrics( + this.client.getEndpoint(), + testRunId, + this.client.getServiceVersion().getVersion(), + body, + accept, + requestOptions, + context)); + } + + /** + * Get all client metrics for a load test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     requestSamplers (Optional): [
+     *         String (Optional)
+     *     ]
+     *     errors (Optional): [
+     *         String (Optional)
+     *     ]
+     *     percentiles (Optional): [
+     *         String (Optional)
+     *     ]
+     *     groupByInterval: String (Optional)
+     *     startTime: OffsetDateTime (Required)
+     *     endTime: OffsetDateTime (Required)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     timeSeries (Optional): {
+     *         activeUsers (Optional): {
+     *             String (Optional): [
+     *                  (Optional){
+     *                     timestamp: OffsetDateTime (Optional)
+     *                     value: Double (Optional)
+     *                 }
+     *             ]
+     *         }
+     *         responseTime (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         throughput (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         errors (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Client metrics request model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all client metrics for a load test run along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestRunClientMetricsWithResponseAsync( + String testRunId, BinaryData body, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getTestRunClientMetrics( + this.client.getEndpoint(), + testRunId, + this.client.getServiceVersion().getVersion(), + body, + accept, + requestOptions, + context); + } + + /** + * Get all client metrics for a load test run. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     requestSamplers (Optional): [
+     *         String (Optional)
+     *     ]
+     *     errors (Optional): [
+     *         String (Optional)
+     *     ]
+     *     percentiles (Optional): [
+     *         String (Optional)
+     *     ]
+     *     groupByInterval: String (Optional)
+     *     startTime: OffsetDateTime (Required)
+     *     endTime: OffsetDateTime (Required)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     timeSeries (Optional): {
+     *         activeUsers (Optional): {
+     *             String (Optional): [
+     *                  (Optional){
+     *                     timestamp: OffsetDateTime (Optional)
+     *                     value: Double (Optional)
+     *                 }
+     *             ]
+     *         }
+     *         responseTime (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         throughput (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         errors (Optional): {
+     *             String (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param testRunId Unique name of the load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param body Client metrics request model. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all client metrics for a load test run along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestRunClientMetricsWithResponse( + String testRunId, BinaryData body, RequestOptions requestOptions) { + return getTestRunClientMetricsWithResponseAsync(testRunId, body, requestOptions).block(); + } + + /** + * Get all filters that are supported for client metrics for a given load test run. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     filters (Optional): {
+     *         requestSamplerValues (Optional): [
+     *             String (Optional)
+     *         ]
+     *         errorFiltersValues (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     timeRange (Optional): {
+     *         startTime: OffsetDateTime (Optional)
+     *         endTime: OffsetDateTime (Optional)
+     *     }
+     * }
+     * }
+ * + * @param testRunId Unique name for load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all filters that are supported for client metrics for a given load test run along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestRunClientMetricsFiltersWithResponseAsync( + String testRunId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getTestRunClientMetricsFilters( + this.client.getEndpoint(), + testRunId, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context)); + } + + /** + * Get all filters that are supported for client metrics for a given load test run. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     filters (Optional): {
+     *         requestSamplerValues (Optional): [
+     *             String (Optional)
+     *         ]
+     *         errorFiltersValues (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     timeRange (Optional): {
+     *         startTime: OffsetDateTime (Optional)
+     *         endTime: OffsetDateTime (Optional)
+     *     }
+     * }
+     * }
+ * + * @param testRunId Unique name for load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all filters that are supported for client metrics for a given load test run along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestRunClientMetricsFiltersWithResponseAsync( + String testRunId, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.getTestRunClientMetricsFilters( + this.client.getEndpoint(), + testRunId, + this.client.getServiceVersion().getVersion(), + accept, + requestOptions, + context); + } + + /** + * Get all filters that are supported for client metrics for a given load test run. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     testRunId: String (Optional)
+     *     filters (Optional): {
+     *         requestSamplerValues (Optional): [
+     *             String (Optional)
+     *         ]
+     *         errorFiltersValues (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     timeRange (Optional): {
+     *         startTime: OffsetDateTime (Optional)
+     *         endTime: OffsetDateTime (Optional)
+     *     }
+     * }
+     * }
+ * + * @param testRunId Unique name for load test run, must be a valid URL character ^[a-z0-9_-]*$. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return all filters that are supported for client metrics for a given load test run along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestRunClientMetricsFiltersWithResponse( + String testRunId, RequestOptions requestOptions) { + return getTestRunClientMetricsFiltersWithResponseAsync(testRunId, requestOptions).block(); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testRunId: String (Optional)
+     *             displayName: String (Optional)
+     *             testId: String (Optional)
+     *             resourceId: String (Optional)
+     *             description: String (Optional)
+     *             status: String (Optional)
+     *             startDateTime: OffsetDateTime (Optional)
+     *             endDateTime: OffsetDateTime (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             testResult: String (Optional)
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             testArtifacts (Optional): {
+     *                 inputArtifacts (Required): {
+     *                     configUrl (Optional): {
+     *                         url: String (Optional)
+     *                         fileId: String (Optional)
+     *                         filename: String (Optional)
+     *                         fileType: String(0/1/2) (Optional)
+     *                         expireTime: OffsetDateTime (Optional)
+     *                         validationStatus: String (Optional)
+     *                     }
+     *                     testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                     userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                     inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                     additionalUrls (Optional): [
+     *                         (recursive schema, see above)
+     *                     ]
+     *                 }
+     *                 outputArtifacts (Optional): {
+     *                     resultUrl (Optional): (recursive schema, see resultUrl above)
+     *                     logsUrl (Optional): (recursive schema, see logsUrl above)
+     *                 }
+     *             }
+     *             executedDateTime: OffsetDateTime (Optional)
+     *             vusers: Integer (Optional)
+     *             testRunStatistics (Optional): {
+     *                 String (Optional): {
+     *                     transaction: String (Optional)
+     *                     sampleCount: Double (Optional)
+     *                     errorCount: Double (Optional)
+     *                     errorPct: Double (Optional)
+     *                     meanResTime: Double (Optional)
+     *                     medianResTime: Double (Optional)
+     *                     maxResTime: Double (Optional)
+     *                     minResTime: Double (Optional)
+     *                     pct1ResTime: Double (Optional)
+     *                     pct2ResTime: Double (Optional)
+     *                     pct3ResTime: Double (Optional)
+     *                     throughput: Double (Optional)
+     *                     receivedKBytesPerSec: Double (Optional)
+     *                     sentKBytesPerSec: Double (Optional)
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             portalUrl: String (Optional)
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             duration: Long (Optional)
+     *             subnetId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return list of Resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listTestRunsSearchNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.listTestRunsSearchNext( + nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             testRunId: String (Optional)
+     *             displayName: String (Optional)
+     *             testId: String (Optional)
+     *             resourceId: String (Optional)
+     *             description: String (Optional)
+     *             status: String (Optional)
+     *             startDateTime: OffsetDateTime (Optional)
+     *             endDateTime: OffsetDateTime (Optional)
+     *             loadTestConfig (Optional): {
+     *                 engineInstances: Integer (Optional)
+     *                 splitAllCSVs: Boolean (Optional)
+     *             }
+     *             testResult: String (Optional)
+     *             passFailCriteria (Optional): {
+     *                 passFailMetrics (Optional): {
+     *                     String (Optional): {
+     *                         clientmetric: String (Optional)
+     *                         aggregate: String (Optional)
+     *                         condition: String (Optional)
+     *                         requestName: String (Optional)
+     *                         value: Double (Optional)
+     *                         action: String (Optional)
+     *                         actualValue: Double (Optional)
+     *                         result: String (Optional)
+     *                     }
+     *                 }
+     *             }
+     *             testArtifacts (Optional): {
+     *                 inputArtifacts (Required): {
+     *                     configUrl (Optional): {
+     *                         url: String (Optional)
+     *                         fileId: String (Optional)
+     *                         filename: String (Optional)
+     *                         fileType: String(0/1/2) (Optional)
+     *                         expireTime: OffsetDateTime (Optional)
+     *                         validationStatus: String (Optional)
+     *                     }
+     *                     testScriptUrl (Optional): (recursive schema, see testScriptUrl above)
+     *                     userPropUrl (Optional): (recursive schema, see userPropUrl above)
+     *                     inputArtifactsZipFileurl (Optional): (recursive schema, see inputArtifactsZipFileurl above)
+     *                     additionalUrls (Optional): [
+     *                         (recursive schema, see above)
+     *                     ]
+     *                 }
+     *                 outputArtifacts (Optional): {
+     *                     resultUrl (Optional): (recursive schema, see resultUrl above)
+     *                     logsUrl (Optional): (recursive schema, see logsUrl above)
+     *                 }
+     *             }
+     *             executedDateTime: OffsetDateTime (Optional)
+     *             vusers: Integer (Optional)
+     *             testRunStatistics (Optional): {
+     *                 String (Optional): {
+     *                     transaction: String (Optional)
+     *                     sampleCount: Double (Optional)
+     *                     errorCount: Double (Optional)
+     *                     errorPct: Double (Optional)
+     *                     meanResTime: Double (Optional)
+     *                     medianResTime: Double (Optional)
+     *                     maxResTime: Double (Optional)
+     *                     minResTime: Double (Optional)
+     *                     pct1ResTime: Double (Optional)
+     *                     pct2ResTime: Double (Optional)
+     *                     pct3ResTime: Double (Optional)
+     *                     throughput: Double (Optional)
+     *                     receivedKBytesPerSec: Double (Optional)
+     *                     sentKBytesPerSec: Double (Optional)
+     *                 }
+     *             }
+     *             createdDateTime: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             lastModifiedDateTime: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             portalUrl: String (Optional)
+     *             secrets (Optional): {
+     *                 String (Optional): {
+     *                     value: String (Optional)
+     *                     type: String (Optional)
+     *                 }
+     *             }
+     *             environmentVariables (Optional): {
+     *                 String: String (Optional)
+     *             }
+     *             duration: Long (Optional)
+     *             subnetId: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return list of Resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listTestRunsSearchNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + final String accept = "application/json"; + return service.listTestRunsSearchNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/package-info.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/package-info.java new file mode 100644 index 0000000000000..3e90e2fad3f8c --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for LoadTestingClient. These APIs allow end users to create, view and run load + * tests using Azure Load Test Service. + */ +package com.azure.developer.loadtesting.implementation; diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/util/MultipartHelper.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/util/MultipartHelper.java new file mode 100644 index 0000000000000..c204768fd135c --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/util/MultipartHelper.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.developer.loadtesting.implementation.util; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import com.azure.core.util.BinaryData; + +/** + * This class provides helper methods for constructing multipart/form-data body + */ +public final class MultipartHelper { + private static final char CR = (char) 0x0D; + private static final char LF = (char) 0x0A; + private static final String NEWLINE = "" + CR + LF; + + /** + * Create Multipart boundary using suffix. + * + * @param boundarySuffix Suffix to be added to multipart boundary, must be a valid URL character ^[a-z0-9_-]*$. + * @return the Multipart boundary {@link String}. + */ + public static String getMultipartBoundary(String boundarySuffix) { + return "----WebkitFormBoundary" + boundarySuffix; + } + + /** + * Delete an App Component. + * + * @param fileName Name of the file, must be a valid URL character ^[a-z0-9_-]*$. + * @param file The file as BinaryData to be used as multipart body of request. + * @param boundary The Multipart boundary used in the request body. + * @throws IOException thrown if error occurs while writing to byte stream. + * @return the Multipart request body as {@link BinaryData} encoded as UTF-8. + */ + public static BinaryData createMultipartBodyFromFile(String fileName, BinaryData file, String boundary) throws IOException { + ByteArrayOutputStream bodyByteStream = new ByteArrayOutputStream(); + bodyByteStream.write(("--" + boundary + NEWLINE).getBytes("UTF-8")); + bodyByteStream.write(("Content-Disposition: form-data; name=\"file\"; filename=\"" + fileName + "\"" + NEWLINE).getBytes("UTF-8")); + bodyByteStream.write(("Content-Type: application/octet-stream" + NEWLINE + NEWLINE).getBytes("UTF-8")); + bodyByteStream.write(file.toBytes()); + bodyByteStream.write((NEWLINE + NEWLINE + "--" + boundary + "--").getBytes("UTF-8")); + + return BinaryData.fromBytes(bodyByteStream.toByteArray()); + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/package-info.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/package-info.java new file mode 100644 index 0000000000000..a56b00226ee54 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for LoadTestingClient. These APIs allow end users to create, view and run load tests + * using Azure Load Test Service. + */ +package com.azure.developer.loadtesting; diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/module-info.java b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/module-info.java new file mode 100644 index 0000000000000..46c02485cca93 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/java/module-info.java @@ -0,0 +1,5 @@ +module com.azure.developer.loadtesting { + requires transitive com.azure.core; + + exports com.azure.developer.loadtesting; +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/main/resources/azure-developer-loadtesting.properties b/sdk/loadtestservice/azure-developer-loadtesting/src/main/resources/azure-developer-loadtesting.properties new file mode 100644 index 0000000000000..ca812989b4f27 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/main/resources/azure-developer-loadtesting.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ReadmeSamples.java b/sdk/loadtestservice/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ReadmeSamples.java new file mode 100644 index 0000000000000..da11ce5078729 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ReadmeSamples.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.developer.loadtesting; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public final class ReadmeSamples { + public void auth() { + // BEGIN: java-readme-sample-auth + // ensure the user, service principal or managed identity used has Loadtesting Contributor role for the resource + TokenCredential credential = new DefaultAzureCredentialBuilder() + .build(); + // create client using DefaultAzureCredential + LoadTestingClient client = new LoadTestingClientBuilder() + .credential(credential) + .endpoint("") + .buildClient(); + LoadTestAdministrationClient adminClient = client.getLoadTestAdministrationClient(); + TestRunClient testRunClient = client.getLoadTestRunClient(); + // END: java-readme-sample-auth + } + + public void createTest() { + // BEGIN: java-readme-sample-createTest + LoadTestingClient client = new LoadTestingClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("") + .buildClient(); + + // construct Test object using nested String:Object Maps + Map testMap = new HashMap(); + testMap.put("displayName", "Sample Display Name"); + testMap.put("description", "Sample Description"); + + // loadTestConfig describes the number of test engines to generate load + Map loadTestConfigMap = new HashMap(); + loadTestConfigMap.put("engineInstances", 1); + testMap.put("loadTestConfig", loadTestConfigMap); + + // environmentVariables are plain-text data passed to test engines + Map envVarMap = new HashMap(); + envVarMap.put("a", "b"); + envVarMap.put("x", "y"); + testMap.put("environmentVariables", envVarMap); + + // secrets are secure data sent using Azure Key Vault + Map secretMap = new HashMap(); + Map sampleSecretMap = new HashMap(); + sampleSecretMap.put("value", "https://samplevault.vault.azure.net/secrets/samplesecret/f113f91fd4c44a368049849c164db827"); + sampleSecretMap.put("type", "AKV_SECRET_URI"); + secretMap.put("sampleSecret", sampleSecretMap); + testMap.put("secrets", secretMap); + + // passFailCriteria define the conditions to conclude the test as success + Map passFailMap = new HashMap(); + Map passFailMetrics = new HashMap(); + Map samplePassFailMetric = new HashMap(); + samplePassFailMetric.put("clientmetric", "response_time_ms"); + samplePassFailMetric.put("aggregate", "percentage"); + samplePassFailMetric.put("condition", ">"); + samplePassFailMetric.put("value", "20"); + samplePassFailMetric.put("action", "continue"); + passFailMetrics.put("fefd759d-7fe8-4f83-8b6d-aeebe0f491fe", samplePassFailMetric); + passFailMap.put("passFailMetrics", passFailMetrics); + testMap.put("passFailCriteria", passFailMap); + + // convert the object Map to JSON BinaryData + BinaryData test = BinaryData.fromObject(testMap); + + // receive response with BinaryData content + Response testOutResponse = client.getLoadTestAdministrationClient().createOrUpdateTestWithResponse("test12345", test, null); + System.out.println(testOutResponse.getValue().toString()); + // END: java-readme-sample-createTest + } + + public void uploadTestFile() throws IOException { + // BEGIN: java-readme-sample-uploadTestFile + LoadTestingClient client = new LoadTestingClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("") + .buildClient(); + + // extract file contents to BinaryData + BinaryData fileData = BinaryData.fromFile(new File("path/to/file").toPath()); + + // receive response with BinaryData content + Response fileUrlOut = client.getLoadTestAdministrationClient().uploadTestFileWithResponse("test12345", "file12345", "sample-file.jmx", fileData, null); + System.out.println(fileUrlOut.getValue().toString()); + // END: java-readme-sample-uploadTestFile + } + + public void runTest() { + // BEGIN: java-readme-sample-runTest + LoadTestingClient client = new LoadTestingClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("") + .buildClient(); + + // construct Test Run object using nested String:Object Maps + Map testRunMap = new HashMap(); + testRunMap.put("testId", "test12345"); + testRunMap.put("displayName", "SDK-Created-TestRun"); + + // convert the object Map to JSON BinaryData + BinaryData testRun = BinaryData.fromObject(testRunMap); + + // receive response with BinaryData content + Response testRunOut = client.getLoadTestRunClient().createOrUpdateTestRunWithResponse("testrun12345", testRun, null); + System.out.println(testRunOut.getValue().toString()); + + // wait for test to reach terminal state + JsonNode testRunJson = null; + String testStatus = null, startDateTime = null, endDateTime = null; + while (testStatus == null || (testStatus != "DONE" && testStatus != "CANCELLED" && testStatus != "FAILED")) { + testRunOut = client.getLoadTestRunClient().getTestRunWithResponse("testrun12345", null); + // parse JSON and read status value + try { + testRunJson = new ObjectMapper().readTree(testRunOut.getValue().toString()); + testStatus = testRunJson.get("status").asText(); + } catch (JsonProcessingException e) { + System.out.println("Error processing JSON response"); + // handle error condition + } + + // wait and check test status every 5 seconds + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + // handle interruption + } + } + + startDateTime = testRunJson.get("startDateTime").asText(); + endDateTime = testRunJson.get("endDateTime").asText(); + + // construct Test Run Client Metrics object using nested String:Object Maps + Map clientMetricsMap = new HashMap(); + List requestSamplersList = new ArrayList(); + requestSamplersList.add("Homepage"); + clientMetricsMap.put("requestSamplers", requestSamplersList); + + List errorsList = new ArrayList(); + errorsList.add("500"); + clientMetricsMap.put("errors", errorsList); + + List percentilesList = new ArrayList(); + percentilesList.add("95"); + clientMetricsMap.put("percentiles", percentilesList); + + clientMetricsMap.put("groupByInterval", "10s"); + clientMetricsMap.put("startTime", startDateTime); + clientMetricsMap.put("endTime", endDateTime); + + // convert the object Map to JSON BinaryData + BinaryData clientMetrics = BinaryData.fromObject(clientMetricsMap); + + // fetch client metrics + Response clientMetricsOut = client.getLoadTestRunClient().getTestRunClientMetricsWithResponse("testrun12345", clientMetrics, null); + System.out.println(clientMetricsOut.getValue().toString()); + // END: java-readme-sample-runTest + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/CreateOrUpdateTestRunTests.java b/sdk/loadtestservice/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/CreateOrUpdateTestRunTests.java new file mode 100644 index 0000000000000..fe6ac0c93ad4d --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/CreateOrUpdateTestRunTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.developer.loadtesting; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class CreateOrUpdateTestRunTests extends LoadTestingClientTestBase { + private final String createTestRunBodyJson = "{\"testId\":\"" + defaultTestId + "\"" + + ",\"description\":\"Sample Test Run\",\"displayName\":\"Java SDK Sample Test Run\"}"; + + private Map getTestRunBodyFromDict() { + Map testRunMap = new HashMap(); + testRunMap.put("testId", defaultTestId); + testRunMap.put("displayName", "Java SDK Sample Test Run"); + testRunMap.put("description", "Sample Test Run"); + + return testRunMap; + } + + @Test + public void createOrUpdateTestRunString() { + BinaryData file = BinaryData.fromString(createTestRunBodyJson); + RequestOptions requestOptions = new RequestOptions(); + Response response = client.getLoadTestRunClient().createOrUpdateTestRunWithResponse(defaultTestRunId, file, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } + + @Test + public void createOrUpdateTestRunDict() { + BinaryData file = BinaryData.fromObject(getTestRunBodyFromDict()); + RequestOptions requestOptions = new RequestOptions(); + Response response = client.getLoadTestRunClient().createOrUpdateTestRunWithResponse(defaultTestRunId, file, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/CreateOrUpdateTestTests.java b/sdk/loadtestservice/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/CreateOrUpdateTestTests.java new file mode 100644 index 0000000000000..b20d3cddd9ee6 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/CreateOrUpdateTestTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.developer.loadtesting; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class CreateOrUpdateTestTests extends LoadTestingClientTestBase { + private final String createTestBodyJson = "{\"description\":\"Sample Test\",\"displayName\":\"Java SDK Sample Test\"," + + "\"environmentVariables\":{\"threads_per_engine\":1,\"ramp_up_time\":0,\"duration_in_sec\":10,\"domain\":\"azure.microsoft.com\",\"protocol\":\"https\"}," + + "\"loadTestConfig\":{\"engineInstances\":1}}"; + + private Map getTestBodyFromDict() { + Map testMap = new HashMap(); + testMap.put("displayName", "Java SDK Sample Test"); + testMap.put("description", "Sample Test"); + + Map loadTestConfigMap = new HashMap(); + loadTestConfigMap.put("engineInstances", 1); + testMap.put("loadTestConfig", loadTestConfigMap); + + Map envVarMap = new HashMap(); + envVarMap.put("threads_per_engine", 1); + envVarMap.put("ramp_up_time", 0); + envVarMap.put("duration_in_sec", 10); + envVarMap.put("domain", "azure.microsoft.com"); + envVarMap.put("protocol", "https"); + testMap.put("environmentVariables", envVarMap); + + return testMap; + } + + @Test + public void createOrUpdateTestString() { + BinaryData body = BinaryData.fromString(createTestBodyJson); + RequestOptions requestOptions = new RequestOptions(); + Response response = client.getLoadTestAdministrationClient().createOrUpdateTestWithResponse(defaultTestId, body, requestOptions); + Assertions.assertTrue(Arrays.asList(200, 201).contains(response.getStatusCode())); + } + + @Test + public void createOrUpdateTestDictDict() { + BinaryData body = BinaryData.fromObject(getTestBodyFromDict()); + RequestOptions requestOptions = new RequestOptions(); + Response response = client.getLoadTestAdministrationClient().createOrUpdateTestWithResponse(defaultTestId, body, requestOptions); + Assertions.assertTrue(Arrays.asList(200, 201).contains(response.getStatusCode())); + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestingClientTestBase.java b/sdk/loadtestservice/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestingClientTestBase.java new file mode 100644 index 0000000000000..8f36dff1dd0ac --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestingClientTestBase.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.developer.loadtesting; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestBase; +import com.azure.core.test.TestMode; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +class LoadTestingClientTestBase extends TestBase { + protected LoadTestingClient client; + + private final String defaultEndpoint = "REDACTED.eus.cnt-prod.loadtesting.azure.com"; + + protected final String defaultTestId = "11111111-1234-1234-1234-123456789012"; + protected final String defaultFileId = "22222222-1234-1234-1234-123456789012"; + protected final String defaultTestRunId = "33333333-1234-1234-1234-123456789012"; + + @Override + protected void beforeTest() { + LoadTestingClientBuilder loadTestingClientBuilder = + new LoadTestingClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", defaultEndpoint)) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + loadTestingClientBuilder + .httpClient(interceptorManager.getPlaybackClient()) + .credential(request -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX))); + } else if (getTestMode() == TestMode.RECORD) { + loadTestingClientBuilder + .addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + loadTestingClientBuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + client = loadTestingClientBuilder.buildClient(); + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/UploadTestFileTests.java b/sdk/loadtestservice/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/UploadTestFileTests.java new file mode 100644 index 0000000000000..bdc730ac8ce98 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/UploadTestFileTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.developer.loadtesting; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import java.io.File; +import java.io.IOException; +import java.net.URL; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class UploadTestFileTests extends LoadTestingClientTestBase { + private final String fileJmxName = "sample-JMX-file.jmx"; + private final URL fileJmxUrl = UploadTestFileTests.class.getClassLoader().getResource(fileJmxName); + + @Test + public void uploadTestFile() throws IOException { + BinaryData file = BinaryData.fromFile(new File(fileJmxUrl.getPath()).toPath()); + RequestOptions requestOptions = new RequestOptions().addQueryParam("fileType", "2"); + Response response = client.getLoadTestAdministrationClient().uploadTestFileWithResponse( + defaultTestId, + defaultFileId, + fileJmxName, + file, + requestOptions); + Assertions.assertEquals(201, response.getStatusCode()); + } +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/sample-JMX-file.jmx b/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/sample-JMX-file.jmx new file mode 100644 index 0000000000000..52feae899c0d3 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/sample-JMX-file.jmx @@ -0,0 +1,86 @@ + + + + + + false + true + false + + + + + + + + + + threads_per_engine + ${__BeanShell( System.getenv("threads_per_engine") )} + = + + + ramp_up_time + ${__BeanShell( System.getenv("ramp_up_time") )} + = + + + duration_in_sec + ${__BeanShell( System.getenv("duration_in_sec") )} + = + + + domain + ${__BeanShell( System.getenv("domain") )} + = + + + protocol + ${__BeanShell( System.getenv("protocol") )} + = + + + path + ${__BeanShell( System.getenv("path") )} + = + + + + + + continue + + false + -1 + + ${threads_per_engine} + ${ramp_up_time} + true + ${duration_in_sec} + 5 + true + + + + + + + ${domain} + + ${protocol} + + ${path} + GET + true + false + true + false + + + + + + + + + diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/CreateOrUpdateTestRunTests.createOrUpdateTestRunDict.json b/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/CreateOrUpdateTestRunTests.createOrUpdateTestRunDict.json new file mode 100644 index 0000000000000..0a71317221628 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/CreateOrUpdateTestRunTests.createOrUpdateTestRunDict.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "PATCH", + "Uri" : "https://REDACTED.eus.cnt-prod.loadtesting.azure.com/testruns/33333333-1234-1234-1234-123456789012?api-version=2022-06-01-preview", + "Headers" : { + "User-Agent" : "azsdk-java-azure-developer-loadtesting/1.0.0-beta.1 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "12cfae38-1665-4b09-b786-bb51a67553c9", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "content-length" : "4731", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "api-supported-versions" : "2021-07-01-preview, 2022-06-01-preview", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "mise-correlation-id" : "24eff5f4-3d07-44d4-b60d-c5b219c8a90b", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"testRunId\":\"33333333-1234-1234-1234-123456789012\",\"displayName\":\"Java SDK Sample Test Run\",\"testId\":\"11111111-1234-1234-1234-123456789012\",\"resourceId\":\"/subscriptions/REDACTED/resourcegroups/loadtest-sdk/providers/microsoft.loadtestservice/loadtests/loadtestingsdk\",\"description\":\"Sample Test Run\",\"status\":\"DONE\",\"startDateTime\":\"2022-09-16T12:48:39Z\",\"endDateTime\":\"2022-09-16T12:48:49Z\",\"loadTestConfig\":{\"engineInstances\":1,\"splitAllCSVs\":null},\"testResult\":\"NOT_APPLICABLE\",\"passFailCriteria\":null,\"testArtifacts\":{\"inputArtifacts\":{\"configUrl\":{\"url\":\"REDACTED\",\"fileId\":\"e480b12d-cad0-4071-b236-72ce70a6bf85\",\"filename\":\"config.yaml\",\"fileType\":2,\"expireTime\":\"2022-09-22T14:22:44.7058466+00:00\",\"validationStatus\":\"\"},\"testScriptUrl\":{\"url\":\"REDACTED\",\"fileId\":\"22222222-1234-1234-1234-123456789012\",\"filename\":\"sample-JMX-file.jmx\",\"fileType\":2,\"expireTime\":\"2022-09-22T14:22:44.7058466+00:00\",\"validationStatus\":\"VALIDATION_SUCCESS\"},\"userPropUrl\":null,\"inputArtifactsZipFileurl\":{\"url\":\"REDACTED\",\"fileId\":\"1da610a8-8dd1-40b0-ae82-2509a8f03538\",\"filename\":\"inputartifacts.zip\",\"fileType\":2,\"expireTime\":\"2022-09-22T14:22:44.7058466+00:00\",\"validationStatus\":\"\"},\"additionalUrls\":[]},\"outputArtifacts\":{\"resultUrl\":{\"url\":\"REDACTED\",\"fileId\":\"03352518-352d-4a88-8a19-079c15e552c2\",\"filename\":\"csv.zip\",\"fileType\":2,\"expireTime\":\"2022-09-22T14:22:44.7058466+00:00\",\"validationStatus\":\"\"},\"logsUrl\":{\"url\":\"REDACTED\",\"fileId\":\"2b1564a9-6dde-4d66-8162-a1158b30a83f\",\"filename\":\"logs.zip\",\"fileType\":2,\"expireTime\":\"2022-09-22T14:22:44.7058466+00:00\",\"validationStatus\":\"\"}}},\"executedDateTime\":\"2022-09-16T12:47:59.439Z\",\"vusers\":1,\"testRunStatistics\":{\"Homepage\":{\"transaction\":\"Homepage\",\"sampleCount\":1794.0,\"errorCount\":1694.0,\"errorPct\":94.0,\"meanResTime\":5.214046822742475,\"medianResTime\":3.0,\"maxResTime\":143.0,\"minResTime\":2.0,\"pct1ResTime\":4.0,\"pct2ResTime\":25.0,\"pct3ResTime\":51.0,\"throughput\":199.33,\"receivedKBytesPerSec\":0.0,\"sentKBytesPerSec\":0.0},\"Homepage-0\":{\"transaction\":\"Homepage-0\",\"sampleCount\":101.0,\"errorCount\":0.0,\"errorPct\":0.0,\"meanResTime\":27.940594059405942,\"medianResTime\":31.0,\"maxResTime\":88.0,\"minResTime\":14.0,\"pct1ResTime\":36.0,\"pct2ResTime\":39.0,\"pct3ResTime\":50.0,\"throughput\":25.25,\"receivedKBytesPerSec\":0.0,\"sentKBytesPerSec\":0.0},\"Homepage-1\":{\"transaction\":\"Homepage-1\",\"sampleCount\":101.0,\"errorCount\":1.0,\"errorPct\":0.0,\"meanResTime\":13.069306930693068,\"medianResTime\":10.0,\"maxResTime\":54.0,\"minResTime\":5.0,\"pct1ResTime\":20.0,\"pct2ResTime\":22.0,\"pct3ResTime\":24.0,\"throughput\":25.25,\"receivedKBytesPerSec\":0.0,\"sentKBytesPerSec\":0.0},\"Total\":{\"transaction\":\"Total\",\"sampleCount\":1996.0,\"errorCount\":1695.0,\"errorPct\":84.0,\"meanResTime\":6.761523046092185,\"medianResTime\":3.0,\"maxResTime\":143.0,\"minResTime\":2.0,\"pct1ResTime\":17.0,\"pct2ResTime\":34.0,\"pct3ResTime\":51.0,\"throughput\":221.78,\"receivedKBytesPerSec\":0.0,\"sentKBytesPerSec\":0.0}},\"createdDateTime\":\"2022-09-16T12:47:59.712Z\",\"createdBy\":null,\"lastModifiedDateTime\":\"2022-09-16T12:47:59.712Z\",\"lastModifiedBy\":null,\"portalUrl\":\"https://portal.azure.com/#blade/Microsoft_Azure_CloudNativeTesting/NewReport//resourceId/%2fsubscriptions%2fREDACTED%2fresourcegroups%2floadtest-sdk%2fproviders%2fmicrosoft.loadtestservice%2floadtests%2floadtestingsdk/testId/11111111-1234-1234-1234-123456789012/testRunId/33333333-1234-1234-1234-123456789012\",\"secrets\":null,\"environmentVariables\":{\"threads_per_engine\":\"1\",\"ramp_up_time\":\"0\",\"duration_in_sec\":\"10\",\"domain\":\"azure.microsoft.com\",\"protocol\":\"https\"},\"duration\":10000,\"subnetId\":null,\"errorDetails\":null}", + "Date" : "Thu, 22 Sep 2022 14:12:44 GMT", + "x-ms-correlation-request-id" : "5245c655-6223-4fe9-9932-d1db1601c755", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/CreateOrUpdateTestRunTests.createOrUpdateTestRunString.json b/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/CreateOrUpdateTestRunTests.createOrUpdateTestRunString.json new file mode 100644 index 0000000000000..9c73446462c0f --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/CreateOrUpdateTestRunTests.createOrUpdateTestRunString.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "PATCH", + "Uri" : "https://REDACTED.eus.cnt-prod.loadtesting.azure.com/testruns/33333333-1234-1234-1234-123456789012?api-version=2022-06-01-preview", + "Headers" : { + "User-Agent" : "azsdk-java-azure-developer-loadtesting/1.0.0-beta.1 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "5745287f-3148-4010-966c-6b6367cb6a59", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "content-length" : "4735", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "api-supported-versions" : "2021-07-01-preview, 2022-06-01-preview", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "mise-correlation-id" : "ea785b04-00cd-46a2-ba25-64c93a9442ec", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"testRunId\":\"33333333-1234-1234-1234-123456789012\",\"displayName\":\"Java SDK Sample Test Run\",\"testId\":\"11111111-1234-1234-1234-123456789012\",\"resourceId\":\"/subscriptions/REDACTED/resourcegroups/loadtest-sdk/providers/microsoft.loadtestservice/loadtests/loadtestingsdk\",\"description\":\"Sample Test Run\",\"status\":\"DONE\",\"startDateTime\":\"2022-09-16T12:48:39Z\",\"endDateTime\":\"2022-09-16T12:48:49Z\",\"loadTestConfig\":{\"engineInstances\":1,\"splitAllCSVs\":null},\"testResult\":\"NOT_APPLICABLE\",\"passFailCriteria\":null,\"testArtifacts\":{\"inputArtifacts\":{\"configUrl\":{\"url\":\"REDACTED\",\"fileId\":\"e480b12d-cad0-4071-b236-72ce70a6bf85\",\"filename\":\"config.yaml\",\"fileType\":2,\"expireTime\":\"2022-09-22T14:22:45.3013994+00:00\",\"validationStatus\":\"\"},\"testScriptUrl\":{\"url\":\"REDACTED\",\"fileId\":\"22222222-1234-1234-1234-123456789012\",\"filename\":\"sample-JMX-file.jmx\",\"fileType\":2,\"expireTime\":\"2022-09-22T14:22:45.3013994+00:00\",\"validationStatus\":\"VALIDATION_SUCCESS\"},\"userPropUrl\":null,\"inputArtifactsZipFileurl\":{\"url\":\"REDACTED\",\"fileId\":\"1da610a8-8dd1-40b0-ae82-2509a8f03538\",\"filename\":\"inputartifacts.zip\",\"fileType\":2,\"expireTime\":\"2022-09-22T14:22:45.3013994+00:00\",\"validationStatus\":\"\"},\"additionalUrls\":[]},\"outputArtifacts\":{\"resultUrl\":{\"url\":\"REDACTED\",\"fileId\":\"03352518-352d-4a88-8a19-079c15e552c2\",\"filename\":\"csv.zip\",\"fileType\":2,\"expireTime\":\"2022-09-22T14:22:45.3013994+00:00\",\"validationStatus\":\"\"},\"logsUrl\":{\"url\":\"REDACTED\",\"fileId\":\"2b1564a9-6dde-4d66-8162-a1158b30a83f\",\"filename\":\"logs.zip\",\"fileType\":2,\"expireTime\":\"2022-09-22T14:22:45.3013994+00:00\",\"validationStatus\":\"\"}}},\"executedDateTime\":\"2022-09-16T12:47:59.439Z\",\"vusers\":1,\"testRunStatistics\":{\"Homepage\":{\"transaction\":\"Homepage\",\"sampleCount\":1794.0,\"errorCount\":1694.0,\"errorPct\":94.0,\"meanResTime\":5.214046822742475,\"medianResTime\":3.0,\"maxResTime\":143.0,\"minResTime\":2.0,\"pct1ResTime\":4.0,\"pct2ResTime\":25.0,\"pct3ResTime\":51.0,\"throughput\":199.33,\"receivedKBytesPerSec\":0.0,\"sentKBytesPerSec\":0.0},\"Homepage-0\":{\"transaction\":\"Homepage-0\",\"sampleCount\":101.0,\"errorCount\":0.0,\"errorPct\":0.0,\"meanResTime\":27.940594059405942,\"medianResTime\":31.0,\"maxResTime\":88.0,\"minResTime\":14.0,\"pct1ResTime\":36.0,\"pct2ResTime\":39.0,\"pct3ResTime\":50.0,\"throughput\":25.25,\"receivedKBytesPerSec\":0.0,\"sentKBytesPerSec\":0.0},\"Homepage-1\":{\"transaction\":\"Homepage-1\",\"sampleCount\":101.0,\"errorCount\":1.0,\"errorPct\":0.0,\"meanResTime\":13.069306930693068,\"medianResTime\":10.0,\"maxResTime\":54.0,\"minResTime\":5.0,\"pct1ResTime\":20.0,\"pct2ResTime\":22.0,\"pct3ResTime\":24.0,\"throughput\":25.25,\"receivedKBytesPerSec\":0.0,\"sentKBytesPerSec\":0.0},\"Total\":{\"transaction\":\"Total\",\"sampleCount\":1996.0,\"errorCount\":1695.0,\"errorPct\":84.0,\"meanResTime\":6.761523046092185,\"medianResTime\":3.0,\"maxResTime\":143.0,\"minResTime\":2.0,\"pct1ResTime\":17.0,\"pct2ResTime\":34.0,\"pct3ResTime\":51.0,\"throughput\":221.78,\"receivedKBytesPerSec\":0.0,\"sentKBytesPerSec\":0.0}},\"createdDateTime\":\"2022-09-16T12:47:59.712Z\",\"createdBy\":null,\"lastModifiedDateTime\":\"2022-09-16T12:47:59.712Z\",\"lastModifiedBy\":null,\"portalUrl\":\"https://portal.azure.com/#blade/Microsoft_Azure_CloudNativeTesting/NewReport//resourceId/%2fsubscriptions%2fREDACTED%2fresourcegroups%2floadtest-sdk%2fproviders%2fmicrosoft.loadtestservice%2floadtests%2floadtestingsdk/testId/11111111-1234-1234-1234-123456789012/testRunId/33333333-1234-1234-1234-123456789012\",\"secrets\":null,\"environmentVariables\":{\"threads_per_engine\":\"1\",\"ramp_up_time\":\"0\",\"duration_in_sec\":\"10\",\"domain\":\"azure.microsoft.com\",\"protocol\":\"https\"},\"duration\":10000,\"subnetId\":null,\"errorDetails\":null}", + "Date" : "Thu, 22 Sep 2022 14:12:45 GMT", + "x-ms-correlation-request-id" : "a4a721c2-91e8-4b69-a451-9740a90911d1", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/CreateOrUpdateTestTests.createOrUpdateTestDictDict.json b/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/CreateOrUpdateTestTests.createOrUpdateTestDictDict.json new file mode 100644 index 0000000000000..66c388a67ed69 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/CreateOrUpdateTestTests.createOrUpdateTestDictDict.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "PATCH", + "Uri" : "https://REDACTED.eus.cnt-prod.loadtesting.azure.com/loadtests/11111111-1234-1234-1234-123456789012?api-version=2022-06-01-preview", + "Headers" : { + "User-Agent" : "azsdk-java-azure-developer-loadtesting/1.0.0-beta.1 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "6a3168d0-3777-45c6-93d7-123d539ca647", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "content-length" : "1274", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "api-supported-versions" : "2021-07-01-preview, 2022-06-01-preview", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "mise-correlation-id" : "a4dcc1d9-6107-468a-9aee-f77984d9d5d4", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"testId\":\"11111111-1234-1234-1234-123456789012\",\"description\":\"Sample Test\",\"displayName\":\"Java SDK Sample Test\",\"resourceId\":\"/subscriptions/REDACTED/resourcegroups/loadtest-sdk/providers/microsoft.loadtestservice/loadtests/loadtestingsdk\",\"loadTestConfig\":{\"engineInstances\":1,\"splitAllCSVs\":null},\"passFailCriteria\":null,\"createdDateTime\":\"2022-09-16T12:47:01.824Z\",\"createdBy\":null,\"lastModifiedDateTime\":\"2022-09-16T12:47:01.824Z\",\"lastModifiedBy\":null,\"inputArtifacts\":{\"configUrl\":null,\"testScriptUrl\":{\"url\":\"REDACTED\",\"fileId\":\"22222222-1234-1234-1234-123456789012\",\"filename\":\"sample-JMX-file.jmx\",\"fileType\":2,\"expireTime\":\"2022-09-22T14:22:46.4975631+00:00\",\"validationStatus\":\"VALIDATION_SUCCESS\"},\"userPropUrl\":null,\"inputArtifactsZipFileurl\":null,\"additionalUrls\":[]},\"secrets\":null,\"environmentVariables\":{\"threads_per_engine\":\"1\",\"ramp_up_time\":\"0\",\"duration_in_sec\":\"10\",\"domain\":\"azure.microsoft.com\",\"protocol\":\"https\"},\"subnetId\":null,\"keyvaultReferenceIdentityType\":null,\"keyvaultReferenceIdentityId\":null}", + "Date" : "Thu, 22 Sep 2022 14:12:46 GMT", + "x-ms-correlation-request-id" : "bb792e69-698d-4570-b6fc-d0b0dd7193d8", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/CreateOrUpdateTestTests.createOrUpdateTestString.json b/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/CreateOrUpdateTestTests.createOrUpdateTestString.json new file mode 100644 index 0000000000000..c91f3b4a130a8 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/CreateOrUpdateTestTests.createOrUpdateTestString.json @@ -0,0 +1,27 @@ +{ + "networkCallRecords" : [ { + "Method" : "PATCH", + "Uri" : "https://REDACTED.eus.cnt-prod.loadtesting.azure.com/loadtests/11111111-1234-1234-1234-123456789012?api-version=2022-06-01-preview", + "Headers" : { + "User-Agent" : "azsdk-java-azure-developer-loadtesting/1.0.0-beta.1 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "42c3c726-dedb-4aec-a046-5625d0790f07", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "content-length" : "1272", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "api-supported-versions" : "2021-07-01-preview, 2022-06-01-preview", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "mise-correlation-id" : "ee45e97f-8257-4ac2-98c6-f1bd1c246cef", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"testId\":\"11111111-1234-1234-1234-123456789012\",\"description\":\"Sample Test\",\"displayName\":\"Java SDK Sample Test\",\"resourceId\":\"/subscriptions/REDACTED/resourcegroups/loadtest-sdk/providers/microsoft.loadtestservice/loadtests/loadtestingsdk\",\"loadTestConfig\":{\"engineInstances\":1,\"splitAllCSVs\":null},\"passFailCriteria\":null,\"createdDateTime\":\"2022-09-16T12:47:01.824Z\",\"createdBy\":null,\"lastModifiedDateTime\":\"2022-09-16T12:47:01.824Z\",\"lastModifiedBy\":null,\"inputArtifacts\":{\"configUrl\":null,\"testScriptUrl\":{\"url\":\"REDACTED\",\"fileId\":\"22222222-1234-1234-1234-123456789012\",\"filename\":\"sample-JMX-file.jmx\",\"fileType\":2,\"expireTime\":\"2022-09-22T14:22:45.8823668+00:00\",\"validationStatus\":\"VALIDATION_SUCCESS\"},\"userPropUrl\":null,\"inputArtifactsZipFileurl\":null,\"additionalUrls\":[]},\"secrets\":null,\"environmentVariables\":{\"threads_per_engine\":\"1\",\"ramp_up_time\":\"0\",\"duration_in_sec\":\"10\",\"domain\":\"azure.microsoft.com\",\"protocol\":\"https\"},\"subnetId\":null,\"keyvaultReferenceIdentityType\":null,\"keyvaultReferenceIdentityId\":null}", + "Date" : "Thu, 22 Sep 2022 14:12:45 GMT", + "x-ms-correlation-request-id" : "f696341c-ac39-4e54-9c1f-9607c8046bed", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/UploadTestFileTests.uploadTestFile.json b/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/UploadTestFileTests.uploadTestFile.json new file mode 100644 index 0000000000000..de947d9c9e182 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/src/test/resources/session-records/UploadTestFileTests.uploadTestFile.json @@ -0,0 +1,28 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://REDACTED.eus.cnt-prod.loadtesting.azure.com/loadtests/11111111-1234-1234-1234-123456789012/files/22222222-1234-1234-1234-123456789012?api-version=2022-06-01-preview&fileType=2", + "Headers" : { + "User-Agent" : "azsdk-java-azure-developer-loadtesting/1.0.0-beta.1 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "add577c9-dd8b-4bbe-9609-019f07e2875b", + "Content-Type" : "multipart/form-data;boundary=----WebkitFormBoundary84aea3" + }, + "Response" : { + "content-length" : "412", + "api-supported-versions" : "2021-07-01-preview, 2022-06-01-preview", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "mise-correlation-id" : "d9c64a28-8b70-4259-a90e-63d6c0e1ef3d", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 22 Sep 2022 14:12:47 GMT", + "x-ms-correlation-request-id" : "c93f9281-0e56-40ef-b1de-ae681e0555de", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Body" : "{\"url\":\"REDACTED\",\"fileId\":\"22222222-1234-1234-1234-123456789012\",\"filename\":\"sample-JMX-file.jmx\",\"fileType\":2,\"expireTime\":\"2022-09-22T14:22:47.13908\",\"validationStatus\":\"VALIDATION_INITIATED\"}", + "Content-Type" : "application/json; charset=utf-8", + "Location" : "https://REDACTED.eus.cnt-prod.loadtesting.azure.com/loadtests/11111111-1234-1234-1234-123456789012/files/22222222-1234-1234-1234-123456789012?resourceId=%2fsubscriptions%2fREDACTED%2fresourcegroups%2floadtest-sdk%2fproviders%2fmicrosoft.loadtestservice%2floadtests%2floadtestingsdk&api-version=2022-06-01-preview" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/loadtestservice/azure-developer-loadtesting/swagger/README.md b/sdk/loadtestservice/azure-developer-loadtesting/swagger/README.md new file mode 100644 index 0000000000000..e41653f0d1ce0 --- /dev/null +++ b/sdk/loadtestservice/azure-developer-loadtesting/swagger/README.md @@ -0,0 +1,37 @@ +## Generate autorest code + +```yaml +require: https://github.com/Azure/azure-rest-api-specs/blob/9401446f22177696d920cf110893a0de7452ee9e/specification/loadtestservice/data-plane/readme.md +java: true +regenerate-pom: false +title: LoadTestingClient +security: AADToken +security-scopes: https://cnt-prod.loadtesting.azure.com/.default +data-plane: true +generate-models: false +generate-samples: false +generate-tests: false +artifact-id: azure-developer-loadtesting +namespace: com.azure.developer.loadtesting +partial-update: true +output-folder: $(azure-sdk-for-java-folder)/sdk/loadtestservice/azure-developer-loadtesting +service-versions: +- 2022-06-01-preview +directive: +- from: swagger-document + where: '$.paths["/testruns/{testRunId}"].patch' + transform: > + $["operationId"] = "TestRun_CreateOrUpdateTestRun"; +- from: swagger-document + where: '$.paths.*[?(@.tags=="AppComponent")]' + transform: > + $["operationId"] = $["operationId"].replace("AppComponent_", "LoadTestAdministration_"); +- from: swagger-document + where: '$.paths.*[?(@.tags=="ServerMetrics")]' + transform: > + $["operationId"] = $["operationId"].replace("ServerMetrics_", "LoadTestAdministration_"); +- from: swagger-document + where: '$.paths.*[?(@.tags=="Test")]' + transform: > + $["operationId"] = $["operationId"].replace("Test_", "LoadTestAdministration_"); +``` diff --git a/sdk/loadtestservice/ci.yml b/sdk/loadtestservice/ci.yml index f7709c4f9d6ed..ec330d59b6ca6 100644 --- a/sdk/loadtestservice/ci.yml +++ b/sdk/loadtestservice/ci.yml @@ -38,3 +38,6 @@ extends: - name: azure-resourcemanager-loadtestservice groupId: com.azure.resourcemanager safeName: azureresourcemanagerloadtestservice + - name: azure-developer-loadtesting + groupId: com.azure + safeName: azuredeveloperloadtesting diff --git a/sdk/loadtestservice/pom.xml b/sdk/loadtestservice/pom.xml index 01ce9807f5359..a29aa2a98337f 100644 --- a/sdk/loadtestservice/pom.xml +++ b/sdk/loadtestservice/pom.xml @@ -10,6 +10,7 @@ 1.0.0 - azure-resourcemanager-loadtestservice + azure-developer-loadtesting + azure-resourcemanager-loadtestservice