diff --git a/sdk/loadtesting/azure-developer-loadtesting/CHANGELOG.md b/sdk/loadtesting/azure-developer-loadtesting/CHANGELOG.md index 01b062cdf0e0d..47b2491edd320 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/CHANGELOG.md +++ b/sdk/loadtesting/azure-developer-loadtesting/CHANGELOG.md @@ -1,208 +1,13 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.0.0-beta.1 (Unreleased) -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 1.0.15 (2024-07-26) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core-http-netty` from `1.15.1` to version `1.15.2`. -- Upgraded `azure-core` from `1.49.1` to version `1.50.0`. - - -## 1.0.14 (2024-06-27) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core-http-netty` from `1.15.0` to version `1.15.1`. -- Upgraded `azure-core` from `1.49.0` to version `1.49.1`. - - -## 1.0.13 (2024-05-28) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core` from `1.48.0` to version `1.49.0`. -- Upgraded `azure-core-http-netty` from `1.14.2` to version `1.15.0`. - - -## 1.0.12 (2024-04-23) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core` from `1.47.0` to version `1.48.0`. -- Upgraded `azure-core-http-netty` from `1.14.1` to version `1.14.2`. - - -## 1.0.11 (2024-03-20) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core` from `1.46.0` to version `1.47.0`. -- Upgraded `azure-core-http-netty` from `1.14.0` to version `1.14.1`. - - -## 1.0.10 (2024-02-20) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core-http-netty` from `1.13.11` to version `1.14.0`. -- Upgraded `azure-core` from `1.45.1` to version `1.46.0`. - - -## 1.0.9 (2023-12-04) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core-http-netty` from `1.13.10` to version `1.13.11`. -- Upgraded `azure-core` from `1.45.0` to version `1.45.1`. - - -## 1.0.8 (2023-11-20) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core` from `1.44.1` to version `1.45.0`. -- Upgraded `azure-core-http-netty` from `1.13.9` to version `1.13.10`. - - -## 1.0.7 (2023-10-20) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core` from `1.43.0` to version `1.44.1`. -- Upgraded `azure-core-http-netty` from `1.13.7` to version `1.13.9`. - - -## 1.0.6 (2023-09-22) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. -- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. - - -## 1.0.5 (2023-08-18) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core` from `1.41.0` to version `1.42.0`. -- Upgraded `azure-core-http-netty` from `1.13.5` to version `1.13.6`. - -## 1.0.4 (2023-07-25) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core` from `1.40.0` to version `1.41.0`. -- Upgraded `azure-core-http-netty` from `1.13.4` to version `1.13.5`. - -## 1.0.3 (2023-06-21) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core` from `1.39.0` to version `1.40.0`. -- Upgraded `azure-core-http-netty` from `1.13.3` to version `1.13.4`. - -## 1.0.2 (2023-05-22) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core` from `1.38.0` to version `1.39.0`. -- Upgraded `azure-core-http-netty` from `1.13.2` to version `1.13.3`. - -## 1.0.1 (2023-04-24) - -### Other Changes - -#### Dependency Updates - -- Upgraded `azure-core` from `1.37.0` to version `1.38.0`. -- Upgraded `azure-core-http-netty` from `1.13.1` to version `1.13.2`. - -## 1.0.0 (2023-03-07) - -- First stable release of Azure Load Testing client library for Java - -### Breaking Changes - -- Reintroduce two client builders - `LoadTestAdministrationClientBuilder` and `LoadTestRunClientBuilder` -- Rename `metricname` parameter to `metricName` in `LoadTestRunClient.listMetrics` -- Rename `LoadTestRunClient.listMetricDefinitionsWithResponse` to `LoadTestRunClient.getMetricDefinitionsWithResponse` -- Rename `LoadTestRunClient.listMetricNamespacesWithResponse` to `LoadTestRunClient.getMetricNamespacesWithResponse` - -### Other Changes - -- Updated samples and test cases - -## 1.0.0-beta.2 (2023-01-22) - -- Second preview release of Azure Load Testing client library for Java. +- Azure Load Testing client library for Java. This package contains Microsoft Azure Load Testing client library. ### Features Added -- Added sync and async versions of `LoadTestRunClient.listMetricNamespacesWithResponse` -- Added sync and async versions of `LoadTestRunClient.listMetricDefinitionsWithResponse` -- Added sync and async versions of `LoadTestRunClient.listMetrics` -- Added sync and async versions of `LoadTestRunClient.listMetricDimensionValues` -- Added sync and async versions of `LoadTestRunClient.createOrUpdateAppComponentWithResponse` -- Added sync and async versions of `LoadTestRunClient.getAppComponentsWithResponse` -- Added sync and async versions of `LoadTestRunClient.createOrUpdateServerMetricsConfigWithResponse` -- Added sync and async versions of `LoadTestRunClient.getServerMetricsConfigWithResponse` -- Added sync and async versions of `LoadTestAdministrationClient.beginUploadTestFile` and `LoadTestRunClient.beginTestRun` Long-Running operation - ### Breaking Changes -- There is a single builder which builds `LoadTestAdministration` and `LoadTestRun` clients, rather than a client which provides them via accessor methods previously -- Added metric namespaces and metric dimensions -- File upload now uses `application/octet-stream` instead of `multipart/form-data` -- File upload now uses file name as primary identifier instead of `fileId` -- Removed sync and async versions of `LoadTestAdministrationClient.ListSupportedResourceType` -- Removed sync and async versions of `LoadTestAdministrationClient.DeleteAppComponent` and `LoadTestAdministrationClient.DeleteAppComponentByName` -- Removed sync and async versions of `LoadTestAdministrationClient.DeleteServerMetrics` and `LoadTestAdministrationClient.DeleteServerMetricsByName` -- Removed sync and async versions of `TestRunClient.GetTestRunClientMetrics` and `TestRunClient.GetTestRunClientMetricsFilters` -- Removed sync and async versions of `TestRunClient.GetServerDefaultMetrics` +### Bugs Fixed ### Other Changes - -- README updated -- Added samples and test cases - -## 1.0.0-beta.1 (2022-10-22) - -- Initial preview release of Azure Load Testing client library for Java with single top-level `LoadTesting` client, and `LoadTestAdministration` and `TestRun` subclients. diff --git a/sdk/loadtesting/azure-developer-loadtesting/README.md b/sdk/loadtesting/azure-developer-loadtesting/README.md index 1bec2fd8d74e8..d8ca43c04f52c 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/README.md +++ b/sdk/loadtesting/azure-developer-loadtesting/README.md @@ -1,16 +1,15 @@ # 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 +Azure Load Testing client library for Java. -This package contains Microsoft Azure Developer LoadTesting client library. +This package contains Microsoft Azure Load Testing client library. ## Documentation Various documentation is available to help you get started -- [Source code][source_code] -- [API reference documentation][api_reference_doc] -- [Product Documentation][product_documentation] +- [API reference documentation][docs] +- [Product documentation][product_documentation] ## Getting started @@ -18,7 +17,6 @@ Various documentation is available to help you get started - [Java Development Kit (JDK)][jdk] with version 8 or above - [Azure Subscription][azure_subscription] -- Azure Load Testing resource ### Adding the package to your product @@ -27,7 +25,7 @@ Various documentation is available to help you get started com.azure azure-developer-loadtesting - 1.0.4 + 1.0.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -36,282 +34,32 @@ Various documentation is available to help you get started [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 -LoadTestAdministrationClient adminClient = new LoadTestAdministrationClientBuilder() - .credential(credential) - .endpoint("") - .buildClient(); -LoadTestRunClient testRunClient = new LoadTestRunClientBuilder() - .credential(credential) - .endpoint("") - .buildClient(); - -RequestOptions reqOpts = new RequestOptions() - .addQueryParam("orderBy", "lastModifiedDateTime") - .addQueryParam("maxPageSize", "10"); -adminClient.listTests(reqOpts); - -reqOpts = new RequestOptions() - .addQueryParam("orderBy", "lastModifiedDateTime") - .addQueryParam("status", "EXECUTING,DONE") - .addQueryParam("maxPageSize", "10"); -testRunClient.listTestRuns(reqOpts); -``` - ## 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 -LoadTestAdministrationClient adminClient = new LoadTestAdministrationClientBuilder() - .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("loadTestConfiguration", 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 = adminClient.createOrUpdateTestWithResponse("test12345", test, null); -System.out.println(testOutResponse.getValue().toString()); -``` - -### Uploading .jmx file to a Load Test - -```java java-readme-sample-uploadTestFile -LoadTestAdministrationClient adminClient = new LoadTestAdministrationClientBuilder() - .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 -PollResponse fileUrlOut = adminClient.beginUploadTestFile("test12345", "sample-file.jmx", fileData, null) - .waitForCompletion(Duration.ofMinutes(2)); -System.out.println(fileUrlOut.getValue().toString()); +```java com.azure.developer.loadtesting.readme ``` -### Running a Load Test +### Service API versions -```java java-readme-sample-runTest -LoadTestRunClient testRunClient = new LoadTestRunClientBuilder() - .credential(new DefaultAzureCredentialBuilder().build()) - .endpoint("") - .buildClient(); +The client library targets the latest service API version by default. +The service client builder accepts an optional service API version parameter to specify which API version to communicate. -// construct Test Run object using nested String:Object Maps -Map testRunMap = new HashMap<>(); -testRunMap.put("testId", "test12345"); -testRunMap.put("displayName", "SDK-Created-TestRun"); +#### Select a service API version -// convert the object Map to JSON BinaryData -BinaryData testRun = BinaryData.fromObject(testRunMap); +You have the flexibility to explicitly select a supported service API version when initializing a service client via the service client builder. +This ensures that the client can communicate with services using the specified API version. -// start test with poller -SyncPoller poller = testRunClient.beginTestRun("testrun12345", testRun, null); -Duration pollInterval = Duration.ofSeconds(5); -poller = poller.setPollInterval(pollInterval); +When selecting an API version, it is important to verify that there are no breaking changes compared to the latest API version. +If there are significant differences, API calls may fail due to incompatibility. -// wait for test to reach terminal state -Map jsonTree = null; -String testStatus; -PollResponse pollResponse = poller.poll(); -while (pollResponse.getStatus() == LongRunningOperationStatus.IN_PROGRESS - || pollResponse.getStatus() == LongRunningOperationStatus.NOT_STARTED) { - - try (JsonReader jsonReader = JsonProviders.createReader(pollResponse.getValue().toBytes())) { - jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - testStatus = jsonTree.get("status").toString(); - System.out.println("Test run status: " + testStatus); - } catch (IOException e) { - System.out.println("Error processing JSON response"); - // handle error condition - } - - // wait and check test status every 5 seconds - try { - Thread.sleep(pollInterval.toMillis()); - } catch (InterruptedException e) { - // handle interruption - } - - pollResponse = poller.poll(); -} - -poller.waitForCompletion(); -BinaryData testRunBinary = poller.getFinalResult(); - -try (JsonReader jsonReader = JsonProviders.createReader(testRunBinary.toBytes())) { - jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - testStatus = jsonTree.get("status").toString(); - System.out.println("Test run status: " + testStatus); -} catch (IOException e) { - System.out.println("Error processing JSON response"); - // handle error condition -} - -String startDateTime = jsonTree.get("startDateTime").toString(); -String endDateTime = jsonTree.get("endDateTime").toString(); -OffsetDateTime startOffsetDateTime = OffsetDateTime.parse(startDateTime); -OffsetDateTime endOffsetDateTime = OffsetDateTime.parse(endDateTime); - -// get list of all metric namespaces and pick the first one -Response metricNamespacesOut = testRunClient.getMetricNamespacesWithResponse("testrun12345", null); -String metricNamespace = null; -// parse JSON and read first value -try (JsonReader jsonReader = JsonProviders.createReader(metricNamespacesOut.getValue().toBytes())) { - jsonTree = jsonReader.readMap(JsonReader::readUntyped); - List metricNamespaces = (List) jsonTree.get("value"); - Map namespaceMap = (Map) metricNamespaces.get(0); - metricNamespace = namespaceMap.get("name").toString(); -} catch (IOException e) { - System.out.println("Error processing JSON response"); - // handle error condition -} - -// get list of all metric definitions and pick the first one -Response metricDefinitionsOut = testRunClient.getMetricDefinitionsWithResponse("testrun12345", metricNamespace, null); -String metricName = null; -// parse JSON and read first value -try (JsonReader jsonReader = JsonProviders.createReader(metricDefinitionsOut.getValue().toBytes())) { - jsonTree = jsonReader.readMap(JsonReader::readUntyped); - List metricDefinitions = (List) jsonTree.get("value"); - Map definitionMap = (Map) metricDefinitions.get(0); - Map nameMap = (Map) definitionMap.get("name"); - metricName = nameMap.get("value").toString(); -} catch (IOException e) { - System.out.println("Error processing JSON response"); - // handle error condition -} - -// fetch client metrics using metric namespace and metric name -PagedIterable clientMetricsOut = testRunClient.listMetrics("testrun12345", metricName, metricNamespace, startDateTime + '/' + endDateTime, null); -clientMetricsOut.forEach((clientMetric) -> { - System.out.println(clientMetric.toString()); -}); -``` +Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy. ## 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. -See [Azure Load Testing samples][sample_code]. - ## Contributing For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). @@ -323,11 +71,10 @@ For details on contributing to this repository, see the [contributing guide](htt 1. Create new Pull Request -[source_code]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/loadtesting/azure-developer-loadtesting/src -[sample_code]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/loadtesting/azure-developer-loadtesting/src/samples -[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/ +[product_documentation]: https://azure.microsoft.com/services/ +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ [azure_subscription]: https://azure.microsoft.com/free/ [azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity -[logging]: https://github.com/Azure/azure-sdk-for-java/wiki/Logging-in-Azure-SDK + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Floadtesting%2Fazure-developer-loadtesting%2FREADME.png) diff --git a/sdk/loadtesting/azure-developer-loadtesting/assets.json b/sdk/loadtesting/azure-developer-loadtesting/assets.json index 034976ee2d230..6288a0d453433 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/assets.json +++ b/sdk/loadtesting/azure-developer-loadtesting/assets.json @@ -1,6 +1 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "java", - "TagPrefix": "java/loadtesting/azure-developer-loadtesting", - "Tag": "java/loadtesting/azure-developer-loadtesting_c9288cb1d7" -} +{"AssetsRepo":"Azure/azure-sdk-assets","AssetsRepoPrefixPath":"java","TagPrefix":"java/loadtesting/azure-developer-loadtesting","Tag":""} \ No newline at end of file diff --git a/sdk/loadtesting/azure-developer-loadtesting/pom.xml b/sdk/loadtesting/azure-developer-loadtesting/pom.xml index ef2a055c6a42e..c6fca1dd1a9d8 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/pom.xml +++ b/sdk/loadtesting/azure-developer-loadtesting/pom.xml @@ -1,3 +1,8 @@ + 4.0.0 @@ -9,7 +14,7 @@ com.azure azure-developer-loadtesting - 1.1.0-beta.1 + 1.0.0-beta.1 jar Microsoft Azure SDK for Load Testing @@ -40,6 +45,16 @@ UTF-8 + + com.azure + azure-json + 1.3.0 + + + com.azure + azure-xml + 1.1.0 + com.azure azure-core @@ -50,6 +65,18 @@ azure-core-http-netty 1.15.4 + + org.junit.jupiter + junit-jupiter-api + 5.9.3 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.9.3 + test + com.azure azure-core-test @@ -62,5 +89,11 @@ 1.13.3 test + + org.slf4j + slf4j-simple + 1.7.36 + test + diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationAsyncClient.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationAsyncClient.java index a954de3f8c178..3edb8d360e2f0 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationAsyncClient.java +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationAsyncClient.java @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. + package com.azure.developer.loadtesting; import com.azure.core.annotation.Generated; @@ -12,182 +13,53 @@ 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.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.util.BinaryData; import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.PollerFlux; -import com.azure.developer.loadtesting.implementation.LoadTestAdministrationsImpl; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.developer.loadtesting.implementation.LoadTestAdministrationClientImpl; +import com.azure.developer.loadtesting.models.FileType; +import com.azure.developer.loadtesting.models.Test; +import com.azure.developer.loadtesting.models.TestAppComponents; +import com.azure.developer.loadtesting.models.TestFileInfo; +import com.azure.developer.loadtesting.models.TestServerMetricConfig; +import java.time.OffsetDateTime; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.time.Duration; - /** - * Initializes a new instance of the asynchronous LoadTestingClient type. + * Initializes a new instance of the asynchronous LoadTestAdministrationClient type. */ @ServiceClient(builder = LoadTestAdministrationClientBuilder.class, isAsync = true) public final class LoadTestAdministrationAsyncClient { - private static final ClientLogger LOGGER = new ClientLogger(LoadTestAdministrationAsyncClient.class); - @Generated - private final LoadTestAdministrationsImpl serviceClient; + private final LoadTestAdministrationClientImpl serviceClient; /** * Initializes an instance of LoadTestAdministrationAsyncClient class. - * + * * @param serviceClient the service client implementation. */ @Generated - LoadTestAdministrationAsyncClient(LoadTestAdministrationsImpl serviceClient) { + LoadTestAdministrationAsyncClient(LoadTestAdministrationClientImpl serviceClient) { this.serviceClient = serviceClient; } /** - * Configure server metrics for a test. - *

- * Request Body Schema - *

- *
{@code
-     * {
-     *     testId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
-     *         }
-     *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
-     *         }
-     *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param body Server metric 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 test server metrics configuration along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateServerMetricsConfigWithResponse(String testId, BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateServerMetricsConfigWithResponseAsync(testId, body, requestOptions); - } - - /** - * Uploads file and polls the validation status of the uploaded file. - * - * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. - * @param fileName Unique name for test file with file extension like : App.jmx. - * @param body The file content as application/octet-stream. - * @param fileUploadRequestOptions The options to configure the file upload HTTP request before HTTP client sends - * it. - * @throws ResourceNotFoundException when a test with {@code testId} doesn't exist. - * @return A {@link PollerFlux} to poll on and retrieve the file info with validation status. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginUploadTestFile(String testId, String fileName, BinaryData body, - RequestOptions fileUploadRequestOptions) { - RequestOptions defaultRequestOptions = new RequestOptions(); - if (fileUploadRequestOptions != null) { - defaultRequestOptions.setContext(fileUploadRequestOptions.getContext()); - } - return new PollerFlux<>(Duration.ofSeconds(2), - (context) -> - uploadTestFileWithResponse(testId, fileName, body, fileUploadRequestOptions) - .flatMap(FluxUtil::toMono) - .flatMap(fileBinaryData -> - PollingUtils.getPollResponseMono(() -> PollingUtils.getValidationStatus(fileBinaryData))) - .flatMap(fileValidationPollResp -> Mono.just(fileValidationPollResp.getValue())), - (context) -> - getTestFileWithResponse(testId, fileName, defaultRequestOptions).flatMap(FluxUtil::toMono) - .flatMap(fileBinaryData -> - PollingUtils.getPollResponseMono(() -> PollingUtils.getValidationStatus(fileBinaryData))), - (activationResponse, context) -> - Mono.error(LOGGER.logExceptionAsError(new RuntimeException("Cancellation is not supported"))), - (context) -> getTestFileWithResponse(testId, fileName, defaultRequestOptions).flatMap(FluxUtil::toMono)); - } - - /** - * Get all test files. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *     expireDateTime: OffsetDateTime (Optional)
-     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *     validationFailureDetails: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @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}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listTestFiles(String testId, RequestOptions requestOptions) { - return this.serviceClient.listTestFilesAsync(testId, requestOptions); - } - - /** - * Create a new test or update an existing test. - *

- * Request Body Schema - *

+ * Create a new test or update an existing test by providing the test Id. + *

Request Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -197,6 +69,11 @@ public PagedFlux listTestFiles(String testId, RequestOptions request
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -217,16 +94,25 @@ public PagedFlux listTestFiles(String testId, RequestOptions request
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -234,14 +120,17 @@ public PagedFlux listTestFiles(String testId, RequestOptions request
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -250,16 +139,16 @@ public PagedFlux listTestFiles(String testId, RequestOptions request
      *     lastModifiedBy: String (Optional)
      * }
      * }
- *

- * Response Body Schema - *

+ * + *

Response Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -269,6 +158,11 @@ public PagedFlux listTestFiles(String testId, RequestOptions request
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -289,16 +183,25 @@ public PagedFlux listTestFiles(String testId, RequestOptions request
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -306,14 +209,17 @@ public PagedFlux listTestFiles(String testId, RequestOptions request
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -322,10 +228,10 @@ public PagedFlux listTestFiles(String testId, RequestOptions request
      *     lastModifiedBy: String (Optional)
      * }
      * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param body Load test model. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param body The resource instance. * @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. @@ -341,35 +247,232 @@ public Mono> createOrUpdateTestWithResponse(String testId, } /** - * Delete a test by its name. - * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. + * Add an app component to a test. + * + * Add an app component to a test by providing the resource Id, name and type. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 the {@link Response} on successful completion of {@link Mono}. + * @return test app components along with {@link Response} on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteTestWithResponse(String testId, RequestOptions requestOptions) { - return this.serviceClient.deleteTestWithResponseAsync(testId, requestOptions); + public Mono> createOrUpdateAppComponentsWithResponse(String testId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateAppComponentsWithResponseAsync(testId, body, requestOptions); + } + + /** + * Configure server metrics for a test. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     testId: String (Optional)
+     *     metrics (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testId: String (Optional)
+     *     metrics (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body Server metric 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 test server metrics configuration along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateServerMetricsConfigWithResponse(String testId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateServerMetricsConfigWithResponseAsync(testId, body, requestOptions); + } + + /** + * Get associated app component (collection of azure resources) for the given test. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 associated app component (collection of azure resources) for the given test along with {@link Response} + * on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAppComponentsWithResponse(String testId, RequestOptions requestOptions) { + return this.serviceClient.getAppComponentsWithResponseAsync(testId, requestOptions); + } + + /** + * List server metrics configuration for the given test. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testId: String (Optional)
+     *     metrics (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 server metrics configuration along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServerMetricsConfigWithResponse(String testId, RequestOptions requestOptions) { + return this.serviceClient.getServerMetricsConfigWithResponseAsync(testId, requestOptions); } /** - * Get load test details by test name. - *

- * Response Body Schema - *

+ * Get load test details by test Id. + *

Response Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -379,6 +482,11 @@ public Mono> deleteTestWithResponse(String testId, RequestOptions
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -399,16 +507,25 @@ public Mono> deleteTestWithResponse(String testId, RequestOptions
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -416,14 +533,17 @@ public Mono> deleteTestWithResponse(String testId, RequestOptions
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -432,15 +552,15 @@ public Mono> deleteTestWithResponse(String testId, RequestOptions
      *     lastModifiedBy: String (Optional)
      * }
      * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. * @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}. + * @return load test details by test Id along with {@link Response} on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) @@ -449,64 +569,98 @@ public Mono> getTestWithResponse(String testId, RequestOpti } /** - * 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 the supported fields in (field asc/desc) format. eg: lastModifiedDateTime asc. Supported fields - - * lastModifiedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - displayName, createdBy. For example, to search for - * a test, with display name is Login Test, the search parameter can be Login.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
maxpagesizeIntegerNoNumber of results in response.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ * Get all the files that are associated with a test. + *

Response Body Schema

+ * *
{@code
      * {
-     *     passFailCriteria (Optional): {
-     *         passFailMetrics (Optional): {
-     *             String (Required): {
-     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
-     *                 condition: String (Optional)
+     *     fileName: String (Required)
+     *     url: String (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *     expireDateTime: OffsetDateTime (Optional)
+     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *     validationFailureDetails: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param fileName Name of the file. + * @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 the files that are associated with a test along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestFileWithResponse(String testId, String fileName, + RequestOptions requestOptions) { + return this.serviceClient.getTestFileWithResponseAsync(testId, fileName, requestOptions); + } + + /** + * Get all test files. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     fileName: String (Required)
+     *     url: String (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *     expireDateTime: OffsetDateTime (Optional)
+     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *     validationFailureDetails: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @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}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestFiles(String testId, RequestOptions requestOptions) { + return this.serviceClient.listTestFilesAsync(testId, 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 the supported fields in (field asc/desc) format. eg: + * lastModifiedDateTime asc. Supported fields - lastModifiedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - + * displayName, + * createdBy. For example, to search for a test, with display name is Login Test, + * the search parameter can be Login.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) + * of the last updated time range to filter tests.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of + * the last updated time range to filter tests.
maxpagesizeIntegerNoNumber of results in response.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Required): {
+     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
+     *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
      *                 action: String(continue/stop) (Optional)
@@ -515,6 +669,11 @@ public Mono> getTestWithResponse(String testId, RequestOpti
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -535,16 +694,25 @@ public Mono> getTestWithResponse(String testId, RequestOpti
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -552,14 +720,17 @@ public Mono> getTestWithResponse(String testId, RequestOpti
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -568,7 +739,7 @@ public Mono> getTestWithResponse(String testId, RequestOpti
      *     lastModifiedBy: 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. @@ -585,53 +756,38 @@ public PagedFlux listTests(RequestOptions 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 application/octet-stream. - * - *

- * Query Parameters - * + * Upload input file for a given test Id. 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 application/octet-stream. + *

Query Parameters

* * - * - * - * - * - * - * - * - * - * - * - * - * + * + * *
Query Parameters
NameTypeRequiredDescription
fileTypeStringNoFile type. Allowed values: "JMX_FILE", "USER_PROPERTIES", "ADDITIONAL_ARTIFACTS".
NameTypeRequiredDescription
fileTypeStringNoFile type. Allowed values: "JMX_FILE", "USER_PROPERTIES", + * "ADDITIONAL_ARTIFACTS", "ZIPPED_ARTIFACTS", "URL_TEST_CONFIG", "TEST_SCRIPT".
- * * You can add these to a request with {@link RequestOptions#addQueryParam} - * - *

- * Request Body Schema - * + *

Request Body Schema

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

- * Response Body Schema - * + * + *

Response Body Schema

+ * *
{@code
      * {
+     *     fileName: String (Required)
      *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *     expireDateTime: OffsetDateTime (Optional)
      *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *     validationFailureDetails: String (Optional)
      * }
      * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. + * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @param fileName Unique name for test file with file extension like : App.jmx. * @param body The file content as application/octet-stream. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. @@ -639,53 +795,40 @@ public PagedFlux listTests(RequestOptions requestOptions) { * @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 file info along with {@link Response} on successful completion of {@link Mono}. + * @return test file info along with {@link Response} on successful completion of {@link Mono}. */ + @Generated @ServiceMethod(returns = ReturnType.SINGLE) - Mono> uploadTestFileWithResponse(String testId, String fileName, BinaryData body, + public Mono> uploadTestFileWithResponse(String testId, String fileName, BinaryData body, RequestOptions requestOptions) { return this.serviceClient.uploadTestFileWithResponseAsync(testId, fileName, body, requestOptions); } /** - * Get test file by the file name. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *     expireDateTime: OffsetDateTime (Optional)
-     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *     validationFailureDetails: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param fileName File name with file extension like app.jmx. + * Delete file by the file name for a test. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param fileName Name of the file. * @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}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTestFileWithResponse(String testId, String fileName, + public Mono> deleteTestFileWithResponse(String testId, String fileName, RequestOptions requestOptions) { - return this.serviceClient.getTestFileWithResponseAsync(testId, fileName, requestOptions); + return this.serviceClient.deleteTestFileWithResponseAsync(testId, fileName, requestOptions); } /** - * Delete file by the file name for a test. - * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param fileName File name with file extension like app.jmx. + * Delete a test by its test Id. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. * @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. @@ -695,158 +838,405 @@ public Mono> getTestFileWithResponse(String testId, String */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteTestFileWithResponse(String testId, String fileName, - RequestOptions requestOptions) { - return this.serviceClient.deleteTestFileWithResponseAsync(testId, fileName, requestOptions); + public Mono> deleteTestWithResponse(String testId, RequestOptions requestOptions) { + return this.serviceClient.deleteTestWithResponseAsync(testId, requestOptions); } /** - * Associate an app component (collection of azure resources) to a test. - *

- * Request Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
-     *         }
-     *     }
-     *     testId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
-     *         }
-     *     }
-     *     testId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. + * Create a new test or update an existing test by providing the test Id. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param body The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return load test model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateTest(String testId, Test body) { + // Generated convenience method for createOrUpdateTestWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateTestWithResponse(testId, bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Test.class)); + } + + /** + * Add an app component to a test. + * + * Add an app component to a test by providing the resource Id, name and type. + * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @param body App Component model. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 app component along with {@link Response} on successful completion of {@link Mono}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test app components on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateAppComponentsWithResponse(String testId, BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateAppComponentsWithResponseAsync(testId, body, requestOptions); + public Mono createOrUpdateAppComponents(String testId, TestAppComponents body) { + // Generated convenience method for createOrUpdateAppComponentsWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestAppComponentsAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestAppComponentsAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateAppComponentsWithResponse(testId, bodyInBinaryData, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestAppComponents.class)); + } + + /** + * Configure server metrics for a test. + * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body Server metric configuration model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test server metrics configuration on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateServerMetricsConfig(String testId, TestServerMetricConfig body) { + // Generated convenience method for createOrUpdateServerMetricsConfigWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestServerMetricConfigAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestServerMetricConfigAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateServerMetricsConfigWithResponse(testId, bodyInBinaryData, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestServerMetricConfig.class)); } /** * Get associated app component (collection of azure resources) for the given test. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
-     *         }
-     *     }
-     *     testId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 associated app component (collection of azure resources) for the given test along with {@link Response} - * on successful completion of {@link Mono}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return associated app component (collection of azure resources) for the given test on successful completion of + * {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAppComponentsWithResponse(String testId, RequestOptions requestOptions) { - return this.serviceClient.getAppComponentsWithResponseAsync(testId, requestOptions); + public Mono getAppComponents(String testId) { + // Generated convenience method for getAppComponentsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAppComponentsWithResponse(testId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestAppComponents.class)); } /** * List server metrics configuration for the given test. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
-     *         }
-     *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 server metrics configuration along with {@link Response} on successful completion of {@link Mono}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test server metrics configuration on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getServerMetricsConfigWithResponse(String testId, RequestOptions requestOptions) { - return this.serviceClient.getServerMetricsConfigWithResponseAsync(testId, requestOptions); + public Mono getServerMetricsConfig(String testId) { + // Generated convenience method for getServerMetricsConfigWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getServerMetricsConfigWithResponse(testId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestServerMetricConfig.class)); + } + + /** + * Get load test details by test Id. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return load test details by test Id on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTest(String testId) { + // Generated convenience method for getTestWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTestWithResponse(testId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Test.class)); + } + + /** + * Get all the files that are associated with a test. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param fileName Name of the file. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the files that are associated with a test on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTestFile(String testId, String fileName) { + // Generated convenience method for getTestFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTestFileWithResponse(testId, fileName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestFileInfo.class)); + } + + /** + * Get all test files. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all test files as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestFiles(String testId) { + // Generated convenience method for listTestFiles + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listTestFiles(testId, requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(TestFileInfo.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Get all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + * + * @param orderBy Sort on the supported fields in (field asc/desc) format. eg: + * lastModifiedDateTime asc. Supported fields - lastModifiedDateTime. + * @param search Prefix based, case sensitive search on searchable fields - displayName, + * createdBy. For example, to search for a test, with display name is Login Test, + * the search parameter can be Login. + * @param lastModifiedStartTime Start DateTime(RFC 3339 literal format) of the last updated time range to filter + * tests. + * @param lastModifiedEndTime End DateTime(RFC 3339 literal format) of the last updated time range to filter tests. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @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 listTests(String orderBy, String search, OffsetDateTime lastModifiedStartTime, + OffsetDateTime lastModifiedEndTime) { + // Generated convenience method for listTests + RequestOptions requestOptions = new RequestOptions(); + if (orderBy != null) { + requestOptions.addQueryParam("orderby", orderBy, false); + } + if (search != null) { + requestOptions.addQueryParam("search", search, false); + } + if (lastModifiedStartTime != null) { + requestOptions.addQueryParam("lastModifiedStartTime", String.valueOf(lastModifiedStartTime), false); + } + if (lastModifiedEndTime != null) { + requestOptions.addQueryParam("lastModifiedEndTime", String.valueOf(lastModifiedEndTime), false); + } + PagedFlux pagedFluxResponse = listTests(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(Test.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Get all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @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 listTests() { + // Generated convenience method for listTests + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listTests(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(Test.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Upload input file for a given test Id. 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 application/octet-stream. + * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param fileName Unique name for test file with file extension like : App.jmx. + * @param body The file content as application/octet-stream. + * @param fileType File type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test file info on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono uploadTestFile(String testId, String fileName, BinaryData body, FileType fileType) { + // Generated convenience method for uploadTestFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (fileType != null) { + requestOptions.addQueryParam("fileType", fileType.toString(), false); + } + return uploadTestFileWithResponse(testId, fileName, body, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestFileInfo.class)); + } + + /** + * Upload input file for a given test Id. 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 application/octet-stream. + * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param fileName Unique name for test file with file extension like : App.jmx. + * @param body The file content as application/octet-stream. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test file info on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono uploadTestFile(String testId, String fileName, BinaryData body) { + // Generated convenience method for uploadTestFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return uploadTestFileWithResponse(testId, fileName, body, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestFileInfo.class)); + } + + /** + * Delete file by the file name for a test. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param fileName Name of the file. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteTestFile(String testId, String fileName) { + // Generated convenience method for deleteTestFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteTestFileWithResponse(testId, fileName, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Delete a test by its test Id. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteTest(String testId) { + // Generated convenience method for deleteTestWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteTestWithResponse(testId, requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationClient.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationClient.java index 9667ce71eaa4b..bbc9189aadc21 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationClient.java +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationClient.java @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. + package com.azure.developer.loadtesting; import com.azure.core.annotation.Generated; @@ -15,172 +16,43 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.SyncPoller; -import com.azure.developer.loadtesting.implementation.LoadTestAdministrationsImpl; - -import java.time.Duration; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.developer.loadtesting.models.FileType; +import com.azure.developer.loadtesting.models.Test; +import com.azure.developer.loadtesting.models.TestAppComponents; +import com.azure.developer.loadtesting.models.TestFileInfo; +import com.azure.developer.loadtesting.models.TestServerMetricConfig; +import java.time.OffsetDateTime; /** - * Initializes a new instance of the synchronous LoadTestingClient type. + * Initializes a new instance of the synchronous LoadTestAdministrationClient type. */ @ServiceClient(builder = LoadTestAdministrationClientBuilder.class) public final class LoadTestAdministrationClient { - private static final ClientLogger LOGGER = new ClientLogger(LoadTestAdministrationClient.class); - @Generated - private final LoadTestAdministrationsImpl serviceClient; + private final LoadTestAdministrationAsyncClient client; /** * Initializes an instance of LoadTestAdministrationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - LoadTestAdministrationClient(LoadTestAdministrationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Configure server metrics for a test. - *

- * Request Body Schema - *

- *
{@code
-     * {
-     *     testId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
-     *         }
-     *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
-     *         }
-     *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param body Server metric 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 test server metrics configuration along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateServerMetricsConfigWithResponse(String testId, BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateServerMetricsConfigWithResponse(testId, body, requestOptions); - } - - /** - * Uploads file and polls the validation status of the uploaded file. - * - * @param testId Unique name for load test, must be a valid URL character ^[a-z0-9_-]*$. - * @param fileName Unique name for test file with file extension like : App.jmx. - * @param body The file content as application/octet-stream. - * @param fileUploadRequestOptions The options to configure the file upload HTTP request before HTTP client sends - * it. - * @throws ResourceNotFoundException when a test with {@code testId} doesn't exist. - * @return A {@link SyncPoller} to poll on and retrieve the file info with validation status. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginUploadTestFile(String testId, String fileName, BinaryData body, - RequestOptions fileUploadRequestOptions) { - RequestOptions defaultRequestOptions = new RequestOptions(); - if (fileUploadRequestOptions != null) { - defaultRequestOptions.setContext(fileUploadRequestOptions.getContext()); - } - return SyncPoller.createPoller(Duration.ofSeconds(2), - (context) -> PollingUtils.getValidationStatus(uploadTestFileWithResponse(testId, fileName, body, - fileUploadRequestOptions).getValue()), - (context) -> PollingUtils.getValidationStatus(getTestFileWithResponse(testId, fileName, - defaultRequestOptions).getValue()), - (activationResponse, context) -> { - throw LOGGER.logExceptionAsError(new RuntimeException("Cancellation is not supported")); - }, - (context) -> getTestFileWithResponse(testId, fileName, defaultRequestOptions).getValue()); - } - - /** - * Get all test files. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *     expireDateTime: OffsetDateTime (Optional)
-     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *     validationFailureDetails: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @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}. + * + * @param client the async client. */ @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listTestFiles(String testId, RequestOptions requestOptions) { - return this.serviceClient.listTestFiles(testId, requestOptions); + LoadTestAdministrationClient(LoadTestAdministrationAsyncClient client) { + this.client = client; } /** - * Create a new test or update an existing test. - *

- * Request Body Schema - *

+ * Create a new test or update an existing test by providing the test Id. + *

Request Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -190,6 +62,11 @@ public PagedIterable listTestFiles(String testId, RequestOptions req
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -210,16 +87,25 @@ public PagedIterable listTestFiles(String testId, RequestOptions req
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -227,14 +113,17 @@ public PagedIterable listTestFiles(String testId, RequestOptions req
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -243,16 +132,16 @@ public PagedIterable listTestFiles(String testId, RequestOptions req
      *     lastModifiedBy: String (Optional)
      * }
      * }
- *

- * Response Body Schema - *

+ * + *

Response Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -262,6 +151,11 @@ public PagedIterable listTestFiles(String testId, RequestOptions req
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -282,16 +176,25 @@ public PagedIterable listTestFiles(String testId, RequestOptions req
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -299,14 +202,17 @@ public PagedIterable listTestFiles(String testId, RequestOptions req
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -315,10 +221,10 @@ public PagedIterable listTestFiles(String testId, RequestOptions req
      *     lastModifiedBy: String (Optional)
      * }
      * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param body Load test model. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param body The resource instance. * @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. @@ -330,39 +236,235 @@ public PagedIterable listTestFiles(String testId, RequestOptions req @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateTestWithResponse(String testId, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateTestWithResponse(testId, body, requestOptions); + return this.client.createOrUpdateTestWithResponse(testId, body, requestOptions).block(); } /** - * Delete a test by its name. - * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. + * Add an app component to a test. + * + * Add an app component to a test by providing the resource Id, name and type. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 the {@link Response}. + * @return test app components along with {@link Response}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteTestWithResponse(String testId, RequestOptions requestOptions) { - return this.serviceClient.deleteTestWithResponse(testId, requestOptions); + public Response createOrUpdateAppComponentsWithResponse(String testId, BinaryData body, + RequestOptions requestOptions) { + return this.client.createOrUpdateAppComponentsWithResponse(testId, body, requestOptions).block(); } /** - * Get load test details by test name. - *

- * Response Body Schema - *

+ * Configure server metrics for a test. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     testId: String (Optional)
+     *     metrics (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testId: String (Optional)
+     *     metrics (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body Server metric 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 test server metrics configuration along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateServerMetricsConfigWithResponse(String testId, BinaryData body, + RequestOptions requestOptions) { + return this.client.createOrUpdateServerMetricsConfigWithResponse(testId, body, requestOptions).block(); + } + + /** + * Get associated app component (collection of azure resources) for the given test. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 associated app component (collection of azure resources) for the given test along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAppComponentsWithResponse(String testId, RequestOptions requestOptions) { + return this.client.getAppComponentsWithResponse(testId, requestOptions).block(); + } + + /** + * List server metrics configuration for the given test. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testId: String (Optional)
+     *     metrics (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 server metrics configuration along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getServerMetricsConfigWithResponse(String testId, RequestOptions requestOptions) { + return this.client.getServerMetricsConfigWithResponse(testId, requestOptions).block(); + } + + /** + * Get load test details by test Id. + *

Response Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -372,6 +474,11 @@ public Response deleteTestWithResponse(String testId, RequestOptions reque
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -392,16 +499,25 @@ public Response deleteTestWithResponse(String testId, RequestOptions reque
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -409,14 +525,17 @@ public Response deleteTestWithResponse(String testId, RequestOptions reque
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -425,80 +544,112 @@ public Response deleteTestWithResponse(String testId, RequestOptions reque
      *     lastModifiedBy: String (Optional)
      * }
      * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. * @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}. + * @return load test details by test Id along with {@link Response}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Response getTestWithResponse(String testId, RequestOptions requestOptions) { - return this.serviceClient.getTestWithResponse(testId, requestOptions); + return this.client.getTestWithResponse(testId, requestOptions).block(); + } + + /** + * Get all the files that are associated with a test. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     fileName: String (Required)
+     *     url: String (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *     expireDateTime: OffsetDateTime (Optional)
+     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *     validationFailureDetails: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param fileName Name of the file. + * @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 the files that are associated with a test along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestFileWithResponse(String testId, String fileName, RequestOptions requestOptions) { + return this.client.getTestFileWithResponse(testId, fileName, requestOptions).block(); + } + + /** + * Get all test files. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     fileName: String (Required)
+     *     url: String (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *     expireDateTime: OffsetDateTime (Optional)
+     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *     validationFailureDetails: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @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}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestFiles(String testId, RequestOptions requestOptions) { + return new PagedIterable<>(this.client.listTestFiles(testId, 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

* * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * *
Query Parameters
NameTypeRequiredDescription
orderbyStringNoSort on the supported fields in (field asc/desc) format. eg: lastModifiedDateTime asc. Supported fields - - * lastModifiedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - displayName, createdBy. For example, to search for - * a test, with display name is Login Test, the search parameter can be Login.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
maxpagesizeIntegerNoNumber of results in response.
NameTypeRequiredDescription
orderbyStringNoSort on the supported fields in (field asc/desc) format. eg: + * lastModifiedDateTime asc. Supported fields - lastModifiedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - + * displayName, + * createdBy. For example, to search for a test, with display name is Login Test, + * the search parameter can be Login.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) + * of the last updated time range to filter tests.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of + * the last updated time range to filter tests.
maxpagesizeIntegerNoNumber of results in response.
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ *

Response Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -508,6 +659,11 @@ public Response getTestWithResponse(String testId, RequestOptions re
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -528,16 +684,25 @@ public Response getTestWithResponse(String testId, RequestOptions re
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -545,14 +710,17 @@ public Response getTestWithResponse(String testId, RequestOptions re
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -561,7 +729,7 @@ public Response getTestWithResponse(String testId, RequestOptions re
      *     lastModifiedBy: 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. @@ -574,57 +742,42 @@ public Response getTestWithResponse(String testId, RequestOptions re @Generated @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listTests(RequestOptions requestOptions) { - return this.serviceClient.listTests(requestOptions); + return new PagedIterable<>(this.client.listTests(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 application/octet-stream. - * - *

- * Query Parameters - * + * Upload input file for a given test Id. 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 application/octet-stream. + *

Query Parameters

* * - * - * - * - * - * - * - * - * - * - * - * - * + * + * *
Query Parameters
NameTypeRequiredDescription
fileTypeStringNoFile type. Allowed values: "JMX_FILE", "USER_PROPERTIES", "ADDITIONAL_ARTIFACTS".
NameTypeRequiredDescription
fileTypeStringNoFile type. Allowed values: "JMX_FILE", "USER_PROPERTIES", + * "ADDITIONAL_ARTIFACTS", "ZIPPED_ARTIFACTS", "URL_TEST_CONFIG", "TEST_SCRIPT".
- * * You can add these to a request with {@link RequestOptions#addQueryParam} - * - *

- * Request Body Schema - * + *

Request Body Schema

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

- * Response Body Schema - * + * + *

Response Body Schema

+ * *
{@code
      * {
+     *     fileName: String (Required)
      *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *     expireDateTime: OffsetDateTime (Optional)
      *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *     validationFailureDetails: String (Optional)
      * }
      * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. + * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @param fileName Unique name for test file with file extension like : App.jmx. * @param body The file content as application/octet-stream. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. @@ -632,52 +785,39 @@ public PagedIterable listTests(RequestOptions requestOptions) { * @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 file info along with {@link Response}. + * @return test file info along with {@link Response}. */ + @Generated @ServiceMethod(returns = ReturnType.SINGLE) - Response uploadTestFileWithResponse(String testId, String fileName, BinaryData body, + public Response uploadTestFileWithResponse(String testId, String fileName, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.uploadTestFileWithResponse(testId, fileName, body, requestOptions); + return this.client.uploadTestFileWithResponse(testId, fileName, body, requestOptions).block(); } /** - * Get test file by the file name. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *     expireDateTime: OffsetDateTime (Optional)
-     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *     validationFailureDetails: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param fileName File name with file extension like app.jmx. + * Delete file by the file name for a test. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param fileName Name of the file. * @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}. + * @return the {@link Response}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTestFileWithResponse(String testId, String fileName, RequestOptions requestOptions) { - return this.serviceClient.getTestFileWithResponse(testId, fileName, requestOptions); + public Response deleteTestFileWithResponse(String testId, String fileName, RequestOptions requestOptions) { + return this.client.deleteTestFileWithResponse(testId, fileName, requestOptions).block(); } /** - * Delete file by the file name for a test. - * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param fileName File name with file extension like app.jmx. + * Delete a test by its test Id. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. * @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. @@ -687,156 +827,345 @@ public Response getTestFileWithResponse(String testId, String fileNa */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteTestFileWithResponse(String testId, String fileName, RequestOptions requestOptions) { - return this.serviceClient.deleteTestFileWithResponse(testId, fileName, requestOptions); + public Response deleteTestWithResponse(String testId, RequestOptions requestOptions) { + return this.client.deleteTestWithResponse(testId, requestOptions).block(); } /** - * Associate an app component (collection of azure resources) to a test. - *

- * Request Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
-     *         }
-     *     }
-     *     testId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
-     *         }
-     *     }
-     *     testId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. + * Create a new test or update an existing test by providing the test Id. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param body The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return load test model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Test createOrUpdateTest(String testId, Test body) { + // Generated convenience method for createOrUpdateTestWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateTestWithResponse(testId, bodyInBinaryData, requestOptions).getValue().toObject(Test.class); + } + + /** + * Add an app component to a test. + * + * Add an app component to a test by providing the resource Id, name and type. + * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @param body App Component model. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 app component along with {@link Response}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test app components. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateAppComponentsWithResponse(String testId, BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateAppComponentsWithResponse(testId, body, requestOptions); + public TestAppComponents createOrUpdateAppComponents(String testId, TestAppComponents body) { + // Generated convenience method for createOrUpdateAppComponentsWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestAppComponentsAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestAppComponentsAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateAppComponentsWithResponse(testId, bodyInBinaryData, requestOptions).getValue() + .toObject(TestAppComponents.class); + } + + /** + * Configure server metrics for a test. + * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body Server metric configuration model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test server metrics configuration. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestServerMetricConfig createOrUpdateServerMetricsConfig(String testId, TestServerMetricConfig body) { + // Generated convenience method for createOrUpdateServerMetricsConfigWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestServerMetricConfigAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestServerMetricConfigAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateServerMetricsConfigWithResponse(testId, bodyInBinaryData, requestOptions).getValue() + .toObject(TestServerMetricConfig.class); } /** * Get associated app component (collection of azure resources) for the given test. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
-     *         }
-     *     }
-     *     testId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 associated app component (collection of azure resources) for the given test along with {@link Response}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return associated app component (collection of azure resources) for the given test. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAppComponentsWithResponse(String testId, RequestOptions requestOptions) { - return this.serviceClient.getAppComponentsWithResponse(testId, requestOptions); + public TestAppComponents getAppComponents(String testId) { + // Generated convenience method for getAppComponentsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAppComponentsWithResponse(testId, requestOptions).getValue().toObject(TestAppComponents.class); } /** * List server metrics configuration for the given test. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
-     *         }
-     *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 server metrics configuration along with {@link Response}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test server metrics configuration. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response getServerMetricsConfigWithResponse(String testId, RequestOptions requestOptions) { - return this.serviceClient.getServerMetricsConfigWithResponse(testId, requestOptions); + public TestServerMetricConfig getServerMetricsConfig(String testId) { + // Generated convenience method for getServerMetricsConfigWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getServerMetricsConfigWithResponse(testId, requestOptions).getValue() + .toObject(TestServerMetricConfig.class); + } + + /** + * Get load test details by test Id. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return load test details by test Id. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Test getTest(String testId) { + // Generated convenience method for getTestWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTestWithResponse(testId, requestOptions).getValue().toObject(Test.class); + } + + /** + * Get all the files that are associated with a test. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param fileName Name of the file. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the files that are associated with a test. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestFileInfo getTestFile(String testId, String fileName) { + // Generated convenience method for getTestFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTestFileWithResponse(testId, fileName, requestOptions).getValue().toObject(TestFileInfo.class); + } + + /** + * Get all test files. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all test files as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestFiles(String testId) { + // Generated convenience method for listTestFiles + return new PagedIterable<>(client.listTestFiles(testId)); + } + + /** + * Get all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + * + * @param orderBy Sort on the supported fields in (field asc/desc) format. eg: + * lastModifiedDateTime asc. Supported fields - lastModifiedDateTime. + * @param search Prefix based, case sensitive search on searchable fields - displayName, + * createdBy. For example, to search for a test, with display name is Login Test, + * the search parameter can be Login. + * @param lastModifiedStartTime Start DateTime(RFC 3339 literal format) of the last updated time range to filter + * tests. + * @param lastModifiedEndTime End DateTime(RFC 3339 literal format) of the last updated time range to filter tests. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @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 listTests(String orderBy, String search, OffsetDateTime lastModifiedStartTime, + OffsetDateTime lastModifiedEndTime) { + // Generated convenience method for listTests + return new PagedIterable<>(client.listTests(orderBy, search, lastModifiedStartTime, lastModifiedEndTime)); + } + + /** + * Get all load tests by the fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @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 listTests() { + // Generated convenience method for listTests + return new PagedIterable<>(client.listTests()); + } + + /** + * Upload input file for a given test Id. 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 application/octet-stream. + * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param fileName Unique name for test file with file extension like : App.jmx. + * @param body The file content as application/octet-stream. + * @param fileType File type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test file info. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestFileInfo uploadTestFile(String testId, String fileName, BinaryData body, FileType fileType) { + // Generated convenience method for uploadTestFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (fileType != null) { + requestOptions.addQueryParam("fileType", fileType.toString(), false); + } + return uploadTestFileWithResponse(testId, fileName, body, requestOptions).getValue() + .toObject(TestFileInfo.class); + } + + /** + * Upload input file for a given test Id. 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 application/octet-stream. + * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param fileName Unique name for test file with file extension like : App.jmx. + * @param body The file content as application/octet-stream. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test file info. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestFileInfo uploadTestFile(String testId, String fileName, BinaryData body) { + // Generated convenience method for uploadTestFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return uploadTestFileWithResponse(testId, fileName, body, requestOptions).getValue() + .toObject(TestFileInfo.class); + } + + /** + * Delete file by the file name for a test. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param fileName Name of the file. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteTestFile(String testId, String fileName) { + // Generated convenience method for deleteTestFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteTestFileWithResponse(testId, fileName, requestOptions).getValue(); + } + + /** + * Delete a test by its test Id. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteTest(String testId) { + // Generated convenience method for deleteTestWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteTestWithResponse(testId, requestOptions).getValue(); } } diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationClientBuilder.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationClientBuilder.java index 1c436f15ab2de..e2f0642c10041 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationClientBuilder.java +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestAdministrationClientBuilder.java @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. + package com.azure.developer.loadtesting; import com.azure.core.annotation.Generated; @@ -11,7 +12,6 @@ import com.azure.core.client.traits.TokenCredentialTrait; import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; @@ -20,8 +20,8 @@ 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.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.HttpPolicyProviders; import com.azure.core.http.policy.RequestIdPolicy; @@ -34,7 +34,7 @@ import com.azure.core.util.builder.ClientBuilderUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.developer.loadtesting.implementation.LoadTestingClientImpl; +import com.azure.developer.loadtesting.implementation.LoadTestAdministrationClientImpl; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -47,7 +47,6 @@ public final class LoadTestAdministrationClientBuilder implements HttpTrait, ConfigurationTrait, TokenCredentialTrait, EndpointTrait { - @Generated private static final String SDK_NAME = "name"; @@ -57,6 +56,10 @@ public final class LoadTestAdministrationClientBuilder @Generated private static final String[] DEFAULT_SCOPES = new String[] { "https://cnt-prod.loadtesting.azure.com/.default" }; + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-developer-loadtesting.properties"); + @Generated private final List pipelinePolicies; @@ -81,7 +84,7 @@ public LoadTestAdministrationClientBuilder() { @Override public LoadTestAdministrationClientBuilder pipeline(HttpPipeline pipeline) { if (this.pipeline != null && pipeline == null) { - LOGGER.info("HttpPipeline is being set to 'null' when it was previously configured."); + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); } this.pipeline = pipeline; return this; @@ -218,7 +221,7 @@ public LoadTestAdministrationClientBuilder endpoint(String endpoint) { /** * Sets Service version. - * + * * @param serviceVersion the serviceVersion value. * @return the LoadTestAdministrationClientBuilder. */ @@ -236,7 +239,7 @@ public LoadTestAdministrationClientBuilder serviceVersion(LoadTestingServiceVers /** * Sets The retry policy that will attempt to retry failed requests, if applicable. - * + * * @param retryPolicy the retryPolicy value. * @return the LoadTestAdministrationClientBuilder. */ @@ -247,20 +250,28 @@ public LoadTestAdministrationClientBuilder retryPolicy(RetryPolicy retryPolicy) } /** - * Builds an instance of LoadTestingClientImpl with the provided parameters. - * - * @return an instance of LoadTestingClientImpl. + * Builds an instance of LoadTestAdministrationClientImpl with the provided parameters. + * + * @return an instance of LoadTestAdministrationClientImpl. */ @Generated - private LoadTestingClientImpl buildInnerClient() { + private LoadTestAdministrationClientImpl buildInnerClient() { + this.validateClient(); HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); LoadTestingServiceVersion localServiceVersion = (serviceVersion != null) ? serviceVersion : LoadTestingServiceVersion.getLatest(); - LoadTestingClientImpl client = new LoadTestingClientImpl(localPipeline, + LoadTestAdministrationClientImpl client = new LoadTestAdministrationClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); return client; } + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + @Generated private HttpPipeline createHttpPipeline() { Configuration buildConfiguration @@ -274,13 +285,12 @@ private HttpPipeline createHttpPipeline() { policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); policies.add(new RequestIdPolicy()); policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = new HttpHeaders(); - localClientOptions.getHeaders() - .forEach(header -> headers.set(HttpHeaderName.fromString(header.getName()), header.getValue())); - if (headers.getSize() > 0) { + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { policies.add(new AddHeadersPolicy(headers)); } - this.pipelinePolicies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) .forEach(p -> policies.add(p)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); @@ -288,38 +298,37 @@ private HttpPipeline createHttpPipeline() { if (tokenCredential != null) { policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); } - this.pipelinePolicies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) .forEach(p -> policies.add(p)); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(localHttpLogOptions)); HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient).clientOptions(localClientOptions).build(); + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); return httpPipeline; } /** * Builds an instance of LoadTestAdministrationAsyncClient class. - * + * * @return an instance of LoadTestAdministrationAsyncClient. */ @Generated public LoadTestAdministrationAsyncClient buildAsyncClient() { - return new LoadTestAdministrationAsyncClient(buildInnerClient().getLoadTestAdministrations()); + return new LoadTestAdministrationAsyncClient(buildInnerClient()); } /** * Builds an instance of LoadTestAdministrationClient class. - * + * * @return an instance of LoadTestAdministrationClient. */ @Generated public LoadTestAdministrationClient buildClient() { - return new LoadTestAdministrationClient(buildInnerClient().getLoadTestAdministrations()); + return new LoadTestAdministrationClient(new LoadTestAdministrationAsyncClient(buildInnerClient())); } - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-developer-loadtesting.properties"); - private static final ClientLogger LOGGER = new ClientLogger(LoadTestAdministrationClientBuilder.class); } diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestRunAsyncClient.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestRunAsyncClient.java index 79e354734ed48..8c3b3be3170e4 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestRunAsyncClient.java +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestRunAsyncClient.java @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. + package com.azure.developer.loadtesting; import com.azure.core.annotation.Generated; @@ -11,469 +12,71 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; import com.azure.core.http.rest.PagedFlux; +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.util.BinaryData; import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.developer.loadtesting.implementation.LoadTestRunsImpl; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.developer.loadtesting.implementation.LoadTestRunClientImpl; +import com.azure.developer.loadtesting.models.DimensionValueList; +import com.azure.developer.loadtesting.models.MetricDefinitionCollection; +import com.azure.developer.loadtesting.models.MetricNamespaceCollection; +import com.azure.developer.loadtesting.models.MetricRequestPayload; +import com.azure.developer.loadtesting.models.TestRun; +import com.azure.developer.loadtesting.models.TestRunAppComponents; +import com.azure.developer.loadtesting.models.TestRunFileInfo; +import com.azure.developer.loadtesting.models.TestRunServerMetricConfig; +import com.azure.developer.loadtesting.models.TimeGrain; +import com.azure.developer.loadtesting.models.TimeSeriesElement; +import java.time.OffsetDateTime; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.time.Duration; - /** - * Initializes a new instance of the asynchronous LoadTestingClient type. + * Initializes a new instance of the asynchronous LoadTestRunClient type. */ @ServiceClient(builder = LoadTestRunClientBuilder.class, isAsync = true) public final class LoadTestRunAsyncClient { @Generated - private final LoadTestRunsImpl serviceClient; + private final LoadTestRunClientImpl serviceClient; /** * Initializes an instance of LoadTestRunAsyncClient class. - * + * * @param serviceClient the service client implementation. */ @Generated - LoadTestRunAsyncClient(LoadTestRunsImpl serviceClient) { + LoadTestRunAsyncClient(LoadTestRunClientImpl serviceClient) { this.serviceClient = serviceClient; } /** - * Configure server metrics for a test run. - *

- * Request Body Schema - *

- *
{@code
-     * {
-     *     testRunId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
-     *         }
-     *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testRunId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
-     *         }
-     *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param body Server metric 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 test run server metrics configuration along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateServerMetricsConfigWithResponse(String testRunId, BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateServerMetricsConfigWithResponseAsync(testRunId, body, requestOptions); - } - - /** - * Starts a test run and polls the status of the test run. - * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param body Load test run model. - * @param testRunRequestOptions The options to configure the file upload HTTP request before HTTP client sends it. - * @throws ResourceNotFoundException when a test with {@code testRunId} doesn't exist. - * @return A {@link PollerFlux} to poll on and retrieve the test run - * status(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE). - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginTestRun(String testRunId, BinaryData body, - RequestOptions testRunRequestOptions) { - RequestOptions defaultRequestOptions = new RequestOptions(); - if (testRunRequestOptions != null) { - defaultRequestOptions.setContext(testRunRequestOptions.getContext()); - } - return new PollerFlux<>(Duration.ofSeconds(5), - (context) -> createOrUpdateTestRunWithResponse(testRunId, body, testRunRequestOptions) - .flatMap(FluxUtil::toMono), - (context) -> getTestRunWithResponse(testRunId, defaultRequestOptions) - .flatMap(FluxUtil::toMono) - .flatMap(testRunBinary -> - PollingUtils.getPollResponseMono(() -> PollingUtils.getTestRunStatus(testRunBinary))), - (activationResponse, context) -> stopTestRunWithResponse(testRunId, defaultRequestOptions) - .flatMap(FluxUtil::toMono), - (context) -> getTestRunWithResponse(testRunId, defaultRequestOptions).flatMap(FluxUtil::toMono)); - } - - - /** - * Associate an app component (collection of azure resources) to a test run. - *

- * Request Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
-     *         }
-     *     }
-     *     testRunId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
-     *         }
-     *     }
-     *     testRunId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @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 test run app component along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateAppComponentsWithResponse(String testRunId, BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateAppComponentsWithResponseAsync(testRunId, body, requestOptions); - } - - /** - * List the metric values for a load test run. - * - *

- * Query Parameters - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
aggregationStringNoThe aggregation
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
- * - * You can add these to a request with {@link RequestOptions#addQueryParam} - * - *

- * Request Body Schema - * - *

{@code
-     * {
-     *     filters (Optional): [
-     *          (Optional){
-     *             name: String (Optional)
-     *             values (Optional): [
-     *                 String (Optional)
-     *             ]
-     *         }
-     *     ]
-     * }
-     * }
- * - *

- * Response Body Schema - * - *

{@code
-     * {
-     *     value (Optional): [
-     *          (Optional){
-     *             data (Optional): [
-     *                  (Optional){
-     *                     timestamp: String (Optional)
-     *                     value: Double (Optional)
-     *                 }
-     *             ]
-     *             dimensionValues (Optional): [
-     *                  (Optional){
-     *                     name: String (Optional)
-     *                     value: String (Optional)
-     *                 }
-     *             ]
-     *         }
-     *     ]
-     *     nextLink: String (Optional)
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param metricName Metric name. - * @param metricNamespace Metric namespace to query metric definitions for. - * @param timespan The timespan of the query. It is a string with the following format - * 'startDateTime_ISO/endDateTime_ISO'. - * @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 to a metrics query as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listMetrics(String testRunId, String metricName, String metricNamespace, - String timespan, RequestOptions requestOptions) { - if (requestOptions == null) { - requestOptions = new RequestOptions(); - } - // Content-Type header required even though body can be null - requestOptions.setHeader(HttpHeaderName.CONTENT_TYPE, "application/json"); - return this.serviceClient.listMetricsAsync(testRunId, metricName, metricNamespace, timespan, requestOptions); - } - - /** - * List the dimension values for the given metric dimension name. - *

- * Query Parameters - *

+ * Create and start a new test run with the given test run Id. + *

Query Parameters

* * - * - * - * - * - * - * - * - * - * - * - * - * + * + * *
Query Parameters
NameTypeRequiredDescription
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
NameTypeRequiredDescription
oldTestRunIdStringNoExisting test run identifier that should be rerun, if this + * is provided, the + * test will run with the JMX file, configuration and app components from the + * existing test run. You can override the configuration values for new test run + * in the request body.
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

- *
{@code
-     * String
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param name Dimension name. - * @param metricName Metric name. - * @param metricNamespace Metric namespace to query metric definitions for. - * @param timespan The timespan of the query. It is a string with the following format - * 'startDateTime_ISO/endDateTime_ISO'. - * @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 metrics dimension values as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listMetricDimensionValues(String testRunId, String name, String metricName, - String metricNamespace, String timespan, RequestOptions requestOptions) { - return this.serviceClient.listMetricDimensionValuesAsync(testRunId, name, metricName, metricNamespace, timespan, - requestOptions); - } - - /** - * Get associated app component (collection of azure resources) for the given test run. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
-     *         }
-     *     }
-     *     testRunId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @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 associated app component (collection of azure resources) for the given test run along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAppComponentsWithResponse(String testRunId, RequestOptions requestOptions) { - return this.serviceClient.getAppComponentsWithResponseAsync(testRunId, requestOptions); - } - - /** - * List server metrics configuration for the given test run. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testRunId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
-     *         }
-     *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @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 server metrics configuration along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getServerMetricsConfigWithResponse(String testRunId, - RequestOptions requestOptions) { - return this.serviceClient.getServerMetricsConfigWithResponseAsync(testRunId, requestOptions); - } - - /** - * Create and start a new test run with the given name. - * - *

- * Query Parameters - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
oldTestRunIdStringNoExisting test run identifier that should be rerun, if this is provided, the test will run with the JMX file, - * configuration and app components from the existing test run. You can override the configuration values for new - * test run in the request body.
- * - * You can add these to a request with {@link RequestOptions#addQueryParam} - * - *

- * Request Body Schema - * + *

Request Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
-     *             String (Optional): {
+     *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -483,8 +86,13 @@ public Mono> getServerMetricsConfigWithResponse(String test
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
-     *         String (Optional): {
+     *         String (Required): {
      *             value: String (Optional)
      *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
      *         }
@@ -495,7 +103,7 @@ public Mono> getServerMetricsConfigWithResponse(String test
      *         name: String (Optional)
      *     }
      *     environmentVariables (Optional): {
-     *         String: String (Optional)
+     *         String: String (Required)
      *     }
      *     errorDetails (Optional): [
      *          (Optional){
@@ -503,7 +111,7 @@ public Mono> getServerMetricsConfigWithResponse(String test
      *         }
      *     ]
      *     testRunStatistics (Optional): {
-     *         String (Optional): {
+     *         String (Required): {
      *             transaction: String (Optional)
      *             sampleCount: Double (Optional)
      *             errorCount: Double (Optional)
@@ -515,28 +123,45 @@ public Mono> getServerMetricsConfigWithResponse(String test
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -544,6 +169,7 @@ public Mono> getServerMetricsConfigWithResponse(String test
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -551,11 +177,15 @@ public Mono> getServerMetricsConfigWithResponse(String test
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -566,23 +196,27 @@ public Mono> getServerMetricsConfigWithResponse(String test
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
      *     lastModifiedBy: String (Optional)
      * }
      * }
- * - *

- * Response Body Schema - * + * + *

Response Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
-     *             String (Optional): {
+     *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -592,8 +226,13 @@ public Mono> getServerMetricsConfigWithResponse(String test
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
-     *         String (Optional): {
+     *         String (Required): {
      *             value: String (Optional)
      *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
      *         }
@@ -604,7 +243,7 @@ public Mono> getServerMetricsConfigWithResponse(String test
      *         name: String (Optional)
      *     }
      *     environmentVariables (Optional): {
-     *         String: String (Optional)
+     *         String: String (Required)
      *     }
      *     errorDetails (Optional): [
      *          (Optional){
@@ -612,7 +251,7 @@ public Mono> getServerMetricsConfigWithResponse(String test
      *         }
      *     ]
      *     testRunStatistics (Optional): {
-     *         String (Optional): {
+     *         String (Required): {
      *             transaction: String (Optional)
      *             sampleCount: Double (Optional)
      *             errorCount: Double (Optional)
@@ -624,28 +263,45 @@ public Mono> getServerMetricsConfigWithResponse(String test
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -653,63 +309,313 @@ public Mono> getServerMetricsConfigWithResponse(String test
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
      *         }
-     *         outputArtifacts (Optional): {
-     *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
-     *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *         outputArtifacts (Optional): {
+     *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
+     *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
+     *         }
+     *     }
+     *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
+     *     virtualUsers: Integer (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     portalUrl: String (Optional)
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body The resource instance. + * @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); + } + + /** + * Add an app component to a test run. + * + * Add an app component to a test run by providing the resource Id, name and type. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testRunId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testRunId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique Id for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 test run app component along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateAppComponentsWithResponse(String testRunId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateAppComponentsWithResponseAsync(testRunId, body, requestOptions); + } + + /** + * Configure server metrics for a test run. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique Id for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body Server metric 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 test run server metrics configuration along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateServerMetricsConfigWithResponse(String testRunId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateServerMetricsConfigWithResponseAsync(testRunId, body, requestOptions); + } + + /** + * Delete an existing load test run. + * + * Delete an existing load test run by providing the testRunId. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 associated app component (collection of azure resources) for the given test + * run. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
      *         }
      *     }
-     *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
-     *     virtualUsers: Integer (Optional)
      *     testRunId: String (Optional)
-     *     displayName: String (Optional)
-     *     testId: String (Optional)
-     *     description: String (Optional)
-     *     status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Optional)
-     *     startDateTime: OffsetDateTime (Optional)
-     *     endDateTime: OffsetDateTime (Optional)
-     *     executedDateTime: OffsetDateTime (Optional)
-     *     portalUrl: String (Optional)
-     *     duration: Long (Optional)
-     *     subnetId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
      *     lastModifiedBy: String (Optional)
      * }
      * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param body Load test run model. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @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}. + * @return associated app component (collection of azure resources) for the given test + * run along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAppComponentsWithResponse(String testRunId, RequestOptions requestOptions) { + return this.serviceClient.getAppComponentsWithResponseAsync(testRunId, requestOptions); + } + + /** + * Get associated server metrics configuration for the given test run. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 associated server metrics configuration for the given test run along with {@link Response} on successful + * completion of {@link Mono}. */ + @Generated @ServiceMethod(returns = ReturnType.SINGLE) - Mono> createOrUpdateTestRunWithResponse(String testRunId, BinaryData body, + public Mono> getServerMetricsConfigWithResponse(String testRunId, RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateTestRunWithResponseAsync(testRunId, body, requestOptions); + return this.serviceClient.getServerMetricsConfigWithResponseAsync(testRunId, requestOptions); } /** - * Get test run details by name. - *

- * Response Body Schema - *

+ * Get test run details by test run Id. + *

Response Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -719,6 +625,11 @@ Mono> createOrUpdateTestRunWithResponse(String testRunId, B
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -751,28 +662,45 @@ Mono> createOrUpdateTestRunWithResponse(String testRunId, B
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -780,6 +708,7 @@ Mono> createOrUpdateTestRunWithResponse(String testRunId, B
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -787,11 +716,15 @@ Mono> createOrUpdateTestRunWithResponse(String testRunId, B
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -802,21 +735,25 @@ Mono> createOrUpdateTestRunWithResponse(String testRunId, B
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
      *     lastModifiedBy: String (Optional)
      * }
      * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @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}. + * @return test run details by test run Id along with {@link Response} on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) @@ -825,125 +762,267 @@ public Mono> getTestRunWithResponse(String testRunId, Reque } /** - * Delete a test run by its name. - * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. + * Get test run file by file name. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     fileName: String (Required)
+     *     url: String (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *     expireDateTime: OffsetDateTime (Optional)
+     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *     validationFailureDetails: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param fileName Name of the file. * @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}. + * @return test run file by file name along with {@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); + public Mono> getTestRunFileWithResponse(String testRunId, String fileName, + RequestOptions requestOptions) { + return this.serviceClient.getTestRunFileWithResponseAsync(testRunId, fileName, requestOptions); } /** - * Get test run file by file name. - *

- * Response Body Schema - *

+ * List the dimension values for the given metric dimension name. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: + * "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * *
{@code
      * {
-     *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *     expireDateTime: OffsetDateTime (Optional)
-     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *     validationFailureDetails: String (Optional)
+     *     name: String (Optional)
+     *     value (Optional): [
+     *         String (Optional)
+     *     ]
+     *     nextLink: String (Optional)
      * }
      * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param fileName Test run file name with file extension. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param name Dimension name. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. * @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}. + * @return metrics dimension values along with {@link Response} on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTestRunFileWithResponse(String testRunId, String fileName, + public Mono> listMetricDimensionValuesWithResponse(String testRunId, String name, + String metricname, String metricNamespace, String timespan, RequestOptions requestOptions) { + return this.serviceClient.listMetricDimensionValuesWithResponseAsync(testRunId, name, metricname, + metricNamespace, timespan, requestOptions); + } + + /** + * List the metric definitions for a load test run. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             dimensions (Optional): [
+     *                  (Optional){
+     *                     description: String (Optional)
+     *                     name: String (Optional)
+     *                 }
+     *             ]
+     *             description: String (Optional)
+     *             name: String (Optional)
+     *             namespace: String (Optional)
+     *             primaryAggregationType: String(Average/Count/None/Total/Percentile75/Percentile90/Percentile95/Percentile96/Percentile97/Percentile98/Percentile99/Percentile999/Percentile9999) (Optional)
+     *             supportedAggregationTypes (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             unit: String(NotSpecified/Percent/Count/Seconds/Milliseconds/Bytes/BytesPerSecond/CountPerSecond) (Optional)
+     *             metricAvailabilities (Optional): [
+     *                  (Optional){
+     *                     timeGrain: String(PT5S/PT10S/PT1M/PT5M/PT1H) (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param metricNamespace Metric namespace to query metric definitions for. + * @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 represents collection of metric definitions along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMetricDefinitionsWithResponse(String testRunId, String metricNamespace, RequestOptions requestOptions) { - return this.serviceClient.getTestRunFileWithResponseAsync(testRunId, fileName, requestOptions); + return this.serviceClient.getMetricDefinitionsWithResponseAsync(testRunId, metricNamespace, requestOptions); + } + + /** + * List the metric namespaces for a load test run. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             description: String (Optional)
+     *             name: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 represents collection of metric namespaces along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMetricNamespacesWithResponse(String testRunId, RequestOptions requestOptions) { + return this.serviceClient.getMetricNamespacesWithResponseAsync(testRunId, requestOptions); + } + + /** + * List the metric values for a load test run. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
aggregationStringNoThe aggregation
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: + * "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     filters (Optional): [
+     *          (Optional){
+     *             name: String (Optional)
+     *             values (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     data (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             value: Double (Optional)
+     *         }
+     *     ]
+     *     dimensionValues (Optional): [
+     *          (Optional){
+     *             name: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @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 to a metrics query as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listMetrics(String testRunId, String metricname, String metricNamespace, + String timespan, RequestOptions requestOptions) { + return this.serviceClient.listMetricsAsync(testRunId, metricname, metricNamespace, timespan, requestOptions); } /** - * Get all test runs with given filters. - *

- * Query Parameters - *

+ * Get all test runs for the given filters. + *

Query Parameters

* * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * + * + * *
Query Parameters
NameTypeRequiredDescription
orderbyStringNoSort on the supported fields in (field asc/desc) format. eg: executedDateTime asc. Supported fields - - * executedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - description, executedUser. For example, to search - * for a test run, with description 500 VUs, the search parameter can be 500.
testIdStringNoUnique name of an existing load test.
executionFromOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of test-run execution time filter range.
executionToOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of test-run execution time filter range.
statusStringNoComma separated list of test run status.
maxpagesizeIntegerNoNumber of results in response.
NameTypeRequiredDescription
orderbyStringNoSort on the supported fields in (field asc/desc) format. eg: + * executedDateTime + * asc. Supported fields - executedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - + * description, + * executedUser. For example, to search for a test run, with description 500 VUs, + * the search parameter can be 500.
testIdStringNoUnique name of an existing load test.
executionFromOffsetDateTimeNoStart DateTime(RFC 3339 literal format) of + * test-run execution time filter range.
executionToOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of test-run + * execution time filter range.
statusStringNoComma separated list of test run status.
maxpagesizeIntegerNoNumber of results in response.
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ *

Response Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -953,6 +1032,11 @@ public Mono> getTestRunFileWithResponse(String testRunId, S
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -985,28 +1069,45 @@ public Mono> getTestRunFileWithResponse(String testRunId, S
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -1014,6 +1115,7 @@ public Mono> getTestRunFileWithResponse(String testRunId, S
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -1021,11 +1123,15 @@ public Mono> getTestRunFileWithResponse(String testRunId, S
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -1036,19 +1142,23 @@ public Mono> getTestRunFileWithResponse(String testRunId, S
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
      *     lastModifiedBy: 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}. + * @return all test runs for the given filters as paginated response with {@link PagedFlux}. */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) @@ -1057,17 +1167,17 @@ public PagedFlux listTestRuns(RequestOptions requestOptions) { } /** - * Stop test run by name. - *

- * Response Body Schema - *

+ * Stop test run by test run Id. + *

Response Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -1077,6 +1187,11 @@ public PagedFlux listTestRuns(RequestOptions requestOptions) {
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -1109,28 +1224,45 @@ public PagedFlux listTestRuns(RequestOptions requestOptions) {
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -1138,6 +1270,7 @@ public PagedFlux listTestRuns(RequestOptions requestOptions) {
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -1145,11 +1278,15 @@ public PagedFlux listTestRuns(RequestOptions requestOptions) {
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -1160,15 +1297,19 @@ public PagedFlux listTestRuns(RequestOptions requestOptions) {
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
      *     lastModifiedBy: String (Optional)
      * }
      * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @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. @@ -1183,85 +1324,548 @@ public Mono> stopTestRunWithResponse(String testRunId, Requ } /** - * List the metric namespaces for a load test run. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     value (Required): [
-     *          (Required){
-     *             description: String (Optional)
-     *             name: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * Create and start a new test run with the given test run Id. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body The resource instance. + * @param oldTestRunId Existing test run identifier that should be rerun, if this is provided, the + * test will run with the JMX file, configuration and app components from the + * existing test run. You can override the configuration values for new test run + * in the request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 represents collection of metric namespaces along with {@link Response} on successful completion of - * {@link Mono}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return load test run model on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getMetricNamespacesWithResponse(String testRunId, RequestOptions requestOptions) { - return this.serviceClient.getMetricNamespacesWithResponseAsync(testRunId, requestOptions); + public Mono createOrUpdateTestRun(String testRunId, TestRun body, String oldTestRunId) { + // Generated convenience method for createOrUpdateTestRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (oldTestRunId != null) { + requestOptions.addQueryParam("oldTestRunId", oldTestRunId, false); + } + JsonMergePatchHelper.getTestRunAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestRunAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateTestRunWithResponse(testRunId, bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestRun.class)); + } + + /** + * Create and start a new test run with the given test run Id. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return load test run model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateTestRun(String testRunId, TestRun body) { + // Generated convenience method for createOrUpdateTestRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestRunAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestRunAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateTestRunWithResponse(testRunId, bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestRun.class)); + } + + /** + * Add an app component to a test run. + * + * Add an app component to a test run by providing the resource Id, name and type. + * + * @param testRunId Unique Id for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body App Component model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test run app component on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAppComponents(String testRunId, TestRunAppComponents body) { + // Generated convenience method for createOrUpdateAppComponentsWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestRunAppComponentsAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestRunAppComponentsAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateAppComponentsWithResponse(testRunId, bodyInBinaryData, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestRunAppComponents.class)); + } + + /** + * Configure server metrics for a test run. + * + * @param testRunId Unique Id for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body Server metric configuration model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test run server metrics configuration on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateServerMetricsConfig(String testRunId, + TestRunServerMetricConfig body) { + // Generated convenience method for createOrUpdateServerMetricsConfigWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestRunServerMetricConfigAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestRunServerMetricConfigAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateServerMetricsConfigWithResponse(testRunId, bodyInBinaryData, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestRunServerMetricConfig.class)); + } + + /** + * Delete an existing load test run. + * + * Delete an existing load test run by providing the testRunId. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteTestRun(String testRunId) { + // Generated convenience method for deleteTestRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteTestRunWithResponse(testRunId, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Get associated app component (collection of azure resources) for the given test + * run. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return associated app component (collection of azure resources) for the given test + * run on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAppComponents(String testRunId) { + // Generated convenience method for getAppComponentsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAppComponentsWithResponse(testRunId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestRunAppComponents.class)); + } + + /** + * Get associated server metrics configuration for the given test run. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return associated server metrics configuration for the given test run on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getServerMetricsConfig(String testRunId) { + // Generated convenience method for getServerMetricsConfigWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getServerMetricsConfigWithResponse(testRunId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestRunServerMetricConfig.class)); + } + + /** + * Get test run details by test run Id. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test run details by test run Id on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTestRun(String testRunId) { + // Generated convenience method for getTestRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTestRunWithResponse(testRunId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestRun.class)); + } + + /** + * Get test run file by file name. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param fileName Name of the file. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test run file by file name on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTestRunFile(String testRunId, String fileName) { + // Generated convenience method for getTestRunFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTestRunFileWithResponse(testRunId, fileName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestRunFileInfo.class)); + } + + /** + * List the dimension values for the given metric dimension name. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param name Dimension name. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metrics dimension values on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listMetricDimensionValues(String testRunId, String name, String metricname, + String metricNamespace, String timespan, TimeGrain interval) { + // Generated convenience method for listMetricDimensionValuesWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (interval != null) { + requestOptions.addQueryParam("interval", interval.toString(), false); + } + return listMetricDimensionValuesWithResponse(testRunId, name, metricname, metricNamespace, timespan, + requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DimensionValueList.class)); + } + + /** + * List the dimension values for the given metric dimension name. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param name Dimension name. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metrics dimension values on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listMetricDimensionValues(String testRunId, String name, String metricname, + String metricNamespace, String timespan) { + // Generated convenience method for listMetricDimensionValuesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listMetricDimensionValuesWithResponse(testRunId, name, metricname, metricNamespace, timespan, + requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DimensionValueList.class)); } /** * List the metric definitions for a load test run. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     value (Required): [
-     *          (Required){
-     *             dimensions (Optional): [
-     *                  (Optional){
-     *                     description: String (Optional)
-     *                     name: String (Optional)
-     *                 }
-     *             ]
-     *             description: String (Optional)
-     *             name: String (Optional)
-     *             namespace: String (Optional)
-     *             primaryAggregationType: String(Average/Count/None/Total/Percentile90/Percentile95/Percentile99) (Optional)
-     *             supportedAggregationTypes (Optional): [
-     *                 String (Optional)
-     *             ]
-     *             unit: String(NotSpecified/Percent/Count/Seconds/Milliseconds/Bytes/BytesPerSecond/CountPerSecond) (Optional)
-     *             metricAvailabilities (Optional): [
-     *                  (Optional){
-     *                     timeGrain: String(PT5S/PT10S/PT1M/PT5M/PT1H) (Optional)
-     *                 }
-     *             ]
-     *         }
-     *     ]
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @param metricNamespace Metric namespace to query metric definitions for. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 represents collection of metric definitions along with {@link Response} on successful completion of - * {@link Mono}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric definitions on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getMetricDefinitionsWithResponse(String testRunId, String metricNamespace, - RequestOptions requestOptions) { - return this.serviceClient.getMetricDefinitionsWithResponseAsync(testRunId, metricNamespace, requestOptions); + public Mono getMetricDefinitions(String testRunId, String metricNamespace) { + // Generated convenience method for getMetricDefinitionsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getMetricDefinitionsWithResponse(testRunId, metricNamespace, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(MetricDefinitionCollection.class)); + } + + /** + * List the metric namespaces for a load test run. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric namespaces on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getMetricNamespaces(String testRunId) { + // Generated convenience method for getMetricNamespacesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getMetricNamespacesWithResponse(testRunId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(MetricNamespaceCollection.class)); + } + + /** + * List the metric values for a load test run. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param aggregation The aggregation. + * @param interval The interval (i.e. timegrain) of the query. + * @param body Metric dimension filter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a metrics query as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listMetrics(String testRunId, String metricname, String metricNamespace, + String timespan, String aggregation, TimeGrain interval, MetricRequestPayload body) { + // Generated convenience method for listMetrics + RequestOptions requestOptions = new RequestOptions(); + if (aggregation != null) { + requestOptions.addQueryParam("aggregation", aggregation, false); + } + if (interval != null) { + requestOptions.addQueryParam("interval", interval.toString(), false); + } + if (body != null) { + requestOptions.setBody(BinaryData.fromObject(body)); + } + PagedFlux pagedFluxResponse + = listMetrics(testRunId, metricname, metricNamespace, timespan, requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(TimeSeriesElement.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List the metric values for a load test run. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a metrics query as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listMetrics(String testRunId, String metricname, String metricNamespace, + String timespan) { + // Generated convenience method for listMetrics + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse + = listMetrics(testRunId, metricname, metricNamespace, timespan, requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(TimeSeriesElement.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Get all test runs for the given filters. + * + * @param orderBy Sort on the supported fields in (field asc/desc) format. eg: executedDateTime + * asc. Supported fields - executedDateTime. + * @param search Prefix based, case sensitive search on searchable fields - description, + * executedUser. For example, to search for a test run, with description 500 VUs, + * the search parameter can be 500. + * @param testId Unique name of an existing load test. + * @param executionFrom Start DateTime(RFC 3339 literal format) of test-run execution time filter range. + * @param executionTo End DateTime(RFC 3339 literal format) of test-run execution time filter range. + * @param status Comma separated list of test run status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all test runs for the given filters as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestRuns(String orderBy, String search, String testId, OffsetDateTime executionFrom, + OffsetDateTime executionTo, String status) { + // Generated convenience method for listTestRuns + RequestOptions requestOptions = new RequestOptions(); + if (orderBy != null) { + requestOptions.addQueryParam("orderby", orderBy, false); + } + if (search != null) { + requestOptions.addQueryParam("search", search, false); + } + if (testId != null) { + requestOptions.addQueryParam("testId", testId, false); + } + if (executionFrom != null) { + requestOptions.addQueryParam("executionFrom", String.valueOf(executionFrom), false); + } + if (executionTo != null) { + requestOptions.addQueryParam("executionTo", String.valueOf(executionTo), false); + } + if (status != null) { + requestOptions.addQueryParam("status", status, false); + } + PagedFlux pagedFluxResponse = listTestRuns(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(TestRun.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Get all test runs for the given filters. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all test runs for the given filters as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestRuns() { + // Generated convenience method for listTestRuns + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listTestRuns(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(TestRun.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Stop test run by test run Id. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return load test run model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono stopTestRun(String testRunId) { + // Generated convenience method for stopTestRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + return stopTestRunWithResponse(testRunId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestRun.class)); } } diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestRunClient.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestRunClient.java index 4c7d066c654c0..7673a1f74caf8 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestRunClient.java +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestRunClient.java @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. + package com.azure.developer.loadtesting; import com.azure.core.annotation.Generated; @@ -11,470 +12,64 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; 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 com.azure.core.util.polling.SyncPoller; -import com.azure.developer.loadtesting.implementation.LoadTestRunsImpl; - -import java.time.Duration; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.developer.loadtesting.models.DimensionValueList; +import com.azure.developer.loadtesting.models.MetricDefinitionCollection; +import com.azure.developer.loadtesting.models.MetricNamespaceCollection; +import com.azure.developer.loadtesting.models.MetricRequestPayload; +import com.azure.developer.loadtesting.models.TestRun; +import com.azure.developer.loadtesting.models.TestRunAppComponents; +import com.azure.developer.loadtesting.models.TestRunFileInfo; +import com.azure.developer.loadtesting.models.TestRunServerMetricConfig; +import com.azure.developer.loadtesting.models.TimeGrain; +import com.azure.developer.loadtesting.models.TimeSeriesElement; +import java.time.OffsetDateTime; /** - * Initializes a new instance of the synchronous LoadTestingClient type. + * Initializes a new instance of the synchronous LoadTestRunClient type. */ @ServiceClient(builder = LoadTestRunClientBuilder.class) public final class LoadTestRunClient { @Generated - private final LoadTestRunsImpl serviceClient; + private final LoadTestRunAsyncClient client; /** * Initializes an instance of LoadTestRunClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - LoadTestRunClient(LoadTestRunsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Configure server metrics for a test run. - *

- * Request Body Schema - *

- *
{@code
-     * {
-     *     testRunId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
-     *         }
-     *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testRunId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
-     *         }
-     *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param body Server metric 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 test run server metrics configuration along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateServerMetricsConfigWithResponse(String testRunId, BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateServerMetricsConfigWithResponse(testRunId, body, requestOptions); - } - - /** - * Starts a test run and polls the status of the test run. - * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param body Load test run model. - * @param testRunRequestOptions The options to configure the file upload HTTP request before HTTP client sends it. - * @throws ResourceNotFoundException when a test with {@code testRunId} doesn't exist. - * @return A {@link SyncPoller} to poll on and retrieve the test run - * status(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE). - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginTestRun(String testRunId, BinaryData body, - RequestOptions testRunRequestOptions) { - RequestOptions defaultRequestOptions = new RequestOptions(); - if (testRunRequestOptions != null) { - defaultRequestOptions.setContext(testRunRequestOptions.getContext()); - } - return SyncPoller.createPoller(Duration.ofSeconds(5), - (context) -> PollingUtils.getTestRunStatus(createOrUpdateTestRunWithResponse(testRunId, body, testRunRequestOptions) - .getValue()), - (context) -> PollingUtils.getTestRunStatus(getTestRunWithResponse(testRunId, defaultRequestOptions) - .getValue()), - (activationResponse, context) -> stopTestRunWithResponse(testRunId, defaultRequestOptions).getValue(), - (context) -> getTestRunWithResponse(testRunId, defaultRequestOptions).getValue()); - } - - /** - * Associate an app component (collection of azure resources) to a test run. - *

- * Request Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
-     *         }
-     *     }
-     *     testRunId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
-     *         }
-     *     }
-     *     testRunId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @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 test run app component along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateAppComponentsWithResponse(String testRunId, BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateAppComponentsWithResponse(testRunId, body, requestOptions); - } - - /** - * List the metric values for a load test run. - *

- * Query Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
aggregationStringNoThe aggregation
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Header Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

- * Request Body Schema - *

- *
{@code
-     * {
-     *     filters (Optional): [
-     *          (Optional){
-     *             name: String (Optional)
-     *             values (Optional): [
-     *                 String (Optional)
-     *             ]
-     *         }
-     *     ]
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     data (Optional): [
-     *          (Optional){
-     *             timestamp: String (Optional)
-     *             value: Double (Optional)
-     *         }
-     *     ]
-     *     dimensionValues (Optional): [
-     *          (Optional){
-     *             name: String (Optional)
-     *             value: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param metricName Metric name. - * @param metricNamespace Metric namespace to query metric definitions for. - * @param timespan The timespan of the query. It is a string with the following format - * 'startDateTime_ISO/endDateTime_ISO'. - * @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 to a metrics query as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listMetrics(String testRunId, String metricName, String metricNamespace, - String timespan, RequestOptions requestOptions) { - if (requestOptions == null) { - requestOptions = new RequestOptions(); - } - // Content-Type header required even though body can be null - requestOptions.setHeader(HttpHeaderName.CONTENT_TYPE, "application/json"); - return this.serviceClient.listMetrics(testRunId, metricName, metricNamespace, timespan, requestOptions); - } - - /** - * List the dimension values for the given metric dimension name. - *

- * Query Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

- *
{@code
-     * String
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param name Dimension name. - * @param metricName Metric name. - * @param metricNamespace Metric namespace to query metric definitions for. - * @param timespan The timespan of the query. It is a string with the following format - * 'startDateTime_ISO/endDateTime_ISO'. - * @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 metrics dimension values as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listMetricDimensionValues(String testRunId, String name, String metricName, - String metricNamespace, String timespan, RequestOptions requestOptions) { - return this.serviceClient.listMetricDimensionValues(testRunId, name, metricName, metricNamespace, timespan, - requestOptions); - } - - /** - * Get associated app component (collection of azure resources) for the given test run. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
-     *         }
-     *     }
-     *     testRunId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @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 associated app component (collection of azure resources) for the given test run along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAppComponentsWithResponse(String testRunId, RequestOptions requestOptions) { - return this.serviceClient.getAppComponentsWithResponse(testRunId, requestOptions); - } - - /** - * List server metrics configuration for the given test run. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testRunId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
-     *         }
-     *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @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 server metrics configuration along with {@link Response}. + * + * @param client the async client. */ @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getServerMetricsConfigWithResponse(String testRunId, RequestOptions requestOptions) { - return this.serviceClient.getServerMetricsConfigWithResponse(testRunId, requestOptions); + LoadTestRunClient(LoadTestRunAsyncClient client) { + this.client = client; } /** - * Create and start a new test run with the given name. - * - *

- * Query Parameters - * + * Create and start a new test run with the given test run Id. + *

Query Parameters

* * - * - * - * - * - * - * - * - * - * - * - * - * + * + * *
Query Parameters
NameTypeRequiredDescription
oldTestRunIdStringNoExisting test run identifier that should be rerun, if this is provided, the test will run with the JMX file, - * configuration and app components from the existing test run. You can override the configuration values for new - * test run in the request body.
NameTypeRequiredDescription
oldTestRunIdStringNoExisting test run identifier that should be rerun, if this + * is provided, the + * test will run with the JMX file, configuration and app components from the + * existing test run. You can override the configuration values for new test run + * in the request body.
- * * You can add these to a request with {@link RequestOptions#addQueryParam} - * - *

- * Request Body Schema - * + *

Request Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
-     *             String (Optional): {
+     *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -484,8 +79,13 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
-     *         String (Optional): {
+     *         String (Required): {
      *             value: String (Optional)
      *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
      *         }
@@ -496,7 +96,7 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *         name: String (Optional)
      *     }
      *     environmentVariables (Optional): {
-     *         String: String (Optional)
+     *         String: String (Required)
      *     }
      *     errorDetails (Optional): [
      *          (Optional){
@@ -504,7 +104,7 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *         }
      *     ]
      *     testRunStatistics (Optional): {
-     *         String (Optional): {
+     *         String (Required): {
      *             transaction: String (Optional)
      *             sampleCount: Double (Optional)
      *             errorCount: Double (Optional)
@@ -516,28 +116,45 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -545,6 +162,7 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -552,11 +170,15 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -567,23 +189,27 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
      *     lastModifiedBy: String (Optional)
      * }
      * }
- * - *

- * Response Body Schema - * + * + *

Response Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
-     *             String (Optional): {
+     *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -593,8 +219,13 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
-     *         String (Optional): {
+     *         String (Required): {
      *             value: String (Optional)
      *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
      *         }
@@ -605,7 +236,7 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *         name: String (Optional)
      *     }
      *     environmentVariables (Optional): {
-     *         String: String (Optional)
+     *         String: String (Required)
      *     }
      *     errorDetails (Optional): [
      *          (Optional){
@@ -613,7 +244,7 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *         }
      *     ]
      *     testRunStatistics (Optional): {
-     *         String (Optional): {
+     *         String (Required): {
      *             transaction: String (Optional)
      *             sampleCount: Double (Optional)
      *             errorCount: Double (Optional)
@@ -625,28 +256,45 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -654,6 +302,7 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -661,11 +310,15 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
-     *         }
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
+     *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -676,16 +329,20 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
      *     lastModifiedBy: String (Optional)
      * }
      * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param body Load test run model. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body The resource instance. * @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. @@ -693,24 +350,262 @@ public Response getServerMetricsConfigWithResponse(String testRunId, * @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) - Response createOrUpdateTestRunWithResponse(String testRunId, BinaryData body, + public Response createOrUpdateTestRunWithResponse(String testRunId, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateTestRunWithResponse(testRunId, body, requestOptions); + return this.client.createOrUpdateTestRunWithResponse(testRunId, body, requestOptions).block(); + } + + /** + * Add an app component to a test run. + * + * Add an app component to a test run by providing the resource Id, name and type. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testRunId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testRunId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique Id for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 test run app component along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateAppComponentsWithResponse(String testRunId, BinaryData body, + RequestOptions requestOptions) { + return this.client.createOrUpdateAppComponentsWithResponse(testRunId, body, requestOptions).block(); + } + + /** + * Configure server metrics for a test run. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique Id for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body Server metric 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 test run server metrics configuration along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateServerMetricsConfigWithResponse(String testRunId, BinaryData body, + RequestOptions requestOptions) { + return this.client.createOrUpdateServerMetricsConfigWithResponse(testRunId, body, requestOptions).block(); + } + + /** + * Delete an existing load test run. + * + * Delete an existing load test run by providing the testRunId. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 associated app component (collection of azure resources) for the given test + * run. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testRunId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 associated app component (collection of azure resources) for the given test + * run along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAppComponentsWithResponse(String testRunId, RequestOptions requestOptions) { + return this.client.getAppComponentsWithResponse(testRunId, requestOptions).block(); + } + + /** + * Get associated server metrics configuration for the given test run. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 associated server metrics configuration for the given test run along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getServerMetricsConfigWithResponse(String testRunId, RequestOptions requestOptions) { + return this.client.getServerMetricsConfigWithResponse(testRunId, requestOptions).block(); } /** - * Get test run details by name. - *

- * Response Body Schema - *

+ * Get test run details by test run Id. + *

Response Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -720,6 +615,11 @@ Response createOrUpdateTestRunWithResponse(String testRunId, BinaryD
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -752,28 +652,45 @@ Response createOrUpdateTestRunWithResponse(String testRunId, BinaryD
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -781,6 +698,7 @@ Response createOrUpdateTestRunWithResponse(String testRunId, BinaryD
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -788,11 +706,15 @@ Response createOrUpdateTestRunWithResponse(String testRunId, BinaryD
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -803,148 +725,295 @@ Response createOrUpdateTestRunWithResponse(String testRunId, BinaryD
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
      *     lastModifiedBy: String (Optional)
      * }
      * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @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}. + * @return test run details by test run Id along with {@link Response}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Response getTestRunWithResponse(String testRunId, RequestOptions requestOptions) { - return this.serviceClient.getTestRunWithResponse(testRunId, requestOptions); + return this.client.getTestRunWithResponse(testRunId, requestOptions).block(); } /** - * Delete a test run by its name. - * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. + * Get test run file by file name. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     fileName: String (Required)
+     *     url: String (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *     expireDateTime: OffsetDateTime (Optional)
+     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *     validationFailureDetails: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param fileName Name of the file. * @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}. + * @return test run file by file name along with {@link Response}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteTestRunWithResponse(String testRunId, RequestOptions requestOptions) { - return this.serviceClient.deleteTestRunWithResponse(testRunId, requestOptions); + public Response getTestRunFileWithResponse(String testRunId, String fileName, + RequestOptions requestOptions) { + return this.client.getTestRunFileWithResponse(testRunId, fileName, requestOptions).block(); } /** - * Get test run file by file name. - *

- * Response Body Schema - *

+ * List the dimension values for the given metric dimension name. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: + * "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * *
{@code
      * {
-     *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *     expireDateTime: OffsetDateTime (Optional)
-     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *     validationFailureDetails: String (Optional)
+     *     name: String (Optional)
+     *     value (Optional): [
+     *         String (Optional)
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param name Dimension name. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @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 metrics dimension values along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listMetricDimensionValuesWithResponse(String testRunId, String name, String metricname, + String metricNamespace, String timespan, RequestOptions requestOptions) { + return this.client + .listMetricDimensionValuesWithResponse(testRunId, name, metricname, metricNamespace, timespan, + requestOptions) + .block(); + } + + /** + * List the metric definitions for a load test run. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             dimensions (Optional): [
+     *                  (Optional){
+     *                     description: String (Optional)
+     *                     name: String (Optional)
+     *                 }
+     *             ]
+     *             description: String (Optional)
+     *             name: String (Optional)
+     *             namespace: String (Optional)
+     *             primaryAggregationType: String(Average/Count/None/Total/Percentile75/Percentile90/Percentile95/Percentile96/Percentile97/Percentile98/Percentile99/Percentile999/Percentile9999) (Optional)
+     *             supportedAggregationTypes (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             unit: String(NotSpecified/Percent/Count/Seconds/Milliseconds/Bytes/BytesPerSecond/CountPerSecond) (Optional)
+     *             metricAvailabilities (Optional): [
+     *                  (Optional){
+     *                     timeGrain: String(PT5S/PT10S/PT1M/PT5M/PT1H) (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param metricNamespace Metric namespace to query metric definitions for. + * @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 represents collection of metric definitions along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMetricDefinitionsWithResponse(String testRunId, String metricNamespace, + RequestOptions requestOptions) { + return this.client.getMetricDefinitionsWithResponse(testRunId, metricNamespace, requestOptions).block(); + } + + /** + * List the metric namespaces for a load test run. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             description: String (Optional)
+     *             name: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 represents collection of metric namespaces along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMetricNamespacesWithResponse(String testRunId, RequestOptions requestOptions) { + return this.client.getMetricNamespacesWithResponse(testRunId, requestOptions).block(); + } + + /** + * List the metric values for a load test run. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
aggregationStringNoThe aggregation
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: + * "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     filters (Optional): [
+     *          (Optional){
+     *             name: String (Optional)
+     *             values (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     data (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             value: Double (Optional)
+     *         }
+     *     ]
+     *     dimensionValues (Optional): [
+     *          (Optional){
+     *             name: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
      * }
      * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param fileName Test run file name with file extension. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. * @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}. + * @return the response to a metrics query as paginated response with {@link PagedIterable}. */ @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTestRunFileWithResponse(String testRunId, String fileName, - RequestOptions requestOptions) { - return this.serviceClient.getTestRunFileWithResponse(testRunId, fileName, requestOptions); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics(String testRunId, String metricname, String metricNamespace, + String timespan, RequestOptions requestOptions) { + return new PagedIterable<>( + this.client.listMetrics(testRunId, metricname, metricNamespace, timespan, requestOptions)); } /** - * Get all test runs with given filters. - *

- * Query Parameters - *

+ * Get all test runs for the given filters. + *

Query Parameters

* * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * + * + * *
Query Parameters
NameTypeRequiredDescription
orderbyStringNoSort on the supported fields in (field asc/desc) format. eg: executedDateTime asc. Supported fields - - * executedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - description, executedUser. For example, to search - * for a test run, with description 500 VUs, the search parameter can be 500.
testIdStringNoUnique name of an existing load test.
executionFromOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of test-run execution time filter range.
executionToOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of test-run execution time filter range.
statusStringNoComma separated list of test run status.
maxpagesizeIntegerNoNumber of results in response.
NameTypeRequiredDescription
orderbyStringNoSort on the supported fields in (field asc/desc) format. eg: + * executedDateTime + * asc. Supported fields - executedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - + * description, + * executedUser. For example, to search for a test run, with description 500 VUs, + * the search parameter can be 500.
testIdStringNoUnique name of an existing load test.
executionFromOffsetDateTimeNoStart DateTime(RFC 3339 literal format) of + * test-run execution time filter range.
executionToOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of test-run + * execution time filter range.
statusStringNoComma separated list of test run status.
maxpagesizeIntegerNoNumber of results in response.
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ *

Response Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -954,6 +1023,11 @@ public Response getTestRunFileWithResponse(String testRunId, String
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -986,28 +1060,45 @@ public Response getTestRunFileWithResponse(String testRunId, String
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -1015,6 +1106,7 @@ public Response getTestRunFileWithResponse(String testRunId, String
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -1022,11 +1114,15 @@ public Response getTestRunFileWithResponse(String testRunId, String
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -1037,38 +1133,42 @@ public Response getTestRunFileWithResponse(String testRunId, String
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
      *     lastModifiedBy: 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}. + * @return all test runs for the given filters as paginated response with {@link PagedIterable}. */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listTestRuns(RequestOptions requestOptions) { - return this.serviceClient.listTestRuns(requestOptions); + return new PagedIterable<>(this.client.listTestRuns(requestOptions)); } /** - * Stop test run by name. - *

- * Response Body Schema - *

+ * Stop test run by test run Id. + *

Response Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -1078,6 +1178,11 @@ public PagedIterable listTestRuns(RequestOptions requestOptions) {
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -1110,28 +1215,45 @@ public PagedIterable listTestRuns(RequestOptions requestOptions) {
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -1139,6 +1261,7 @@ public PagedIterable listTestRuns(RequestOptions requestOptions) {
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -1146,11 +1269,15 @@ public PagedIterable listTestRuns(RequestOptions requestOptions) {
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -1161,15 +1288,19 @@ public PagedIterable listTestRuns(RequestOptions requestOptions) {
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
      *     lastModifiedBy: String (Optional)
      * }
      * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @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. @@ -1180,87 +1311,464 @@ public PagedIterable listTestRuns(RequestOptions requestOptions) { @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Response stopTestRunWithResponse(String testRunId, RequestOptions requestOptions) { - return this.serviceClient.stopTestRunWithResponse(testRunId, requestOptions); + return this.client.stopTestRunWithResponse(testRunId, requestOptions).block(); } /** - * List the metric namespaces for a load test run. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     value (Required): [
-     *          (Required){
-     *             description: String (Optional)
-     *             name: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * Create and start a new test run with the given test run Id. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body The resource instance. + * @param oldTestRunId Existing test run identifier that should be rerun, if this is provided, the + * test will run with the JMX file, configuration and app components from the + * existing test run. You can override the configuration values for new test run + * in the request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 represents collection of metric namespaces along with {@link Response}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return load test run model. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response getMetricNamespacesWithResponse(String testRunId, RequestOptions requestOptions) { - return this.serviceClient.getMetricNamespacesWithResponse(testRunId, requestOptions); + public TestRun createOrUpdateTestRun(String testRunId, TestRun body, String oldTestRunId) { + // Generated convenience method for createOrUpdateTestRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (oldTestRunId != null) { + requestOptions.addQueryParam("oldTestRunId", oldTestRunId, false); + } + JsonMergePatchHelper.getTestRunAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestRunAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateTestRunWithResponse(testRunId, bodyInBinaryData, requestOptions).getValue() + .toObject(TestRun.class); + } + + /** + * Create and start a new test run with the given test run Id. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return load test run model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestRun createOrUpdateTestRun(String testRunId, TestRun body) { + // Generated convenience method for createOrUpdateTestRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestRunAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestRunAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateTestRunWithResponse(testRunId, bodyInBinaryData, requestOptions).getValue() + .toObject(TestRun.class); + } + + /** + * Add an app component to a test run. + * + * Add an app component to a test run by providing the resource Id, name and type. + * + * @param testRunId Unique Id for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body App Component model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test run app component. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestRunAppComponents createOrUpdateAppComponents(String testRunId, TestRunAppComponents body) { + // Generated convenience method for createOrUpdateAppComponentsWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestRunAppComponentsAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestRunAppComponentsAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateAppComponentsWithResponse(testRunId, bodyInBinaryData, requestOptions).getValue() + .toObject(TestRunAppComponents.class); + } + + /** + * Configure server metrics for a test run. + * + * @param testRunId Unique Id for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body Server metric configuration model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test run server metrics configuration. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestRunServerMetricConfig createOrUpdateServerMetricsConfig(String testRunId, + TestRunServerMetricConfig body) { + // Generated convenience method for createOrUpdateServerMetricsConfigWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestRunServerMetricConfigAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestRunServerMetricConfigAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateServerMetricsConfigWithResponse(testRunId, bodyInBinaryData, requestOptions).getValue() + .toObject(TestRunServerMetricConfig.class); + } + + /** + * Delete an existing load test run. + * + * Delete an existing load test run by providing the testRunId. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteTestRun(String testRunId) { + // Generated convenience method for deleteTestRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteTestRunWithResponse(testRunId, requestOptions).getValue(); + } + + /** + * Get associated app component (collection of azure resources) for the given test + * run. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return associated app component (collection of azure resources) for the given test + * run. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestRunAppComponents getAppComponents(String testRunId) { + // Generated convenience method for getAppComponentsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAppComponentsWithResponse(testRunId, requestOptions).getValue().toObject(TestRunAppComponents.class); + } + + /** + * Get associated server metrics configuration for the given test run. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return associated server metrics configuration for the given test run. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestRunServerMetricConfig getServerMetricsConfig(String testRunId) { + // Generated convenience method for getServerMetricsConfigWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getServerMetricsConfigWithResponse(testRunId, requestOptions).getValue() + .toObject(TestRunServerMetricConfig.class); + } + + /** + * Get test run details by test run Id. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test run details by test run Id. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestRun getTestRun(String testRunId) { + // Generated convenience method for getTestRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTestRunWithResponse(testRunId, requestOptions).getValue().toObject(TestRun.class); + } + + /** + * Get test run file by file name. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param fileName Name of the file. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test run file by file name. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestRunFileInfo getTestRunFile(String testRunId, String fileName) { + // Generated convenience method for getTestRunFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTestRunFileWithResponse(testRunId, fileName, requestOptions).getValue() + .toObject(TestRunFileInfo.class); + } + + /** + * List the dimension values for the given metric dimension name. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param name Dimension name. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metrics dimension values. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DimensionValueList listMetricDimensionValues(String testRunId, String name, String metricname, + String metricNamespace, String timespan, TimeGrain interval) { + // Generated convenience method for listMetricDimensionValuesWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (interval != null) { + requestOptions.addQueryParam("interval", interval.toString(), false); + } + return listMetricDimensionValuesWithResponse(testRunId, name, metricname, metricNamespace, timespan, + requestOptions).getValue().toObject(DimensionValueList.class); + } + + /** + * List the dimension values for the given metric dimension name. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param name Dimension name. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metrics dimension values. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DimensionValueList listMetricDimensionValues(String testRunId, String name, String metricname, + String metricNamespace, String timespan) { + // Generated convenience method for listMetricDimensionValuesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listMetricDimensionValuesWithResponse(testRunId, name, metricname, metricNamespace, timespan, + requestOptions).getValue().toObject(DimensionValueList.class); } /** * List the metric definitions for a load test run. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     value (Required): [
-     *          (Required){
-     *             dimensions (Optional): [
-     *                  (Optional){
-     *                     description: String (Optional)
-     *                     name: String (Optional)
-     *                 }
-     *             ]
-     *             description: String (Optional)
-     *             name: String (Optional)
-     *             namespace: String (Optional)
-     *             primaryAggregationType: String(Average/Count/None/Total/Percentile90/Percentile95/Percentile99) (Optional)
-     *             supportedAggregationTypes (Optional): [
-     *                 String (Optional)
-     *             ]
-     *             unit: String(NotSpecified/Percent/Count/Seconds/Milliseconds/Bytes/BytesPerSecond/CountPerSecond) (Optional)
-     *             metricAvailabilities (Optional): [
-     *                  (Optional){
-     *                     timeGrain: String(PT5S/PT10S/PT1M/PT5M/PT1H) (Optional)
-     *                 }
-     *             ]
-     *         }
-     *     ]
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @param metricNamespace Metric namespace to query metric definitions for. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 represents collection of metric definitions along with {@link Response}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric definitions. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response getMetricDefinitionsWithResponse(String testRunId, String metricNamespace, - RequestOptions requestOptions) { - return this.serviceClient.getMetricDefinitionsWithResponse(testRunId, metricNamespace, requestOptions); + public MetricDefinitionCollection getMetricDefinitions(String testRunId, String metricNamespace) { + // Generated convenience method for getMetricDefinitionsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getMetricDefinitionsWithResponse(testRunId, metricNamespace, requestOptions).getValue() + .toObject(MetricDefinitionCollection.class); + } + + /** + * List the metric namespaces for a load test run. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric namespaces. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public MetricNamespaceCollection getMetricNamespaces(String testRunId) { + // Generated convenience method for getMetricNamespacesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getMetricNamespacesWithResponse(testRunId, requestOptions).getValue() + .toObject(MetricNamespaceCollection.class); + } + + /** + * List the metric values for a load test run. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param aggregation The aggregation. + * @param interval The interval (i.e. timegrain) of the query. + * @param body Metric dimension filter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a metrics query as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics(String testRunId, String metricname, String metricNamespace, + String timespan, String aggregation, TimeGrain interval, MetricRequestPayload body) { + // Generated convenience method for listMetrics + return new PagedIterable<>( + client.listMetrics(testRunId, metricname, metricNamespace, timespan, aggregation, interval, body)); + } + + /** + * List the metric values for a load test run. + * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a metrics query as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics(String testRunId, String metricname, String metricNamespace, + String timespan) { + // Generated convenience method for listMetrics + return new PagedIterable<>(client.listMetrics(testRunId, metricname, metricNamespace, timespan)); + } + + /** + * Get all test runs for the given filters. + * + * @param orderBy Sort on the supported fields in (field asc/desc) format. eg: executedDateTime + * asc. Supported fields - executedDateTime. + * @param search Prefix based, case sensitive search on searchable fields - description, + * executedUser. For example, to search for a test run, with description 500 VUs, + * the search parameter can be 500. + * @param testId Unique name of an existing load test. + * @param executionFrom Start DateTime(RFC 3339 literal format) of test-run execution time filter range. + * @param executionTo End DateTime(RFC 3339 literal format) of test-run execution time filter range. + * @param status Comma separated list of test run status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all test runs for the given filters as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestRuns(String orderBy, String search, String testId, + OffsetDateTime executionFrom, OffsetDateTime executionTo, String status) { + // Generated convenience method for listTestRuns + return new PagedIterable<>(client.listTestRuns(orderBy, search, testId, executionFrom, executionTo, status)); + } + + /** + * Get all test runs for the given filters. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all test runs for the given filters as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestRuns() { + // Generated convenience method for listTestRuns + return new PagedIterable<>(client.listTestRuns()); + } + + /** + * Stop test run by test run Id. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return load test run model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestRun stopTestRun(String testRunId) { + // Generated convenience method for stopTestRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + return stopTestRunWithResponse(testRunId, requestOptions).getValue().toObject(TestRun.class); } } diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestRunClientBuilder.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestRunClientBuilder.java index 19b68e9cdf82c..f661c67e34fc1 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestRunClientBuilder.java +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestRunClientBuilder.java @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. + package com.azure.developer.loadtesting; import com.azure.core.annotation.Generated; @@ -11,7 +12,6 @@ import com.azure.core.client.traits.TokenCredentialTrait; import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; @@ -20,8 +20,8 @@ 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.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.HttpPolicyProviders; import com.azure.core.http.policy.RequestIdPolicy; @@ -34,7 +34,7 @@ import com.azure.core.util.builder.ClientBuilderUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.developer.loadtesting.implementation.LoadTestingClientImpl; +import com.azure.developer.loadtesting.implementation.LoadTestRunClientImpl; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -47,7 +47,6 @@ public final class LoadTestRunClientBuilder implements HttpTrait, ConfigurationTrait, TokenCredentialTrait, EndpointTrait { - @Generated private static final String SDK_NAME = "name"; @@ -57,6 +56,10 @@ public final class LoadTestRunClientBuilder @Generated private static final String[] DEFAULT_SCOPES = new String[] { "https://cnt-prod.loadtesting.azure.com/.default" }; + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-developer-loadtesting.properties"); + @Generated private final List pipelinePolicies; @@ -81,7 +84,7 @@ public LoadTestRunClientBuilder() { @Override public LoadTestRunClientBuilder pipeline(HttpPipeline pipeline) { if (this.pipeline != null && pipeline == null) { - LOGGER.info("HttpPipeline is being set to 'null' when it was previously configured."); + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); } this.pipeline = pipeline; return this; @@ -218,7 +221,7 @@ public LoadTestRunClientBuilder endpoint(String endpoint) { /** * Sets Service version. - * + * * @param serviceVersion the serviceVersion value. * @return the LoadTestRunClientBuilder. */ @@ -236,7 +239,7 @@ public LoadTestRunClientBuilder serviceVersion(LoadTestingServiceVersion service /** * Sets The retry policy that will attempt to retry failed requests, if applicable. - * + * * @param retryPolicy the retryPolicy value. * @return the LoadTestRunClientBuilder. */ @@ -247,20 +250,28 @@ public LoadTestRunClientBuilder retryPolicy(RetryPolicy retryPolicy) { } /** - * Builds an instance of LoadTestingClientImpl with the provided parameters. - * - * @return an instance of LoadTestingClientImpl. + * Builds an instance of LoadTestRunClientImpl with the provided parameters. + * + * @return an instance of LoadTestRunClientImpl. */ @Generated - private LoadTestingClientImpl buildInnerClient() { + private LoadTestRunClientImpl buildInnerClient() { + this.validateClient(); HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); LoadTestingServiceVersion localServiceVersion = (serviceVersion != null) ? serviceVersion : LoadTestingServiceVersion.getLatest(); - LoadTestingClientImpl client = new LoadTestingClientImpl(localPipeline, + LoadTestRunClientImpl client = new LoadTestRunClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); return client; } + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + @Generated private HttpPipeline createHttpPipeline() { Configuration buildConfiguration @@ -274,13 +285,12 @@ private HttpPipeline createHttpPipeline() { policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); policies.add(new RequestIdPolicy()); policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = new HttpHeaders(); - localClientOptions.getHeaders() - .forEach(header -> headers.set(HttpHeaderName.fromString(header.getName()), header.getValue())); - if (headers.getSize() > 0) { + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { policies.add(new AddHeadersPolicy(headers)); } - this.pipelinePolicies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) .forEach(p -> policies.add(p)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); @@ -288,38 +298,37 @@ private HttpPipeline createHttpPipeline() { if (tokenCredential != null) { policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); } - this.pipelinePolicies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) .forEach(p -> policies.add(p)); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(localHttpLogOptions)); HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient).clientOptions(localClientOptions).build(); + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); return httpPipeline; } /** * Builds an instance of LoadTestRunAsyncClient class. - * + * * @return an instance of LoadTestRunAsyncClient. */ @Generated public LoadTestRunAsyncClient buildAsyncClient() { - return new LoadTestRunAsyncClient(buildInnerClient().getLoadTestRuns()); + return new LoadTestRunAsyncClient(buildInnerClient()); } /** * Builds an instance of LoadTestRunClient class. - * + * * @return an instance of LoadTestRunClient. */ @Generated public LoadTestRunClient buildClient() { - return new LoadTestRunClient(buildInnerClient().getLoadTestRuns()); + return new LoadTestRunClient(new LoadTestRunAsyncClient(buildInnerClient())); } - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-developer-loadtesting.properties"); - private static final ClientLogger LOGGER = new ClientLogger(LoadTestRunClientBuilder.class); } diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingServiceVersion.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingServiceVersion.java index 277cd8cc2f90d..4e81d338fee32 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingServiceVersion.java +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/LoadTestingServiceVersion.java @@ -1,19 +1,34 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.developer.loadtesting; import com.azure.core.util.ServiceVersion; /** - * Service version of LoadTestingClient. + * Service version of Load TestingClient. */ public enum LoadTestingServiceVersion implements ServiceVersion { /** * Enum value 2022-11-01. */ - V2022_11_01("2022-11-01"); + V2022_11_01("2022-11-01"), + + /** + * Enum value 2023-04-01-preview. + */ + V2023_04_01_PREVIEW("2023-04-01-preview"), + + /** + * Enum value 2024-03-01-preview. + */ + V2024_03_01_PREVIEW("2024-03-01-preview"), + + /** + * Enum value 2024-05-01-preview. + */ + V2024_05_01_PREVIEW("2024-05-01-preview"); private final String version; @@ -35,6 +50,6 @@ public String getVersion() { * @return The latest {@link LoadTestingServiceVersion}. */ public static LoadTestingServiceVersion getLatest() { - return V2022_11_01; + return V2024_05_01_PREVIEW; } } diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/PollingUtils.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/PollingUtils.java deleted file mode 100644 index 32522f92163b6..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/PollingUtils.java +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.developer.loadtesting; - -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollResponse; -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; -import reactor.core.publisher.Mono; - -import java.io.IOException; -import java.util.Map; -import java.util.concurrent.Callable; - -final class PollingUtils { - static Mono> getPollResponseMono(Callable> pollOperation) { - try { - return Mono.just(pollOperation.call()); - } catch (Exception e) { - return Mono.error(e); - } - } - - static PollResponse getValidationStatus(BinaryData fileBinary) throws RuntimeException { - String validationStatus, fileType; - - try (JsonReader jsonReader = JsonProviders.createReader(fileBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - validationStatus = jsonTree.get("validationStatus").toString(); - fileType = jsonTree.get("fileType").toString(); - } catch (IOException e) { - throw new RuntimeException("Encountered exception while retrieving validation status", e); - } - - LongRunningOperationStatus lroStatus; - - switch (validationStatus) { - case "VALIDATION_NOT_REQUIRED": - case "VALIDATION_SUCCESS": - lroStatus = LongRunningOperationStatus.SUCCESSFULLY_COMPLETED; - - break; - case "VALIDATION_FAILURE": - lroStatus = LongRunningOperationStatus.FAILED; - - break; - case "VALIDATION_INITIATED": - lroStatus = LongRunningOperationStatus.IN_PROGRESS; - - break; - case "NOT_VALIDATED": - if ("JMX_FILE".equalsIgnoreCase(fileType)) { - lroStatus = LongRunningOperationStatus.NOT_STARTED; - } else { - lroStatus = LongRunningOperationStatus.SUCCESSFULLY_COMPLETED; - } - - break; - default: - lroStatus = LongRunningOperationStatus.NOT_STARTED; - - break; - } - - return new PollResponse<>(lroStatus, fileBinary); - } - - static PollResponse getTestRunStatus(BinaryData testRunBinary) throws RuntimeException { - String status; - - try (JsonReader jsonReader = JsonProviders.createReader(testRunBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - status = jsonTree.get("status").toString(); - } catch (IOException e) { - throw new RuntimeException("Encountered exception while retrieving test run status", e); - } - - LongRunningOperationStatus lroStatus; - - switch (status) { - case "NOTSTARTED": - lroStatus = LongRunningOperationStatus.NOT_STARTED; - - break; - case "DONE": - lroStatus = LongRunningOperationStatus.SUCCESSFULLY_COMPLETED; - - break; - case "FAILED": - lroStatus = LongRunningOperationStatus.FAILED; - - break; - case "CANCELLED": - lroStatus = LongRunningOperationStatus.USER_CANCELLED; - - break; - default: - lroStatus = LongRunningOperationStatus.IN_PROGRESS; - - break; - } - - return new PollResponse<>(lroStatus, testRunBinary); - } -} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileAdministrationAsyncClient.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileAdministrationAsyncClient.java new file mode 100644 index 0000000000000..a9c825839ae7e --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileAdministrationAsyncClient.java @@ -0,0 +1,383 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +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.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.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.developer.loadtesting.implementation.TestProfileAdministrationClientImpl; +import com.azure.developer.loadtesting.models.TestProfile; +import java.time.OffsetDateTime; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous TestProfileAdministrationClient type. + */ +@ServiceClient(builder = TestProfileAdministrationClientBuilder.class, isAsync = true) +public final class TestProfileAdministrationAsyncClient { + @Generated + private final TestProfileAdministrationClientImpl serviceClient; + + /** + * Initializes an instance of TestProfileAdministrationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TestProfileAdministrationAsyncClient(TestProfileAdministrationClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Create a new test profile or update an existing test profile. + * + * Create a new test profile or update an existing test profile by providing the test profile Id. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param body The resource instance. + * @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 Profile Model along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateTestProfileWithResponse(String testProfileId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateTestProfileWithResponseAsync(testProfileId, body, requestOptions); + } + + /** + * Delete a test profile. + * + * Delete a test profile by its test profile Id. + * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @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> deleteTestProfileWithResponse(String testProfileId, RequestOptions requestOptions) { + return this.serviceClient.deleteTestProfileWithResponseAsync(testProfileId, requestOptions); + } + + /** + * Get load test profile details. + * + * Get load test profile details by test profile Id. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @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 profile details. + * + * Get load test profile details by test profile Id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestProfileWithResponse(String testProfileId, RequestOptions requestOptions) { + return this.serviceClient.getTestProfileWithResponseAsync(testProfileId, requestOptions); + } + + /** + * List test profiles. + * + * Get all test profiles for the given filters. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoMaximum number of results to include in a single + * response.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) + * of the last updated time range to filter test profiles.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of + * the last updated time range to filter test profiles.
testProfileIdsStringNoComma separated list of IDs of the test profiles to + * filter.
testIdsStringNoComma separated list IDs of the tests which should be + * associated with the test profiles to fetch.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: 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 paged collection of TestProfile items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestProfiles(RequestOptions requestOptions) { + return this.serviceClient.listTestProfilesAsync(requestOptions); + } + + /** + * Create a new test profile or update an existing test profile. + * + * Create a new test profile or update an existing test profile by providing the test profile Id. + * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param body The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test Profile Model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateTestProfile(String testProfileId, TestProfile body) { + // Generated convenience method for createOrUpdateTestProfileWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestProfileAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestProfileAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateTestProfileWithResponse(testProfileId, bodyInBinaryData, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestProfile.class)); + } + + /** + * Delete a test profile. + * + * Delete a test profile by its test profile Id. + * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteTestProfile(String testProfileId) { + // Generated convenience method for deleteTestProfileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteTestProfileWithResponse(testProfileId, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Get load test profile details. + * + * Get load test profile details by test profile Id. + * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return load test profile details. + * + * Get load test profile details by test profile Id on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTestProfile(String testProfileId) { + // Generated convenience method for getTestProfileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTestProfileWithResponse(testProfileId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestProfile.class)); + } + + /** + * List test profiles. + * + * Get all test profiles for the given filters. + * + * @param lastModifiedStartTime Start DateTime(RFC 3339 literal format) of the last updated time range to filter + * test profiles. + * @param lastModifiedEndTime End DateTime(RFC 3339 literal format) of the last updated time range to filter test + * profiles. + * @param testProfileIds Comma separated list of IDs of the test profiles to filter. + * @param testIds Comma separated list IDs of the tests which should be associated with the test profiles to fetch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of TestProfile items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestProfiles(OffsetDateTime lastModifiedStartTime, + OffsetDateTime lastModifiedEndTime, String testProfileIds, String testIds) { + // Generated convenience method for listTestProfiles + RequestOptions requestOptions = new RequestOptions(); + if (lastModifiedStartTime != null) { + requestOptions.addQueryParam("lastModifiedStartTime", String.valueOf(lastModifiedStartTime), false); + } + if (lastModifiedEndTime != null) { + requestOptions.addQueryParam("lastModifiedEndTime", String.valueOf(lastModifiedEndTime), false); + } + if (testProfileIds != null) { + requestOptions.addQueryParam("testProfileIds", testProfileIds, false); + } + if (testIds != null) { + requestOptions.addQueryParam("testIds", testIds, false); + } + PagedFlux pagedFluxResponse = listTestProfiles(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(TestProfile.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List test profiles. + * + * Get all test profiles for the given filters. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of TestProfile items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestProfiles() { + // Generated convenience method for listTestProfiles + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listTestProfiles(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(TestProfile.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileAdministrationClient.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileAdministrationClient.java new file mode 100644 index 0000000000000..b29b0b4b2b815 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileAdministrationClient.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +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 com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.developer.loadtesting.models.TestProfile; +import java.time.OffsetDateTime; + +/** + * Initializes a new instance of the synchronous TestProfileAdministrationClient type. + */ +@ServiceClient(builder = TestProfileAdministrationClientBuilder.class) +public final class TestProfileAdministrationClient { + @Generated + private final TestProfileAdministrationAsyncClient client; + + /** + * Initializes an instance of TestProfileAdministrationClient class. + * + * @param client the async client. + */ + @Generated + TestProfileAdministrationClient(TestProfileAdministrationAsyncClient client) { + this.client = client; + } + + /** + * Create a new test profile or update an existing test profile. + * + * Create a new test profile or update an existing test profile by providing the test profile Id. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param body The resource instance. + * @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 Profile Model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateTestProfileWithResponse(String testProfileId, BinaryData body, + RequestOptions requestOptions) { + return this.client.createOrUpdateTestProfileWithResponse(testProfileId, body, requestOptions).block(); + } + + /** + * Delete a test profile. + * + * Delete a test profile by its test profile Id. + * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @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 deleteTestProfileWithResponse(String testProfileId, RequestOptions requestOptions) { + return this.client.deleteTestProfileWithResponse(testProfileId, requestOptions).block(); + } + + /** + * Get load test profile details. + * + * Get load test profile details by test profile Id. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @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 profile details. + * + * Get load test profile details by test profile Id along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestProfileWithResponse(String testProfileId, RequestOptions requestOptions) { + return this.client.getTestProfileWithResponse(testProfileId, requestOptions).block(); + } + + /** + * List test profiles. + * + * Get all test profiles for the given filters. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoMaximum number of results to include in a single + * response.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) + * of the last updated time range to filter test profiles.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of + * the last updated time range to filter test profiles.
testProfileIdsStringNoComma separated list of IDs of the test profiles to + * filter.
testIdsStringNoComma separated list IDs of the tests which should be + * associated with the test profiles to fetch.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: 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 paged collection of TestProfile items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestProfiles(RequestOptions requestOptions) { + return new PagedIterable<>(this.client.listTestProfiles(requestOptions)); + } + + /** + * Create a new test profile or update an existing test profile. + * + * Create a new test profile or update an existing test profile by providing the test profile Id. + * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param body The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test Profile Model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestProfile createOrUpdateTestProfile(String testProfileId, TestProfile body) { + // Generated convenience method for createOrUpdateTestProfileWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestProfileAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestProfileAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateTestProfileWithResponse(testProfileId, bodyInBinaryData, requestOptions).getValue() + .toObject(TestProfile.class); + } + + /** + * Delete a test profile. + * + * Delete a test profile by its test profile Id. + * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteTestProfile(String testProfileId) { + // Generated convenience method for deleteTestProfileWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteTestProfileWithResponse(testProfileId, requestOptions).getValue(); + } + + /** + * Get load test profile details. + * + * Get load test profile details by test profile Id. + * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return load test profile details. + * + * Get load test profile details by test profile Id. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestProfile getTestProfile(String testProfileId) { + // Generated convenience method for getTestProfileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTestProfileWithResponse(testProfileId, requestOptions).getValue().toObject(TestProfile.class); + } + + /** + * List test profiles. + * + * Get all test profiles for the given filters. + * + * @param lastModifiedStartTime Start DateTime(RFC 3339 literal format) of the last updated time range to filter + * test profiles. + * @param lastModifiedEndTime End DateTime(RFC 3339 literal format) of the last updated time range to filter test + * profiles. + * @param testProfileIds Comma separated list of IDs of the test profiles to filter. + * @param testIds Comma separated list IDs of the tests which should be associated with the test profiles to fetch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of TestProfile items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestProfiles(OffsetDateTime lastModifiedStartTime, + OffsetDateTime lastModifiedEndTime, String testProfileIds, String testIds) { + // Generated convenience method for listTestProfiles + return new PagedIterable<>( + client.listTestProfiles(lastModifiedStartTime, lastModifiedEndTime, testProfileIds, testIds)); + } + + /** + * List test profiles. + * + * Get all test profiles for the given filters. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of TestProfile items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestProfiles() { + // Generated convenience method for listTestProfiles + return new PagedIterable<>(client.listTestProfiles()); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileAdministrationClientBuilder.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileAdministrationClientBuilder.java new file mode 100644 index 0000000000000..39505f1c1d88a --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileAdministrationClientBuilder.java @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting; + +import com.azure.core.annotation.Generated; +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.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpLogOptions; +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.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.developer.loadtesting.implementation.TestProfileAdministrationClientImpl; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the TestProfileAdministrationClient type. + */ +@ServiceClientBuilder( + serviceClients = { TestProfileAdministrationClient.class, TestProfileAdministrationAsyncClient.class }) +public final class TestProfileAdministrationClientBuilder implements HttpTrait, + ConfigurationTrait, + TokenCredentialTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final String[] DEFAULT_SCOPES = new String[] { "https://cnt-prod.loadtesting.azure.com/.default" }; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-developer-loadtesting.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the TestProfileAdministrationClientBuilder. + */ + @Generated + public TestProfileAdministrationClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileAdministrationClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileAdministrationClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileAdministrationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileAdministrationClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileAdministrationClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileAdministrationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileAdministrationClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The TokenCredential used for authentication. + */ + @Generated + private TokenCredential tokenCredential; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileAdministrationClientBuilder credential(TokenCredential tokenCredential) { + this.tokenCredential = tokenCredential; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileAdministrationClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private LoadTestingServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the TestProfileAdministrationClientBuilder. + */ + @Generated + public TestProfileAdministrationClientBuilder serviceVersion(LoadTestingServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the TestProfileAdministrationClientBuilder. + */ + @Generated + public TestProfileAdministrationClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of TestProfileAdministrationClientImpl with the provided parameters. + * + * @return an instance of TestProfileAdministrationClientImpl. + */ + @Generated + private TestProfileAdministrationClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + LoadTestingServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : LoadTestingServiceVersion.getLatest(); + TestProfileAdministrationClientImpl client = new TestProfileAdministrationClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + if (tokenCredential != null) { + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of TestProfileAdministrationAsyncClient class. + * + * @return an instance of TestProfileAdministrationAsyncClient. + */ + @Generated + public TestProfileAdministrationAsyncClient buildAsyncClient() { + return new TestProfileAdministrationAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of TestProfileAdministrationClient class. + * + * @return an instance of TestProfileAdministrationClient. + */ + @Generated + public TestProfileAdministrationClient buildClient() { + return new TestProfileAdministrationClient(new TestProfileAdministrationAsyncClient(buildInnerClient())); + } + + private static final ClientLogger LOGGER = new ClientLogger(TestProfileAdministrationClientBuilder.class); +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileRunAsyncClient.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileRunAsyncClient.java new file mode 100644 index 0000000000000..5c833a174ef5a --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileRunAsyncClient.java @@ -0,0 +1,611 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +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.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.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.developer.loadtesting.implementation.TestProfileRunClientImpl; +import com.azure.developer.loadtesting.models.TestProfileRun; +import java.time.OffsetDateTime; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous TestProfileRunClient type. + */ +@ServiceClient(builder = TestProfileRunClientBuilder.class, isAsync = true) +public final class TestProfileRunAsyncClient { + @Generated + private final TestProfileRunClientImpl serviceClient; + + /** + * Initializes an instance of TestProfileRunAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TestProfileRunAsyncClient(TestProfileRunClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Create and start a new test profile run. + * + * Create and start a new test profile run with the given test profile run Id. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body The resource instance. + * @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 Profile Run model along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateTestProfileRunWithResponse(String testProfileRunId, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateTestProfileRunWithResponseAsync(testProfileRunId, body, requestOptions); + } + + /** + * Delete an existing load test profile run. + * + * Delete an existing load test profile run by providing the test profile run Id. + * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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> deleteTestProfileRunWithResponse(String testProfileRunId, + RequestOptions requestOptions) { + return this.serviceClient.deleteTestProfileRunWithResponseAsync(testProfileRunId, requestOptions); + } + + /** + * Get test profile run details. + * + * Get test profile run details by test profile run Id. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 profile run details. + * + * Get test profile run details by test profile run Id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestProfileRunWithResponse(String testProfileRunId, + RequestOptions requestOptions) { + return this.serviceClient.getTestProfileRunWithResponseAsync(testProfileRunId, requestOptions); + } + + /** + * List test profile runs. + * + * Get all test profile runs for the given filters. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoMaximum number of results to include in a single + * response.
minStartDateTimeOffsetDateTimeNoMinimum Start DateTime(RFC 3339 literal + * format) of the test profile runs to filter on.
maxStartDateTimeOffsetDateTimeNoMaximum Start DateTime(RFC 3339 literal + * format) of the test profile runs to filter on.
minEndDateTimeOffsetDateTimeNoMinimum End DateTime(RFC 3339 literal format) of + * the test profile runs to filter on.
maxEndDateTimeOffsetDateTimeNoMaximum End DateTime(RFC 3339 literal format) of + * the test profile runs to filter on.
createdDateStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) of + * the created time range to filter test profile runs.
createdDateEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of the + * created time range to filter test profile runs.
testProfileRunIdsStringNoComma separated list of IDs of the test profile runs + * to filter.
testProfileIdsStringNoComma separated IDs of the test profiles which should be + * associated with the test profile runs to fetch.
statusesStringNoComma separated list of Statuses of the test profile runs to + * filter.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: 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 paged collection of TestProfileRun items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestProfileRuns(RequestOptions requestOptions) { + return this.serviceClient.listTestProfileRunsAsync(requestOptions); + } + + /** + * Stop test profile run. + * + * Stop test profile run for the given test profile run Id. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 Profile Run model along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stopTestProfileRunWithResponse(String testProfileRunId, + RequestOptions requestOptions) { + return this.serviceClient.stopTestProfileRunWithResponseAsync(testProfileRunId, requestOptions); + } + + /** + * Create and start a new test profile run. + * + * Create and start a new test profile run with the given test profile run Id. + * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test Profile Run model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateTestProfileRun(String testProfileRunId, TestProfileRun body) { + // Generated convenience method for createOrUpdateTestProfileRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestProfileRunAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestProfileRunAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateTestProfileRunWithResponse(testProfileRunId, bodyInBinaryData, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestProfileRun.class)); + } + + /** + * Delete an existing load test profile run. + * + * Delete an existing load test profile run by providing the test profile run Id. + * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteTestProfileRun(String testProfileRunId) { + // Generated convenience method for deleteTestProfileRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteTestProfileRunWithResponse(testProfileRunId, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Get test profile run details. + * + * Get test profile run details by test profile run Id. + * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test profile run details. + * + * Get test profile run details by test profile run Id on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTestProfileRun(String testProfileRunId) { + // Generated convenience method for getTestProfileRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTestProfileRunWithResponse(testProfileRunId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestProfileRun.class)); + } + + /** + * List test profile runs. + * + * Get all test profile runs for the given filters. + * + * @param minStartDateTime Minimum Start DateTime(RFC 3339 literal format) of the test profile runs to filter on. + * @param maxStartDateTime Maximum Start DateTime(RFC 3339 literal format) of the test profile runs to filter on. + * @param minEndDateTime Minimum End DateTime(RFC 3339 literal format) of the test profile runs to filter on. + * @param maxEndDateTime Maximum End DateTime(RFC 3339 literal format) of the test profile runs to filter on. + * @param createdDateStartTime Start DateTime(RFC 3339 literal format) of the created time range to filter test + * profile runs. + * @param createdDateEndTime End DateTime(RFC 3339 literal format) of the created time range to filter test profile + * runs. + * @param testProfileRunIds Comma separated list of IDs of the test profile runs to filter. + * @param testProfileIds Comma separated IDs of the test profiles which should be associated with the test profile + * runs to fetch. + * @param statuses Comma separated list of Statuses of the test profile runs to filter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of TestProfileRun items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestProfileRuns(OffsetDateTime minStartDateTime, + OffsetDateTime maxStartDateTime, OffsetDateTime minEndDateTime, OffsetDateTime maxEndDateTime, + OffsetDateTime createdDateStartTime, OffsetDateTime createdDateEndTime, String testProfileRunIds, + String testProfileIds, String statuses) { + // Generated convenience method for listTestProfileRuns + RequestOptions requestOptions = new RequestOptions(); + if (minStartDateTime != null) { + requestOptions.addQueryParam("minStartDateTime", String.valueOf(minStartDateTime), false); + } + if (maxStartDateTime != null) { + requestOptions.addQueryParam("maxStartDateTime", String.valueOf(maxStartDateTime), false); + } + if (minEndDateTime != null) { + requestOptions.addQueryParam("minEndDateTime", String.valueOf(minEndDateTime), false); + } + if (maxEndDateTime != null) { + requestOptions.addQueryParam("maxEndDateTime", String.valueOf(maxEndDateTime), false); + } + if (createdDateStartTime != null) { + requestOptions.addQueryParam("createdDateStartTime", String.valueOf(createdDateStartTime), false); + } + if (createdDateEndTime != null) { + requestOptions.addQueryParam("createdDateEndTime", String.valueOf(createdDateEndTime), false); + } + if (testProfileRunIds != null) { + requestOptions.addQueryParam("testProfileRunIds", testProfileRunIds, false); + } + if (testProfileIds != null) { + requestOptions.addQueryParam("testProfileIds", testProfileIds, false); + } + if (statuses != null) { + requestOptions.addQueryParam("statuses", statuses, false); + } + PagedFlux pagedFluxResponse = listTestProfileRuns(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(TestProfileRun.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List test profile runs. + * + * Get all test profile runs for the given filters. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of TestProfileRun items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestProfileRuns() { + // Generated convenience method for listTestProfileRuns + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listTestProfileRuns(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(TestProfileRun.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Stop test profile run. + * + * Stop test profile run for the given test profile run Id. + * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test Profile Run model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono stopTestProfileRun(String testProfileRunId) { + // Generated convenience method for stopTestProfileRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + return stopTestProfileRunWithResponse(testProfileRunId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestProfileRun.class)); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileRunClient.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileRunClient.java new file mode 100644 index 0000000000000..51025f44d15c9 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileRunClient.java @@ -0,0 +1,546 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +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 com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.developer.loadtesting.models.TestProfileRun; +import java.time.OffsetDateTime; + +/** + * Initializes a new instance of the synchronous TestProfileRunClient type. + */ +@ServiceClient(builder = TestProfileRunClientBuilder.class) +public final class TestProfileRunClient { + @Generated + private final TestProfileRunAsyncClient client; + + /** + * Initializes an instance of TestProfileRunClient class. + * + * @param client the async client. + */ + @Generated + TestProfileRunClient(TestProfileRunAsyncClient client) { + this.client = client; + } + + /** + * Create and start a new test profile run. + * + * Create and start a new test profile run with the given test profile run Id. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body The resource instance. + * @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 Profile Run model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateTestProfileRunWithResponse(String testProfileRunId, BinaryData body, + RequestOptions requestOptions) { + return this.client.createOrUpdateTestProfileRunWithResponse(testProfileRunId, body, requestOptions).block(); + } + + /** + * Delete an existing load test profile run. + * + * Delete an existing load test profile run by providing the test profile run Id. + * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 deleteTestProfileRunWithResponse(String testProfileRunId, RequestOptions requestOptions) { + return this.client.deleteTestProfileRunWithResponse(testProfileRunId, requestOptions).block(); + } + + /** + * Get test profile run details. + * + * Get test profile run details by test profile run Id. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 profile run details. + * + * Get test profile run details by test profile run Id along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestProfileRunWithResponse(String testProfileRunId, RequestOptions requestOptions) { + return this.client.getTestProfileRunWithResponse(testProfileRunId, requestOptions).block(); + } + + /** + * List test profile runs. + * + * Get all test profile runs for the given filters. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoMaximum number of results to include in a single + * response.
minStartDateTimeOffsetDateTimeNoMinimum Start DateTime(RFC 3339 literal + * format) of the test profile runs to filter on.
maxStartDateTimeOffsetDateTimeNoMaximum Start DateTime(RFC 3339 literal + * format) of the test profile runs to filter on.
minEndDateTimeOffsetDateTimeNoMinimum End DateTime(RFC 3339 literal format) of + * the test profile runs to filter on.
maxEndDateTimeOffsetDateTimeNoMaximum End DateTime(RFC 3339 literal format) of + * the test profile runs to filter on.
createdDateStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) of + * the created time range to filter test profile runs.
createdDateEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of the + * created time range to filter test profile runs.
testProfileRunIdsStringNoComma separated list of IDs of the test profile runs + * to filter.
testProfileIdsStringNoComma separated IDs of the test profiles which should be + * associated with the test profile runs to fetch.
statusesStringNoComma separated list of Statuses of the test profile runs to + * filter.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: 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 paged collection of TestProfileRun items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestProfileRuns(RequestOptions requestOptions) { + return new PagedIterable<>(this.client.listTestProfileRuns(requestOptions)); + } + + /** + * Stop test profile run. + * + * Stop test profile run for the given test profile run Id. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 Profile Run model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stopTestProfileRunWithResponse(String testProfileRunId, RequestOptions requestOptions) { + return this.client.stopTestProfileRunWithResponse(testProfileRunId, requestOptions).block(); + } + + /** + * Create and start a new test profile run. + * + * Create and start a new test profile run with the given test profile run Id. + * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test Profile Run model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestProfileRun createOrUpdateTestProfileRun(String testProfileRunId, TestProfileRun body) { + // Generated convenience method for createOrUpdateTestProfileRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTestProfileRunAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getTestProfileRunAccessor().prepareModelForJsonMergePatch(body, false); + return createOrUpdateTestProfileRunWithResponse(testProfileRunId, bodyInBinaryData, requestOptions).getValue() + .toObject(TestProfileRun.class); + } + + /** + * Delete an existing load test profile run. + * + * Delete an existing load test profile run by providing the test profile run Id. + * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteTestProfileRun(String testProfileRunId) { + // Generated convenience method for deleteTestProfileRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteTestProfileRunWithResponse(testProfileRunId, requestOptions).getValue(); + } + + /** + * Get test profile run details. + * + * Get test profile run details by test profile run Id. + * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test profile run details. + * + * Get test profile run details by test profile run Id. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestProfileRun getTestProfileRun(String testProfileRunId) { + // Generated convenience method for getTestProfileRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTestProfileRunWithResponse(testProfileRunId, requestOptions).getValue() + .toObject(TestProfileRun.class); + } + + /** + * List test profile runs. + * + * Get all test profile runs for the given filters. + * + * @param minStartDateTime Minimum Start DateTime(RFC 3339 literal format) of the test profile runs to filter on. + * @param maxStartDateTime Maximum Start DateTime(RFC 3339 literal format) of the test profile runs to filter on. + * @param minEndDateTime Minimum End DateTime(RFC 3339 literal format) of the test profile runs to filter on. + * @param maxEndDateTime Maximum End DateTime(RFC 3339 literal format) of the test profile runs to filter on. + * @param createdDateStartTime Start DateTime(RFC 3339 literal format) of the created time range to filter test + * profile runs. + * @param createdDateEndTime End DateTime(RFC 3339 literal format) of the created time range to filter test profile + * runs. + * @param testProfileRunIds Comma separated list of IDs of the test profile runs to filter. + * @param testProfileIds Comma separated IDs of the test profiles which should be associated with the test profile + * runs to fetch. + * @param statuses Comma separated list of Statuses of the test profile runs to filter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of TestProfileRun items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestProfileRuns(OffsetDateTime minStartDateTime, + OffsetDateTime maxStartDateTime, OffsetDateTime minEndDateTime, OffsetDateTime maxEndDateTime, + OffsetDateTime createdDateStartTime, OffsetDateTime createdDateEndTime, String testProfileRunIds, + String testProfileIds, String statuses) { + // Generated convenience method for listTestProfileRuns + return new PagedIterable<>(client.listTestProfileRuns(minStartDateTime, maxStartDateTime, minEndDateTime, + maxEndDateTime, createdDateStartTime, createdDateEndTime, testProfileRunIds, testProfileIds, statuses)); + } + + /** + * List test profile runs. + * + * Get all test profile runs for the given filters. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of TestProfileRun items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestProfileRuns() { + // Generated convenience method for listTestProfileRuns + return new PagedIterable<>(client.listTestProfileRuns()); + } + + /** + * Stop test profile run. + * + * Stop test profile run for the given test profile run Id. + * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test Profile Run model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestProfileRun stopTestProfileRun(String testProfileRunId) { + // Generated convenience method for stopTestProfileRunWithResponse + RequestOptions requestOptions = new RequestOptions(); + return stopTestProfileRunWithResponse(testProfileRunId, requestOptions).getValue() + .toObject(TestProfileRun.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileRunClientBuilder.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileRunClientBuilder.java new file mode 100644 index 0000000000000..751b664c17ab5 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/TestProfileRunClientBuilder.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting; + +import com.azure.core.annotation.Generated; +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.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpLogOptions; +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.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.developer.loadtesting.implementation.TestProfileRunClientImpl; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the TestProfileRunClient type. + */ +@ServiceClientBuilder(serviceClients = { TestProfileRunClient.class, TestProfileRunAsyncClient.class }) +public final class TestProfileRunClientBuilder + implements HttpTrait, ConfigurationTrait, + TokenCredentialTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final String[] DEFAULT_SCOPES = new String[] { "https://cnt-prod.loadtesting.azure.com/.default" }; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-developer-loadtesting.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the TestProfileRunClientBuilder. + */ + @Generated + public TestProfileRunClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileRunClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileRunClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileRunClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileRunClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileRunClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileRunClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileRunClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The TokenCredential used for authentication. + */ + @Generated + private TokenCredential tokenCredential; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileRunClientBuilder credential(TokenCredential tokenCredential) { + this.tokenCredential = tokenCredential; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TestProfileRunClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private LoadTestingServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the TestProfileRunClientBuilder. + */ + @Generated + public TestProfileRunClientBuilder serviceVersion(LoadTestingServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the TestProfileRunClientBuilder. + */ + @Generated + public TestProfileRunClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of TestProfileRunClientImpl with the provided parameters. + * + * @return an instance of TestProfileRunClientImpl. + */ + @Generated + private TestProfileRunClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + LoadTestingServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : LoadTestingServiceVersion.getLatest(); + TestProfileRunClientImpl client = new TestProfileRunClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + if (tokenCredential != null) { + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of TestProfileRunAsyncClient class. + * + * @return an instance of TestProfileRunAsyncClient. + */ + @Generated + public TestProfileRunAsyncClient buildAsyncClient() { + return new TestProfileRunAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of TestProfileRunClient class. + * + * @return an instance of TestProfileRunClient. + */ + @Generated + public TestProfileRunClient buildClient() { + return new TestProfileRunClient(new TestProfileRunAsyncClient(buildInnerClient())); + } + + private static final ClientLogger LOGGER = new ClientLogger(TestProfileRunClientBuilder.class); +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/JsonMergePatchHelper.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/JsonMergePatchHelper.java new file mode 100644 index 0000000000000..4e1a81502b0e8 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/JsonMergePatchHelper.java @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.implementation; + +import com.azure.developer.loadtesting.models.AppComponent; +import com.azure.developer.loadtesting.models.AutoStopCriteria; +import com.azure.developer.loadtesting.models.CertificateMetadata; +import com.azure.developer.loadtesting.models.FunctionFlexConsumptionResourceConfiguration; +import com.azure.developer.loadtesting.models.LoadTestConfiguration; +import com.azure.developer.loadtesting.models.OptionalLoadTestConfig; +import com.azure.developer.loadtesting.models.PassFailCriteria; +import com.azure.developer.loadtesting.models.PassFailMetric; +import com.azure.developer.loadtesting.models.RegionalConfiguration; +import com.azure.developer.loadtesting.models.ResourceMetric; +import com.azure.developer.loadtesting.models.Secret; +import com.azure.developer.loadtesting.models.TargetResourceConfigurations; +import com.azure.developer.loadtesting.models.Test; +import com.azure.developer.loadtesting.models.TestAppComponents; +import com.azure.developer.loadtesting.models.TestProfile; +import com.azure.developer.loadtesting.models.TestProfileRun; +import com.azure.developer.loadtesting.models.TestRun; +import com.azure.developer.loadtesting.models.TestRunAppComponents; +import com.azure.developer.loadtesting.models.TestRunServerMetricConfig; +import com.azure.developer.loadtesting.models.TestServerMetricConfig; + +/** + * This is the Helper class to enable json merge patch serialization for a model. + */ +public class JsonMergePatchHelper { + private static TestAccessor testAccessor; + + public interface TestAccessor { + Test prepareModelForJsonMergePatch(Test test, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(Test test); + } + + public static void setTestAccessor(TestAccessor accessor) { + testAccessor = accessor; + } + + public static TestAccessor getTestAccessor() { + return testAccessor; + } + + private static PassFailCriteriaAccessor passFailCriteriaAccessor; + + public interface PassFailCriteriaAccessor { + PassFailCriteria prepareModelForJsonMergePatch(PassFailCriteria passFailCriteria, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(PassFailCriteria passFailCriteria); + } + + public static void setPassFailCriteriaAccessor(PassFailCriteriaAccessor accessor) { + passFailCriteriaAccessor = accessor; + } + + public static PassFailCriteriaAccessor getPassFailCriteriaAccessor() { + return passFailCriteriaAccessor; + } + + private static PassFailMetricAccessor passFailMetricAccessor; + + public interface PassFailMetricAccessor { + PassFailMetric prepareModelForJsonMergePatch(PassFailMetric passFailMetric, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(PassFailMetric passFailMetric); + } + + public static void setPassFailMetricAccessor(PassFailMetricAccessor accessor) { + passFailMetricAccessor = accessor; + } + + public static PassFailMetricAccessor getPassFailMetricAccessor() { + return passFailMetricAccessor; + } + + private static AutoStopCriteriaAccessor autoStopCriteriaAccessor; + + public interface AutoStopCriteriaAccessor { + AutoStopCriteria prepareModelForJsonMergePatch(AutoStopCriteria autoStopCriteria, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(AutoStopCriteria autoStopCriteria); + } + + public static void setAutoStopCriteriaAccessor(AutoStopCriteriaAccessor accessor) { + autoStopCriteriaAccessor = accessor; + } + + public static AutoStopCriteriaAccessor getAutoStopCriteriaAccessor() { + return autoStopCriteriaAccessor; + } + + private static SecretAccessor secretAccessor; + + public interface SecretAccessor { + Secret prepareModelForJsonMergePatch(Secret secret, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(Secret secret); + } + + public static void setSecretAccessor(SecretAccessor accessor) { + secretAccessor = accessor; + } + + public static SecretAccessor getSecretAccessor() { + return secretAccessor; + } + + private static CertificateMetadataAccessor certificateMetadataAccessor; + + public interface CertificateMetadataAccessor { + CertificateMetadata prepareModelForJsonMergePatch(CertificateMetadata certificateMetadata, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(CertificateMetadata certificateMetadata); + } + + public static void setCertificateMetadataAccessor(CertificateMetadataAccessor accessor) { + certificateMetadataAccessor = accessor; + } + + public static CertificateMetadataAccessor getCertificateMetadataAccessor() { + return certificateMetadataAccessor; + } + + private static LoadTestConfigurationAccessor loadTestConfigurationAccessor; + + public interface LoadTestConfigurationAccessor { + LoadTestConfiguration prepareModelForJsonMergePatch(LoadTestConfiguration loadTestConfiguration, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(LoadTestConfiguration loadTestConfiguration); + } + + public static void setLoadTestConfigurationAccessor(LoadTestConfigurationAccessor accessor) { + loadTestConfigurationAccessor = accessor; + } + + public static LoadTestConfigurationAccessor getLoadTestConfigurationAccessor() { + return loadTestConfigurationAccessor; + } + + private static OptionalLoadTestConfigAccessor optionalLoadTestConfigAccessor; + + public interface OptionalLoadTestConfigAccessor { + OptionalLoadTestConfig prepareModelForJsonMergePatch(OptionalLoadTestConfig optionalLoadTestConfig, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(OptionalLoadTestConfig optionalLoadTestConfig); + } + + public static void setOptionalLoadTestConfigAccessor(OptionalLoadTestConfigAccessor accessor) { + optionalLoadTestConfigAccessor = accessor; + } + + public static OptionalLoadTestConfigAccessor getOptionalLoadTestConfigAccessor() { + return optionalLoadTestConfigAccessor; + } + + private static RegionalConfigurationAccessor regionalConfigurationAccessor; + + public interface RegionalConfigurationAccessor { + RegionalConfiguration prepareModelForJsonMergePatch(RegionalConfiguration regionalConfiguration, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(RegionalConfiguration regionalConfiguration); + } + + public static void setRegionalConfigurationAccessor(RegionalConfigurationAccessor accessor) { + regionalConfigurationAccessor = accessor; + } + + public static RegionalConfigurationAccessor getRegionalConfigurationAccessor() { + return regionalConfigurationAccessor; + } + + private static TestAppComponentsAccessor testAppComponentsAccessor; + + public interface TestAppComponentsAccessor { + TestAppComponents prepareModelForJsonMergePatch(TestAppComponents testAppComponents, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(TestAppComponents testAppComponents); + } + + public static void setTestAppComponentsAccessor(TestAppComponentsAccessor accessor) { + testAppComponentsAccessor = accessor; + } + + public static TestAppComponentsAccessor getTestAppComponentsAccessor() { + return testAppComponentsAccessor; + } + + private static AppComponentAccessor appComponentAccessor; + + public interface AppComponentAccessor { + AppComponent prepareModelForJsonMergePatch(AppComponent appComponent, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(AppComponent appComponent); + } + + public static void setAppComponentAccessor(AppComponentAccessor accessor) { + appComponentAccessor = accessor; + } + + public static AppComponentAccessor getAppComponentAccessor() { + return appComponentAccessor; + } + + private static TestServerMetricConfigAccessor testServerMetricConfigAccessor; + + public interface TestServerMetricConfigAccessor { + TestServerMetricConfig prepareModelForJsonMergePatch(TestServerMetricConfig testServerMetricConfig, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(TestServerMetricConfig testServerMetricConfig); + } + + public static void setTestServerMetricConfigAccessor(TestServerMetricConfigAccessor accessor) { + testServerMetricConfigAccessor = accessor; + } + + public static TestServerMetricConfigAccessor getTestServerMetricConfigAccessor() { + return testServerMetricConfigAccessor; + } + + private static ResourceMetricAccessor resourceMetricAccessor; + + public interface ResourceMetricAccessor { + ResourceMetric prepareModelForJsonMergePatch(ResourceMetric resourceMetric, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(ResourceMetric resourceMetric); + } + + public static void setResourceMetricAccessor(ResourceMetricAccessor accessor) { + resourceMetricAccessor = accessor; + } + + public static ResourceMetricAccessor getResourceMetricAccessor() { + return resourceMetricAccessor; + } + + private static TestRunAccessor testRunAccessor; + + public interface TestRunAccessor { + TestRun prepareModelForJsonMergePatch(TestRun testRun, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(TestRun testRun); + } + + public static void setTestRunAccessor(TestRunAccessor accessor) { + testRunAccessor = accessor; + } + + public static TestRunAccessor getTestRunAccessor() { + return testRunAccessor; + } + + private static TestRunAppComponentsAccessor testRunAppComponentsAccessor; + + public interface TestRunAppComponentsAccessor { + TestRunAppComponents prepareModelForJsonMergePatch(TestRunAppComponents testRunAppComponents, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(TestRunAppComponents testRunAppComponents); + } + + public static void setTestRunAppComponentsAccessor(TestRunAppComponentsAccessor accessor) { + testRunAppComponentsAccessor = accessor; + } + + public static TestRunAppComponentsAccessor getTestRunAppComponentsAccessor() { + return testRunAppComponentsAccessor; + } + + private static TestRunServerMetricConfigAccessor testRunServerMetricConfigAccessor; + + public interface TestRunServerMetricConfigAccessor { + TestRunServerMetricConfig prepareModelForJsonMergePatch(TestRunServerMetricConfig testRunServerMetricConfig, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(TestRunServerMetricConfig testRunServerMetricConfig); + } + + public static void setTestRunServerMetricConfigAccessor(TestRunServerMetricConfigAccessor accessor) { + testRunServerMetricConfigAccessor = accessor; + } + + public static TestRunServerMetricConfigAccessor getTestRunServerMetricConfigAccessor() { + return testRunServerMetricConfigAccessor; + } + + private static TestProfileAccessor testProfileAccessor; + + public interface TestProfileAccessor { + TestProfile prepareModelForJsonMergePatch(TestProfile testProfile, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(TestProfile testProfile); + } + + public static void setTestProfileAccessor(TestProfileAccessor accessor) { + testProfileAccessor = accessor; + } + + public static TestProfileAccessor getTestProfileAccessor() { + return testProfileAccessor; + } + + private static TargetResourceConfigurationsAccessor targetResourceConfigurationsAccessor; + + public interface TargetResourceConfigurationsAccessor { + TargetResourceConfigurations prepareModelForJsonMergePatch( + TargetResourceConfigurations targetResourceConfigurations, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(TargetResourceConfigurations targetResourceConfigurations); + } + + public static void setTargetResourceConfigurationsAccessor(TargetResourceConfigurationsAccessor accessor) { + targetResourceConfigurationsAccessor = accessor; + } + + public static TargetResourceConfigurationsAccessor getTargetResourceConfigurationsAccessor() { + return targetResourceConfigurationsAccessor; + } + + private static FunctionFlexConsumptionResourceConfigurationAccessor functionFlexConsumptionResourceConfigurationAccessor; + + public interface FunctionFlexConsumptionResourceConfigurationAccessor { + FunctionFlexConsumptionResourceConfiguration prepareModelForJsonMergePatch( + FunctionFlexConsumptionResourceConfiguration functionFlexConsumptionResourceConfiguration, + boolean jsonMergePatchEnabled); + + boolean + isJsonMergePatch(FunctionFlexConsumptionResourceConfiguration functionFlexConsumptionResourceConfiguration); + } + + public static void setFunctionFlexConsumptionResourceConfigurationAccessor( + FunctionFlexConsumptionResourceConfigurationAccessor accessor) { + functionFlexConsumptionResourceConfigurationAccessor = accessor; + } + + public static FunctionFlexConsumptionResourceConfigurationAccessor + getFunctionFlexConsumptionResourceConfigurationAccessor() { + return functionFlexConsumptionResourceConfigurationAccessor; + } + + private static TestProfileRunAccessor testProfileRunAccessor; + + public interface TestProfileRunAccessor { + TestProfileRun prepareModelForJsonMergePatch(TestProfileRun testProfileRun, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(TestProfileRun testProfileRun); + } + + public static void setTestProfileRunAccessor(TestProfileRunAccessor accessor) { + testProfileRunAccessor = accessor; + } + + public static TestProfileRunAccessor getTestProfileRunAccessor() { + return testProfileRunAccessor; + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestAdministrationsImpl.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestAdministrationClientImpl.java similarity index 61% rename from sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestAdministrationsImpl.java rename to sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestAdministrationClientImpl.java index ca69e8a0d0388..bbf7e12d9c9d8 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestAdministrationsImpl.java +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestAdministrationClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.developer.loadtesting.implementation; @@ -23,6 +23,10 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.PagedResponse; @@ -34,6 +38,8 @@ import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.UrlBuilder; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; import com.azure.developer.loadtesting.LoadTestingServiceVersion; import java.util.List; import java.util.Map; @@ -41,314 +47,243 @@ import reactor.core.publisher.Mono; /** - * An instance of this class provides access to all the operations defined in LoadTestAdministrations. + * Initializes a new instance of the LoadTestAdministrationClient type. */ -public final class LoadTestAdministrationsImpl { +public final class LoadTestAdministrationClientImpl { /** * The proxy service used to perform REST calls. */ - private final LoadTestAdministrationsService service; + private final LoadTestAdministrationClientService service; /** - * The service client containing this operation class. */ - private final LoadTestingClientImpl client; + private final String endpoint; /** - * Initializes an instance of LoadTestAdministrationsImpl. + * Gets. * - * @param client the instance of the service client containing this operation class. + * @return the endpoint value. */ - LoadTestAdministrationsImpl(LoadTestingClientImpl client) { - this.service = RestProxy.create(LoadTestAdministrationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; + public String getEndpoint() { + return this.endpoint; } + /** + * Service version. + */ + private final LoadTestingServiceVersion serviceVersion; + /** * Gets Service version. * * @return the serviceVersion value. */ public LoadTestingServiceVersion getServiceVersion() { - return client.getServiceVersion(); + return this.serviceVersion; } /** - * The interface defining all the services for LoadTestingClientLoadTestAdministrations to be used by the proxy - * service to perform REST calls. + * The HTTP pipeline to send requests through. */ - @Host("https://{Endpoint}") - @ServiceInterface(name = "LoadTestingClientLoa") - public interface LoadTestAdministrationsService { - @Patch("/tests/{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, - @PathParam("testId") String testId, @QueryParam("api-version") String apiVersion, - @BodyParam("application/merge-patch+json") BinaryData body, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Patch("/tests/{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) - Response createOrUpdateTestSync(@HostParam("Endpoint") String endpoint, - @PathParam("testId") String testId, @QueryParam("api-version") String apiVersion, - @BodyParam("application/merge-patch+json") BinaryData body, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); + private final HttpPipeline httpPipeline; - @Delete("/tests/{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> deleteTest(@HostParam("Endpoint") String endpoint, @PathParam("testId") String testId, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } - @Delete("/tests/{testId}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response deleteTestSync(@HostParam("Endpoint") String endpoint, @PathParam("testId") String testId, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; - @Get("/tests/{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> getTest(@HostParam("Endpoint") String endpoint, @PathParam("testId") String testId, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } - @Get("/tests/{testId}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getTestSync(@HostParam("Endpoint") String endpoint, @PathParam("testId") String testId, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); + /** + * Initializes an instance of LoadTestAdministrationClient client. + * + * @param endpoint + * @param serviceVersion Service version. + */ + public LoadTestAdministrationClientImpl(String endpoint, LoadTestingServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } - @Get("/tests") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listTests(@HostParam("Endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); + /** + * Initializes an instance of LoadTestAdministrationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint + * @param serviceVersion Service version. + */ + public LoadTestAdministrationClientImpl(HttpPipeline httpPipeline, String endpoint, + LoadTestingServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } - @Get("/tests") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listTestsSync(@HostParam("Endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); + /** + * Initializes an instance of LoadTestAdministrationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint + * @param serviceVersion Service version. + */ + public LoadTestAdministrationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint, LoadTestingServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(LoadTestAdministrationClientService.class, this.httpPipeline, + this.getSerializerAdapter()); + } - @Put("/tests/{testId}/files/{fileName}") - @ExpectedResponses({ 201 }) + /** + * The interface defining all the services for LoadTestAdministrationClient to be used by the proxy service to + * perform REST calls. + */ + @Host("https://{endpoint}") + @ServiceInterface(name = "LoadTestAdministrati") + public interface LoadTestAdministrationClientService { + @Patch("/tests/{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> uploadTestFile(@HostParam("Endpoint") String endpoint, - @PathParam("testId") String testId, @PathParam("fileName") String fileName, - @QueryParam("api-version") String apiVersion, @BodyParam("application/octet-stream") BinaryData body, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + Mono> createOrUpdateTest(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testId") String testId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions, Context context); - @Put("/tests/{testId}/files/{fileName}") - @ExpectedResponses({ 201 }) + @Patch("/tests/{testId}/app-components") + @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response uploadTestFileSync(@HostParam("Endpoint") String endpoint, - @PathParam("testId") String testId, @PathParam("fileName") String fileName, - @QueryParam("api-version") String apiVersion, @BodyParam("application/octet-stream") BinaryData body, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + Mono> createOrUpdateAppComponents(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("content-type") String contentType, + @PathParam("testId") String testId, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions, Context context); - @Get("/tests/{testId}/files/{fileName}") - @ExpectedResponses({ 200 }) + @Patch("/tests/{testId}/server-metrics-config") + @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> getTestFile(@HostParam("Endpoint") String endpoint, - @PathParam("testId") String testId, @PathParam("fileName") String fileName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); + Mono> createOrUpdateServerMetricsConfig(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("content-type") String contentType, + @PathParam("testId") String testId, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions, Context context); - @Get("/tests/{testId}/files/{fileName}") + @Get("/tests/{testId}/app-components") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getTestFileSync(@HostParam("Endpoint") String endpoint, @PathParam("testId") String testId, - @PathParam("fileName") String fileName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Delete("/tests/{testId}/files/{fileName}") - @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("fileName") String fileName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Delete("/tests/{testId}/files/{fileName}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response deleteTestFileSync(@HostParam("Endpoint") String endpoint, @PathParam("testId") String testId, - @PathParam("fileName") String fileName, @QueryParam("api-version") String apiVersion, + Mono> getAppComponents(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testId") String testId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("/tests/{testId}/files") + @Get("/tests/{testId}/server-metrics-config") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listTestFiles(@HostParam("Endpoint") String endpoint, - @PathParam("testId") String testId, @QueryParam("api-version") String apiVersion, + Mono> getServerMetricsConfig(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testId") String testId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("/tests/{testId}/files") + @Get("/tests/{testId}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listTestFilesSync(@HostParam("Endpoint") String endpoint, - @PathParam("testId") String testId, @QueryParam("api-version") String apiVersion, + Mono> getTest(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testId") String testId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Patch("/tests/{testId}/app-components") - @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("testId") String testId, @QueryParam("api-version") String apiVersion, - @BodyParam("application/merge-patch+json") BinaryData body, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Patch("/tests/{testId}/app-components") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrUpdateAppComponentsSync(@HostParam("Endpoint") String endpoint, - @PathParam("testId") String testId, @QueryParam("api-version") String apiVersion, - @BodyParam("application/merge-patch+json") BinaryData body, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/tests/{testId}/app-components") + @Get("/tests/{testId}/files/{fileName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAppComponents(@HostParam("Endpoint") String endpoint, - @PathParam("testId") String testId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + Mono> getTestFile(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testId") String testId, + @PathParam("fileName") String fileName, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); - @Get("/tests/{testId}/app-components") + @Get("/tests/{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) - Response getAppComponentsSync(@HostParam("Endpoint") String endpoint, - @PathParam("testId") String testId, @QueryParam("api-version") String apiVersion, + Mono> listTestFiles(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testId") String testId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Patch("/tests/{testId}/server-metrics-config") - @ExpectedResponses({ 200, 201 }) + @Get("/tests") + @ExpectedResponses({ 200 }) @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("testId") String testId, @QueryParam("api-version") String apiVersion, - @BodyParam("application/merge-patch+json") BinaryData body, @HeaderParam("Accept") String accept, + Mono> listTests(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Patch("/tests/{testId}/server-metrics-config") - @ExpectedResponses({ 200, 201 }) + @Put("/tests/{testId}/files/{fileName}") + @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrUpdateServerMetricsConfigSync(@HostParam("Endpoint") String endpoint, - @PathParam("testId") String testId, @QueryParam("api-version") String apiVersion, - @BodyParam("application/merge-patch+json") BinaryData body, @HeaderParam("Accept") String accept, + Mono> uploadTestFile(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("content-type") String contentType, + @PathParam("testId") String testId, @PathParam("fileName") String fileName, + @HeaderParam("Accept") String accept, @BodyParam("application/octet-stream") BinaryData body, RequestOptions requestOptions, Context context); - @Get("/tests/{testId}/server-metrics-config") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getServerMetricsConfig(@HostParam("Endpoint") String endpoint, - @PathParam("testId") String testId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/tests/{testId}/server-metrics-config") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getServerMetricsConfigSync(@HostParam("Endpoint") String endpoint, - @PathParam("testId") String testId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) + @Delete("/tests/{testId}/files/{fileName}") + @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listTestsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("Endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Mono> deleteTestFile(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testId") String testId, + @PathParam("fileName") String fileName, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("{nextLink}") - @ExpectedResponses({ 200 }) + @Delete("/tests/{testId}") + @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listTestsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("Endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); + Mono> deleteTest(@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 }) @@ -357,7 +292,7 @@ Response listTestsNextSync(@PathParam(value = "nextLink", encoded = @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> listTestFilesNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("Endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Get("{nextLink}") @@ -366,23 +301,22 @@ Mono> listTestFilesNext(@PathParam(value = "nextLink", enco @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listTestFilesNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("Endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Mono> listTestsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); } /** - * Create a new test or update an existing test. - *

- * Request Body Schema - *

+ * Create a new test or update an existing test by providing the test Id. + *

Request Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -392,6 +326,11 @@ Response listTestFilesNextSync(@PathParam(value = "nextLink", encode
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -412,16 +351,25 @@ Response listTestFilesNextSync(@PathParam(value = "nextLink", encode
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -429,14 +377,17 @@ Response listTestFilesNextSync(@PathParam(value = "nextLink", encode
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -445,16 +396,16 @@ Response listTestFilesNextSync(@PathParam(value = "nextLink", encode
      *     lastModifiedBy: String (Optional)
      * }
      * }
- *

- * Response Body Schema - *

+ * + *

Response Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -464,6 +415,11 @@ Response listTestFilesNextSync(@PathParam(value = "nextLink", encode
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -484,16 +440,25 @@ Response listTestFilesNextSync(@PathParam(value = "nextLink", encode
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -501,14 +466,17 @@ Response listTestFilesNextSync(@PathParam(value = "nextLink", encode
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -518,9 +486,9 @@ Response listTestFilesNextSync(@PathParam(value = "nextLink", encode
      * }
      * }
* - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param body Load test model. + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param body The resource instance. * @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. @@ -531,23 +499,23 @@ Response listTestFilesNextSync(@PathParam(value = "nextLink", encode @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createOrUpdateTestWithResponseAsync(String testId, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createOrUpdateTest(this.client.getEndpoint(), testId, - this.client.getServiceVersion().getVersion(), body, accept, requestOptions, context)); + return FluxUtil.withContext(context -> service.createOrUpdateTest(this.getEndpoint(), + this.getServiceVersion().getVersion(), testId, contentType, accept, body, requestOptions, context)); } /** - * Create a new test or update an existing test. - *

- * Request Body Schema - *

+ * Create a new test or update an existing test by providing the test Id. + *

Request Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -557,6 +525,11 @@ public Mono> createOrUpdateTestWithResponseAsync(String tes
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -577,16 +550,25 @@ public Mono> createOrUpdateTestWithResponseAsync(String tes
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -594,14 +576,17 @@ public Mono> createOrUpdateTestWithResponseAsync(String tes
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -610,16 +595,16 @@ public Mono> createOrUpdateTestWithResponseAsync(String tes
      *     lastModifiedBy: String (Optional)
      * }
      * }
- *

- * Response Body Schema - *

+ * + *

Response Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -629,6 +614,11 @@ public Mono> createOrUpdateTestWithResponseAsync(String tes
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -649,16 +639,25 @@ public Mono> createOrUpdateTestWithResponseAsync(String tes
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -666,14 +665,17 @@ public Mono> createOrUpdateTestWithResponseAsync(String tes
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -683,9 +685,9 @@ public Mono> createOrUpdateTestWithResponseAsync(String tes
      * }
      * }
* - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param body Load test model. + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param body The resource instance. * @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. @@ -696,117 +698,121 @@ public Mono> createOrUpdateTestWithResponseAsync(String tes @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateTestWithResponse(String testId, BinaryData body, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.createOrUpdateTestSync(this.client.getEndpoint(), testId, - this.client.getServiceVersion().getVersion(), body, accept, requestOptions, Context.NONE); + return createOrUpdateTestWithResponseAsync(testId, body, requestOptions).block(); } /** - * Delete a test by its name. + * Add an app component to a test. + * + * Add an app component to a test by providing the resource Id, name and type. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
* - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 the {@link Response} on successful completion of {@link Mono}. + * @return test app components along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteTestWithResponseAsync(String testId, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.deleteTest(this.client.getEndpoint(), testId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); - } - - /** - * Delete a test by its name. - * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @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 deleteTestWithResponse(String testId, RequestOptions requestOptions) { + public Mono> createOrUpdateAppComponentsWithResponseAsync(String testId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; final String accept = "application/json"; - return service.deleteTestSync(this.client.getEndpoint(), testId, this.client.getServiceVersion().getVersion(), - accept, requestOptions, Context.NONE); + return FluxUtil.withContext(context -> service.createOrUpdateAppComponents(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, testId, accept, body, requestOptions, context)); } /** - * Get load test details by test name. - *

- * Response Body Schema - *

+ * Add an app component to a test. + * + * Add an app component to a test by providing the resource Id, name and type. + *

Request Body Schema

+ * *
{@code
      * {
-     *     passFailCriteria (Optional): {
-     *         passFailMetrics (Optional): {
-     *             String (Required): {
-     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
-     *                 condition: String (Optional)
-     *                 requestName: String (Optional)
-     *                 value: Double (Optional)
-     *                 action: String(continue/stop) (Optional)
-     *                 actualValue: Double (Optional)
-     *                 result: String(passed/undetermined/failed) (Optional)
-     *             }
-     *         }
-     *     }
-     *     secrets (Optional): {
+     *     components (Optional, Required on create): {
      *         String (Required): {
-     *             value: String (Optional)
-     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
-     *         }
-     *     }
-     *     certificate (Optional): {
-     *         value: String (Optional)
-     *         type: String(AKV_CERT_URI) (Optional)
-     *         name: String (Optional)
-     *     }
-     *     environmentVariables (Optional): {
-     *         String: String (Required)
-     *     }
-     *     loadTestConfiguration (Optional): {
-     *         engineInstances: Integer (Optional)
-     *         splitAllCSVs: Boolean (Optional)
-     *         quickStartTest: Boolean (Optional)
-     *         optionalLoadTestConfig (Optional): {
-     *             endpointUrl: String (Optional)
-     *             virtualUsers: Integer (Optional)
-     *             rampUpTime: Integer (Optional)
-     *             duration: Integer (Optional)
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
      *         }
      *     }
-     *     inputArtifacts (Optional): {
-     *         configFileInfo (Optional): {
-     *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *             expireDateTime: OffsetDateTime (Optional)
-     *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *             validationFailureDetails: String (Optional)
+     *     testId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
      *         }
-     *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
-     *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
-     *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
-     *         additionalFileInfo (Optional): [
-     *             (recursive schema, see above)
-     *         ]
      *     }
      *     testId: String (Optional)
-     *     description: String (Optional)
-     *     displayName: String (Optional)
-     *     subnetId: String (Optional)
-     *     keyvaultReferenceIdentityType: String (Optional)
-     *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -814,90 +820,65 @@ public Response deleteTestWithResponse(String testId, RequestOptions reque
      * }
      * }
* - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 load test details by test name along with {@link Response} on successful completion of {@link Mono}. + * @return test app components along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTestWithResponseAsync(String testId, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getTest(this.client.getEndpoint(), testId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); + public Response createOrUpdateAppComponentsWithResponse(String testId, BinaryData body, + RequestOptions requestOptions) { + return createOrUpdateAppComponentsWithResponseAsync(testId, body, requestOptions).block(); } /** - * Get load test details by test name. - *

- * Response Body Schema - *

+ * Configure server metrics for a test. + *

Request Body Schema

+ * *
{@code
      * {
-     *     passFailCriteria (Optional): {
-     *         passFailMetrics (Optional): {
-     *             String (Required): {
-     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
-     *                 condition: String (Optional)
-     *                 requestName: String (Optional)
-     *                 value: Double (Optional)
-     *                 action: String(continue/stop) (Optional)
-     *                 actualValue: Double (Optional)
-     *                 result: String(passed/undetermined/failed) (Optional)
-     *             }
-     *         }
-     *     }
-     *     secrets (Optional): {
+     *     testId: String (Optional)
+     *     metrics (Optional, Required on create): {
      *         String (Required): {
-     *             value: String (Optional)
-     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
-     *         }
-     *     }
-     *     certificate (Optional): {
-     *         value: String (Optional)
-     *         type: String(AKV_CERT_URI) (Optional)
-     *         name: String (Optional)
-     *     }
-     *     environmentVariables (Optional): {
-     *         String: String (Required)
-     *     }
-     *     loadTestConfiguration (Optional): {
-     *         engineInstances: Integer (Optional)
-     *         splitAllCSVs: Boolean (Optional)
-     *         quickStartTest: Boolean (Optional)
-     *         optionalLoadTestConfig (Optional): {
-     *             endpointUrl: String (Optional)
-     *             virtualUsers: Integer (Optional)
-     *             rampUpTime: Integer (Optional)
-     *             duration: Integer (Optional)
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
      *         }
      *     }
-     *     inputArtifacts (Optional): {
-     *         configFileInfo (Optional): {
-     *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *             expireDateTime: OffsetDateTime (Optional)
-     *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *             validationFailureDetails: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testId: String (Optional)
+     *     metrics (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
      *         }
-     *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
-     *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
-     *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
-     *         additionalFileInfo (Optional): [
-     *             (recursive schema, see above)
-     *         ]
      *     }
-     *     testId: String (Optional)
-     *     description: String (Optional)
-     *     displayName: String (Optional)
-     *     subnetId: String (Optional)
-     *     keyvaultReferenceIdentityType: String (Optional)
-     *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -905,136 +886,68 @@ public Mono> getTestWithResponseAsync(String testId, Reques
      * }
      * }
* - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body Server metric 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 load test details by test name along with {@link Response}. + * @return test server metrics configuration along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTestWithResponse(String testId, RequestOptions requestOptions) { + public Mono> createOrUpdateServerMetricsConfigWithResponseAsync(String testId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; final String accept = "application/json"; - return service.getTestSync(this.client.getEndpoint(), testId, this.client.getServiceVersion().getVersion(), - accept, requestOptions, Context.NONE); + return FluxUtil.withContext(context -> service.createOrUpdateServerMetricsConfig(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, testId, accept, body, requestOptions, 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 the supported fields in (field asc/desc) format. eg: lastModifiedDateTime asc. Supported fields - - * lastModifiedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - displayName, createdBy. For example, to search for - * a test, with display name is Login Test, the search parameter can be Login.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
maxpagesizeIntegerNoNumber of results in response.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ * Configure server metrics for a test. + *

Request Body Schema

+ * *
{@code
      * {
-     *     passFailCriteria (Optional): {
-     *         passFailMetrics (Optional): {
-     *             String (Required): {
-     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
-     *                 condition: String (Optional)
-     *                 requestName: String (Optional)
-     *                 value: Double (Optional)
-     *                 action: String(continue/stop) (Optional)
-     *                 actualValue: Double (Optional)
-     *                 result: String(passed/undetermined/failed) (Optional)
-     *             }
-     *         }
-     *     }
-     *     secrets (Optional): {
+     *     testId: String (Optional)
+     *     metrics (Optional, Required on create): {
      *         String (Required): {
-     *             value: String (Optional)
-     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
-     *         }
-     *     }
-     *     certificate (Optional): {
-     *         value: String (Optional)
-     *         type: String(AKV_CERT_URI) (Optional)
-     *         name: String (Optional)
-     *     }
-     *     environmentVariables (Optional): {
-     *         String: String (Required)
-     *     }
-     *     loadTestConfiguration (Optional): {
-     *         engineInstances: Integer (Optional)
-     *         splitAllCSVs: Boolean (Optional)
-     *         quickStartTest: Boolean (Optional)
-     *         optionalLoadTestConfig (Optional): {
-     *             endpointUrl: String (Optional)
-     *             virtualUsers: Integer (Optional)
-     *             rampUpTime: Integer (Optional)
-     *             duration: Integer (Optional)
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
      *         }
      *     }
-     *     inputArtifacts (Optional): {
-     *         configFileInfo (Optional): {
-     *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *             expireDateTime: OffsetDateTime (Optional)
-     *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *             validationFailureDetails: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testId: String (Optional)
+     *     metrics (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
      *         }
-     *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
-     *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
-     *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
-     *         additionalFileInfo (Optional): [
-     *             (recursive schema, see above)
-     *         ]
      *     }
-     *     testId: String (Optional)
-     *     description: String (Optional)
-     *     displayName: String (Optional)
-     *     subnetId: String (Optional)
-     *     keyvaultReferenceIdentityType: String (Optional)
-     *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -1042,139 +955,165 @@ public Response getTestWithResponse(String testId, RequestOptions re
      * }
      * }
* + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body Server metric 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 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}. + * @return test server metrics configuration along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listTestsSinglePageAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listTests(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)); + public Response createOrUpdateServerMetricsConfigWithResponse(String testId, BinaryData body, + RequestOptions requestOptions) { + return createOrUpdateServerMetricsConfigWithResponseAsync(testId, body, 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 the supported fields in (field asc/desc) format. eg: lastModifiedDateTime asc. Supported fields - - * lastModifiedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - displayName, createdBy. For example, to search for - * a test, with display name is Login Test, the search parameter can be Login.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
maxpagesizeIntegerNoNumber of results in response.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ * Get associated app component (collection of azure resources) for the given test. + *

Response Body Schema

+ * *
{@code
      * {
-     *     passFailCriteria (Optional): {
-     *         passFailMetrics (Optional): {
-     *             String (Required): {
-     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
-     *                 condition: String (Optional)
-     *                 requestName: String (Optional)
-     *                 value: Double (Optional)
-     *                 action: String(continue/stop) (Optional)
-     *                 actualValue: Double (Optional)
-     *                 result: String(passed/undetermined/failed) (Optional)
-     *             }
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
      *         }
      *     }
-     *     secrets (Optional): {
+     *     testId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 associated app component (collection of azure resources) for the given test along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAppComponentsWithResponseAsync(String testId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getAppComponents(this.getEndpoint(), + this.getServiceVersion().getVersion(), testId, accept, requestOptions, context)); + } + + /** + * Get associated app component (collection of azure resources) for the given test. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
      *         String (Required): {
-     *             value: String (Optional)
-     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
      *         }
      *     }
-     *     certificate (Optional): {
-     *         value: String (Optional)
-     *         type: String(AKV_CERT_URI) (Optional)
-     *         name: String (Optional)
-     *     }
-     *     environmentVariables (Optional): {
-     *         String: String (Required)
-     *     }
-     *     loadTestConfiguration (Optional): {
-     *         engineInstances: Integer (Optional)
-     *         splitAllCSVs: Boolean (Optional)
-     *         quickStartTest: Boolean (Optional)
-     *         optionalLoadTestConfig (Optional): {
-     *             endpointUrl: String (Optional)
-     *             virtualUsers: Integer (Optional)
-     *             rampUpTime: Integer (Optional)
-     *             duration: Integer (Optional)
+     *     testId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 associated app component (collection of azure resources) for the given test along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAppComponentsWithResponse(String testId, RequestOptions requestOptions) { + return getAppComponentsWithResponseAsync(testId, requestOptions).block(); + } + + /** + * List server metrics configuration for the given test. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testId: String (Optional)
+     *     metrics (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
      *         }
      *     }
-     *     inputArtifacts (Optional): {
-     *         configFileInfo (Optional): {
-     *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *             expireDateTime: OffsetDateTime (Optional)
-     *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *             validationFailureDetails: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 server metrics configuration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServerMetricsConfigWithResponseAsync(String testId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getServerMetricsConfig(this.getEndpoint(), + this.getServiceVersion().getVersion(), testId, accept, requestOptions, context)); + } + + /** + * List server metrics configuration for the given test. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testId: String (Optional)
+     *     metrics (Optional, Required on create): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
      *         }
-     *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
-     *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
-     *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
-     *         additionalFileInfo (Optional): [
-     *             (recursive schema, see above)
-     *         ]
      *     }
-     *     testId: String (Optional)
-     *     description: String (Optional)
-     *     displayName: String (Optional)
-     *     subnetId: String (Optional)
-     *     keyvaultReferenceIdentityType: String (Optional)
-     *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -1182,102 +1121,31 @@ private Mono> listTestsSinglePageAsync(RequestOptions
      * }
      * }
* + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @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}. + * @return test server metrics configuration along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listTestsAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>((pageSize) -> { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listTestsSinglePageAsync(requestOptionsLocal); - }, (nextLink, pageSize) -> { - RequestOptions requestOptionsLocal = new RequestOptions(); - requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listTestsNextSinglePageAsync(nextLink, requestOptionsLocal); - }); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getServerMetricsConfigWithResponse(String testId, RequestOptions requestOptions) { + return getServerMetricsConfigWithResponseAsync(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 the supported fields in (field asc/desc) format. eg: lastModifiedDateTime asc. Supported fields - - * lastModifiedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - displayName, createdBy. For example, to search for - * a test, with display name is Login Test, the search parameter can be Login.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
maxpagesizeIntegerNoNumber of results in response.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ * Get load test details by test Id. + *

Response Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -1287,6 +1155,11 @@ public PagedFlux listTestsAsync(RequestOptions requestOptions) {
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -1307,16 +1180,25 @@ public PagedFlux listTestsAsync(RequestOptions requestOptions) {
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -1324,14 +1206,17 @@ public PagedFlux listTestsAsync(RequestOptions requestOptions) {
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -1341,82 +1226,33 @@ public PagedFlux listTestsAsync(RequestOptions requestOptions) {
      * }
      * }
* + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. * @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}. + * @return load test details by test Id along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listTestsSinglePage(RequestOptions requestOptions) { + public Mono> getTestWithResponseAsync(String testId, RequestOptions requestOptions) { final String accept = "application/json"; - Response res = service.listTestsSync(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + return FluxUtil.withContext(context -> service.getTest(this.getEndpoint(), + this.getServiceVersion().getVersion(), testId, accept, requestOptions, 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 the supported fields in (field asc/desc) format. eg: lastModifiedDateTime asc. Supported fields - - * lastModifiedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - displayName, createdBy. For example, to search for - * a test, with display name is Login Test, the search parameter can be Login.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of the last updated time range to filter tests.
maxpagesizeIntegerNoNumber of results in response.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ * Get load test details by test Id. + *

Response Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -1426,6 +1262,11 @@ private PagedResponse listTestsSinglePage(RequestOptions requestOpti
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -1446,16 +1287,25 @@ private PagedResponse listTestsSinglePage(RequestOptions requestOpti
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -1463,14 +1313,17 @@ private PagedResponse listTestsSinglePage(RequestOptions requestOpti
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -1480,292 +1333,101 @@ private PagedResponse listTestsSinglePage(RequestOptions requestOpti
      * }
      * }
* + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. * @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}. + * @return load test details by test Id along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listTests(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>((pageSize) -> { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listTestsSinglePage(requestOptionsLocal); - }, (nextLink, pageSize) -> { - RequestOptions requestOptionsLocal = new RequestOptions(); - requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listTestsNextSinglePage(nextLink, requestOptionsLocal); - }); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestWithResponse(String testId, RequestOptions requestOptions) { + return getTestWithResponseAsync(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 application/octet-stream. - *

- * Query Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fileTypeStringNoFile type. Allowed values: "JMX_FILE", "USER_PROPERTIES", "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)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *     expireDateTime: OffsetDateTime (Optional)
-     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *     validationFailureDetails: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param fileName Unique name for test file with file extension like : App.jmx. - * @param body The file content as application/octet-stream. - * @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 file info along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadTestFileWithResponseAsync(String testId, String fileName, BinaryData body, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.uploadTestFile(this.client.getEndpoint(), testId, fileName, - this.client.getServiceVersion().getVersion(), body, 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 application/octet-stream. - *

- * Query Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fileTypeStringNoFile type. Allowed values: "JMX_FILE", "USER_PROPERTIES", "ADDITIONAL_ARTIFACTS".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Request Body Schema - *

- *
{@code
-     * BinaryData
-     * }
- *

- * Response Body Schema - *

+ * Get all the files that are associated with a test. + *

Response Body Schema

+ * *
{@code
      * {
+     *     fileName: String (Required)
      *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *     expireDateTime: OffsetDateTime (Optional)
      *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *     validationFailureDetails: String (Optional)
      * }
      * }
* - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param fileName Unique name for test file with file extension like : App.jmx. - * @param body The file content as application/octet-stream. + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param fileName Name of the file. * @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 file info along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadTestFileWithResponse(String testId, String fileName, BinaryData body, - RequestOptions requestOptions) { - final String accept = "application/json"; - return service.uploadTestFileSync(this.client.getEndpoint(), testId, fileName, - this.client.getServiceVersion().getVersion(), body, accept, requestOptions, Context.NONE); - } - - /** - * Get test file by the file name. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *     expireDateTime: OffsetDateTime (Optional)
-     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *     validationFailureDetails: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param fileName File name with file extension like app.jmx. - * @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}. + * @return all the files that are associated with a test along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getTestFileWithResponseAsync(String testId, String fileName, RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getTestFile(this.client.getEndpoint(), testId, fileName, - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); + return FluxUtil.withContext(context -> service.getTestFile(this.getEndpoint(), + this.getServiceVersion().getVersion(), testId, fileName, accept, requestOptions, context)); } /** - * Get test file by the file name. - *

- * Response Body Schema - *

+ * Get all the files that are associated with a test. + *

Response Body Schema

+ * *
{@code
      * {
+     *     fileName: String (Required)
      *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *     expireDateTime: OffsetDateTime (Optional)
      *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *     validationFailureDetails: String (Optional)
      * }
      * }
* - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param fileName File name with file extension like app.jmx. + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param fileName Name of the file. * @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}. + * @return all the files that are associated with a test along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getTestFileWithResponse(String testId, String fileName, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getTestFileSync(this.client.getEndpoint(), testId, fileName, - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - } - - /** - * Delete file by the file name for a test. - * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param fileName File name with file extension like app.jmx. - * @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 fileName, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.deleteTestFile(this.client.getEndpoint(), testId, fileName, - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); - } - - /** - * Delete file by the file name for a test. - * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param fileName File name with file extension like app.jmx. - * @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 fileName, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.deleteTestFileSync(this.client.getEndpoint(), testId, fileName, - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return getTestFileWithResponseAsync(testId, fileName, requestOptions).block(); } /** * Get all test files. - *

- * Response Body Schema - *

+ *

Response Body Schema

+ * *
{@code
      * {
+     *     fileName: String (Required)
      *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *     expireDateTime: OffsetDateTime (Optional)
      *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *     validationFailureDetails: String (Optional)
      * }
      * }
* - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. * @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. @@ -1777,30 +1439,29 @@ public Response deleteTestFileWithResponse(String testId, String fileName, private Mono> listTestFilesSinglePageAsync(String testId, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listTestFiles(this.client.getEndpoint(), testId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) + .withContext(context -> service.listTestFiles(this.getEndpoint(), this.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. - *

- * Response Body Schema - *

+ *

Response Body Schema

+ * *
{@code
      * {
+     *     fileName: String (Required)
      *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *     expireDateTime: OffsetDateTime (Optional)
      *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *     validationFailureDetails: String (Optional)
      * }
      * }
* - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. * @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. @@ -1819,56 +1480,21 @@ public PagedFlux listTestFilesAsync(String testId, RequestOptions re /** * Get all test files. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *     expireDateTime: OffsetDateTime (Optional)
-     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *     validationFailureDetails: String (Optional)
-     * }
-     * }
+ *

Response Body Schema

* - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listTestFilesSinglePage(String testId, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listTestFilesSync(this.client.getEndpoint(), testId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - /** - * Get all test files. - *

- * Response Body Schema - *

*
{@code
      * {
+     *     fileName: String (Required)
      *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *     expireDateTime: OffsetDateTime (Optional)
      *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *     validationFailureDetails: String (Optional)
      * }
      * }
* - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. * @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. @@ -1878,209 +1504,111 @@ private PagedResponse listTestFilesSinglePage(String testId, Request */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listTestFiles(String testId, RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listTestFilesSinglePage(testId, requestOptions), - nextLink -> listTestFilesNextSinglePage(nextLink, requestOptionsForNextPage)); + return new PagedIterable<>(listTestFilesAsync(testId, requestOptions)); } /** - * Associate an app component (collection of azure resources) to a test. - *

- * Request Body Schema - *

+ * 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 the supported fields in (field asc/desc) format. eg: + * lastModifiedDateTime asc. Supported fields - lastModifiedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - + * displayName, + * createdBy. For example, to search for a test, with display name is Login Test, + * the search parameter can be Login.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) + * of the last updated time range to filter tests.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of + * the last updated time range to filter tests.
maxpagesizeIntegerNoNumber of results in response.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * *
{@code
      * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Required): {
+     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String(continue/stop) (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String(passed/undetermined/failed) (Optional)
+     *             }
      *         }
      *     }
-     *     testId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
-     *         }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
      *     }
-     *     testId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @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 test app component along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateAppComponentsWithResponseAsync(String testId, BinaryData body, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createOrUpdateAppComponents(this.client.getEndpoint(), testId, - this.client.getServiceVersion().getVersion(), body, accept, requestOptions, context)); - } - - /** - * Associate an app component (collection of azure resources) to a test. - *

- * Request Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
+     *     secrets (Optional): {
      *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
+     *             value: String (Optional)
+     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
      *         }
      *     }
-     *     testId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
-     *         }
+     *     certificate (Optional): {
+     *         value: String (Optional)
+     *         type: String(AKV_CERT_URI) (Optional)
+     *         name: String (Optional)
      *     }
-     *     testId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @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 test app component along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateAppComponentsWithResponse(String testId, BinaryData body, - RequestOptions requestOptions) { - final String accept = "application/json"; - return service.createOrUpdateAppComponentsSync(this.client.getEndpoint(), testId, - this.client.getServiceVersion().getVersion(), body, accept, requestOptions, Context.NONE); - } - - /** - * Get associated app component (collection of azure resources) for the given test. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
+     *     environmentVariables (Optional): {
+     *         String: String (Required)
+     *     }
+     *     loadTestConfiguration (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *         quickStartTest: Boolean (Optional)
+     *         optionalLoadTestConfig (Optional): {
+     *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
+     *             virtualUsers: Integer (Optional)
+     *             rampUpTime: Integer (Optional)
+     *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
-     *     testId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @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 associated app component (collection of azure resources) for the given test along with {@link Response} - * on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAppComponentsWithResponseAsync(String testId, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getAppComponents(this.client.getEndpoint(), testId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); - } - - /** - * Get associated app component (collection of azure resources) for the given test. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
+     *     baselineTestRunId: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configFileInfo (Optional): {
+     *             fileName: String (Required)
+     *             url: String (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *             expireDateTime: OffsetDateTime (Optional)
+     *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *             validationFailureDetails: String (Optional)
      *         }
+     *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
+     *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
+     *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
+     *         additionalFileInfo (Optional): [
+     *             (recursive schema, see above)
+     *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -2088,224 +1616,127 @@ public Mono> getAppComponentsWithResponseAsync(String testI
      * }
      * }
* - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. * @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 associated app component (collection of azure resources) for the given test along with {@link Response}. + * @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 Response getAppComponentsWithResponse(String testId, RequestOptions requestOptions) { + private Mono> listTestsSinglePageAsync(RequestOptions requestOptions) { final String accept = "application/json"; - return service.getAppComponentsSync(this.client.getEndpoint(), testId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return FluxUtil + .withContext(context -> service.listTests(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, + requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } /** - * Configure server metrics for a test. - *

- * Request Body Schema - *

+ * 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 the supported fields in (field asc/desc) format. eg: + * lastModifiedDateTime asc. Supported fields - lastModifiedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - + * displayName, + * createdBy. For example, to search for a test, with display name is Login Test, + * the search parameter can be Login.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) + * of the last updated time range to filter tests.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of + * the last updated time range to filter tests.
maxpagesizeIntegerNoNumber of results in response.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * *
{@code
      * {
-     *     testId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Required): {
+     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String(continue/stop) (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String(passed/undetermined/failed) (Optional)
+     *             }
      *         }
      *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
-     *         }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
      *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param body Server metric 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 test server metrics configuration along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateServerMetricsConfigWithResponseAsync(String testId, BinaryData body, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createOrUpdateServerMetricsConfig(this.client.getEndpoint(), - testId, this.client.getServiceVersion().getVersion(), body, accept, requestOptions, context)); - } - - /** - * Configure server metrics for a test. - *

- * Request Body Schema - *

- *
{@code
-     * {
-     *     testId: String (Optional)
-     *     metrics (Optional): {
+     *     secrets (Optional): {
      *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
+     *             value: String (Optional)
+     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
      *         }
      *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
-     *         }
+     *     certificate (Optional): {
+     *         value: String (Optional)
+     *         type: String(AKV_CERT_URI) (Optional)
+     *         name: String (Optional)
      *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @param body Server metric 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 test server metrics configuration along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateServerMetricsConfigWithResponse(String testId, BinaryData body, - RequestOptions requestOptions) { - final String accept = "application/json"; - return service.createOrUpdateServerMetricsConfigSync(this.client.getEndpoint(), testId, - this.client.getServiceVersion().getVersion(), body, accept, requestOptions, Context.NONE); - } - - /** - * List server metrics configuration for the given test. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
+     *     environmentVariables (Optional): {
+     *         String: String (Required)
+     *     }
+     *     loadTestConfiguration (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *         quickStartTest: Boolean (Optional)
+     *         optionalLoadTestConfig (Optional): {
+     *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
+     *             virtualUsers: Integer (Optional)
+     *             rampUpTime: Integer (Optional)
+     *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. - * @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 server metrics configuration along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getServerMetricsConfigWithResponseAsync(String testId, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getServerMetricsConfig(this.client.getEndpoint(), testId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); - } - - /** - * List server metrics configuration for the given test. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
+     *     baselineTestRunId: String (Optional)
+     *     inputArtifacts (Optional): {
+     *         configFileInfo (Optional): {
+     *             fileName: String (Required)
+     *             url: String (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *             expireDateTime: OffsetDateTime (Optional)
+     *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *             validationFailureDetails: String (Optional)
      *         }
+     *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
+     *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
+     *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
+     *         additionalFileInfo (Optional): [
+     *             (recursive schema, see above)
+     *         ]
      *     }
+     *     testId: String (Required)
+     *     description: String (Optional)
+     *     displayName: String (Optional)
+     *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
+     *     keyvaultReferenceIdentityType: String (Optional)
+     *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -2313,34 +1744,73 @@ public Mono> getServerMetricsConfigWithResponseAsync(String
      * }
      * }
* - * @param testId Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or - * hyphen characters. * @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 server metrics configuration along with {@link Response}. + * @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.SINGLE) - public Response getServerMetricsConfigWithResponse(String testId, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getServerMetricsConfigSync(this.client.getEndpoint(), testId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestsAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listTestsSinglePageAsync(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listTestsNextSinglePageAsync(nextLink, requestOptionsLocal); + }); } /** - * Get the next page of items. - *

- * Response Body Schema - *

+ * 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 the supported fields in (field asc/desc) format. eg: + * lastModifiedDateTime asc. Supported fields - lastModifiedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - + * displayName, + * createdBy. For example, to search for a test, with display name is Login Test, + * the search parameter can be Login.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) + * of the last updated time range to filter tests.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of + * the last updated time range to filter tests.
maxpagesizeIntegerNoNumber of results in response.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -2350,6 +1820,11 @@ public Response getServerMetricsConfigWithResponse(String testId, Re
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -2370,16 +1845,25 @@ public Response getServerMetricsConfigWithResponse(String testId, Re
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -2387,14 +1871,17 @@ public Response getServerMetricsConfigWithResponse(String testId, Re
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -2404,39 +1891,246 @@ public Response getServerMetricsConfigWithResponse(String testId, Re
      * }
      * }
* - * @param nextLink The URL to get the next list of items + * @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 listTests(RequestOptions requestOptions) { + return new PagedIterable<>(listTestsAsync(requestOptions)); + } + + /** + * Upload input file for a given test Id. 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 application/octet-stream. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fileTypeStringNoFile type. Allowed values: "JMX_FILE", "USER_PROPERTIES", + * "ADDITIONAL_ARTIFACTS", "ZIPPED_ARTIFACTS", "URL_TEST_CONFIG", "TEST_SCRIPT".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

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

Response Body Schema

+ * + *
{@code
+     * {
+     *     fileName: String (Required)
+     *     url: String (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *     expireDateTime: OffsetDateTime (Optional)
+     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *     validationFailureDetails: String (Optional)
+     * }
+     * }
+ * + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param fileName Unique name for test file with file extension like : App.jmx. + * @param body The file content as application/octet-stream. + * @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 info along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadTestFileWithResponseAsync(String testId, String fileName, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/octet-stream"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.uploadTestFile(this.getEndpoint(), this.getServiceVersion().getVersion(), + contentType, testId, fileName, accept, body, requestOptions, context)); + } + + /** + * Upload input file for a given test Id. 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 application/octet-stream. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fileTypeStringNoFile type. Allowed values: "JMX_FILE", "USER_PROPERTIES", + * "ADDITIONAL_ARTIFACTS", "ZIPPED_ARTIFACTS", "URL_TEST_CONFIG", "TEST_SCRIPT".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

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

Response Body Schema

+ * + *
{@code
+     * {
+     *     fileName: String (Required)
+     *     url: String (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *     expireDateTime: OffsetDateTime (Optional)
+     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *     validationFailureDetails: String (Optional)
+     * }
+     * }
* - * The nextLink parameter. + * @param testId Unique name for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param fileName Unique name for test file with file extension like : App.jmx. + * @param body The file content as application/octet-stream. * @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 collection of tests along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return test file info along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listTestsNextSinglePageAsync(String nextLink, + public Response uploadTestFileWithResponse(String testId, String fileName, BinaryData body, + RequestOptions requestOptions) { + return uploadTestFileWithResponseAsync(testId, fileName, body, requestOptions).block(); + } + + /** + * Delete file by the file name for a test. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param fileName Name of the file. + * @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 fileName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.deleteTestFile(this.getEndpoint(), + this.getServiceVersion().getVersion(), testId, fileName, accept, requestOptions, context)); + } + + /** + * Delete file by the file name for a test. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param fileName Name of the file. + * @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 fileName, RequestOptions requestOptions) { + return deleteTestFileWithResponseAsync(testId, fileName, requestOptions).block(); + } + + /** + * Delete a test by its test Id. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @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> deleteTestWithResponseAsync(String testId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.deleteTest(this.getEndpoint(), + this.getServiceVersion().getVersion(), testId, accept, requestOptions, context)); + } + + /** + * Delete a test by its test Id. + * + * @param testId Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @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 deleteTestWithResponse(String testId, RequestOptions requestOptions) { + return deleteTestWithResponseAsync(testId, requestOptions).block(); + } + + /** + * Get all test files. + * + * Get the next page of items. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     fileName: String (Required)
+     *     url: String (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *     expireDateTime: OffsetDateTime (Optional)
+     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *     validationFailureDetails: String (Optional)
+     * }
+     * }
+ * + * @param nextLink The URL to get the next list of items. + * @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 paged collection of TestFileInfo items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTestFilesNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil .withContext( - context -> service.listTestsNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + context -> service.listTestFilesNext(nextLink, this.getEndpoint(), 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}. + * * Get the next page of items. - *

- * Response Body Schema - *

+ *

Response Body Schema

+ * *
{@code
      * {
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -2446,6 +2140,11 @@ private Mono> listTestsNextSinglePageAsync(String next
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -2466,16 +2165,25 @@ private Mono> listTestsNextSinglePageAsync(String next
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
+     *     baselineTestRunId: String (Optional)
      *     inputArtifacts (Optional): {
      *         configFileInfo (Optional): {
+     *             fileName: String (Required)
      *             url: String (Optional)
-     *             fileName: String (Optional)
-     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *             fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *             expireDateTime: OffsetDateTime (Optional)
      *             validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *             validationFailureDetails: String (Optional)
@@ -2483,14 +2191,17 @@ private Mono> listTestsNextSinglePageAsync(String next
      *         testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *         userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *         inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *         urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *         additionalFileInfo (Optional): [
      *             (recursive schema, see above)
      *         ]
      *     }
-     *     testId: String (Optional)
+     *     testId: String (Required)
      *     description: String (Optional)
      *     displayName: String (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     keyvaultReferenceIdentityType: String (Optional)
      *     keyvaultReferenceIdentityId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
@@ -2500,96 +2211,25 @@ private Mono> listTestsNextSinglePageAsync(String next
      * }
      * }
* - * @param nextLink The URL to get the next list of items - * - * 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 collection of tests along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listTestsNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listTestsNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); - return 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
-     * {
-     *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *     expireDateTime: OffsetDateTime (Optional)
-     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *     validationFailureDetails: String (Optional)
-     * }
-     * }
- * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @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 collection of files along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return paged collection of Test items along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listTestFilesNextSinglePageAsync(String nextLink, + private Mono> listTestsNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.listTestFilesNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + return FluxUtil + .withContext( + context -> service.listTestsNext(nextLink, this.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
-     * {
-     *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *     expireDateTime: OffsetDateTime (Optional)
-     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *     validationFailureDetails: String (Optional)
-     * }
-     * }
- * - * @param nextLink The URL to get the next list of items - * - * 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 collection of files along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listTestFilesNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listTestFilesNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); - return 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); diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestRunsImpl.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestRunClientImpl.java similarity index 61% rename from sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestRunsImpl.java rename to sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestRunClientImpl.java index 3964844777f85..5f09b874f342c 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestRunsImpl.java +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestRunClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.developer.loadtesting.implementation; @@ -24,6 +24,10 @@ import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.PagedResponse; @@ -35,6 +39,8 @@ import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.UrlBuilder; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; import com.azure.developer.loadtesting.LoadTestingServiceVersion; import java.util.List; import java.util.Map; @@ -42,235 +48,198 @@ import reactor.core.publisher.Mono; /** - * An instance of this class provides access to all the operations defined in LoadTestRuns. + * Initializes a new instance of the LoadTestRunClient type. */ -public final class LoadTestRunsImpl { +public final class LoadTestRunClientImpl { /** * The proxy service used to perform REST calls. */ - private final LoadTestRunsService service; + private final LoadTestRunClientService service; /** - * The service client containing this operation class. */ - private final LoadTestingClientImpl client; + private final String endpoint; /** - * Initializes an instance of LoadTestRunsImpl. + * Gets. * - * @param client the instance of the service client containing this operation class. + * @return the endpoint value. */ - LoadTestRunsImpl(LoadTestingClientImpl client) { - this.service - = RestProxy.create(LoadTestRunsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; + public String getEndpoint() { + return this.endpoint; } + /** + * Service version. + */ + private final LoadTestingServiceVersion serviceVersion; + /** * Gets Service version. * * @return the serviceVersion value. */ public LoadTestingServiceVersion getServiceVersion() { - return client.getServiceVersion(); + return this.serviceVersion; } /** - * The interface defining all the services for LoadTestingClientLoadTestRuns to be used by the proxy service to - * perform REST calls. + * The HTTP pipeline to send requests through. */ - @Host("https://{Endpoint}") - @ServiceInterface(name = "LoadTestingClientLoa") - public interface LoadTestRunsService { - @Patch("/test-runs/{testRunId}") - @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> 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); + private final HttpPipeline httpPipeline; - @Patch("/test-runs/{testRunId}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrUpdateTestRunSync(@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); + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } - @Get("/test-runs/{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); + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; - @Get("/test-runs/{testRunId}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getTestRunSync(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } - @Delete("/test-runs/{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); + /** + * Initializes an instance of LoadTestRunClient client. + * + * @param endpoint + * @param serviceVersion Service version. + */ + public LoadTestRunClientImpl(String endpoint, LoadTestingServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } - @Delete("/test-runs/{testRunId}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response deleteTestRunSync(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + /** + * Initializes an instance of LoadTestRunClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint + * @param serviceVersion Service version. + */ + public LoadTestRunClientImpl(HttpPipeline httpPipeline, String endpoint, LoadTestingServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } - @Get("/test-runs/{testRunId}/files/{fileName}") - @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("fileName") String fileName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); + /** + * Initializes an instance of LoadTestRunClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint + * @param serviceVersion Service version. + */ + public LoadTestRunClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + LoadTestingServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(LoadTestRunClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } - @Get("/test-runs/{testRunId}/files/{fileName}") - @ExpectedResponses({ 200 }) + /** + * The interface defining all the services for LoadTestRunClient to be used by the proxy service to perform REST + * calls. + */ + @Host("https://{endpoint}") + @ServiceInterface(name = "LoadTestRunClient") + public interface LoadTestRunClientService { + @Patch("/test-runs/{testRunId}") + @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getTestRunFileSync(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @PathParam("fileName") String fileName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); + Mono> createOrUpdateTestRun(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testRunId") String testRunId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions, Context context); - @Get("/test-runs") - @ExpectedResponses({ 200 }) + @Patch("/test-runs/{testRunId}/app-components") + @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> listTestRuns(@HostParam("Endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); + Mono> createOrUpdateAppComponents(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("content-type") String contentType, + @PathParam("testRunId") String testRunId, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions, Context context); - @Get("/test-runs") - @ExpectedResponses({ 200 }) + @Patch("/test-runs/{testRunId}/server-metrics-config") + @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listTestRunsSync(@HostParam("Endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); + Mono> createOrUpdateServerMetricsConfig(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("content-type") String contentType, + @PathParam("testRunId") String testRunId, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions, Context context); - @Post("/test-runs/{testRunId}:stop") - @ExpectedResponses({ 200 }) + @Delete("/test-runs/{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> stopTestRun(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("api-version") String apiVersion, + Mono> deleteTestRun(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testRunId") String testRunId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Post("/test-runs/{testRunId}:stop") + @Get("/test-runs/{testRunId}/app-components") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response stopTestRunSync(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("api-version") String apiVersion, + Mono> getAppComponents(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testRunId") String testRunId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("/test-runs/{testRunId}/metric-namespaces") + @Get("/test-runs/{testRunId}/server-metrics-config") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getMetricNamespaces(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("api-version") String apiVersion, + Mono> getServerMetricsConfig(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testRunId") String testRunId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("/test-runs/{testRunId}/metric-namespaces") + @Get("/test-runs/{testRunId}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getMetricNamespacesSync(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("api-version") String apiVersion, + Mono> getTestRun(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testRunId") String testRunId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("/test-runs/{testRunId}/metric-definitions") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getMetricDefinitions(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("metricNamespace") String metricNamespace, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/test-runs/{testRunId}/metric-definitions") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getMetricDefinitionsSync(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("metricNamespace") String metricNamespace, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/test-runs/{testRunId}/metrics") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listMetrics(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("metricname") String metricName, - @QueryParam("metricNamespace") String metricNamespace, @QueryParam("timespan") String timespan, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/test-runs/{testRunId}/metrics") + @Get("/test-runs/{testRunId}/files/{fileName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listMetricsSync(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("metricname") String metricName, - @QueryParam("metricNamespace") String metricNamespace, @QueryParam("timespan") String timespan, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); + Mono> getTestRunFile(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testRunId") String testRunId, + @PathParam("fileName") String fileName, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); @Get("/test-runs/{testRunId}/metric-dimensions/{name}/values") @ExpectedResponses({ 200 }) @@ -278,128 +247,65 @@ Response listMetricsSync(@HostParam("Endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listMetricDimensionValues(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @PathParam("name") String name, - @QueryParam("metricname") String metricName, @QueryParam("metricNamespace") String metricNamespace, - @QueryParam("timespan") String timespan, @QueryParam("api-version") String apiVersion, + Mono> listMetricDimensionValues(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testRunId") String testRunId, + @PathParam("name") String name, @QueryParam("metricname") String metricname, + @QueryParam("metricNamespace") String metricNamespace, @QueryParam("timespan") String timespan, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("/test-runs/{testRunId}/metric-dimensions/{name}/values") + @Get("/test-runs/{testRunId}/metric-definitions") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listMetricDimensionValuesSync(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @PathParam("name") String name, - @QueryParam("metricname") String metricName, @QueryParam("metricNamespace") String metricNamespace, - @QueryParam("timespan") String timespan, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Patch("/test-runs/{testRunId}/app-components") - @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("testRunId") String testRunId, @QueryParam("api-version") String apiVersion, - @BodyParam("application/merge-patch+json") BinaryData body, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Patch("/test-runs/{testRunId}/app-components") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrUpdateAppComponentsSync(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("api-version") String apiVersion, - @BodyParam("application/merge-patch+json") BinaryData body, @HeaderParam("Accept") String accept, + Mono> getMetricDefinitions(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testRunId") String testRunId, + @QueryParam("metricNamespace") String metricNamespace, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("/test-runs/{testRunId}/app-components") + @Get("/test-runs/{testRunId}/metric-namespaces") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAppComponents(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("api-version") String apiVersion, + Mono> getMetricNamespaces(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testRunId") String testRunId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("/test-runs/{testRunId}/app-components") + @Post("/test-runs/{testRunId}/metrics") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAppComponentsSync(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Patch("/test-runs/{testRunId}/server-metrics-config") - @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("testRunId") String testRunId, @QueryParam("api-version") String apiVersion, - @BodyParam("application/merge-patch+json") BinaryData body, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Patch("/test-runs/{testRunId}/server-metrics-config") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrUpdateServerMetricsConfigSync(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("api-version") String apiVersion, - @BodyParam("application/merge-patch+json") BinaryData body, @HeaderParam("Accept") String accept, + Mono> listMetrics(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testRunId") String testRunId, + @QueryParam("metricname") String metricname, @QueryParam("metricNamespace") String metricNamespace, + @QueryParam("timespan") String timespan, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("/test-runs/{testRunId}/server-metrics-config") + @Get("/test-runs") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getServerMetricsConfig(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + Mono> listTestRuns(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); - @Get("/test-runs/{testRunId}/server-metrics-config") + @Post("/test-runs/{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) - Response getServerMetricsConfigSync(@HostParam("Endpoint") String endpoint, - @PathParam("testRunId") String testRunId, @QueryParam("api-version") String apiVersion, + Mono> stopTestRun(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testRunId") String testRunId, @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> listTestRunsNext(@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) - Response listTestRunsNextSync(@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 }) @@ -407,7 +313,7 @@ Response listTestRunsNextSync(@PathParam(value = "nextLink", encoded @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> listMetricsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("Endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Get("{nextLink}") @@ -416,64 +322,34 @@ Mono> listMetricsNext(@PathParam(value = "nextLink", encode @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listMetricsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("Endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Mono> listTestRunsNext(@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> listMetricDimensionValuesNext( - @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) - Response listMetricDimensionValuesNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("Endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); } /** - * Create and start a new test run with the given name. - *

- * Query Parameters - *

+ * Create and start a new test run with the given test run Id. + *

Query Parameters

* * - * - * - * - * - * - * - * - * - * - * - * - * + * + * *
Query Parameters
NameTypeRequiredDescription
oldTestRunIdStringNoExisting test run identifier that should be rerun, if this is provided, the test will run with the JMX file, - * configuration and app components from the existing test run. You can override the configuration values for new - * test run in the request body.
NameTypeRequiredDescription
oldTestRunIdStringNoExisting test run identifier that should be rerun, if this + * is provided, the + * test will run with the JMX file, configuration and app components from the + * existing test run. You can override the configuration values for new test run + * in the request body.
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Request Body Schema - *

+ *

Request Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -483,6 +359,11 @@ Response listMetricDimensionValuesNextSync(
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -515,28 +396,45 @@ Response listMetricDimensionValuesNextSync(
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -544,6 +442,7 @@ Response listMetricDimensionValuesNextSync(
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -551,11 +450,15 @@ Response listMetricDimensionValuesNextSync(
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -566,22 +469,27 @@ Response listMetricDimensionValuesNextSync(
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
      *     lastModifiedBy: String (Optional)
      * }
      * }
- *

- * Response Body Schema - *

+ * + *

Response Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -591,6 +499,11 @@ Response listMetricDimensionValuesNextSync(
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -623,28 +536,45 @@ Response listMetricDimensionValuesNextSync(
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -652,6 +582,7 @@ Response listMetricDimensionValuesNextSync(
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -659,11 +590,15 @@ Response listMetricDimensionValuesNextSync(
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -674,6 +609,10 @@ Response listMetricDimensionValuesNextSync(
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -681,9 +620,9 @@ Response listMetricDimensionValuesNextSync(
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param body Load test run model. + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body The resource instance. * @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. @@ -694,44 +633,35 @@ Response listMetricDimensionValuesNextSync( @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createOrUpdateTestRunWithResponseAsync(String testRunId, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createOrUpdateTestRun(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), body, accept, requestOptions, context)); + return FluxUtil.withContext(context -> service.createOrUpdateTestRun(this.getEndpoint(), + this.getServiceVersion().getVersion(), testRunId, contentType, accept, body, requestOptions, context)); } /** - * Create and start a new test run with the given name. - *

- * Query Parameters - *

+ * Create and start a new test run with the given test run Id. + *

Query Parameters

* * - * - * - * - * - * - * - * - * - * - * - * - * + * + * *
Query Parameters
NameTypeRequiredDescription
oldTestRunIdStringNoExisting test run identifier that should be rerun, if this is provided, the test will run with the JMX file, - * configuration and app components from the existing test run. You can override the configuration values for new - * test run in the request body.
NameTypeRequiredDescription
oldTestRunIdStringNoExisting test run identifier that should be rerun, if this + * is provided, the + * test will run with the JMX file, configuration and app components from the + * existing test run. You can override the configuration values for new test run + * in the request body.
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Request Body Schema - *

+ *

Request Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -741,6 +671,11 @@ public Mono> createOrUpdateTestRunWithResponseAsync(String
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -773,28 +708,45 @@ public Mono> createOrUpdateTestRunWithResponseAsync(String
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -802,6 +754,7 @@ public Mono> createOrUpdateTestRunWithResponseAsync(String
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -809,11 +762,15 @@ public Mono> createOrUpdateTestRunWithResponseAsync(String
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -824,22 +781,27 @@ public Mono> createOrUpdateTestRunWithResponseAsync(String
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
      *     lastModifiedBy: String (Optional)
      * }
      * }
- *

- * Response Body Schema - *

+ * + *

Response Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -849,6 +811,11 @@ public Mono> createOrUpdateTestRunWithResponseAsync(String
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -881,28 +848,45 @@ public Mono> createOrUpdateTestRunWithResponseAsync(String
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -910,6 +894,7 @@ public Mono> createOrUpdateTestRunWithResponseAsync(String
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -917,11 +902,15 @@ public Mono> createOrUpdateTestRunWithResponseAsync(String
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -932,6 +921,10 @@ public Mono> createOrUpdateTestRunWithResponseAsync(String
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -939,9 +932,9 @@ public Mono> createOrUpdateTestRunWithResponseAsync(String
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param body Load test run model. + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body The resource instance. * @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. @@ -952,115 +945,52 @@ public Mono> createOrUpdateTestRunWithResponseAsync(String @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateTestRunWithResponse(String testRunId, BinaryData body, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.createOrUpdateTestRunSync(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), body, accept, requestOptions, Context.NONE); + return createOrUpdateTestRunWithResponseAsync(testRunId, body, requestOptions).block(); } /** - * Get test run details by name. - *

- * Response Body Schema - *

+ * Add an app component to a test run. + * + * Add an app component to a test run by providing the resource Id, name and type. + *

Request Body Schema

+ * *
{@code
      * {
-     *     passFailCriteria (Optional): {
-     *         passFailMetrics (Optional): {
-     *             String (Required): {
-     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
-     *                 condition: String (Optional)
-     *                 requestName: String (Optional)
-     *                 value: Double (Optional)
-     *                 action: String(continue/stop) (Optional)
-     *                 actualValue: Double (Optional)
-     *                 result: String(passed/undetermined/failed) (Optional)
-     *             }
-     *         }
-     *     }
-     *     secrets (Optional): {
+     *     components (Optional, Required on create): {
      *         String (Required): {
-     *             value: String (Optional)
-     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
      *         }
      *     }
-     *     certificate (Optional): {
-     *         value: String (Optional)
-     *         type: String(AKV_CERT_URI) (Optional)
-     *         name: String (Optional)
-     *     }
-     *     environmentVariables (Optional): {
-     *         String: String (Required)
-     *     }
-     *     errorDetails (Optional): [
-     *          (Optional){
-     *             message: String (Optional)
-     *         }
-     *     ]
-     *     testRunStatistics (Optional): {
+     *     testRunId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
      *         String (Required): {
-     *             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)
-     *         }
-     *     }
-     *     loadTestConfiguration (Optional): {
-     *         engineInstances: Integer (Optional)
-     *         splitAllCSVs: Boolean (Optional)
-     *         quickStartTest: Boolean (Optional)
-     *         optionalLoadTestConfig (Optional): {
-     *             endpointUrl: String (Optional)
-     *             virtualUsers: Integer (Optional)
-     *             rampUpTime: Integer (Optional)
-     *             duration: Integer (Optional)
-     *         }
-     *     }
-     *     testArtifacts (Optional): {
-     *         inputArtifacts (Optional): {
-     *             configFileInfo (Optional): {
-     *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *                 expireDateTime: OffsetDateTime (Optional)
-     *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *                 validationFailureDetails: String (Optional)
-     *             }
-     *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
-     *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
-     *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
-     *             additionalFileInfo (Optional): [
-     *                 (recursive schema, see above)
-     *             ]
-     *         }
-     *         outputArtifacts (Optional): {
-     *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
-     *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
      *         }
      *     }
-     *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
-     *     virtualUsers: Integer (Optional)
      *     testRunId: String (Optional)
-     *     displayName: String (Optional)
-     *     testId: String (Optional)
-     *     description: String (Optional)
-     *     status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Optional)
-     *     startDateTime: OffsetDateTime (Optional)
-     *     endDateTime: OffsetDateTime (Optional)
-     *     executedDateTime: OffsetDateTime (Optional)
-     *     portalUrl: String (Optional)
-     *     duration: Long (Optional)
-     *     subnetId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -1068,126 +998,68 @@ public Response createOrUpdateTestRunWithResponse(String testRunId,
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. + * @param testRunId Unique Id for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 test run details by name along with {@link Response} on successful completion of {@link Mono}. + * @return test run app component along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTestRunWithResponseAsync(String testRunId, RequestOptions requestOptions) { + public Mono> createOrUpdateAppComponentsWithResponseAsync(String testRunId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getTestRun(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); + return FluxUtil.withContext(context -> service.createOrUpdateAppComponents(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, testRunId, accept, body, requestOptions, context)); } /** - * Get test run details by name. - *

- * Response Body Schema - *

+ * Add an app component to a test run. + * + * Add an app component to a test run by providing the resource Id, name and type. + *

Request Body Schema

+ * *
{@code
      * {
-     *     passFailCriteria (Optional): {
-     *         passFailMetrics (Optional): {
-     *             String (Required): {
-     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
-     *                 condition: String (Optional)
-     *                 requestName: String (Optional)
-     *                 value: Double (Optional)
-     *                 action: String(continue/stop) (Optional)
-     *                 actualValue: Double (Optional)
-     *                 result: String(passed/undetermined/failed) (Optional)
-     *             }
-     *         }
-     *     }
-     *     secrets (Optional): {
+     *     components (Optional, Required on create): {
      *         String (Required): {
-     *             value: String (Optional)
-     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
      *         }
      *     }
-     *     certificate (Optional): {
-     *         value: String (Optional)
-     *         type: String(AKV_CERT_URI) (Optional)
-     *         name: String (Optional)
-     *     }
-     *     environmentVariables (Optional): {
-     *         String: String (Required)
-     *     }
-     *     errorDetails (Optional): [
-     *          (Optional){
-     *             message: String (Optional)
-     *         }
-     *     ]
-     *     testRunStatistics (Optional): {
+     *     testRunId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
      *         String (Required): {
-     *             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)
-     *         }
-     *     }
-     *     loadTestConfiguration (Optional): {
-     *         engineInstances: Integer (Optional)
-     *         splitAllCSVs: Boolean (Optional)
-     *         quickStartTest: Boolean (Optional)
-     *         optionalLoadTestConfig (Optional): {
-     *             endpointUrl: String (Optional)
-     *             virtualUsers: Integer (Optional)
-     *             rampUpTime: Integer (Optional)
-     *             duration: Integer (Optional)
-     *         }
-     *     }
-     *     testArtifacts (Optional): {
-     *         inputArtifacts (Optional): {
-     *             configFileInfo (Optional): {
-     *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *                 expireDateTime: OffsetDateTime (Optional)
-     *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *                 validationFailureDetails: String (Optional)
-     *             }
-     *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
-     *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
-     *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
-     *             additionalFileInfo (Optional): [
-     *                 (recursive schema, see above)
-     *             ]
-     *         }
-     *         outputArtifacts (Optional): {
-     *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
-     *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
      *         }
      *     }
-     *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
-     *     virtualUsers: Integer (Optional)
      *     testRunId: String (Optional)
-     *     displayName: String (Optional)
-     *     testId: String (Optional)
-     *     description: String (Optional)
-     *     status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Optional)
-     *     startDateTime: OffsetDateTime (Optional)
-     *     endDateTime: OffsetDateTime (Optional)
-     *     executedDateTime: OffsetDateTime (Optional)
-     *     portalUrl: String (Optional)
-     *     duration: Long (Optional)
-     *     subnetId: String (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -1195,197 +1067,379 @@ public Mono> getTestRunWithResponseAsync(String testRunId,
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @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) { - final String accept = "application/json"; - return service.getTestRunSync(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - } - - /** - * Delete a test run by its name. - * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. + * @param testRunId Unique Id for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 the {@link Response} on successful completion of {@link Mono}. + * @return test run app component along with {@link Response}. */ @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)); + public Response createOrUpdateAppComponentsWithResponse(String testRunId, BinaryData body, + RequestOptions requestOptions) { + return createOrUpdateAppComponentsWithResponseAsync(testRunId, body, requestOptions).block(); } /** - * Delete a test run by its name. + * Configure server metrics for a test run. + *

Request Body Schema

* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @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) { - final String accept = "application/json"; - return service.deleteTestRunSync(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - } - + *
{@code
+     * {
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique Id for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body Server metric 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 test run server metrics configuration along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateServerMetricsConfigWithResponseAsync(String testRunId, + BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createOrUpdateServerMetricsConfig(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, testRunId, accept, body, requestOptions, context)); + } + /** - * Get test run file by file name. - *

- * Response Body Schema - *

+ * Configure server metrics for a test run. + *

Request Body Schema

+ * *
{@code
      * {
-     *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *     expireDateTime: OffsetDateTime (Optional)
-     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *     validationFailureDetails: String (Optional)
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param fileName Test run file name with file extension. + * @param testRunId Unique Id for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body Server metric 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 test run file by file name along with {@link Response} on successful completion of {@link Mono}. + * @return test run server metrics configuration along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTestRunFileWithResponseAsync(String testRunId, String fileName, + public Response createOrUpdateServerMetricsConfigWithResponse(String testRunId, BinaryData body, RequestOptions requestOptions) { + return createOrUpdateServerMetricsConfigWithResponseAsync(testRunId, body, requestOptions).block(); + } + + /** + * Delete an existing load test run. + * + * Delete an existing load test run by providing the testRunId. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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.getTestRunFile(this.client.getEndpoint(), testRunId, fileName, - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); + return FluxUtil.withContext(context -> service.deleteTestRun(this.getEndpoint(), + this.getServiceVersion().getVersion(), testRunId, accept, requestOptions, context)); } /** - * Get test run file by file name. - *

- * Response Body Schema - *

+ * Delete an existing load test run. + * + * Delete an existing load test run by providing the testRunId. + * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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(); + } + + /** + * Get associated app component (collection of azure resources) for the given test + * run. + *

Response Body Schema

+ * *
{@code
      * {
-     *     url: String (Optional)
-     *     fileName: String (Optional)
-     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *     expireDateTime: OffsetDateTime (Optional)
-     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *     validationFailureDetails: String (Optional)
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testRunId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param fileName Test run file name with file extension. + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @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}. + * @return associated app component (collection of azure resources) for the given test + * run along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTestRunFileWithResponse(String testRunId, String fileName, + public Mono> getAppComponentsWithResponseAsync(String testRunId, RequestOptions requestOptions) { final String accept = "application/json"; - return service.getTestRunFileSync(this.client.getEndpoint(), testRunId, fileName, - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return FluxUtil.withContext(context -> service.getAppComponents(this.getEndpoint(), + this.getServiceVersion().getVersion(), testRunId, accept, requestOptions, context)); } /** - * Get all test runs with given filters. - *

- * Query Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
orderbyStringNoSort on the supported fields in (field asc/desc) format. eg: executedDateTime asc. Supported fields - - * executedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - description, executedUser. For example, to search - * for a test run, with description 500 VUs, the search parameter can be 500.
testIdStringNoUnique name of an existing load test.
executionFromOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of test-run execution time filter range.
executionToOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of test-run execution time filter range.
statusStringNoComma separated list of test run status.
maxpagesizeIntegerNoNumber of results in response.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ * Get associated app component (collection of azure resources) for the given test + * run. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     components (Optional, Required on create): {
+     *         String (Required): {
+     *             resourceId: String (Required)
+     *             resourceName: String (Optional, Required on create)
+     *             resourceType: String (Optional, Required on create)
+     *             displayName: String (Optional)
+     *             resourceGroup: String (Optional)
+     *             subscriptionId: String (Optional)
+     *             kind: String (Optional)
+     *         }
+     *     }
+     *     testRunId: String (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 associated app component (collection of azure resources) for the given test + * run along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAppComponentsWithResponse(String testRunId, RequestOptions requestOptions) { + return getAppComponentsWithResponseAsync(testRunId, requestOptions).block(); + } + + /** + * Get associated server metrics configuration for the given test run. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 associated server metrics configuration for the given test run along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServerMetricsConfigWithResponseAsync(String testRunId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getServerMetricsConfig(this.getEndpoint(), + this.getServiceVersion().getVersion(), testRunId, accept, requestOptions, context)); + } + + /** + * Get associated server metrics configuration for the given test run. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testRunId: String (Optional)
+     *     metrics (Optional): {
+     *         String (Required): {
+     *             id: String (Optional)
+     *             resourceId: String (Optional, Required on create)
+     *             metricNamespace: String (Optional, Required on create)
+     *             displayDescription: String (Optional)
+     *             name: String (Optional, Required on create)
+     *             aggregation: String (Optional, Required on create)
+     *             unit: String (Optional)
+     *             resourceType: String (Optional, Required on create)
+     *         }
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 associated server metrics configuration for the given test run along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getServerMetricsConfigWithResponse(String testRunId, RequestOptions requestOptions) { + return getServerMetricsConfigWithResponseAsync(testRunId, requestOptions).block(); + } + + /** + * Get test run details by test run Id. + *

Response Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -1395,6 +1449,11 @@ public Response getTestRunFileWithResponse(String testRunId, String
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -1427,28 +1486,45 @@ public Response getTestRunFileWithResponse(String testRunId, String
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -1456,6 +1532,7 @@ public Response getTestRunFileWithResponse(String testRunId, String
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -1463,11 +1540,15 @@ public Response getTestRunFileWithResponse(String testRunId, String
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -1478,6 +1559,10 @@ public Response getTestRunFileWithResponse(String testRunId, String
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -1485,93 +1570,34 @@ public Response getTestRunFileWithResponse(String testRunId, String
      * }
      * }
* + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @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}. + * @return test run details by test run Id along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listTestRunsSinglePageAsync(RequestOptions requestOptions) { + public Mono> getTestRunWithResponseAsync(String testRunId, RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listTestRuns(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)); + return FluxUtil.withContext(context -> service.getTestRun(this.getEndpoint(), + this.getServiceVersion().getVersion(), testRunId, accept, requestOptions, context)); } /** - * Get all test runs with given filters. - *

- * Query Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
orderbyStringNoSort on the supported fields in (field asc/desc) format. eg: executedDateTime asc. Supported fields - - * executedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - description, executedUser. For example, to search - * for a test run, with description 500 VUs, the search parameter can be 500.
testIdStringNoUnique name of an existing load test.
executionFromOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of test-run execution time filter range.
executionToOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of test-run execution time filter range.
statusStringNoComma separated list of test run status.
maxpagesizeIntegerNoNumber of results in response.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ * Get test run details by test run Id. + *

Response Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -1581,6 +1607,11 @@ private Mono> listTestRunsSinglePageAsync(RequestOptio
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -1613,28 +1644,45 @@ private Mono> listTestRunsSinglePageAsync(RequestOptio
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -1642,6 +1690,7 @@ private Mono> listTestRunsSinglePageAsync(RequestOptio
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -1649,11 +1698,15 @@ private Mono> listTestRunsSinglePageAsync(RequestOptio
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -1664,6 +1717,10 @@ private Mono> listTestRunsSinglePageAsync(RequestOptio
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -1671,1155 +1728,155 @@ private Mono> listTestRunsSinglePageAsync(RequestOptio
      * }
      * }
* + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @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}. + * @return test run details by test run Id along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listTestRunsAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>((pageSize) -> { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listTestRunsSinglePageAsync(requestOptionsLocal); - }, (nextLink, pageSize) -> { - RequestOptions requestOptionsLocal = new RequestOptions(); - requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listTestRunsNextSinglePageAsync(nextLink, requestOptionsLocal); - }); + @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
+     * {
+     *     fileName: String (Required)
+     *     url: String (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *     expireDateTime: OffsetDateTime (Optional)
+     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *     validationFailureDetails: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param fileName Name of the file. + * @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 fileName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getTestRunFile(this.getEndpoint(), + this.getServiceVersion().getVersion(), testRunId, fileName, accept, requestOptions, context)); + } + + /** + * Get test run file by file name. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     fileName: String (Required)
+     *     url: String (Optional)
+     *     fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *     expireDateTime: OffsetDateTime (Optional)
+     *     validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *     validationFailureDetails: String (Optional)
+     * }
+     * }
+ * + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param fileName Name of the file. + * @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 fileName, + RequestOptions requestOptions) { + return getTestRunFileWithResponseAsync(testRunId, fileName, requestOptions).block(); } /** - * Get all test runs with given filters. - *

- * Query Parameters - *

+ * List the dimension values for the given metric dimension name. + *

Query Parameters

* * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * *
Query Parameters
NameTypeRequiredDescription
orderbyStringNoSort on the supported fields in (field asc/desc) format. eg: executedDateTime asc. Supported fields - - * executedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - description, executedUser. For example, to search - * for a test run, with description 500 VUs, the search parameter can be 500.
testIdStringNoUnique name of an existing load test.
executionFromOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of test-run execution time filter range.
executionToOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of test-run execution time filter range.
statusStringNoComma separated list of test run status.
maxpagesizeIntegerNoNumber of results in response.
NameTypeRequiredDescription
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: + * "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ *

Response Body Schema

+ * *
{@code
      * {
-     *     passFailCriteria (Optional): {
-     *         passFailMetrics (Optional): {
-     *             String (Required): {
-     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
-     *                 condition: String (Optional)
-     *                 requestName: String (Optional)
-     *                 value: Double (Optional)
-     *                 action: String(continue/stop) (Optional)
-     *                 actualValue: Double (Optional)
-     *                 result: String(passed/undetermined/failed) (Optional)
-     *             }
-     *         }
-     *     }
-     *     secrets (Optional): {
-     *         String (Required): {
-     *             value: String (Optional)
-     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
-     *         }
-     *     }
-     *     certificate (Optional): {
-     *         value: String (Optional)
-     *         type: String(AKV_CERT_URI) (Optional)
-     *         name: String (Optional)
-     *     }
-     *     environmentVariables (Optional): {
-     *         String: String (Required)
-     *     }
-     *     errorDetails (Optional): [
-     *          (Optional){
-     *             message: String (Optional)
-     *         }
+     *     name: String (Optional)
+     *     value (Optional): [
+     *         String (Optional)
      *     ]
-     *     testRunStatistics (Optional): {
-     *         String (Required): {
-     *             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)
-     *         }
-     *     }
-     *     loadTestConfiguration (Optional): {
-     *         engineInstances: Integer (Optional)
-     *         splitAllCSVs: Boolean (Optional)
-     *         quickStartTest: Boolean (Optional)
-     *         optionalLoadTestConfig (Optional): {
-     *             endpointUrl: String (Optional)
-     *             virtualUsers: Integer (Optional)
-     *             rampUpTime: Integer (Optional)
-     *             duration: Integer (Optional)
-     *         }
-     *     }
-     *     testArtifacts (Optional): {
-     *         inputArtifacts (Optional): {
-     *             configFileInfo (Optional): {
-     *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *                 expireDateTime: OffsetDateTime (Optional)
-     *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *                 validationFailureDetails: String (Optional)
-     *             }
-     *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
-     *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
-     *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
-     *             additionalFileInfo (Optional): [
-     *                 (recursive schema, see above)
-     *             ]
-     *         }
-     *         outputArtifacts (Optional): {
-     *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
-     *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
-     *         }
-     *     }
-     *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
-     *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
-     *     displayName: String (Optional)
-     *     testId: String (Optional)
-     *     description: String (Optional)
-     *     status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Optional)
-     *     startDateTime: OffsetDateTime (Optional)
-     *     endDateTime: OffsetDateTime (Optional)
-     *     executedDateTime: OffsetDateTime (Optional)
-     *     portalUrl: String (Optional)
-     *     duration: Long (Optional)
-     *     subnetId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
+     *     nextLink: String (Optional)
      * }
      * }
* + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param name Dimension name. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. * @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}. + * @return metrics dimension values along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listTestRunsSinglePage(RequestOptions requestOptions) { + public Mono> listMetricDimensionValuesWithResponseAsync(String testRunId, String name, + String metricname, String metricNamespace, String timespan, RequestOptions requestOptions) { final String accept = "application/json"; - Response res = service.listTestRunsSync(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + return FluxUtil.withContext( + context -> service.listMetricDimensionValues(this.getEndpoint(), this.getServiceVersion().getVersion(), + testRunId, name, metricname, metricNamespace, timespan, accept, requestOptions, context)); } /** - * Get all test runs with given filters. - *

- * Query Parameters - *

+ * List the dimension values for the given metric dimension name. + *

Query Parameters

* * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * *
Query Parameters
NameTypeRequiredDescription
orderbyStringNoSort on the supported fields in (field asc/desc) format. eg: executedDateTime asc. Supported fields - - * executedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - description, executedUser. For example, to search - * for a test run, with description 500 VUs, the search parameter can be 500.
testIdStringNoUnique name of an existing load test.
executionFromOffsetDateTimeNoStart DateTime(ISO 8601 literal format) of test-run execution time filter range.
executionToOffsetDateTimeNoEnd DateTime(ISO 8601 literal format) of test-run execution time filter range.
statusStringNoComma separated list of test run status.
maxpagesizeIntegerNoNumber of results in response.
NameTypeRequiredDescription
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: + * "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ *

Response Body Schema

+ * *
{@code
      * {
-     *     passFailCriteria (Optional): {
-     *         passFailMetrics (Optional): {
-     *             String (Required): {
-     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
-     *                 condition: String (Optional)
-     *                 requestName: String (Optional)
-     *                 value: Double (Optional)
-     *                 action: String(continue/stop) (Optional)
-     *                 actualValue: Double (Optional)
-     *                 result: String(passed/undetermined/failed) (Optional)
-     *             }
-     *         }
-     *     }
-     *     secrets (Optional): {
-     *         String (Required): {
-     *             value: String (Optional)
-     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
-     *         }
-     *     }
-     *     certificate (Optional): {
-     *         value: String (Optional)
-     *         type: String(AKV_CERT_URI) (Optional)
-     *         name: String (Optional)
-     *     }
-     *     environmentVariables (Optional): {
-     *         String: String (Required)
-     *     }
-     *     errorDetails (Optional): [
-     *          (Optional){
-     *             message: String (Optional)
-     *         }
-     *     ]
-     *     testRunStatistics (Optional): {
-     *         String (Required): {
-     *             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)
-     *         }
-     *     }
-     *     loadTestConfiguration (Optional): {
-     *         engineInstances: Integer (Optional)
-     *         splitAllCSVs: Boolean (Optional)
-     *         quickStartTest: Boolean (Optional)
-     *         optionalLoadTestConfig (Optional): {
-     *             endpointUrl: String (Optional)
-     *             virtualUsers: Integer (Optional)
-     *             rampUpTime: Integer (Optional)
-     *             duration: Integer (Optional)
-     *         }
-     *     }
-     *     testArtifacts (Optional): {
-     *         inputArtifacts (Optional): {
-     *             configFileInfo (Optional): {
-     *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *                 expireDateTime: OffsetDateTime (Optional)
-     *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *                 validationFailureDetails: String (Optional)
-     *             }
-     *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
-     *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
-     *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
-     *             additionalFileInfo (Optional): [
-     *                 (recursive schema, see above)
-     *             ]
-     *         }
-     *         outputArtifacts (Optional): {
-     *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
-     *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
-     *         }
-     *     }
-     *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
-     *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
-     *     displayName: String (Optional)
-     *     testId: String (Optional)
-     *     description: String (Optional)
-     *     status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Optional)
-     *     startDateTime: OffsetDateTime (Optional)
-     *     endDateTime: OffsetDateTime (Optional)
-     *     executedDateTime: OffsetDateTime (Optional)
-     *     portalUrl: String (Optional)
-     *     duration: Long (Optional)
-     *     subnetId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: 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 listTestRuns(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>((pageSize) -> { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listTestRunsSinglePage(requestOptionsLocal); - }, (nextLink, pageSize) -> { - RequestOptions requestOptionsLocal = new RequestOptions(); - requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listTestRunsNextSinglePage(nextLink, requestOptionsLocal); - }); - } - - /** - * Stop test run by name. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     passFailCriteria (Optional): {
-     *         passFailMetrics (Optional): {
-     *             String (Required): {
-     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
-     *                 condition: String (Optional)
-     *                 requestName: String (Optional)
-     *                 value: Double (Optional)
-     *                 action: String(continue/stop) (Optional)
-     *                 actualValue: Double (Optional)
-     *                 result: String(passed/undetermined/failed) (Optional)
-     *             }
-     *         }
-     *     }
-     *     secrets (Optional): {
-     *         String (Required): {
-     *             value: String (Optional)
-     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
-     *         }
-     *     }
-     *     certificate (Optional): {
-     *         value: String (Optional)
-     *         type: String(AKV_CERT_URI) (Optional)
-     *         name: String (Optional)
-     *     }
-     *     environmentVariables (Optional): {
-     *         String: String (Required)
-     *     }
-     *     errorDetails (Optional): [
-     *          (Optional){
-     *             message: String (Optional)
-     *         }
-     *     ]
-     *     testRunStatistics (Optional): {
-     *         String (Required): {
-     *             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)
-     *         }
-     *     }
-     *     loadTestConfiguration (Optional): {
-     *         engineInstances: Integer (Optional)
-     *         splitAllCSVs: Boolean (Optional)
-     *         quickStartTest: Boolean (Optional)
-     *         optionalLoadTestConfig (Optional): {
-     *             endpointUrl: String (Optional)
-     *             virtualUsers: Integer (Optional)
-     *             rampUpTime: Integer (Optional)
-     *             duration: Integer (Optional)
-     *         }
-     *     }
-     *     testArtifacts (Optional): {
-     *         inputArtifacts (Optional): {
-     *             configFileInfo (Optional): {
-     *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *                 expireDateTime: OffsetDateTime (Optional)
-     *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *                 validationFailureDetails: String (Optional)
-     *             }
-     *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
-     *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
-     *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
-     *             additionalFileInfo (Optional): [
-     *                 (recursive schema, see above)
-     *             ]
-     *         }
-     *         outputArtifacts (Optional): {
-     *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
-     *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
-     *         }
-     *     }
-     *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
-     *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
-     *     displayName: String (Optional)
-     *     testId: String (Optional)
-     *     description: String (Optional)
-     *     status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Optional)
-     *     startDateTime: OffsetDateTime (Optional)
-     *     endDateTime: OffsetDateTime (Optional)
-     *     executedDateTime: OffsetDateTime (Optional)
-     *     portalUrl: String (Optional)
-     *     duration: Long (Optional)
-     *     subnetId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @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
-     * {
-     *     passFailCriteria (Optional): {
-     *         passFailMetrics (Optional): {
-     *             String (Required): {
-     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
-     *                 condition: String (Optional)
-     *                 requestName: String (Optional)
-     *                 value: Double (Optional)
-     *                 action: String(continue/stop) (Optional)
-     *                 actualValue: Double (Optional)
-     *                 result: String(passed/undetermined/failed) (Optional)
-     *             }
-     *         }
-     *     }
-     *     secrets (Optional): {
-     *         String (Required): {
-     *             value: String (Optional)
-     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
-     *         }
-     *     }
-     *     certificate (Optional): {
-     *         value: String (Optional)
-     *         type: String(AKV_CERT_URI) (Optional)
-     *         name: String (Optional)
-     *     }
-     *     environmentVariables (Optional): {
-     *         String: String (Required)
-     *     }
-     *     errorDetails (Optional): [
-     *          (Optional){
-     *             message: String (Optional)
-     *         }
-     *     ]
-     *     testRunStatistics (Optional): {
-     *         String (Required): {
-     *             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)
-     *         }
-     *     }
-     *     loadTestConfiguration (Optional): {
-     *         engineInstances: Integer (Optional)
-     *         splitAllCSVs: Boolean (Optional)
-     *         quickStartTest: Boolean (Optional)
-     *         optionalLoadTestConfig (Optional): {
-     *             endpointUrl: String (Optional)
-     *             virtualUsers: Integer (Optional)
-     *             rampUpTime: Integer (Optional)
-     *             duration: Integer (Optional)
-     *         }
-     *     }
-     *     testArtifacts (Optional): {
-     *         inputArtifacts (Optional): {
-     *             configFileInfo (Optional): {
-     *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
-     *                 expireDateTime: OffsetDateTime (Optional)
-     *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
-     *                 validationFailureDetails: String (Optional)
-     *             }
-     *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
-     *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
-     *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
-     *             additionalFileInfo (Optional): [
-     *                 (recursive schema, see above)
-     *             ]
-     *         }
-     *         outputArtifacts (Optional): {
-     *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
-     *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
-     *         }
-     *     }
-     *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
-     *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
-     *     displayName: String (Optional)
-     *     testId: String (Optional)
-     *     description: String (Optional)
-     *     status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Optional)
-     *     startDateTime: OffsetDateTime (Optional)
-     *     endDateTime: OffsetDateTime (Optional)
-     *     executedDateTime: OffsetDateTime (Optional)
-     *     portalUrl: String (Optional)
-     *     duration: Long (Optional)
-     *     subnetId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @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) { - final String accept = "application/json"; - return service.stopTestRunSync(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - } - - /** - * List the metric namespaces for a load test run. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     value (Required): [
-     *          (Required){
-     *             description: String (Optional)
-     *             name: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @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 represents collection of metric namespaces along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getMetricNamespacesWithResponseAsync(String testRunId, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getMetricNamespaces(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); - } - - /** - * List the metric namespaces for a load test run. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     value (Required): [
-     *          (Required){
-     *             description: String (Optional)
-     *             name: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @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 represents collection of metric namespaces along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getMetricNamespacesWithResponse(String testRunId, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getMetricNamespacesSync(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - } - - /** - * List the metric definitions for a load test run. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     value (Required): [
-     *          (Required){
-     *             dimensions (Optional): [
-     *                  (Optional){
-     *                     description: String (Optional)
-     *                     name: String (Optional)
-     *                 }
-     *             ]
-     *             description: String (Optional)
-     *             name: String (Optional)
-     *             namespace: String (Optional)
-     *             primaryAggregationType: String(Average/Count/None/Total/Percentile90/Percentile95/Percentile99) (Optional)
-     *             supportedAggregationTypes (Optional): [
-     *                 String (Optional)
-     *             ]
-     *             unit: String(NotSpecified/Percent/Count/Seconds/Milliseconds/Bytes/BytesPerSecond/CountPerSecond) (Optional)
-     *             metricAvailabilities (Optional): [
-     *                  (Optional){
-     *                     timeGrain: String(PT5S/PT10S/PT1M/PT5M/PT1H) (Optional)
-     *                 }
-     *             ]
-     *         }
-     *     ]
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param metricNamespace Metric namespace to query metric definitions for. - * @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 represents collection of metric definitions along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getMetricDefinitionsWithResponseAsync(String testRunId, String metricNamespace, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getMetricDefinitions(this.client.getEndpoint(), testRunId, - metricNamespace, this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); - } - - /** - * List the metric definitions for a load test run. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     value (Required): [
-     *          (Required){
-     *             dimensions (Optional): [
-     *                  (Optional){
-     *                     description: String (Optional)
-     *                     name: String (Optional)
-     *                 }
-     *             ]
-     *             description: String (Optional)
-     *             name: String (Optional)
-     *             namespace: String (Optional)
-     *             primaryAggregationType: String(Average/Count/None/Total/Percentile90/Percentile95/Percentile99) (Optional)
-     *             supportedAggregationTypes (Optional): [
-     *                 String (Optional)
-     *             ]
-     *             unit: String(NotSpecified/Percent/Count/Seconds/Milliseconds/Bytes/BytesPerSecond/CountPerSecond) (Optional)
-     *             metricAvailabilities (Optional): [
-     *                  (Optional){
-     *                     timeGrain: String(PT5S/PT10S/PT1M/PT5M/PT1H) (Optional)
-     *                 }
-     *             ]
-     *         }
-     *     ]
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param metricNamespace Metric namespace to query metric definitions for. - * @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 represents collection of metric definitions along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getMetricDefinitionsWithResponse(String testRunId, String metricNamespace, - RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getMetricDefinitionsSync(this.client.getEndpoint(), testRunId, metricNamespace, - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - } - - /** - * List the metric values for a load test run. - *

- * Query Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
aggregationStringNoThe aggregation
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Header Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

- * Request Body Schema - *

- *
{@code
-     * {
-     *     filters (Optional): [
-     *          (Optional){
-     *             name: String (Optional)
-     *             values (Optional): [
-     *                 String (Optional)
-     *             ]
-     *         }
-     *     ]
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     data (Optional): [
-     *          (Optional){
-     *             timestamp: String (Optional)
-     *             value: Double (Optional)
-     *         }
-     *     ]
-     *     dimensionValues (Optional): [
-     *          (Optional){
-     *             name: String (Optional)
-     *             value: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param metricName Metric name. - * @param metricNamespace Metric namespace to query metric definitions for. - * @param timespan The timespan of the query. It is a string with the following format - * 'startDateTime_ISO/endDateTime_ISO'. - * @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 to a metrics query along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listMetricsSinglePageAsync(String testRunId, String metricName, - String metricNamespace, String timespan, RequestOptions requestOptions) { - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - } - }); - return FluxUtil - .withContext( - context -> service.listMetrics(this.client.getEndpoint(), testRunId, metricName, metricNamespace, - timespan, this.client.getServiceVersion().getVersion(), accept, requestOptionsLocal, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * List the metric values for a load test run. - *

- * Query Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
aggregationStringNoThe aggregation
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Header Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

- * Request Body Schema - *

- *
{@code
-     * {
-     *     filters (Optional): [
-     *          (Optional){
-     *             name: String (Optional)
-     *             values (Optional): [
-     *                 String (Optional)
-     *             ]
-     *         }
-     *     ]
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     data (Optional): [
-     *          (Optional){
-     *             timestamp: String (Optional)
-     *             value: Double (Optional)
-     *         }
-     *     ]
-     *     dimensionValues (Optional): [
-     *          (Optional){
-     *             name: String (Optional)
-     *             value: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param metricName Metric name. - * @param metricNamespace Metric namespace to query metric definitions for. - * @param timespan The timespan of the query. It is a string with the following format - * 'startDateTime_ISO/endDateTime_ISO'. - * @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 to a metrics query as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listMetricsAsync(String testRunId, String metricName, String metricNamespace, - String timespan, RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>( - () -> listMetricsSinglePageAsync(testRunId, metricName, metricNamespace, timespan, requestOptions), - nextLink -> listMetricsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); - } - - /** - * List the metric values for a load test run. - *

- * Query Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
aggregationStringNoThe aggregation
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Header Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

- * Request Body Schema - *

- *
{@code
-     * {
-     *     filters (Optional): [
-     *          (Optional){
-     *             name: String (Optional)
-     *             values (Optional): [
-     *                 String (Optional)
-     *             ]
-     *         }
-     *     ]
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     data (Optional): [
-     *          (Optional){
-     *             timestamp: String (Optional)
-     *             value: Double (Optional)
-     *         }
-     *     ]
-     *     dimensionValues (Optional): [
-     *          (Optional){
-     *             name: String (Optional)
-     *             value: String (Optional)
-     *         }
+     *     name: String (Optional)
+     *     value (Optional): [
+     *         String (Optional)
      *     ]
+     *     nextLink: String (Optional)
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param metricName Metric name. + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param name Dimension name. + * @param metricname Metric name. * @param metricNamespace Metric namespace to query metric definitions for. * @param timespan The timespan of the query. It is a string with the following format * 'startDateTime_ISO/endDateTime_ISO'. @@ -2828,610 +1885,564 @@ public PagedFlux listMetricsAsync(String testRunId, String metricNam * @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 to a metrics query along with {@link PagedResponse}. + * @return metrics dimension values along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listMetricsSinglePage(String testRunId, String metricName, String metricNamespace, - String timespan, RequestOptions requestOptions) { - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - } - }); - Response res - = service.listMetricsSync(this.client.getEndpoint(), testRunId, metricName, metricNamespace, timespan, - this.client.getServiceVersion().getVersion(), accept, requestOptionsLocal, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + public Response listMetricDimensionValuesWithResponse(String testRunId, String name, String metricname, + String metricNamespace, String timespan, RequestOptions requestOptions) { + return listMetricDimensionValuesWithResponseAsync(testRunId, name, metricname, metricNamespace, timespan, + requestOptions).block(); } /** - * List the metric values for a load test run. - *

- * Query Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
aggregationStringNoThe aggregation
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Header Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

- * Request Body Schema - *

+ * List the metric definitions for a load test run. + *

Response Body Schema

+ * *
{@code
      * {
-     *     filters (Optional): [
-     *          (Optional){
+     *     value (Required): [
+     *          (Required){
+     *             dimensions (Optional): [
+     *                  (Optional){
+     *                     description: String (Optional)
+     *                     name: String (Optional)
+     *                 }
+     *             ]
+     *             description: String (Optional)
      *             name: String (Optional)
-     *             values (Optional): [
+     *             namespace: String (Optional)
+     *             primaryAggregationType: String(Average/Count/None/Total/Percentile75/Percentile90/Percentile95/Percentile96/Percentile97/Percentile98/Percentile99/Percentile999/Percentile9999) (Optional)
+     *             supportedAggregationTypes (Optional): [
      *                 String (Optional)
      *             ]
-     *         }
-     *     ]
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     data (Optional): [
-     *          (Optional){
-     *             timestamp: String (Optional)
-     *             value: Double (Optional)
-     *         }
-     *     ]
-     *     dimensionValues (Optional): [
-     *          (Optional){
-     *             name: String (Optional)
-     *             value: String (Optional)
+     *             unit: String(NotSpecified/Percent/Count/Seconds/Milliseconds/Bytes/BytesPerSecond/CountPerSecond) (Optional)
+     *             metricAvailabilities (Optional): [
+     *                  (Optional){
+     *                     timeGrain: String(PT5S/PT10S/PT1M/PT5M/PT1H) (Optional)
+     *                 }
+     *             ]
      *         }
      *     ]
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param metricName Metric name. + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @param metricNamespace Metric namespace to query metric definitions for. - * @param timespan The timespan of the query. It is a string with the following format - * 'startDateTime_ISO/endDateTime_ISO'. * @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 to a metrics query as paginated response with {@link PagedIterable}. + * @return represents collection of metric definitions along with {@link Response} on successful completion of + * {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listMetrics(String testRunId, String metricName, String metricNamespace, - String timespan, RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>( - () -> listMetricsSinglePage(testRunId, metricName, metricNamespace, timespan, requestOptions), - nextLink -> listMetricsNextSinglePage(nextLink, requestOptionsForNextPage)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMetricDefinitionsWithResponseAsync(String testRunId, String metricNamespace, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getMetricDefinitions(this.getEndpoint(), + this.getServiceVersion().getVersion(), testRunId, metricNamespace, accept, requestOptions, context)); } /** - * List the dimension values for the given metric dimension name. - *

- * Query Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ * List the metric definitions for a load test run. + *

Response Body Schema

+ * *
{@code
-     * String
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             dimensions (Optional): [
+     *                  (Optional){
+     *                     description: String (Optional)
+     *                     name: String (Optional)
+     *                 }
+     *             ]
+     *             description: String (Optional)
+     *             name: String (Optional)
+     *             namespace: String (Optional)
+     *             primaryAggregationType: String(Average/Count/None/Total/Percentile75/Percentile90/Percentile95/Percentile96/Percentile97/Percentile98/Percentile99/Percentile999/Percentile9999) (Optional)
+     *             supportedAggregationTypes (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             unit: String(NotSpecified/Percent/Count/Seconds/Milliseconds/Bytes/BytesPerSecond/CountPerSecond) (Optional)
+     *             metricAvailabilities (Optional): [
+     *                  (Optional){
+     *                     timeGrain: String(PT5S/PT10S/PT1M/PT5M/PT1H) (Optional)
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param name Dimension name. - * @param metricName Metric name. + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @param metricNamespace Metric namespace to query metric definitions for. - * @param timespan The timespan of the query. It is a string with the following format - * 'startDateTime_ISO/endDateTime_ISO'. * @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 metrics dimension values along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return represents collection of metric definitions along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listMetricDimensionValuesSinglePageAsync(String testRunId, String name, - String metricName, String metricNamespace, String timespan, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listMetricDimensionValues(this.client.getEndpoint(), testRunId, name, - metricName, metricNamespace, timespan, 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)); + public Response getMetricDefinitionsWithResponse(String testRunId, String metricNamespace, + RequestOptions requestOptions) { + return getMetricDefinitionsWithResponseAsync(testRunId, metricNamespace, requestOptions).block(); } /** - * List the dimension values for the given metric dimension name. - *

- * Query Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ * List the metric namespaces for a load test run. + *

Response Body Schema

+ * *
{@code
-     * String
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             description: String (Optional)
+     *             name: String (Optional)
+     *         }
+     *     ]
+     * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param name Dimension name. - * @param metricName Metric name. - * @param metricNamespace Metric namespace to query metric definitions for. - * @param timespan The timespan of the query. It is a string with the following format - * 'startDateTime_ISO/endDateTime_ISO'. + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @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 metrics dimension values as paginated response with {@link PagedFlux}. + * @return represents collection of metric namespaces along with {@link Response} on successful completion of + * {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listMetricDimensionValuesAsync(String testRunId, String name, String metricName, - String metricNamespace, String timespan, RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>( - () -> listMetricDimensionValuesSinglePageAsync(testRunId, name, metricName, metricNamespace, timespan, - requestOptions), - nextLink -> listMetricDimensionValuesNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMetricNamespacesWithResponseAsync(String testRunId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getMetricNamespaces(this.getEndpoint(), + this.getServiceVersion().getVersion(), testRunId, accept, requestOptions, context)); } /** - * List the dimension values for the given metric dimension name. - *

- * Query Parameters - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

+ * List the metric namespaces for a load test run. + *

Response Body Schema

+ * *
{@code
-     * String
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             description: String (Optional)
+     *             name: String (Optional)
+     *         }
+     *     ]
+     * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param name Dimension name. - * @param metricName Metric name. - * @param metricNamespace Metric namespace to query metric definitions for. - * @param timespan The timespan of the query. It is a string with the following format - * 'startDateTime_ISO/endDateTime_ISO'. + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @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 metrics dimension values along with {@link PagedResponse}. + * @return represents collection of metric namespaces along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listMetricDimensionValuesSinglePage(String testRunId, String name, - String metricName, String metricNamespace, String timespan, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listMetricDimensionValuesSync(this.client.getEndpoint(), testRunId, name, - metricName, metricNamespace, timespan, this.client.getServiceVersion().getVersion(), accept, requestOptions, - Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + public Response getMetricNamespacesWithResponse(String testRunId, RequestOptions requestOptions) { + return getMetricNamespacesWithResponseAsync(testRunId, requestOptions).block(); } /** - * List the dimension values for the given metric dimension name. - *

- * Query Parameters - *

+ * List the metric values for a load test run. + *

Query Parameters

* * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * *
Query Parameters
NameTypeRequiredDescription
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
NameTypeRequiredDescription
aggregationStringNoThe aggregation
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: + * "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

- * Response Body Schema - *

- *
{@code
-     * String
-     * }
+ *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param name Dimension name. - * @param metricName Metric name. - * @param metricNamespace Metric namespace to query metric definitions for. - * @param timespan The timespan of the query. It is a string with the following format - * 'startDateTime_ISO/endDateTime_ISO'. - * @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 metrics dimension values as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listMetricDimensionValues(String testRunId, String name, String metricName, - String metricNamespace, String timespan, RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>( - () -> listMetricDimensionValuesSinglePage(testRunId, name, metricName, metricNamespace, timespan, - requestOptions), - nextLink -> listMetricDimensionValuesNextSinglePage(nextLink, requestOptionsForNextPage)); - } - - /** - * Associate an app component (collection of azure resources) to a test run. - *

- * Request Body Schema - *

*
{@code
      * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
+     *     filters (Optional): [
+     *          (Optional){
+     *             name: String (Optional)
+     *             values (Optional): [
+     *                 String (Optional)
+     *             ]
      *         }
-     *     }
-     *     testRunId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
+     *     ]
      * }
      * }
- *

- * Response Body Schema - *

+ * + *

Response Body Schema

+ * *
{@code
      * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
+     *     data (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             value: Double (Optional)
      *         }
-     *     }
-     *     testRunId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
+     *     ]
+     *     dimensionValues (Optional): [
+     *          (Optional){
+     *             name: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param body App Component model. + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. * @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 app component along with {@link Response} on successful completion of {@link Mono}. + * @return the response to a metrics query along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateAppComponentsWithResponseAsync(String testRunId, BinaryData body, - RequestOptions requestOptions) { + private Mono> listMetricsSinglePageAsync(String testRunId, String metricname, + String metricNamespace, String timespan, RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createOrUpdateAppComponents(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), body, accept, requestOptions, context)); + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); + } + }); + return FluxUtil + .withContext(context -> service.listMetrics(this.getEndpoint(), this.getServiceVersion().getVersion(), + testRunId, metricname, metricNamespace, timespan, accept, requestOptionsLocal, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } /** - * Associate an app component (collection of azure resources) to a test run. - *

- * Request Body Schema - *

+ * List the metric values for a load test run. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
aggregationStringNoThe aggregation
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: + * "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * *
{@code
      * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
+     *     filters (Optional): [
+     *          (Optional){
+     *             name: String (Optional)
+     *             values (Optional): [
+     *                 String (Optional)
+     *             ]
      *         }
-     *     }
-     *     testRunId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
+     *     ]
      * }
      * }
- *

- * Response Body Schema - *

+ * + *

Response Body Schema

+ * *
{@code
      * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
+     *     data (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             value: Double (Optional)
      *         }
-     *     }
-     *     testRunId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
+     *     ]
+     *     dimensionValues (Optional): [
+     *          (Optional){
+     *             name: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param body App Component model. + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. * @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 app component along with {@link Response}. + * @return the response to a metrics query as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateAppComponentsWithResponse(String testRunId, BinaryData body, - RequestOptions requestOptions) { - final String accept = "application/json"; - return service.createOrUpdateAppComponentsSync(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), body, accept, requestOptions, Context.NONE); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listMetricsAsync(String testRunId, String metricname, String metricNamespace, + String timespan, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(testRunId, metricname, metricNamespace, timespan, requestOptions), + nextLink -> listMetricsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); } /** - * Get associated app component (collection of azure resources) for the given test run. - *

- * Response Body Schema - *

+ * List the metric values for a load test run. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
aggregationStringNoThe aggregation
intervalStringNoThe interval (i.e. timegrain) of the query. Allowed values: + * "PT5S", "PT10S", "PT1M", "PT5M", "PT1H".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * *
{@code
      * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
+     *     filters (Optional): [
+     *          (Optional){
+     *             name: String (Optional)
+     *             values (Optional): [
+     *                 String (Optional)
+     *             ]
      *         }
-     *     }
-     *     testRunId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
+     *     ]
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @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 associated app component (collection of azure resources) for the given test run along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAppComponentsWithResponseAsync(String testRunId, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getAppComponents(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); - } - - /** - * Get associated app component (collection of azure resources) for the given test run. - *

- * Response Body Schema - *

+ *

Response Body Schema

+ * *
{@code
      * {
-     *     components (Required): {
-     *         String (Required): {
-     *             resourceId: String (Optional)
-     *             resourceName: String (Optional)
-     *             resourceType: String (Optional)
-     *             displayName: String (Optional)
-     *             resourceGroup: String (Optional)
-     *             subscriptionId: String (Optional)
-     *             kind: String (Optional)
+     *     data (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             value: Double (Optional)
      *         }
-     *     }
-     *     testRunId: String (Optional)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
+     *     ]
+     *     dimensionValues (Optional): [
+     *          (Optional){
+     *             name: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. + * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param metricname Metric name. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. * @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 associated app component (collection of azure resources) for the given test run along with - * {@link Response}. + * @return the response to a metrics query as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAppComponentsWithResponse(String testRunId, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAppComponentsSync(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics(String testRunId, String metricname, String metricNamespace, + String timespan, RequestOptions requestOptions) { + return new PagedIterable<>(listMetricsAsync(testRunId, metricname, metricNamespace, timespan, requestOptions)); } /** - * Configure server metrics for a test run. - *

- * Request Body Schema - *

+ * Get all test runs for the given filters. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderbyStringNoSort on the supported fields in (field asc/desc) format. eg: + * executedDateTime + * asc. Supported fields - executedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - + * description, + * executedUser. For example, to search for a test run, with description 500 VUs, + * the search parameter can be 500.
testIdStringNoUnique name of an existing load test.
executionFromOffsetDateTimeNoStart DateTime(RFC 3339 literal format) of + * test-run execution time filter range.
executionToOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of test-run + * execution time filter range.
statusStringNoComma separated list of test run status.
maxpagesizeIntegerNoNumber of results in response.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * *
{@code
      * {
-     *     testRunId: String (Optional)
-     *     metrics (Optional): {
+     *     testRunId: String (Required)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Required): {
+     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String(continue/stop) (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String(passed/undetermined/failed) (Optional)
+     *             }
+     *         }
+     *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
+     *     secrets (Optional): {
      *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
+     *             value: String (Optional)
+     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
      *         }
      *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testRunId: String (Optional)
-     *     metrics (Optional): {
+     *     certificate (Optional): {
+     *         value: String (Optional)
+     *         type: String(AKV_CERT_URI) (Optional)
+     *         name: String (Optional)
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Required)
+     *     }
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     testRunStatistics (Optional): {
      *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
+     *             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)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     *     loadTestConfiguration (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *         quickStartTest: Boolean (Optional)
+     *         optionalLoadTestConfig (Optional): {
+     *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
+     *             virtualUsers: Integer (Optional)
+     *             rampUpTime: Integer (Optional)
+     *             duration: Integer (Optional)
+     *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Optional): {
+     *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
+     *                 url: String (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *                 validationFailureDetails: String (Optional)
+     *             }
+     *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
+     *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
+     *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
+     *             additionalFileInfo (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
+     *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
+     *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
+     *     virtualUsers: Integer (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     portalUrl: String (Optional)
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -3439,69 +2450,179 @@ public Response getAppComponentsWithResponse(String testRunId, Reque
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param body Server metric 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 test run server metrics configuration along with {@link Response} on successful completion of + * @return all test runs for the given filters along with {@link PagedResponse} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateServerMetricsConfigWithResponseAsync(String testRunId, - BinaryData body, RequestOptions requestOptions) { + private Mono> listTestRunsSinglePageAsync(RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createOrUpdateServerMetricsConfig(this.client.getEndpoint(), - testRunId, this.client.getServiceVersion().getVersion(), body, accept, requestOptions, context)); + return FluxUtil + .withContext(context -> service.listTestRuns(this.getEndpoint(), this.getServiceVersion().getVersion(), + accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } /** - * Configure server metrics for a test run. - *

- * Request Body Schema - *

+ * Get all test runs for the given filters. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderbyStringNoSort on the supported fields in (field asc/desc) format. eg: + * executedDateTime + * asc. Supported fields - executedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - + * description, + * executedUser. For example, to search for a test run, with description 500 VUs, + * the search parameter can be 500.
testIdStringNoUnique name of an existing load test.
executionFromOffsetDateTimeNoStart DateTime(RFC 3339 literal format) of + * test-run execution time filter range.
executionToOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of test-run + * execution time filter range.
statusStringNoComma separated list of test run status.
maxpagesizeIntegerNoNumber of results in response.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * *
{@code
      * {
-     *     testRunId: String (Optional)
-     *     metrics (Optional): {
+     *     testRunId: String (Required)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Required): {
+     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String(continue/stop) (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String(passed/undetermined/failed) (Optional)
+     *             }
+     *         }
+     *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
+     *     secrets (Optional): {
      *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
+     *             value: String (Optional)
+     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
      *         }
      *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testRunId: String (Optional)
-     *     metrics (Optional): {
+     *     certificate (Optional): {
+     *         value: String (Optional)
+     *         type: String(AKV_CERT_URI) (Optional)
+     *         name: String (Optional)
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Required)
+     *     }
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     testRunStatistics (Optional): {
      *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
+     *             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)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     *     loadTestConfiguration (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *         quickStartTest: Boolean (Optional)
+     *         optionalLoadTestConfig (Optional): {
+     *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
+     *             virtualUsers: Integer (Optional)
+     *             rampUpTime: Integer (Optional)
+     *             duration: Integer (Optional)
+     *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Optional): {
+     *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
+     *                 url: String (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *                 validationFailureDetails: String (Optional)
+     *             }
+     *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
+     *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
+     *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
+     *             additionalFileInfo (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
+     *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
+     *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
+     *     virtualUsers: Integer (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     portalUrl: String (Optional)
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -3509,89 +2630,197 @@ public Mono> createOrUpdateServerMetricsConfigWithResponseA
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @param body Server metric 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 test run server metrics configuration along with {@link Response}. + * @return all test runs for the given filters as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateServerMetricsConfigWithResponse(String testRunId, BinaryData body, - RequestOptions requestOptions) { - final String accept = "application/json"; - return service.createOrUpdateServerMetricsConfigSync(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), body, accept, requestOptions, Context.NONE); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestRunsAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listTestRunsSinglePageAsync(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listTestRunsNextSinglePageAsync(nextLink, requestOptionsLocal); + }); } /** - * List server metrics configuration for the given test run. - *

- * Response Body Schema - *

+ * Get all test runs for the given filters. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
orderbyStringNoSort on the supported fields in (field asc/desc) format. eg: + * executedDateTime + * asc. Supported fields - executedDateTime
searchStringNoPrefix based, case sensitive search on searchable fields - + * description, + * executedUser. For example, to search for a test run, with description 500 VUs, + * the search parameter can be 500.
testIdStringNoUnique name of an existing load test.
executionFromOffsetDateTimeNoStart DateTime(RFC 3339 literal format) of + * test-run execution time filter range.
executionToOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of test-run + * execution time filter range.
statusStringNoComma separated list of test run status.
maxpagesizeIntegerNoNumber of results in response.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * *
{@code
      * {
-     *     testRunId: String (Optional)
-     *     metrics (Optional): {
+     *     testRunId: String (Required)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Required): {
+     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String(continue/stop) (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String(passed/undetermined/failed) (Optional)
+     *             }
+     *         }
+     *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
+     *     secrets (Optional): {
      *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
+     *             value: String (Optional)
+     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
+     *         }
+     *     }
+     *     certificate (Optional): {
+     *         value: String (Optional)
+     *         type: String(AKV_CERT_URI) (Optional)
+     *         name: String (Optional)
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Required)
+     *     }
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     testRunStatistics (Optional): {
+     *         String (Required): {
+     *             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)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     *     loadTestConfiguration (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *         quickStartTest: Boolean (Optional)
+     *         optionalLoadTestConfig (Optional): {
+     *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
+     *             virtualUsers: Integer (Optional)
+     *             rampUpTime: Integer (Optional)
+     *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     createdBy: String (Optional)
-     *     lastModifiedDateTime: OffsetDateTime (Optional)
-     *     lastModifiedBy: String (Optional)
-     * }
-     * }
- * - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. - * @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 server metrics configuration along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getServerMetricsConfigWithResponseAsync(String testRunId, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getServerMetricsConfig(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); - } - - /** - * List server metrics configuration for the given test run. - *

- * Response Body Schema - *

- *
{@code
-     * {
-     *     testRunId: String (Optional)
-     *     metrics (Optional): {
-     *         String (Required): {
-     *             id: String (Optional)
-     *             resourceId: String (Required)
-     *             metricNamespace: String (Required)
-     *             displayDescription: String (Optional)
-     *             name: String (Required)
-     *             aggregation: String (Required)
-     *             unit: String (Optional)
-     *             resourceType: String (Required)
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Optional): {
+     *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
+     *                 url: String (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *                 validationFailureDetails: String (Optional)
+     *             }
+     *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
+     *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
+     *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
+     *             additionalFileInfo (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
+     *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
+     *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
+     *     virtualUsers: Integer (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     portalUrl: String (Optional)
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -3599,34 +2828,30 @@ public Mono> getServerMetricsConfigWithResponseAsync(String
      * }
      * }
* - * @param testRunId Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore - * or hyphen characters. * @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 server metrics configuration along with {@link Response}. + * @return all test runs for the given filters as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getServerMetricsConfigWithResponse(String testRunId, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getServerMetricsConfigSync(this.client.getEndpoint(), testRunId, - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestRuns(RequestOptions requestOptions) { + return new PagedIterable<>(listTestRunsAsync(requestOptions)); } /** - * Get the next page of items. - *

- * Response Body Schema - *

+ * Stop test run by test run Id. + *

Response Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -3636,6 +2861,11 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -3668,28 +2898,45 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -3697,6 +2944,7 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -3704,11 +2952,15 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -3719,6 +2971,10 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -3726,38 +2982,34 @@ public Response getServerMetricsConfigWithResponse(String testRunId,
      * }
      * }
* - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @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 collection of test runs along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return load test run model along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listTestRunsNextSinglePageAsync(String nextLink, - RequestOptions requestOptions) { + public Mono> stopTestRunWithResponseAsync(String testRunId, RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.listTestRunsNext(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)); + return FluxUtil.withContext(context -> service.stopTestRun(this.getEndpoint(), + this.getServiceVersion().getVersion(), testRunId, accept, requestOptions, context)); } /** - * Get the next page of items. - *

- * Response Body Schema - *

+ * Stop test run by test run Id. + *

Response Body Schema

+ * *
{@code
      * {
+     *     testRunId: String (Required)
      *     passFailCriteria (Optional): {
      *         passFailMetrics (Optional): {
      *             String (Required): {
      *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
-     *                 aggregate: String(count/percentage/avg/p50/p90/p95/p99/min/max) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
      *                 condition: String (Optional)
      *                 requestName: String (Optional)
      *                 value: Double (Optional)
@@ -3767,6 +3019,11 @@ private Mono> listTestRunsNextSinglePageAsync(String n
      *             }
      *         }
      *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
      *     secrets (Optional): {
      *         String (Required): {
      *             value: String (Optional)
@@ -3799,28 +3056,45 @@ private Mono> listTestRunsNextSinglePageAsync(String n
      *             pct1ResTime: Double (Optional)
      *             pct2ResTime: Double (Optional)
      *             pct3ResTime: Double (Optional)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
      *             throughput: Double (Optional)
      *             receivedKBytesPerSec: Double (Optional)
      *             sentKBytesPerSec: Double (Optional)
      *         }
      *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
      *     loadTestConfiguration (Optional): {
      *         engineInstances: Integer (Optional)
      *         splitAllCSVs: Boolean (Optional)
      *         quickStartTest: Boolean (Optional)
      *         optionalLoadTestConfig (Optional): {
      *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
      *             virtualUsers: Integer (Optional)
      *             rampUpTime: Integer (Optional)
      *             duration: Integer (Optional)
      *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
      *     }
      *     testArtifacts (Optional): {
      *         inputArtifacts (Optional): {
      *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
      *                 url: String (Optional)
-     *                 fileName: String (Optional)
-     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS) (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
      *                 expireDateTime: OffsetDateTime (Optional)
      *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
      *                 validationFailureDetails: String (Optional)
@@ -3828,6 +3102,7 @@ private Mono> listTestRunsNextSinglePageAsync(String n
      *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
      *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
      *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
      *             additionalFileInfo (Optional): [
      *                 (recursive schema, see above)
      *             ]
@@ -3835,11 +3110,15 @@ private Mono> listTestRunsNextSinglePageAsync(String n
      *         outputArtifacts (Optional): {
      *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
      *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
      *         }
      *     }
      *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
      *     virtualUsers: Integer (Optional)
-     *     testRunId: String (Optional)
      *     displayName: String (Optional)
      *     testId: String (Optional)
      *     description: String (Optional)
@@ -3850,6 +3129,10 @@ private Mono> listTestRunsNextSinglePageAsync(String n
      *     portalUrl: String (Optional)
      *     duration: Long (Optional)
      *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
      *     createdDateTime: OffsetDateTime (Optional)
      *     createdBy: String (Optional)
      *     lastModifiedDateTime: OffsetDateTime (Optional)
@@ -3857,35 +3140,31 @@ private Mono> listTestRunsNextSinglePageAsync(String n
      * }
      * }
* - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param testRunId Unique test run identifier for the load test run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. * @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 collection of test runs along with {@link PagedResponse}. + * @return load test run model along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listTestRunsNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listTestRunsNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + public Response stopTestRunWithResponse(String testRunId, RequestOptions requestOptions) { + return stopTestRunWithResponseAsync(testRunId, requestOptions).block(); } /** + * List the metric values for a load test run. + * * Get the next page of items. - *

- * Response Body Schema - *

+ *

Response Body Schema

+ * *
{@code
      * {
      *     data (Optional): [
      *          (Optional){
-     *             timestamp: String (Optional)
+     *             timestamp: OffsetDateTime (Optional)
      *             value: Double (Optional)
      *         }
      *     ]
@@ -3898,9 +3177,7 @@ private PagedResponse listTestRunsNextSinglePage(String nextLink, Re
      * }
      * }
* - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @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. @@ -3913,112 +3190,177 @@ private PagedResponse listTestRunsNextSinglePage(String nextLink, Re private Mono> listMetricsNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.listMetricsNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + return FluxUtil + .withContext( + context -> service.listMetricsNext(nextLink, this.getEndpoint(), 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 for the given filters. + * * Get the next page of items. - *

- * Response Body Schema - *

+ *

Response Body Schema

+ * *
{@code
      * {
-     *     data (Optional): [
-     *          (Optional){
-     *             timestamp: String (Optional)
-     *             value: Double (Optional)
+     *     testRunId: String (Required)
+     *     passFailCriteria (Optional): {
+     *         passFailMetrics (Optional): {
+     *             String (Required): {
+     *                 clientMetric: String(response_time_ms/latency/error/requests/requests_per_sec) (Optional)
+     *                 aggregate: String(count/percentage/avg/p50/p75/p90/p95/p96/p97/p98/p99/p99.9/p99.99/min/max) (Optional)
+     *                 condition: String (Optional)
+     *                 requestName: String (Optional)
+     *                 value: Double (Optional)
+     *                 action: String(continue/stop) (Optional)
+     *                 actualValue: Double (Optional)
+     *                 result: String(passed/undetermined/failed) (Optional)
+     *             }
      *         }
-     *     ]
-     *     dimensionValues (Optional): [
-     *          (Optional){
-     *             name: String (Optional)
+     *     }
+     *     autoStopCriteria (Optional): {
+     *         autoStopDisabled: Boolean (Optional)
+     *         errorRate: Double (Optional)
+     *         errorRateTimeWindowInSeconds: Integer (Optional)
+     *     }
+     *     secrets (Optional): {
+     *         String (Required): {
      *             value: String (Optional)
+     *             type: String(AKV_SECRET_URI/SECRET_VALUE) (Optional)
+     *         }
+     *     }
+     *     certificate (Optional): {
+     *         value: String (Optional)
+     *         type: String(AKV_CERT_URI) (Optional)
+     *         name: String (Optional)
+     *     }
+     *     environmentVariables (Optional): {
+     *         String: String (Required)
+     *     }
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
      *         }
      *     ]
+     *     testRunStatistics (Optional): {
+     *         String (Required): {
+     *             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)
+     *             pct75ResTime: Double (Optional)
+     *             pct96ResTime: Double (Optional)
+     *             pct97ResTime: Double (Optional)
+     *             pct98ResTime: Double (Optional)
+     *             pct999ResTime: Double (Optional)
+     *             pct9999ResTime: Double (Optional)
+     *             throughput: Double (Optional)
+     *             receivedKBytesPerSec: Double (Optional)
+     *             sentKBytesPerSec: Double (Optional)
+     *         }
+     *     }
+     *     regionalStatistics (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     *     loadTestConfiguration (Optional): {
+     *         engineInstances: Integer (Optional)
+     *         splitAllCSVs: Boolean (Optional)
+     *         quickStartTest: Boolean (Optional)
+     *         optionalLoadTestConfig (Optional): {
+     *             endpointUrl: String (Optional)
+     *             requestsPerSecond: Integer (Optional)
+     *             maxResponseTimeInMs: Integer (Optional)
+     *             virtualUsers: Integer (Optional)
+     *             rampUpTime: Integer (Optional)
+     *             duration: Integer (Optional)
+     *         }
+     *         regionalLoadTestConfig (Optional): [
+     *              (Optional){
+     *                 engineInstances: int (Optional, Required on create)
+     *                 region: String (Optional, Required on create)
+     *             }
+     *         ]
+     *     }
+     *     testArtifacts (Optional): {
+     *         inputArtifacts (Optional): {
+     *             configFileInfo (Optional): {
+     *                 fileName: String (Required)
+     *                 url: String (Optional)
+     *                 fileType: String(JMX_FILE/USER_PROPERTIES/ADDITIONAL_ARTIFACTS/ZIPPED_ARTIFACTS/URL_TEST_CONFIG/TEST_SCRIPT) (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *                 validationStatus: String(NOT_VALIDATED/VALIDATION_SUCCESS/VALIDATION_FAILURE/VALIDATION_INITIATED/VALIDATION_NOT_REQUIRED) (Optional)
+     *                 validationFailureDetails: String (Optional)
+     *             }
+     *             testScriptFileInfo (Optional): (recursive schema, see testScriptFileInfo above)
+     *             userPropFileInfo (Optional): (recursive schema, see userPropFileInfo above)
+     *             inputArtifactsZipFileInfo (Optional): (recursive schema, see inputArtifactsZipFileInfo above)
+     *             urlTestConfigFileInfo (Optional): (recursive schema, see urlTestConfigFileInfo above)
+     *             additionalFileInfo (Optional): [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *         outputArtifacts (Optional): {
+     *             resultFileInfo (Optional): (recursive schema, see resultFileInfo above)
+     *             logsFileInfo (Optional): (recursive schema, see logsFileInfo above)
+     *             artifactsContainerInfo (Optional): {
+     *                 url: String (Optional)
+     *                 expireDateTime: OffsetDateTime (Optional)
+     *             }
+     *             reportFileInfo (Optional): (recursive schema, see reportFileInfo above)
+     *         }
+     *     }
+     *     testResult: String(PASSED/NOT_APPLICABLE/FAILED) (Optional)
+     *     virtualUsers: Integer (Optional)
+     *     displayName: String (Optional)
+     *     testId: String (Optional)
+     *     description: String (Optional)
+     *     status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Optional)
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     executedDateTime: OffsetDateTime (Optional)
+     *     portalUrl: String (Optional)
+     *     duration: Long (Optional)
+     *     subnetId: String (Optional)
+     *     kind: String(URL/JMX/Locust) (Optional)
+     *     requestDataLevel: String(NONE/ERRORS) (Optional)
+     *     debugLogsEnabled: Boolean (Optional)
+     *     publicIPDisabled: Boolean (Optional)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
      * }
      * }
* - * @param nextLink The URL to get the next list of items - * - * 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 to a metrics query along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listMetricsNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listMetricsNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); - return 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
-     * String
-     * }
- * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @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 metrics dimension values along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return paged collection of TestRun items along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listMetricDimensionValuesNextSinglePageAsync(String nextLink, + private Mono> listTestRunsNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listMetricDimensionValuesNext(nextLink, this.client.getEndpoint(), accept, - requestOptions, context)) + .withContext( + context -> service.listTestRunsNext(nextLink, this.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
-     * String
-     * }
- * - * @param nextLink The URL to get the next list of items - * - * 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 metrics dimension values along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listMetricDimensionValuesNextSinglePage(String nextLink, - RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listMetricDimensionValuesNextSync(nextLink, this.client.getEndpoint(), - accept, requestOptions, Context.NONE); - return 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); diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestingClientImpl.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestingClientImpl.java deleted file mode 100644 index a391923f7629f..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/LoadTestingClientImpl.java +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.developer.loadtesting.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.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 LoadTestRunsImpl object to access its operations. - */ - private final LoadTestRunsImpl loadTestRuns; - - /** - * Gets the LoadTestRunsImpl object to access its operations. - * - * @return the LoadTestRunsImpl object. - */ - public LoadTestRunsImpl getLoadTestRuns() { - return this.loadTestRuns; - } - - /** - * 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()).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.loadTestRuns = new LoadTestRunsImpl(this); - } -} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/TestProfileAdministrationClientImpl.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/TestProfileAdministrationClientImpl.java new file mode 100644 index 0000000000000..4644cc91ccfef --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/TestProfileAdministrationClientImpl.java @@ -0,0 +1,698 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.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.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.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 com.azure.core.util.UrlBuilder; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.developer.loadtesting.LoadTestingServiceVersion; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the TestProfileAdministrationClient type. + */ +public final class TestProfileAdministrationClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final TestProfileAdministrationClientService service; + + /** + */ + private final String endpoint; + + /** + * Gets. + * + * @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; + } + + /** + * Initializes an instance of TestProfileAdministrationClient client. + * + * @param endpoint + * @param serviceVersion Service version. + */ + public TestProfileAdministrationClientImpl(String endpoint, LoadTestingServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of TestProfileAdministrationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint + * @param serviceVersion Service version. + */ + public TestProfileAdministrationClientImpl(HttpPipeline httpPipeline, String endpoint, + LoadTestingServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of TestProfileAdministrationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint + * @param serviceVersion Service version. + */ + public TestProfileAdministrationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint, LoadTestingServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(TestProfileAdministrationClientService.class, this.httpPipeline, + this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for TestProfileAdministrationClient to be used by the proxy service to + * perform REST calls. + */ + @Host("https://{endpoint}") + @ServiceInterface(name = "TestProfileAdministr") + public interface TestProfileAdministrationClientService { + @Patch("/test-profiles/{testProfileId}") + @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> createOrUpdateTestProfile(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testProfileId") String testProfileId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions, Context context); + + @Delete("/test-profiles/{testProfileId}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteTestProfile(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testProfileId") String testProfileId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/test-profiles/{testProfileId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTestProfile(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testProfileId") String testProfileId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/test-profiles") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listTestProfiles(@HostParam("endpoint") String endpoint, + @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> listTestProfilesNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * Create a new test profile or update an existing test profile. + * + * Create a new test profile or update an existing test profile by providing the test profile Id. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param body The resource instance. + * @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 Profile Model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateTestProfileWithResponseAsync(String testProfileId, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createOrUpdateTestProfile(this.getEndpoint(), + this.getServiceVersion().getVersion(), testProfileId, contentType, accept, body, requestOptions, context)); + } + + /** + * Create a new test profile or update an existing test profile. + * + * Create a new test profile or update an existing test profile by providing the test profile Id. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @param body The resource instance. + * @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 Profile Model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateTestProfileWithResponse(String testProfileId, BinaryData body, + RequestOptions requestOptions) { + return createOrUpdateTestProfileWithResponseAsync(testProfileId, body, requestOptions).block(); + } + + /** + * Delete a test profile. + * + * Delete a test profile by its test profile Id. + * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @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> deleteTestProfileWithResponseAsync(String testProfileId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.deleteTestProfile(this.getEndpoint(), + this.getServiceVersion().getVersion(), testProfileId, accept, requestOptions, context)); + } + + /** + * Delete a test profile. + * + * Delete a test profile by its test profile Id. + * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @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 deleteTestProfileWithResponse(String testProfileId, RequestOptions requestOptions) { + return deleteTestProfileWithResponseAsync(testProfileId, requestOptions).block(); + } + + /** + * Get load test profile details. + * + * Get load test profile details by test profile Id. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @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 profile details. + * + * Get load test profile details by test profile Id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestProfileWithResponseAsync(String testProfileId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getTestProfile(this.getEndpoint(), + this.getServiceVersion().getVersion(), testProfileId, accept, requestOptions, context)); + } + + /** + * Get load test profile details. + * + * Get load test profile details by test profile Id. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileId Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, + * underscore or hyphen characters. + * @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 profile details. + * + * Get load test profile details by test profile Id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestProfileWithResponse(String testProfileId, RequestOptions requestOptions) { + return getTestProfileWithResponseAsync(testProfileId, requestOptions).block(); + } + + /** + * List test profiles. + * + * Get all test profiles for the given filters. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoMaximum number of results to include in a single + * response.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) + * of the last updated time range to filter test profiles.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of + * the last updated time range to filter test profiles.
testProfileIdsStringNoComma separated list of IDs of the test profiles to + * filter.
testIdsStringNoComma separated list IDs of the tests which should be + * associated with the test profiles to fetch.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: 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 paged collection of TestProfile items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTestProfilesSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listTestProfiles(this.getEndpoint(), this.getServiceVersion().getVersion(), + accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List test profiles. + * + * Get all test profiles for the given filters. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoMaximum number of results to include in a single + * response.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) + * of the last updated time range to filter test profiles.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of + * the last updated time range to filter test profiles.
testProfileIdsStringNoComma separated list of IDs of the test profiles to + * filter.
testIdsStringNoComma separated list IDs of the tests which should be + * associated with the test profiles to fetch.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: 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 paged collection of TestProfile items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestProfilesAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listTestProfilesSinglePageAsync(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listTestProfilesNextSinglePageAsync(nextLink, requestOptionsLocal); + }); + } + + /** + * List test profiles. + * + * Get all test profiles for the given filters. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoMaximum number of results to include in a single + * response.
lastModifiedStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) + * of the last updated time range to filter test profiles.
lastModifiedEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of + * the last updated time range to filter test profiles.
testProfileIdsStringNoComma separated list of IDs of the test profiles to + * filter.
testIdsStringNoComma separated list IDs of the tests which should be + * associated with the test profiles to fetch.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: 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 paged collection of TestProfile items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestProfiles(RequestOptions requestOptions) { + return new PagedIterable<>(listTestProfilesAsync(requestOptions)); + } + + /** + * List test profiles. + * + * Get the next page of items. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param nextLink The URL to get the next list of items. + * @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 paged collection of TestProfile items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTestProfilesNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listTestProfilesNext(nextLink, this.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/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/TestProfileRunClientImpl.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/TestProfileRunClientImpl.java new file mode 100644 index 0000000000000..2ab8a4284b451 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/TestProfileRunClientImpl.java @@ -0,0 +1,1128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.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 com.azure.core.util.UrlBuilder; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.developer.loadtesting.LoadTestingServiceVersion; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the TestProfileRunClient type. + */ +public final class TestProfileRunClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final TestProfileRunClientService service; + + /** + */ + private final String endpoint; + + /** + * Gets. + * + * @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; + } + + /** + * Initializes an instance of TestProfileRunClient client. + * + * @param endpoint + * @param serviceVersion Service version. + */ + public TestProfileRunClientImpl(String endpoint, LoadTestingServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of TestProfileRunClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint + * @param serviceVersion Service version. + */ + public TestProfileRunClientImpl(HttpPipeline httpPipeline, String endpoint, + LoadTestingServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of TestProfileRunClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint + * @param serviceVersion Service version. + */ + public TestProfileRunClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + LoadTestingServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service + = RestProxy.create(TestProfileRunClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for TestProfileRunClient to be used by the proxy service to perform REST + * calls. + */ + @Host("https://{endpoint}") + @ServiceInterface(name = "TestProfileRunClient") + public interface TestProfileRunClientService { + @Patch("/test-profile-runs/{testProfileRunId}") + @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> createOrUpdateTestProfileRun(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testProfileRunId") String testProfileRunId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions, Context context); + + @Delete("/test-profile-runs/{testProfileRunId}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteTestProfileRun(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testProfileRunId") String testProfileRunId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/test-profile-runs/{testProfileRunId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTestProfileRun(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testProfileRunId") String testProfileRunId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/test-profile-runs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listTestProfileRuns(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/test-profile-runs/{testProfileRunId}: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> stopTestProfileRun(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("testProfileRunId") String testProfileRunId, + @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> listTestProfileRunsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * Create and start a new test profile run. + * + * Create and start a new test profile run with the given test profile run Id. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body The resource instance. + * @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 Profile Run model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateTestProfileRunWithResponseAsync(String testProfileRunId, + BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.createOrUpdateTestProfileRun(this.getEndpoint(), this.getServiceVersion().getVersion(), + testProfileRunId, contentType, accept, body, requestOptions, context)); + } + + /** + * Create and start a new test profile run. + * + * Create and start a new test profile run with the given test profile run Id. + *

Request Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @param body The resource instance. + * @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 Profile Run model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateTestProfileRunWithResponse(String testProfileRunId, BinaryData body, + RequestOptions requestOptions) { + return createOrUpdateTestProfileRunWithResponseAsync(testProfileRunId, body, requestOptions).block(); + } + + /** + * Delete an existing load test profile run. + * + * Delete an existing load test profile run by providing the test profile run Id. + * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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> deleteTestProfileRunWithResponseAsync(String testProfileRunId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.deleteTestProfileRun(this.getEndpoint(), + this.getServiceVersion().getVersion(), testProfileRunId, accept, requestOptions, context)); + } + + /** + * Delete an existing load test profile run. + * + * Delete an existing load test profile run by providing the test profile run Id. + * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 deleteTestProfileRunWithResponse(String testProfileRunId, RequestOptions requestOptions) { + return deleteTestProfileRunWithResponseAsync(testProfileRunId, requestOptions).block(); + } + + /** + * Get test profile run details. + * + * Get test profile run details by test profile run Id. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 profile run details. + * + * Get test profile run details by test profile run Id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTestProfileRunWithResponseAsync(String testProfileRunId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getTestProfileRun(this.getEndpoint(), + this.getServiceVersion().getVersion(), testProfileRunId, accept, requestOptions, context)); + } + + /** + * Get test profile run details. + * + * Get test profile run details by test profile run Id. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 profile run details. + * + * Get test profile run details by test profile run Id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestProfileRunWithResponse(String testProfileRunId, RequestOptions requestOptions) { + return getTestProfileRunWithResponseAsync(testProfileRunId, requestOptions).block(); + } + + /** + * List test profile runs. + * + * Get all test profile runs for the given filters. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoMaximum number of results to include in a single + * response.
minStartDateTimeOffsetDateTimeNoMinimum Start DateTime(RFC 3339 literal + * format) of the test profile runs to filter on.
maxStartDateTimeOffsetDateTimeNoMaximum Start DateTime(RFC 3339 literal + * format) of the test profile runs to filter on.
minEndDateTimeOffsetDateTimeNoMinimum End DateTime(RFC 3339 literal format) of + * the test profile runs to filter on.
maxEndDateTimeOffsetDateTimeNoMaximum End DateTime(RFC 3339 literal format) of + * the test profile runs to filter on.
createdDateStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) of + * the created time range to filter test profile runs.
createdDateEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of the + * created time range to filter test profile runs.
testProfileRunIdsStringNoComma separated list of IDs of the test profile runs + * to filter.
testProfileIdsStringNoComma separated IDs of the test profiles which should be + * associated with the test profile runs to fetch.
statusesStringNoComma separated list of Statuses of the test profile runs to + * filter.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: 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 paged collection of TestProfileRun items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTestProfileRunsSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listTestProfileRuns(this.getEndpoint(), + this.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List test profile runs. + * + * Get all test profile runs for the given filters. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoMaximum number of results to include in a single + * response.
minStartDateTimeOffsetDateTimeNoMinimum Start DateTime(RFC 3339 literal + * format) of the test profile runs to filter on.
maxStartDateTimeOffsetDateTimeNoMaximum Start DateTime(RFC 3339 literal + * format) of the test profile runs to filter on.
minEndDateTimeOffsetDateTimeNoMinimum End DateTime(RFC 3339 literal format) of + * the test profile runs to filter on.
maxEndDateTimeOffsetDateTimeNoMaximum End DateTime(RFC 3339 literal format) of + * the test profile runs to filter on.
createdDateStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) of + * the created time range to filter test profile runs.
createdDateEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of the + * created time range to filter test profile runs.
testProfileRunIdsStringNoComma separated list of IDs of the test profile runs + * to filter.
testProfileIdsStringNoComma separated IDs of the test profiles which should be + * associated with the test profile runs to fetch.
statusesStringNoComma separated list of Statuses of the test profile runs to + * filter.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: 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 paged collection of TestProfileRun items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTestProfileRunsAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listTestProfileRunsSinglePageAsync(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listTestProfileRunsNextSinglePageAsync(nextLink, requestOptionsLocal); + }); + } + + /** + * List test profile runs. + * + * Get all test profile runs for the given filters. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoMaximum number of results to include in a single + * response.
minStartDateTimeOffsetDateTimeNoMinimum Start DateTime(RFC 3339 literal + * format) of the test profile runs to filter on.
maxStartDateTimeOffsetDateTimeNoMaximum Start DateTime(RFC 3339 literal + * format) of the test profile runs to filter on.
minEndDateTimeOffsetDateTimeNoMinimum End DateTime(RFC 3339 literal format) of + * the test profile runs to filter on.
maxEndDateTimeOffsetDateTimeNoMaximum End DateTime(RFC 3339 literal format) of + * the test profile runs to filter on.
createdDateStartTimeOffsetDateTimeNoStart DateTime(RFC 3339 literal format) of + * the created time range to filter test profile runs.
createdDateEndTimeOffsetDateTimeNoEnd DateTime(RFC 3339 literal format) of the + * created time range to filter test profile runs.
testProfileRunIdsStringNoComma separated list of IDs of the test profile runs + * to filter.
testProfileIdsStringNoComma separated IDs of the test profiles which should be + * associated with the test profile runs to fetch.
statusesStringNoComma separated list of Statuses of the test profile runs to + * filter.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: 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 paged collection of TestProfileRun items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTestProfileRuns(RequestOptions requestOptions) { + return new PagedIterable<>(listTestProfileRunsAsync(requestOptions)); + } + + /** + * Stop test profile run. + * + * Stop test profile run for the given test profile run Id. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 Profile Run model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stopTestProfileRunWithResponseAsync(String testProfileRunId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.stopTestProfileRun(this.getEndpoint(), + this.getServiceVersion().getVersion(), testProfileRunId, accept, requestOptions, context)); + } + + /** + * Stop test profile run. + * + * Stop test profile run for the given test profile run Id. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param testProfileRunId Unique identifier for the test profile run, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * @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 Profile Run model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stopTestProfileRunWithResponse(String testProfileRunId, RequestOptions requestOptions) { + return stopTestProfileRunWithResponseAsync(testProfileRunId, requestOptions).block(); + } + + /** + * List test profile runs. + * + * Get the next page of items. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     testProfileRunId: String (Required)
+     *     displayName: String (Optional)
+     *     description: String (Optional)
+     *     testProfileId: String (Optional)
+     *     targetResourceId: String (Optional)
+     *     targetResourceConfigurations (Optional): {
+     *         kind: String(FunctionsFlexConsumption) (Required)
+     *     }
+     *     status: String(ACCEPTED/NOTSTARTED/EXECUTING/DONE/CANCELLING/CANCELLED/FAILED) (Optional)
+     *     errorDetails (Optional): [
+     *          (Optional){
+     *             message: String (Optional)
+     *         }
+     *     ]
+     *     startDateTime: OffsetDateTime (Optional)
+     *     endDateTime: OffsetDateTime (Optional)
+     *     durationInSeconds: Long (Optional)
+     *     testRunDetails (Optional): {
+     *         String (Required): {
+     *             status: String(ACCEPTED/NOTSTARTED/PROVISIONING/PROVISIONED/CONFIGURING/CONFIGURED/EXECUTING/EXECUTED/DEPROVISIONING/DEPROVISIONED/DONE/CANCELLING/CANCELLED/FAILED/VALIDATION_SUCCESS/VALIDATION_FAILURE) (Required)
+     *             configurationId: String (Required)
+     *             properties (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     recommendations (Optional): [
+     *          (Optional){
+     *             category: String(ThroughputOptimized/CostOptimized) (Required)
+     *             configurations (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *     ]
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     lastModifiedDateTime: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     * }
+     * }
+ * + * @param nextLink The URL to get the next list of items. + * @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 paged collection of TestProfileRun items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTestProfileRunsNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listTestProfileRunsNext(nextLink, this.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/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/package-info.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/package-info.java index 918f9c45b17bd..bb46a586166a2 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/package-info.java +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/implementation/package-info.java @@ -1,8 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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 containing the implementations for LoadTesting. + * 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/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/AggregationType.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/AggregationType.java new file mode 100644 index 0000000000000..73c7e3a8636f3 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/AggregationType.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Aggregation type. + */ +public final class AggregationType extends ExpandableStringEnum { + /** + * Average value. + */ + @Generated + public static final AggregationType AVERAGE = fromString("Average"); + + /** + * Total count. + */ + @Generated + public static final AggregationType COUNT = fromString("Count"); + + /** + * Aggregation will be average in this case. + */ + @Generated + public static final AggregationType NONE = fromString("None"); + + /** + * Total sum. + */ + @Generated + public static final AggregationType TOTAL = fromString("Total"); + + /** + * 75th percentile. + */ + @Generated + public static final AggregationType PERCENTILE75 = fromString("Percentile75"); + + /** + * 90th percentile. + */ + @Generated + public static final AggregationType PERCENTILE90 = fromString("Percentile90"); + + /** + * 95th percentile. + */ + @Generated + public static final AggregationType PERCENTILE95 = fromString("Percentile95"); + + /** + * 96th percentile. + */ + @Generated + public static final AggregationType PERCENTILE96 = fromString("Percentile96"); + + /** + * 97th percentile. + */ + @Generated + public static final AggregationType PERCENTILE97 = fromString("Percentile97"); + + /** + * 98th percentile. + */ + @Generated + public static final AggregationType PERCENTILE98 = fromString("Percentile98"); + + /** + * 99th percentile. + */ + @Generated + public static final AggregationType PERCENTILE99 = fromString("Percentile99"); + + /** + * 99.9th percentile. + */ + @Generated + public static final AggregationType PERCENTILE999 = fromString("Percentile999"); + + /** + * 99.99th percentile. + */ + @Generated + public static final AggregationType PERCENTILE9999 = fromString("Percentile9999"); + + /** + * Creates a new instance of AggregationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AggregationType() { + } + + /** + * Creates or finds a AggregationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AggregationType. + */ + @Generated + public static AggregationType fromString(String name) { + return fromString(name, AggregationType.class); + } + + /** + * Gets known AggregationType values. + * + * @return known AggregationType values. + */ + @Generated + public static Collection values() { + return values(AggregationType.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/AppComponent.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/AppComponent.java new file mode 100644 index 0000000000000..2c354037ac4f9 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/AppComponent.java @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * An Azure resource object (Refer azure generic resource model + * :https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id#genericresource). + */ +@Fluent +public final class AppComponent implements JsonSerializable { + /* + * fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName} + */ + @Generated + private String resourceId; + + /* + * Azure resource name, required while creating the app component. + */ + @Generated + private String resourceName; + + /* + * Azure resource type, required while creating the app component. + */ + @Generated + private String resourceType; + + /* + * Azure resource display name + */ + @Generated + private String displayName; + + /* + * Resource group name of the Azure resource + */ + @Generated + private String resourceGroup; + + /* + * Subscription Id of the Azure resource + */ + @Generated + private String subscriptionId; + + /* + * Kind of Azure resource type + */ + @Generated + private String kind; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setAppComponentAccessor(new JsonMergePatchHelper.AppComponentAccessor() { + @Override + public AppComponent prepareModelForJsonMergePatch(AppComponent model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(AppComponent model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of AppComponent class. + */ + @Generated + public AppComponent() { + } + + /** + * Get the resourceId property: fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. + * + * @return the resourceId value. + */ + @Generated + public String getResourceId() { + return this.resourceId; + } + + /** + * Get the resourceName property: Azure resource name, required while creating the app component. + * + * @return the resourceName value. + */ + @Generated + public String getResourceName() { + return this.resourceName; + } + + /** + * Set the resourceName property: Azure resource name, required while creating the app component. + *

Required when create the resource.

+ * + * @param resourceName the resourceName value to set. + * @return the AppComponent object itself. + */ + @Generated + public AppComponent setResourceName(String resourceName) { + this.resourceName = resourceName; + this.updatedProperties.add("resourceName"); + return this; + } + + /** + * Get the resourceType property: Azure resource type, required while creating the app component. + * + * @return the resourceType value. + */ + @Generated + public String getResourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: Azure resource type, required while creating the app component. + *

Required when create the resource.

+ * + * @param resourceType the resourceType value to set. + * @return the AppComponent object itself. + */ + @Generated + public AppComponent setResourceType(String resourceType) { + this.resourceType = resourceType; + this.updatedProperties.add("resourceType"); + return this; + } + + /** + * Get the displayName property: Azure resource display name. + * + * @return the displayName value. + */ + @Generated + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: Azure resource display name. + * + * @param displayName the displayName value to set. + * @return the AppComponent object itself. + */ + @Generated + public AppComponent setDisplayName(String displayName) { + this.displayName = displayName; + this.updatedProperties.add("displayName"); + return this; + } + + /** + * Get the resourceGroup property: Resource group name of the Azure resource. + * + * @return the resourceGroup value. + */ + @Generated + public String getResourceGroup() { + return this.resourceGroup; + } + + /** + * Get the subscriptionId property: Subscription Id of the Azure resource. + * + * @return the subscriptionId value. + */ + @Generated + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * Get the kind property: Kind of Azure resource type. + * + * @return the kind value. + */ + @Generated + public String getKind() { + return this.kind; + } + + /** + * Set the kind property: Kind of Azure resource type. + * + * @param kind the kind value to set. + * @return the AppComponent object itself. + */ + @Generated + public AppComponent setKind(String kind) { + this.kind = kind; + this.updatedProperties.add("kind"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceName", this.resourceName); + jsonWriter.writeStringField("resourceType", this.resourceType); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("resourceName")) { + if (this.resourceName == null) { + jsonWriter.writeNullField("resourceName"); + } else { + jsonWriter.writeStringField("resourceName", this.resourceName); + } + } + if (updatedProperties.contains("resourceType")) { + if (this.resourceType == null) { + jsonWriter.writeNullField("resourceType"); + } else { + jsonWriter.writeStringField("resourceType", this.resourceType); + } + } + if (updatedProperties.contains("displayName")) { + if (this.displayName == null) { + jsonWriter.writeNullField("displayName"); + } else { + jsonWriter.writeStringField("displayName", this.displayName); + } + } + if (updatedProperties.contains("kind")) { + if (this.kind == null) { + jsonWriter.writeNullField("kind"); + } else { + jsonWriter.writeStringField("kind", this.kind); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AppComponent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AppComponent if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AppComponent. + */ + @Generated + public static AppComponent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AppComponent deserializedAppComponent = new AppComponent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceId".equals(fieldName)) { + deserializedAppComponent.resourceId = reader.getString(); + } else if ("resourceName".equals(fieldName)) { + deserializedAppComponent.resourceName = reader.getString(); + } else if ("resourceType".equals(fieldName)) { + deserializedAppComponent.resourceType = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedAppComponent.displayName = reader.getString(); + } else if ("resourceGroup".equals(fieldName)) { + deserializedAppComponent.resourceGroup = reader.getString(); + } else if ("subscriptionId".equals(fieldName)) { + deserializedAppComponent.subscriptionId = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedAppComponent.kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAppComponent; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/ArtifactsContainerInfo.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/ArtifactsContainerInfo.java new file mode 100644 index 0000000000000..64a5de3d762eb --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/ArtifactsContainerInfo.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Artifacts container info. + */ +@Immutable +public final class ArtifactsContainerInfo implements JsonSerializable { + /* + * This is a SAS URI to an Azure Storage Container that contains the test run artifacts. + */ + @Generated + private String url; + + /* + * Expiry time of the container (RFC 3339 literal format) + */ + @Generated + private OffsetDateTime expireDateTime; + + /** + * Creates an instance of ArtifactsContainerInfo class. + */ + @Generated + private ArtifactsContainerInfo() { + } + + /** + * Get the url property: This is a SAS URI to an Azure Storage Container that contains the test run artifacts. + * + * @return the url value. + */ + @Generated + public String getUrl() { + return this.url; + } + + /** + * Get the expireDateTime property: Expiry time of the container (RFC 3339 literal format). + * + * @return the expireDateTime value. + */ + @Generated + public OffsetDateTime getExpireDateTime() { + return this.expireDateTime; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("url", this.url); + jsonWriter.writeStringField("expireDateTime", + this.expireDateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expireDateTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ArtifactsContainerInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ArtifactsContainerInfo if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ArtifactsContainerInfo. + */ + @Generated + public static ArtifactsContainerInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ArtifactsContainerInfo deserializedArtifactsContainerInfo = new ArtifactsContainerInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("url".equals(fieldName)) { + deserializedArtifactsContainerInfo.url = reader.getString(); + } else if ("expireDateTime".equals(fieldName)) { + deserializedArtifactsContainerInfo.expireDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedArtifactsContainerInfo; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/AutoStopCriteria.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/AutoStopCriteria.java new file mode 100644 index 0000000000000..79fe9840abbe9 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/AutoStopCriteria.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Auto stop criteria for a test. This will automatically stop a load test if the error percentage is high for a certain + * time window. + */ +@Fluent +public final class AutoStopCriteria implements JsonSerializable { + /* + * Whether auto-stop should be disabled. The default value is false. + */ + @Generated + private Boolean autoStopDisabled; + + /* + * Threshold percentage of errors on which test run should be automatically stopped. Allowed values are in range of + * 0.0-100.0 + */ + @Generated + private Double errorRate; + + /* + * Time window during which the error percentage should be evaluated in seconds. + */ + @Generated + private Integer errorRateTimeWindowInSeconds; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setAutoStopCriteriaAccessor(new JsonMergePatchHelper.AutoStopCriteriaAccessor() { + @Override + public AutoStopCriteria prepareModelForJsonMergePatch(AutoStopCriteria model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(AutoStopCriteria model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of AutoStopCriteria class. + */ + @Generated + public AutoStopCriteria() { + } + + /** + * Get the autoStopDisabled property: Whether auto-stop should be disabled. The default value is false. + * + * @return the autoStopDisabled value. + */ + @Generated + public Boolean isAutoStopDisabled() { + return this.autoStopDisabled; + } + + /** + * Set the autoStopDisabled property: Whether auto-stop should be disabled. The default value is false. + * + * @param autoStopDisabled the autoStopDisabled value to set. + * @return the AutoStopCriteria object itself. + */ + @Generated + public AutoStopCriteria setAutoStopDisabled(Boolean autoStopDisabled) { + this.autoStopDisabled = autoStopDisabled; + this.updatedProperties.add("autoStopDisabled"); + return this; + } + + /** + * Get the errorRate property: Threshold percentage of errors on which test run should be automatically stopped. + * Allowed values are in range of 0.0-100.0. + * + * @return the errorRate value. + */ + @Generated + public Double getErrorRate() { + return this.errorRate; + } + + /** + * Set the errorRate property: Threshold percentage of errors on which test run should be automatically stopped. + * Allowed values are in range of 0.0-100.0. + * + * @param errorRate the errorRate value to set. + * @return the AutoStopCriteria object itself. + */ + @Generated + public AutoStopCriteria setErrorRate(Double errorRate) { + this.errorRate = errorRate; + this.updatedProperties.add("errorRate"); + return this; + } + + /** + * Get the errorRateTimeWindowInSeconds property: Time window during which the error percentage should be evaluated + * in seconds. + * + * @return the errorRateTimeWindowInSeconds value. + */ + @Generated + public Integer getErrorRateTimeWindowInSeconds() { + return this.errorRateTimeWindowInSeconds; + } + + /** + * Set the errorRateTimeWindowInSeconds property: Time window during which the error percentage should be evaluated + * in seconds. + * + * @param errorRateTimeWindowInSeconds the errorRateTimeWindowInSeconds value to set. + * @return the AutoStopCriteria object itself. + */ + @Generated + public AutoStopCriteria setErrorRateTimeWindowInSeconds(Integer errorRateTimeWindowInSeconds) { + this.errorRateTimeWindowInSeconds = errorRateTimeWindowInSeconds; + this.updatedProperties.add("errorRateTimeWindowInSeconds"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("autoStopDisabled", this.autoStopDisabled); + jsonWriter.writeNumberField("errorRate", this.errorRate); + jsonWriter.writeNumberField("errorRateTimeWindowInSeconds", this.errorRateTimeWindowInSeconds); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("autoStopDisabled")) { + if (this.autoStopDisabled == null) { + jsonWriter.writeNullField("autoStopDisabled"); + } else { + jsonWriter.writeBooleanField("autoStopDisabled", this.autoStopDisabled); + } + } + if (updatedProperties.contains("errorRate")) { + if (this.errorRate == null) { + jsonWriter.writeNullField("errorRate"); + } else { + jsonWriter.writeNumberField("errorRate", this.errorRate); + } + } + if (updatedProperties.contains("errorRateTimeWindowInSeconds")) { + if (this.errorRateTimeWindowInSeconds == null) { + jsonWriter.writeNullField("errorRateTimeWindowInSeconds"); + } else { + jsonWriter.writeNumberField("errorRateTimeWindowInSeconds", this.errorRateTimeWindowInSeconds); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutoStopCriteria from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutoStopCriteria if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AutoStopCriteria. + */ + @Generated + public static AutoStopCriteria fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutoStopCriteria deserializedAutoStopCriteria = new AutoStopCriteria(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("autoStopDisabled".equals(fieldName)) { + deserializedAutoStopCriteria.autoStopDisabled = reader.getNullable(JsonReader::getBoolean); + } else if ("errorRate".equals(fieldName)) { + deserializedAutoStopCriteria.errorRate = reader.getNullable(JsonReader::getDouble); + } else if ("errorRateTimeWindowInSeconds".equals(fieldName)) { + deserializedAutoStopCriteria.errorRateTimeWindowInSeconds = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedAutoStopCriteria; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/CertificateMetadata.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/CertificateMetadata.java new file mode 100644 index 0000000000000..11c6a09d15b42 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/CertificateMetadata.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Certificates metadata. + */ +@Fluent +public final class CertificateMetadata implements JsonSerializable { + /* + * The value of the certificate for respective type + */ + @Generated + private String value; + + /* + * Type of certificate + */ + @Generated + private CertificateType type; + + /* + * Name of the certificate. + */ + @Generated + private String name; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setCertificateMetadataAccessor(new JsonMergePatchHelper.CertificateMetadataAccessor() { + @Override + public CertificateMetadata prepareModelForJsonMergePatch(CertificateMetadata model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(CertificateMetadata model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of CertificateMetadata class. + */ + @Generated + public CertificateMetadata() { + } + + /** + * Get the value property: The value of the certificate for respective type. + * + * @return the value value. + */ + @Generated + public String getValue() { + return this.value; + } + + /** + * Set the value property: The value of the certificate for respective type. + * + * @param value the value value to set. + * @return the CertificateMetadata object itself. + */ + @Generated + public CertificateMetadata setValue(String value) { + this.value = value; + this.updatedProperties.add("value"); + return this; + } + + /** + * Get the type property: Type of certificate. + * + * @return the type value. + */ + @Generated + public CertificateType getType() { + return this.type; + } + + /** + * Set the type property: Type of certificate. + * + * @param type the type value to set. + * @return the CertificateMetadata object itself. + */ + @Generated + public CertificateMetadata setType(CertificateType type) { + this.type = type; + this.updatedProperties.add("type"); + return this; + } + + /** + * Get the name property: Name of the certificate. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: Name of the certificate. + * + * @param name the name value to set. + * @return the CertificateMetadata object itself. + */ + @Generated + public CertificateMetadata setName(String name) { + this.name = name; + this.updatedProperties.add("name"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", this.value); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("value")) { + if (this.value == null) { + jsonWriter.writeNullField("value"); + } else { + jsonWriter.writeStringField("value", this.value); + } + } + if (updatedProperties.contains("type")) { + if (this.type == null) { + jsonWriter.writeNullField("type"); + } else { + jsonWriter.writeStringField("type", this.type.toString()); + } + } + if (updatedProperties.contains("name")) { + if (this.name == null) { + jsonWriter.writeNullField("name"); + } else { + jsonWriter.writeStringField("name", this.name); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CertificateMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CertificateMetadata if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CertificateMetadata. + */ + @Generated + public static CertificateMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CertificateMetadata deserializedCertificateMetadata = new CertificateMetadata(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedCertificateMetadata.value = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCertificateMetadata.type = CertificateType.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedCertificateMetadata.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCertificateMetadata; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/CertificateType.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/CertificateType.java new file mode 100644 index 0000000000000..87e49e8ebc8e5 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/CertificateType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Types of certificates supported. + */ +public final class CertificateType extends ExpandableStringEnum { + /** + * If the certificate is stored in an Azure Key Vault. + */ + @Generated + public static final CertificateType AKV_CERT_URI = fromString("AKV_CERT_URI"); + + /** + * Creates a new instance of CertificateType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public CertificateType() { + } + + /** + * Creates or finds a CertificateType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CertificateType. + */ + @Generated + public static CertificateType fromString(String name) { + return fromString(name, CertificateType.class); + } + + /** + * Gets known CertificateType values. + * + * @return known CertificateType values. + */ + @Generated + public static Collection values() { + return values(CertificateType.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/DimensionFilter.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/DimensionFilter.java new file mode 100644 index 0000000000000..8743a3a6383e3 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/DimensionFilter.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Dimension name and values to filter. + */ +@Fluent +public final class DimensionFilter implements JsonSerializable { + /* + * The dimension name + */ + @Generated + private String name; + + /* + * The dimension values. Maximum values can be 20. + */ + @Generated + private List values; + + /** + * Creates an instance of DimensionFilter class. + */ + @Generated + public DimensionFilter() { + } + + /** + * Get the name property: The dimension name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The dimension name. + * + * @param name the name value to set. + * @return the DimensionFilter object itself. + */ + @Generated + public DimensionFilter setName(String name) { + this.name = name; + return this; + } + + /** + * Get the values property: The dimension values. Maximum values can be 20. + * + * @return the values value. + */ + @Generated + public List getValues() { + return this.values; + } + + /** + * Set the values property: The dimension values. Maximum values can be 20. + * + * @param values the values value to set. + * @return the DimensionFilter object itself. + */ + @Generated + public DimensionFilter setValues(List values) { + this.values = values; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeArrayField("values", this.values, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DimensionFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DimensionFilter if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DimensionFilter. + */ + @Generated + public static DimensionFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DimensionFilter deserializedDimensionFilter = new DimensionFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedDimensionFilter.name = reader.getString(); + } else if ("values".equals(fieldName)) { + List values = reader.readArray(reader1 -> reader1.getString()); + deserializedDimensionFilter.values = values; + } else { + reader.skipChildren(); + } + } + + return deserializedDimensionFilter; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/DimensionValue.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/DimensionValue.java new file mode 100644 index 0000000000000..9e4c2f005480a --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/DimensionValue.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a metric dimension value. + */ +@Immutable +public final class DimensionValue implements JsonSerializable { + /* + * The name of the dimension. + */ + @Generated + private String name; + + /* + * The value of the dimension. + */ + @Generated + private String value; + + /** + * Creates an instance of DimensionValue class. + */ + @Generated + private DimensionValue() { + } + + /** + * Get the name property: The name of the dimension. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the value property: The value of the dimension. + * + * @return the value value. + */ + @Generated + public String getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DimensionValue from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DimensionValue if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DimensionValue. + */ + @Generated + public static DimensionValue fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DimensionValue deserializedDimensionValue = new DimensionValue(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedDimensionValue.name = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedDimensionValue.value = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDimensionValue; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/DimensionValueList.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/DimensionValueList.java new file mode 100644 index 0000000000000..83e5813dfb054 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/DimensionValueList.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Metrics dimension values. + */ +@Immutable +public final class DimensionValueList implements JsonSerializable { + /* + * The dimension name + */ + @Generated + private String name; + + /* + * The dimension value + */ + @Generated + private List value; + + /* + * Link for the next set of values in case of paginated results, if applicable. + */ + @Generated + private String nextLink; + + /** + * Creates an instance of DimensionValueList class. + */ + @Generated + private DimensionValueList() { + } + + /** + * Get the name property: The dimension name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the value property: The dimension value. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } + + /** + * Get the nextLink property: Link for the next set of values in case of paginated results, if applicable. + * + * @return the nextLink value. + */ + @Generated + public String getNextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DimensionValueList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DimensionValueList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DimensionValueList. + */ + @Generated + public static DimensionValueList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DimensionValueList deserializedDimensionValueList = new DimensionValueList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedDimensionValueList.name = reader.getString(); + } else if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> reader1.getString()); + deserializedDimensionValueList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDimensionValueList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDimensionValueList; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/ErrorDetails.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/ErrorDetails.java new file mode 100644 index 0000000000000..dcd2d2cda2d60 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/ErrorDetails.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Error details if there is any failure in load test run. + */ +@Immutable +public final class ErrorDetails implements JsonSerializable { + /* + * Error details in case test run was not successfully run. + */ + @Generated + private String message; + + /** + * Creates an instance of ErrorDetails class. + */ + @Generated + private ErrorDetails() { + } + + /** + * Get the message property: Error details in case test run was not successfully run. + * + * @return the message value. + */ + @Generated + public String getMessage() { + return this.message; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ErrorDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ErrorDetails if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ErrorDetails. + */ + @Generated + public static ErrorDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ErrorDetails deserializedErrorDetails = new ErrorDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("message".equals(fieldName)) { + deserializedErrorDetails.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedErrorDetails; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/FileStatus.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/FileStatus.java new file mode 100644 index 0000000000000..ffe858eeef7f4 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/FileStatus.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * File status. + */ +public final class FileStatus extends ExpandableStringEnum { + /** + * File is not validated. + */ + @Generated + public static final FileStatus NOT_VALIDATED = fromString("NOT_VALIDATED"); + + /** + * File is validated. + */ + @Generated + public static final FileStatus VALIDATION_SUCCESS = fromString("VALIDATION_SUCCESS"); + + /** + * File validation is failed. + */ + @Generated + public static final FileStatus VALIDATION_FAILURE = fromString("VALIDATION_FAILURE"); + + /** + * File validation is in progress. + */ + @Generated + public static final FileStatus VALIDATION_INITIATED = fromString("VALIDATION_INITIATED"); + + /** + * Validation is not required. + */ + @Generated + public static final FileStatus VALIDATION_NOT_REQUIRED = fromString("VALIDATION_NOT_REQUIRED"); + + /** + * Creates a new instance of FileStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public FileStatus() { + } + + /** + * Creates or finds a FileStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding FileStatus. + */ + @Generated + public static FileStatus fromString(String name) { + return fromString(name, FileStatus.class); + } + + /** + * Gets known FileStatus values. + * + * @return known FileStatus values. + */ + @Generated + public static Collection values() { + return values(FileStatus.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/FileType.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/FileType.java new file mode 100644 index 0000000000000..4b994d4d53c4d --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/FileType.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Types of file supported. + */ +public final class FileType extends ExpandableStringEnum { + /** + * If the file is a JMX script. + */ + @Generated + public static final FileType JMX_FILE = fromString("JMX_FILE"); + + /** + * If the file is a user properties file. + */ + @Generated + public static final FileType USER_PROPERTIES = fromString("USER_PROPERTIES"); + + /** + * If the file is not among any of the other supported file types. + */ + @Generated + public static final FileType ADDITIONAL_ARTIFACTS = fromString("ADDITIONAL_ARTIFACTS"); + + /** + * If the file is a compressed archive containing a collection of various artifacts or resources. + */ + @Generated + public static final FileType ZIPPED_ARTIFACTS = fromString("ZIPPED_ARTIFACTS"); + + /** + * If the file is a JSON config file to define the requests for a URL test. + */ + @Generated + public static final FileType URL_TEST_CONFIG = fromString("URL_TEST_CONFIG"); + + /** + * If the file is a test script. + */ + @Generated + public static final FileType TEST_SCRIPT = fromString("TEST_SCRIPT"); + + /** + * Creates a new instance of FileType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public FileType() { + } + + /** + * Creates or finds a FileType from its string representation. + * + * @param name a name to look for. + * @return the corresponding FileType. + */ + @Generated + public static FileType fromString(String name) { + return fromString(name, FileType.class); + } + + /** + * Gets known FileType values. + * + * @return known FileType values. + */ + @Generated + public static Collection values() { + return values(FileType.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/FunctionFlexConsumptionResourceConfiguration.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/FunctionFlexConsumptionResourceConfiguration.java new file mode 100644 index 0000000000000..26c583c77b7b5 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/FunctionFlexConsumptionResourceConfiguration.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Resource configuration instance for a Flex Consumption based Azure Function App. + */ +@Fluent +public final class FunctionFlexConsumptionResourceConfiguration + implements JsonSerializable { + /* + * Memory size of the instance. Supported values are 2048, 4096. + */ + @Generated + private long instanceMemoryMB; + + /* + * HTTP Concurrency for the function app. + */ + @Generated + private long httpConcurrency; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setFunctionFlexConsumptionResourceConfigurationAccessor( + new JsonMergePatchHelper.FunctionFlexConsumptionResourceConfigurationAccessor() { + @Override + public FunctionFlexConsumptionResourceConfiguration prepareModelForJsonMergePatch( + FunctionFlexConsumptionResourceConfiguration model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(FunctionFlexConsumptionResourceConfiguration model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of FunctionFlexConsumptionResourceConfiguration class. + */ + @Generated + public FunctionFlexConsumptionResourceConfiguration() { + } + + /** + * Get the instanceMemoryMB property: Memory size of the instance. Supported values are 2048, 4096. + * + * @return the instanceMemoryMB value. + */ + @Generated + public long getInstanceMemoryMB() { + return this.instanceMemoryMB; + } + + /** + * Set the instanceMemoryMB property: Memory size of the instance. Supported values are 2048, 4096. + *

Required when create the resource.

+ * + * @param instanceMemoryMB the instanceMemoryMB value to set. + * @return the FunctionFlexConsumptionResourceConfiguration object itself. + */ + @Generated + public FunctionFlexConsumptionResourceConfiguration setInstanceMemoryMB(long instanceMemoryMB) { + this.instanceMemoryMB = instanceMemoryMB; + this.updatedProperties.add("instanceMemoryMB"); + return this; + } + + /** + * Get the httpConcurrency property: HTTP Concurrency for the function app. + * + * @return the httpConcurrency value. + */ + @Generated + public long getHttpConcurrency() { + return this.httpConcurrency; + } + + /** + * Set the httpConcurrency property: HTTP Concurrency for the function app. + *

Required when create the resource.

+ * + * @param httpConcurrency the httpConcurrency value to set. + * @return the FunctionFlexConsumptionResourceConfiguration object itself. + */ + @Generated + public FunctionFlexConsumptionResourceConfiguration setHttpConcurrency(long httpConcurrency) { + this.httpConcurrency = httpConcurrency; + this.updatedProperties.add("httpConcurrency"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeLongField("instanceMemoryMB", this.instanceMemoryMB); + jsonWriter.writeLongField("httpConcurrency", this.httpConcurrency); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("instanceMemoryMB")) { + jsonWriter.writeLongField("instanceMemoryMB", this.instanceMemoryMB); + } + if (updatedProperties.contains("httpConcurrency")) { + jsonWriter.writeLongField("httpConcurrency", this.httpConcurrency); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FunctionFlexConsumptionResourceConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FunctionFlexConsumptionResourceConfiguration if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the FunctionFlexConsumptionResourceConfiguration. + */ + @Generated + public static FunctionFlexConsumptionResourceConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FunctionFlexConsumptionResourceConfiguration deserializedFunctionFlexConsumptionResourceConfiguration + = new FunctionFlexConsumptionResourceConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("instanceMemoryMB".equals(fieldName)) { + deserializedFunctionFlexConsumptionResourceConfiguration.instanceMemoryMB = reader.getLong(); + } else if ("httpConcurrency".equals(fieldName)) { + deserializedFunctionFlexConsumptionResourceConfiguration.httpConcurrency = reader.getLong(); + } else { + reader.skipChildren(); + } + } + + return deserializedFunctionFlexConsumptionResourceConfiguration; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/FunctionFlexConsumptionTargetResourceConfigurations.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/FunctionFlexConsumptionTargetResourceConfigurations.java new file mode 100644 index 0000000000000..00e3c330bf698 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/FunctionFlexConsumptionTargetResourceConfigurations.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Configurations for a Function App using Flex Consumption Plan. + */ +@Fluent +public final class FunctionFlexConsumptionTargetResourceConfigurations extends TargetResourceConfigurations { + /* + * Kind of the resource for which the configurations apply. + */ + @Generated + private ResourceKind kind = ResourceKind.FUNCTIONS_FLEX_CONSUMPTION; + + /* + * A map of configurations for a Function app using Flex Consumption Plan. + */ + @Generated + private Map configurations; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + /** + * Creates an instance of FunctionFlexConsumptionTargetResourceConfigurations class. + */ + @Generated + public FunctionFlexConsumptionTargetResourceConfigurations() { + } + + /** + * Get the kind property: Kind of the resource for which the configurations apply. + * + * @return the kind value. + */ + @Generated + @Override + public ResourceKind getKind() { + return this.kind; + } + + /** + * Get the configurations property: A map of configurations for a Function app using Flex Consumption Plan. + * + * @return the configurations value. + */ + @Generated + public Map getConfigurations() { + return this.configurations; + } + + /** + * Set the configurations property: A map of configurations for a Function app using Flex Consumption Plan. + * + * @param configurations the configurations value to set. + * @return the FunctionFlexConsumptionTargetResourceConfigurations object itself. + */ + @Generated + public FunctionFlexConsumptionTargetResourceConfigurations + setConfigurations(Map configurations) { + this.configurations = configurations; + this.updatedProperties.add("configurations"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (JsonMergePatchHelper.getTargetResourceConfigurationsAccessor().isJsonMergePatch(this)) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeMapField("configurations", this.configurations, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind.toString()); + if (updatedProperties.contains("configurations")) { + if (this.configurations == null) { + jsonWriter.writeNullField("configurations"); + } else { + jsonWriter.writeMapField("configurations", this.configurations, (writer, element) -> { + if (element != null) { + JsonMergePatchHelper.getFunctionFlexConsumptionResourceConfigurationAccessor() + .prepareModelForJsonMergePatch(element, true); + writer.writeJson(element); + JsonMergePatchHelper.getFunctionFlexConsumptionResourceConfigurationAccessor() + .prepareModelForJsonMergePatch(element, false); + } else { + writer.writeNull(); + } + }); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FunctionFlexConsumptionTargetResourceConfigurations from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FunctionFlexConsumptionTargetResourceConfigurations if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the FunctionFlexConsumptionTargetResourceConfigurations. + */ + @Generated + public static FunctionFlexConsumptionTargetResourceConfigurations fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + FunctionFlexConsumptionTargetResourceConfigurations deserializedFunctionFlexConsumptionTargetResourceConfigurations + = new FunctionFlexConsumptionTargetResourceConfigurations(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedFunctionFlexConsumptionTargetResourceConfigurations.kind + = ResourceKind.fromString(reader.getString()); + } else if ("configurations".equals(fieldName)) { + Map configurations + = reader.readMap(reader1 -> FunctionFlexConsumptionResourceConfiguration.fromJson(reader1)); + deserializedFunctionFlexConsumptionTargetResourceConfigurations.configurations = configurations; + } else { + reader.skipChildren(); + } + } + + return deserializedFunctionFlexConsumptionTargetResourceConfigurations; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/LoadTestConfiguration.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/LoadTestConfiguration.java new file mode 100644 index 0000000000000..37e99349e8aef --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/LoadTestConfiguration.java @@ -0,0 +1,323 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Configurations for the load test. + */ +@Fluent +public final class LoadTestConfiguration implements JsonSerializable { + /* + * The number of engine instances to execute load test. Supported values are in range of 1-400. Required for + * creating a new test. + */ + @Generated + private Integer engineInstances; + + /* + * If false, Azure Load Testing copies and processes your input files unmodified + * across all test engine instances. If true, Azure Load Testing splits the CSV + * input data evenly across all engine instances. If you provide multiple CSV + * files, each file will be split evenly. + */ + @Generated + private Boolean splitAllCSVs; + + /* + * If true, optionalLoadTestConfig is required and JMX script for the load test is + * not required to upload. + */ + @Generated + private Boolean quickStartTest; + + /* + * Configuration for quick load test + */ + @Generated + private OptionalLoadTestConfig optionalLoadTestConfig; + + /* + * Region distribution configuration for the load test. + */ + @Generated + private List regionalLoadTestConfig; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setLoadTestConfigurationAccessor(new JsonMergePatchHelper.LoadTestConfigurationAccessor() { + @Override + public LoadTestConfiguration prepareModelForJsonMergePatch(LoadTestConfiguration model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(LoadTestConfiguration model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of LoadTestConfiguration class. + */ + @Generated + public LoadTestConfiguration() { + } + + /** + * Get the engineInstances property: The number of engine instances to execute load test. Supported values are in + * range of 1-400. Required for creating a new test. + * + * @return the engineInstances value. + */ + @Generated + public Integer getEngineInstances() { + return this.engineInstances; + } + + /** + * Set the engineInstances property: The number of engine instances to execute load test. Supported values are in + * range of 1-400. Required for creating a new test. + * + * @param engineInstances the engineInstances value to set. + * @return the LoadTestConfiguration object itself. + */ + @Generated + public LoadTestConfiguration setEngineInstances(Integer engineInstances) { + this.engineInstances = engineInstances; + this.updatedProperties.add("engineInstances"); + return this; + } + + /** + * Get the splitAllCSVs property: If false, Azure Load Testing copies and processes your input files unmodified + * across all test engine instances. If true, Azure Load Testing splits the CSV + * input data evenly across all engine instances. If you provide multiple CSV + * files, each file will be split evenly. + * + * @return the splitAllCSVs value. + */ + @Generated + public Boolean isSplitAllCSVs() { + return this.splitAllCSVs; + } + + /** + * Set the splitAllCSVs property: If false, Azure Load Testing copies and processes your input files unmodified + * across all test engine instances. If true, Azure Load Testing splits the CSV + * input data evenly across all engine instances. If you provide multiple CSV + * files, each file will be split evenly. + * + * @param splitAllCSVs the splitAllCSVs value to set. + * @return the LoadTestConfiguration object itself. + */ + @Generated + public LoadTestConfiguration setSplitAllCSVs(Boolean splitAllCSVs) { + this.splitAllCSVs = splitAllCSVs; + this.updatedProperties.add("splitAllCSVs"); + return this; + } + + /** + * Get the quickStartTest property: If true, optionalLoadTestConfig is required and JMX script for the load test is + * not required to upload. + * + * @return the quickStartTest value. + */ + @Generated + public Boolean isQuickStartTest() { + return this.quickStartTest; + } + + /** + * Set the quickStartTest property: If true, optionalLoadTestConfig is required and JMX script for the load test is + * not required to upload. + * + * @param quickStartTest the quickStartTest value to set. + * @return the LoadTestConfiguration object itself. + */ + @Generated + public LoadTestConfiguration setQuickStartTest(Boolean quickStartTest) { + this.quickStartTest = quickStartTest; + this.updatedProperties.add("quickStartTest"); + return this; + } + + /** + * Get the optionalLoadTestConfig property: Configuration for quick load test. + * + * @return the optionalLoadTestConfig value. + */ + @Generated + public OptionalLoadTestConfig getOptionalLoadTestConfig() { + return this.optionalLoadTestConfig; + } + + /** + * Set the optionalLoadTestConfig property: Configuration for quick load test. + * + * @param optionalLoadTestConfig the optionalLoadTestConfig value to set. + * @return the LoadTestConfiguration object itself. + */ + @Generated + public LoadTestConfiguration setOptionalLoadTestConfig(OptionalLoadTestConfig optionalLoadTestConfig) { + this.optionalLoadTestConfig = optionalLoadTestConfig; + this.updatedProperties.add("optionalLoadTestConfig"); + return this; + } + + /** + * Get the regionalLoadTestConfig property: Region distribution configuration for the load test. + * + * @return the regionalLoadTestConfig value. + */ + @Generated + public List getRegionalLoadTestConfig() { + return this.regionalLoadTestConfig; + } + + /** + * Set the regionalLoadTestConfig property: Region distribution configuration for the load test. + * + * @param regionalLoadTestConfig the regionalLoadTestConfig value to set. + * @return the LoadTestConfiguration object itself. + */ + @Generated + public LoadTestConfiguration setRegionalLoadTestConfig(List regionalLoadTestConfig) { + this.regionalLoadTestConfig = regionalLoadTestConfig; + this.updatedProperties.add("regionalLoadTestConfig"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("engineInstances", this.engineInstances); + jsonWriter.writeBooleanField("splitAllCSVs", this.splitAllCSVs); + jsonWriter.writeBooleanField("quickStartTest", this.quickStartTest); + jsonWriter.writeJsonField("optionalLoadTestConfig", this.optionalLoadTestConfig); + jsonWriter.writeArrayField("regionalLoadTestConfig", this.regionalLoadTestConfig, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("engineInstances")) { + if (this.engineInstances == null) { + jsonWriter.writeNullField("engineInstances"); + } else { + jsonWriter.writeNumberField("engineInstances", this.engineInstances); + } + } + if (updatedProperties.contains("splitAllCSVs")) { + if (this.splitAllCSVs == null) { + jsonWriter.writeNullField("splitAllCSVs"); + } else { + jsonWriter.writeBooleanField("splitAllCSVs", this.splitAllCSVs); + } + } + if (updatedProperties.contains("quickStartTest")) { + if (this.quickStartTest == null) { + jsonWriter.writeNullField("quickStartTest"); + } else { + jsonWriter.writeBooleanField("quickStartTest", this.quickStartTest); + } + } + if (updatedProperties.contains("optionalLoadTestConfig")) { + if (this.optionalLoadTestConfig == null) { + jsonWriter.writeNullField("optionalLoadTestConfig"); + } else { + JsonMergePatchHelper.getOptionalLoadTestConfigAccessor() + .prepareModelForJsonMergePatch(this.optionalLoadTestConfig, true); + jsonWriter.writeJsonField("optionalLoadTestConfig", this.optionalLoadTestConfig); + JsonMergePatchHelper.getOptionalLoadTestConfigAccessor() + .prepareModelForJsonMergePatch(this.optionalLoadTestConfig, false); + } + } + if (updatedProperties.contains("regionalLoadTestConfig")) { + if (this.regionalLoadTestConfig == null) { + jsonWriter.writeNullField("regionalLoadTestConfig"); + } else { + jsonWriter.writeArrayField("regionalLoadTestConfig", this.regionalLoadTestConfig, + (writer, element) -> writer.writeJson(element)); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LoadTestConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LoadTestConfiguration if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the LoadTestConfiguration. + */ + @Generated + public static LoadTestConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LoadTestConfiguration deserializedLoadTestConfiguration = new LoadTestConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("engineInstances".equals(fieldName)) { + deserializedLoadTestConfiguration.engineInstances = reader.getNullable(JsonReader::getInt); + } else if ("splitAllCSVs".equals(fieldName)) { + deserializedLoadTestConfiguration.splitAllCSVs = reader.getNullable(JsonReader::getBoolean); + } else if ("quickStartTest".equals(fieldName)) { + deserializedLoadTestConfiguration.quickStartTest = reader.getNullable(JsonReader::getBoolean); + } else if ("optionalLoadTestConfig".equals(fieldName)) { + deserializedLoadTestConfiguration.optionalLoadTestConfig = OptionalLoadTestConfig.fromJson(reader); + } else if ("regionalLoadTestConfig".equals(fieldName)) { + List regionalLoadTestConfig + = reader.readArray(reader1 -> RegionalConfiguration.fromJson(reader1)); + deserializedLoadTestConfiguration.regionalLoadTestConfig = regionalLoadTestConfig; + } else { + reader.skipChildren(); + } + } + + return deserializedLoadTestConfiguration; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricAvailability.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricAvailability.java new file mode 100644 index 0000000000000..76d19461c2db1 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricAvailability.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Metric availability specifies the time grain (aggregation interval or frequency). + */ +@Immutable +public final class MetricAvailability implements JsonSerializable { + /* + * The time grain specifies the aggregation interval for the metric. Expressed as + * a duration 'PT1M', 'PT1H', etc. + */ + @Generated + private TimeGrain timeGrain; + + /** + * Creates an instance of MetricAvailability class. + */ + @Generated + private MetricAvailability() { + } + + /** + * Get the timeGrain property: The time grain specifies the aggregation interval for the metric. Expressed as + * a duration 'PT1M', 'PT1H', etc. + * + * @return the timeGrain value. + */ + @Generated + public TimeGrain getTimeGrain() { + return this.timeGrain; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("timeGrain", this.timeGrain == null ? null : this.timeGrain.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricAvailability from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricAvailability if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MetricAvailability. + */ + @Generated + public static MetricAvailability fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricAvailability deserializedMetricAvailability = new MetricAvailability(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("timeGrain".equals(fieldName)) { + deserializedMetricAvailability.timeGrain = TimeGrain.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMetricAvailability; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricDefinition.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricDefinition.java new file mode 100644 index 0000000000000..73636b9a80d77 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricDefinition.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Metric definition. + */ +@Immutable +public final class MetricDefinition implements JsonSerializable { + /* + * List of dimensions + */ + @Generated + private List dimensions; + + /* + * The metric description + */ + @Generated + private String description; + + /* + * The metric name + */ + @Generated + private String name; + + /* + * The namespace the metric belongs to. + */ + @Generated + private String namespace; + + /* + * The primary aggregation type value defining how to use the values for display. + */ + @Generated + private AggregationType primaryAggregationType; + + /* + * The collection of what all aggregation types are supported. + */ + @Generated + private List supportedAggregationTypes; + + /* + * The unit of the metric. + */ + @Generated + private MetricUnit unit; + + /* + * Metric availability specifies the time grain (aggregation interval or + * frequency). + */ + @Generated + private List metricAvailabilities; + + /** + * Creates an instance of MetricDefinition class. + */ + @Generated + private MetricDefinition() { + } + + /** + * Get the dimensions property: List of dimensions. + * + * @return the dimensions value. + */ + @Generated + public List getDimensions() { + return this.dimensions; + } + + /** + * Get the description property: The metric description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Get the name property: The metric name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the namespace property: The namespace the metric belongs to. + * + * @return the namespace value. + */ + @Generated + public String getNamespace() { + return this.namespace; + } + + /** + * Get the primaryAggregationType property: The primary aggregation type value defining how to use the values for + * display. + * + * @return the primaryAggregationType value. + */ + @Generated + public AggregationType getPrimaryAggregationType() { + return this.primaryAggregationType; + } + + /** + * Get the supportedAggregationTypes property: The collection of what all aggregation types are supported. + * + * @return the supportedAggregationTypes value. + */ + @Generated + public List getSupportedAggregationTypes() { + return this.supportedAggregationTypes; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + @Generated + public MetricUnit getUnit() { + return this.unit; + } + + /** + * Get the metricAvailabilities property: Metric availability specifies the time grain (aggregation interval or + * frequency). + * + * @return the metricAvailabilities value. + */ + @Generated + public List getMetricAvailabilities() { + return this.metricAvailabilities; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("dimensions", this.dimensions, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("namespace", this.namespace); + jsonWriter.writeStringField("primaryAggregationType", + this.primaryAggregationType == null ? null : this.primaryAggregationType.toString()); + jsonWriter.writeArrayField("supportedAggregationTypes", this.supportedAggregationTypes, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("unit", this.unit == null ? null : this.unit.toString()); + jsonWriter.writeArrayField("metricAvailabilities", this.metricAvailabilities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricDefinition if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MetricDefinition. + */ + @Generated + public static MetricDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricDefinition deserializedMetricDefinition = new MetricDefinition(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dimensions".equals(fieldName)) { + List dimensions = reader.readArray(reader1 -> NameAndDesc.fromJson(reader1)); + deserializedMetricDefinition.dimensions = dimensions; + } else if ("description".equals(fieldName)) { + deserializedMetricDefinition.description = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMetricDefinition.name = reader.getString(); + } else if ("namespace".equals(fieldName)) { + deserializedMetricDefinition.namespace = reader.getString(); + } else if ("primaryAggregationType".equals(fieldName)) { + deserializedMetricDefinition.primaryAggregationType + = AggregationType.fromString(reader.getString()); + } else if ("supportedAggregationTypes".equals(fieldName)) { + List supportedAggregationTypes = reader.readArray(reader1 -> reader1.getString()); + deserializedMetricDefinition.supportedAggregationTypes = supportedAggregationTypes; + } else if ("unit".equals(fieldName)) { + deserializedMetricDefinition.unit = MetricUnit.fromString(reader.getString()); + } else if ("metricAvailabilities".equals(fieldName)) { + List metricAvailabilities + = reader.readArray(reader1 -> MetricAvailability.fromJson(reader1)); + deserializedMetricDefinition.metricAvailabilities = metricAvailabilities; + } else { + reader.skipChildren(); + } + } + + return deserializedMetricDefinition; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricDefinitionCollection.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricDefinitionCollection.java new file mode 100644 index 0000000000000..19dbd1374a30c --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricDefinitionCollection.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents collection of metric definitions. + */ +@Immutable +public final class MetricDefinitionCollection implements JsonSerializable { + /* + * the values for the metric definitions. + */ + @Generated + private final List value; + + /** + * Creates an instance of MetricDefinitionCollection class. + * + * @param value the value value to set. + */ + @Generated + private MetricDefinitionCollection(List value) { + this.value = value; + } + + /** + * Get the value property: the values for the metric definitions. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricDefinitionCollection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricDefinitionCollection if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MetricDefinitionCollection. + */ + @Generated + public static MetricDefinitionCollection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.readArray(reader1 -> MetricDefinition.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new MetricDefinitionCollection(value); + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricNamespace.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricNamespace.java new file mode 100644 index 0000000000000..2f064cde7ff97 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricNamespace.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Metric namespace class specifies the metadata for a metric namespace. + */ +@Immutable +public final class MetricNamespace implements JsonSerializable { + /* + * The namespace description. + */ + @Generated + private String description; + + /* + * The metric namespace name. + */ + @Generated + private String name; + + /** + * Creates an instance of MetricNamespace class. + */ + @Generated + private MetricNamespace() { + } + + /** + * Get the description property: The namespace description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Get the name property: The metric namespace name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricNamespace from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricNamespace if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MetricNamespace. + */ + @Generated + public static MetricNamespace fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricNamespace deserializedMetricNamespace = new MetricNamespace(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedMetricNamespace.description = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMetricNamespace.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMetricNamespace; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricNamespaceCollection.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricNamespaceCollection.java new file mode 100644 index 0000000000000..91ed6226d7003 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricNamespaceCollection.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents collection of metric namespaces. + */ +@Immutable +public final class MetricNamespaceCollection implements JsonSerializable { + /* + * The values for the metric namespaces. + */ + @Generated + private final List value; + + /** + * Creates an instance of MetricNamespaceCollection class. + * + * @param value the value value to set. + */ + @Generated + private MetricNamespaceCollection(List value) { + this.value = value; + } + + /** + * Get the value property: The values for the metric namespaces. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricNamespaceCollection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricNamespaceCollection if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MetricNamespaceCollection. + */ + @Generated + public static MetricNamespaceCollection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.readArray(reader1 -> MetricNamespace.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new MetricNamespaceCollection(value); + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricRequestPayload.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricRequestPayload.java new file mode 100644 index 0000000000000..b0f29414ff909 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricRequestPayload.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Filters to fetch the set of metric. + */ +@Fluent +public final class MetricRequestPayload implements JsonSerializable { + /* + * Get metrics for specific dimension values. Example: Metric contains dimension + * like SamplerName, Error. To retrieve all the time series data where SamplerName + * is equals to HTTPRequest1 or HTTPRequest2, the DimensionFilter value will be + * {"SamplerName", ["HTTPRequest1", "HTTPRequest2"} + */ + @Generated + private List filters; + + /** + * Creates an instance of MetricRequestPayload class. + */ + @Generated + public MetricRequestPayload() { + } + + /** + * Get the filters property: Get metrics for specific dimension values. Example: Metric contains dimension + * like SamplerName, Error. To retrieve all the time series data where SamplerName + * is equals to HTTPRequest1 or HTTPRequest2, the DimensionFilter value will be + * {"SamplerName", ["HTTPRequest1", "HTTPRequest2"}. + * + * @return the filters value. + */ + @Generated + public List getFilters() { + return this.filters; + } + + /** + * Set the filters property: Get metrics for specific dimension values. Example: Metric contains dimension + * like SamplerName, Error. To retrieve all the time series data where SamplerName + * is equals to HTTPRequest1 or HTTPRequest2, the DimensionFilter value will be + * {"SamplerName", ["HTTPRequest1", "HTTPRequest2"}. + * + * @param filters the filters value to set. + * @return the MetricRequestPayload object itself. + */ + @Generated + public MetricRequestPayload setFilters(List filters) { + this.filters = filters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("filters", this.filters, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricRequestPayload from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricRequestPayload if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the MetricRequestPayload. + */ + @Generated + public static MetricRequestPayload fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricRequestPayload deserializedMetricRequestPayload = new MetricRequestPayload(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("filters".equals(fieldName)) { + List filters = reader.readArray(reader1 -> DimensionFilter.fromJson(reader1)); + deserializedMetricRequestPayload.filters = filters; + } else { + reader.skipChildren(); + } + } + + return deserializedMetricRequestPayload; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricUnit.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricUnit.java new file mode 100644 index 0000000000000..83a787b2aff2f --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricUnit.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Metric unit. + */ +public final class MetricUnit extends ExpandableStringEnum { + /** + * No unit specified. + */ + @Generated + public static final MetricUnit NOT_SPECIFIED = fromString("NotSpecified"); + + /** + * Percentage. + */ + @Generated + public static final MetricUnit PERCENT = fromString("Percent"); + + /** + * Value count. + */ + @Generated + public static final MetricUnit COUNT = fromString("Count"); + + /** + * Seconds. + */ + @Generated + public static final MetricUnit SECONDS = fromString("Seconds"); + + /** + * Milliseconds. + */ + @Generated + public static final MetricUnit MILLISECONDS = fromString("Milliseconds"); + + /** + * Bytes. + */ + @Generated + public static final MetricUnit BYTES = fromString("Bytes"); + + /** + * Bytes per second. + */ + @Generated + public static final MetricUnit BYTES_PER_SECOND = fromString("BytesPerSecond"); + + /** + * Count per second. + */ + @Generated + public static final MetricUnit COUNT_PER_SECOND = fromString("CountPerSecond"); + + /** + * Creates a new instance of MetricUnit value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public MetricUnit() { + } + + /** + * Creates or finds a MetricUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding MetricUnit. + */ + @Generated + public static MetricUnit fromString(String name) { + return fromString(name, MetricUnit.class); + } + + /** + * Gets known MetricUnit values. + * + * @return known MetricUnit values. + */ + @Generated + public static Collection values() { + return values(MetricUnit.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricValue.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricValue.java new file mode 100644 index 0000000000000..84b10e65cd28a --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/MetricValue.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents a metric value. + */ +@Immutable +public final class MetricValue implements JsonSerializable { + /* + * The timestamp for the metric value in RFC 3339 format. + */ + @Generated + private OffsetDateTime timestamp; + + /* + * The metric value. + */ + @Generated + private Double value; + + /** + * Creates an instance of MetricValue class. + */ + @Generated + private MetricValue() { + } + + /** + * Get the timestamp property: The timestamp for the metric value in RFC 3339 format. + * + * @return the timestamp value. + */ + @Generated + public OffsetDateTime getTimestamp() { + return this.timestamp; + } + + /** + * Get the value property: The metric value. + * + * @return the value value. + */ + @Generated + public Double getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("timestamp", + this.timestamp == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.timestamp)); + jsonWriter.writeNumberField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricValue from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricValue if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MetricValue. + */ + @Generated + public static MetricValue fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricValue deserializedMetricValue = new MetricValue(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("timestamp".equals(fieldName)) { + deserializedMetricValue.timestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("value".equals(fieldName)) { + deserializedMetricValue.value = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedMetricValue; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/NameAndDesc.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/NameAndDesc.java new file mode 100644 index 0000000000000..7c8b086110ce3 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/NameAndDesc.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The name and description. + */ +@Immutable +public final class NameAndDesc implements JsonSerializable { + /* + * The description + */ + @Generated + private String description; + + /* + * The name + */ + @Generated + private String name; + + /** + * Creates an instance of NameAndDesc class. + */ + @Generated + private NameAndDesc() { + } + + /** + * Get the description property: The description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Get the name property: The name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NameAndDesc from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NameAndDesc if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the NameAndDesc. + */ + @Generated + public static NameAndDesc fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NameAndDesc deserializedNameAndDesc = new NameAndDesc(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedNameAndDesc.description = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedNameAndDesc.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNameAndDesc; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/OptionalLoadTestConfig.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/OptionalLoadTestConfig.java new file mode 100644 index 0000000000000..06185770d960d --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/OptionalLoadTestConfig.java @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Configuration for quick load test. + */ +@Fluent +public final class OptionalLoadTestConfig implements JsonSerializable { + /* + * Test URL. Provide the complete HTTP URL. For example, https://contoso-app.azurewebsites.net/login + */ + @Generated + private String endpointUrl; + + /* + * Target throughput (requests per second). This may not be necessarily achieved. The actual throughput will be + * lower if the application is not capable of handling it. + */ + @Generated + private Integer requestsPerSecond; + + /* + * Maximum response time in milliseconds of the API/endpoint. + */ + @Generated + private Integer maxResponseTimeInMs; + + /* + * No of concurrent virtual users. + */ + @Generated + private Integer virtualUsers; + + /* + * Ramp up time in seconds. + */ + @Generated + private Integer rampUpTime; + + /* + * Test run duration in seconds. + */ + @Generated + private Integer duration; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper + .setOptionalLoadTestConfigAccessor(new JsonMergePatchHelper.OptionalLoadTestConfigAccessor() { + @Override + public OptionalLoadTestConfig prepareModelForJsonMergePatch(OptionalLoadTestConfig model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(OptionalLoadTestConfig model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of OptionalLoadTestConfig class. + */ + @Generated + public OptionalLoadTestConfig() { + } + + /** + * Get the endpointUrl property: Test URL. Provide the complete HTTP URL. For example, + * https://contoso-app.azurewebsites.net/login. + * + * @return the endpointUrl value. + */ + @Generated + public String getEndpointUrl() { + return this.endpointUrl; + } + + /** + * Set the endpointUrl property: Test URL. Provide the complete HTTP URL. For example, + * https://contoso-app.azurewebsites.net/login. + * + * @param endpointUrl the endpointUrl value to set. + * @return the OptionalLoadTestConfig object itself. + */ + @Generated + public OptionalLoadTestConfig setEndpointUrl(String endpointUrl) { + this.endpointUrl = endpointUrl; + this.updatedProperties.add("endpointUrl"); + return this; + } + + /** + * Get the requestsPerSecond property: Target throughput (requests per second). This may not be necessarily + * achieved. The actual throughput will be lower if the application is not capable of handling it. + * + * @return the requestsPerSecond value. + */ + @Generated + public Integer getRequestsPerSecond() { + return this.requestsPerSecond; + } + + /** + * Set the requestsPerSecond property: Target throughput (requests per second). This may not be necessarily + * achieved. The actual throughput will be lower if the application is not capable of handling it. + * + * @param requestsPerSecond the requestsPerSecond value to set. + * @return the OptionalLoadTestConfig object itself. + */ + @Generated + public OptionalLoadTestConfig setRequestsPerSecond(Integer requestsPerSecond) { + this.requestsPerSecond = requestsPerSecond; + this.updatedProperties.add("requestsPerSecond"); + return this; + } + + /** + * Get the maxResponseTimeInMs property: Maximum response time in milliseconds of the API/endpoint. + * + * @return the maxResponseTimeInMs value. + */ + @Generated + public Integer getMaxResponseTimeInMs() { + return this.maxResponseTimeInMs; + } + + /** + * Set the maxResponseTimeInMs property: Maximum response time in milliseconds of the API/endpoint. + * + * @param maxResponseTimeInMs the maxResponseTimeInMs value to set. + * @return the OptionalLoadTestConfig object itself. + */ + @Generated + public OptionalLoadTestConfig setMaxResponseTimeInMs(Integer maxResponseTimeInMs) { + this.maxResponseTimeInMs = maxResponseTimeInMs; + this.updatedProperties.add("maxResponseTimeInMs"); + return this; + } + + /** + * Get the virtualUsers property: No of concurrent virtual users. + * + * @return the virtualUsers value. + */ + @Generated + public Integer getVirtualUsers() { + return this.virtualUsers; + } + + /** + * Set the virtualUsers property: No of concurrent virtual users. + * + * @param virtualUsers the virtualUsers value to set. + * @return the OptionalLoadTestConfig object itself. + */ + @Generated + public OptionalLoadTestConfig setVirtualUsers(Integer virtualUsers) { + this.virtualUsers = virtualUsers; + this.updatedProperties.add("virtualUsers"); + return this; + } + + /** + * Get the rampUpTime property: Ramp up time in seconds. + * + * @return the rampUpTime value. + */ + @Generated + public Integer getRampUpTime() { + return this.rampUpTime; + } + + /** + * Set the rampUpTime property: Ramp up time in seconds. + * + * @param rampUpTime the rampUpTime value to set. + * @return the OptionalLoadTestConfig object itself. + */ + @Generated + public OptionalLoadTestConfig setRampUpTime(Integer rampUpTime) { + this.rampUpTime = rampUpTime; + this.updatedProperties.add("rampUpTime"); + return this; + } + + /** + * Get the duration property: Test run duration in seconds. + * + * @return the duration value. + */ + @Generated + public Integer getDuration() { + return this.duration; + } + + /** + * Set the duration property: Test run duration in seconds. + * + * @param duration the duration value to set. + * @return the OptionalLoadTestConfig object itself. + */ + @Generated + public OptionalLoadTestConfig setDuration(Integer duration) { + this.duration = duration; + this.updatedProperties.add("duration"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("endpointUrl", this.endpointUrl); + jsonWriter.writeNumberField("requestsPerSecond", this.requestsPerSecond); + jsonWriter.writeNumberField("maxResponseTimeInMs", this.maxResponseTimeInMs); + jsonWriter.writeNumberField("virtualUsers", this.virtualUsers); + jsonWriter.writeNumberField("rampUpTime", this.rampUpTime); + jsonWriter.writeNumberField("duration", this.duration); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("endpointUrl")) { + if (this.endpointUrl == null) { + jsonWriter.writeNullField("endpointUrl"); + } else { + jsonWriter.writeStringField("endpointUrl", this.endpointUrl); + } + } + if (updatedProperties.contains("requestsPerSecond")) { + if (this.requestsPerSecond == null) { + jsonWriter.writeNullField("requestsPerSecond"); + } else { + jsonWriter.writeNumberField("requestsPerSecond", this.requestsPerSecond); + } + } + if (updatedProperties.contains("maxResponseTimeInMs")) { + if (this.maxResponseTimeInMs == null) { + jsonWriter.writeNullField("maxResponseTimeInMs"); + } else { + jsonWriter.writeNumberField("maxResponseTimeInMs", this.maxResponseTimeInMs); + } + } + if (updatedProperties.contains("virtualUsers")) { + if (this.virtualUsers == null) { + jsonWriter.writeNullField("virtualUsers"); + } else { + jsonWriter.writeNumberField("virtualUsers", this.virtualUsers); + } + } + if (updatedProperties.contains("rampUpTime")) { + if (this.rampUpTime == null) { + jsonWriter.writeNullField("rampUpTime"); + } else { + jsonWriter.writeNumberField("rampUpTime", this.rampUpTime); + } + } + if (updatedProperties.contains("duration")) { + if (this.duration == null) { + jsonWriter.writeNullField("duration"); + } else { + jsonWriter.writeNumberField("duration", this.duration); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OptionalLoadTestConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OptionalLoadTestConfig if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the OptionalLoadTestConfig. + */ + @Generated + public static OptionalLoadTestConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OptionalLoadTestConfig deserializedOptionalLoadTestConfig = new OptionalLoadTestConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("endpointUrl".equals(fieldName)) { + deserializedOptionalLoadTestConfig.endpointUrl = reader.getString(); + } else if ("requestsPerSecond".equals(fieldName)) { + deserializedOptionalLoadTestConfig.requestsPerSecond = reader.getNullable(JsonReader::getInt); + } else if ("maxResponseTimeInMs".equals(fieldName)) { + deserializedOptionalLoadTestConfig.maxResponseTimeInMs = reader.getNullable(JsonReader::getInt); + } else if ("virtualUsers".equals(fieldName)) { + deserializedOptionalLoadTestConfig.virtualUsers = reader.getNullable(JsonReader::getInt); + } else if ("rampUpTime".equals(fieldName)) { + deserializedOptionalLoadTestConfig.rampUpTime = reader.getNullable(JsonReader::getInt); + } else if ("duration".equals(fieldName)) { + deserializedOptionalLoadTestConfig.duration = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedOptionalLoadTestConfig; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFAction.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFAction.java new file mode 100644 index 0000000000000..04d4a5636ea25 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFAction.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Action to take on failure of pass/fail criteria. + */ +public final class PFAction extends ExpandableStringEnum { + /** + * Test will continue to run even if pass fail metric criteria metric gets failed. + */ + @Generated + public static final PFAction CONTINUE = fromString("continue"); + + /** + * Test run will stop if pass fail criteria metric is not passed. + */ + @Generated + public static final PFAction STOP = fromString("stop"); + + /** + * Creates a new instance of PFAction value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public PFAction() { + } + + /** + * Creates or finds a PFAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding PFAction. + */ + @Generated + public static PFAction fromString(String name) { + return fromString(name, PFAction.class); + } + + /** + * Gets known PFAction values. + * + * @return known PFAction values. + */ + @Generated + public static Collection values() { + return values(PFAction.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFAgFunc.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFAgFunc.java new file mode 100644 index 0000000000000..21c73c3b1a7ab --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFAgFunc.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Aggregation functions for pass/fail criteria. + */ +public final class PFAgFunc extends ExpandableStringEnum { + /** + * Criteria applies for count value. + */ + @Generated + public static final PFAgFunc COUNT = fromString("count"); + + /** + * Criteria applies for given percentage value. + */ + @Generated + public static final PFAgFunc PERCENTAGE = fromString("percentage"); + + /** + * Criteria applies for avg value. + */ + @Generated + public static final PFAgFunc AVG = fromString("avg"); + + /** + * Criteria applies for 50th percentile value. + */ + @Generated + public static final PFAgFunc P50 = fromString("p50"); + + /** + * Criteria applies for 75th percentile value. + */ + @Generated + public static final PFAgFunc P75 = fromString("p75"); + + /** + * Criteria applies for 90th percentile value. + */ + @Generated + public static final PFAgFunc P90 = fromString("p90"); + + /** + * Criteria applies for 95th percentile value. + */ + @Generated + public static final PFAgFunc P95 = fromString("p95"); + + /** + * Criteria applies for 96th percentile value. + */ + @Generated + public static final PFAgFunc P96 = fromString("p96"); + + /** + * Criteria applies for 97th percentile value. + */ + @Generated + public static final PFAgFunc P97 = fromString("p97"); + + /** + * Criteria applies for 98th percentile value. + */ + @Generated + public static final PFAgFunc P98 = fromString("p98"); + + /** + * Criteria applies for 99th percentile value. + */ + @Generated + public static final PFAgFunc P99 = fromString("p99"); + + /** + * Criteria applies for 99.9th percentile value. + */ + @Generated + public static final PFAgFunc P99_9 = fromString("p99.9"); + + /** + * Criteria applies for 99.99th percentile value. + */ + @Generated + public static final PFAgFunc P99_99 = fromString("p99.99"); + + /** + * Criteria applies for minimum value. + */ + @Generated + public static final PFAgFunc MIN = fromString("min"); + + /** + * Criteria applies for maximum value. + */ + @Generated + public static final PFAgFunc MAX = fromString("max"); + + /** + * Creates a new instance of PFAgFunc value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public PFAgFunc() { + } + + /** + * Creates or finds a PFAgFunc from its string representation. + * + * @param name a name to look for. + * @return the corresponding PFAgFunc. + */ + @Generated + public static PFAgFunc fromString(String name) { + return fromString(name, PFAgFunc.class); + } + + /** + * Gets known PFAgFunc values. + * + * @return known PFAgFunc values. + */ + @Generated + public static Collection values() { + return values(PFAgFunc.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFMetrics.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFMetrics.java new file mode 100644 index 0000000000000..58458f12fa68d --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFMetrics.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Metrics for pass/fail criteria. + */ +public final class PFMetrics extends ExpandableStringEnum { + /** + * Pass fail criteria for response time metric in milliseconds. + */ + @Generated + public static final PFMetrics RESPONSE_TIME_MS = fromString("response_time_ms"); + + /** + * Pass fail criteria for latency metric in milliseconds. + */ + @Generated + public static final PFMetrics LATENCY = fromString("latency"); + + /** + * Pass fail criteria for error metric. + */ + @Generated + public static final PFMetrics ERROR = fromString("error"); + + /** + * Pass fail criteria for total requests. + */ + @Generated + public static final PFMetrics REQUESTS = fromString("requests"); + + /** + * Pass fail criteria for request per second. + */ + @Generated + public static final PFMetrics REQUESTS_PER_SEC = fromString("requests_per_sec"); + + /** + * Creates a new instance of PFMetrics value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public PFMetrics() { + } + + /** + * Creates or finds a PFMetrics from its string representation. + * + * @param name a name to look for. + * @return the corresponding PFMetrics. + */ + @Generated + public static PFMetrics fromString(String name) { + return fromString(name, PFMetrics.class); + } + + /** + * Gets known PFMetrics values. + * + * @return known PFMetrics values. + */ + @Generated + public static Collection values() { + return values(PFMetrics.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFResult.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFResult.java new file mode 100644 index 0000000000000..8d3062ca78232 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Pass/fail criteria result. + */ +public final class PFResult extends ExpandableStringEnum { + /** + * Given pass fail criteria metric has passed. + */ + @Generated + public static final PFResult PASSED = fromString("passed"); + + /** + * Given pass fail criteria metric couldn't determine. + */ + @Generated + public static final PFResult UNDETERMINED = fromString("undetermined"); + + /** + * Given pass fail criteria metric has failed. + */ + @Generated + public static final PFResult FAILED = fromString("failed"); + + /** + * Creates a new instance of PFResult value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public PFResult() { + } + + /** + * Creates or finds a PFResult from its string representation. + * + * @param name a name to look for. + * @return the corresponding PFResult. + */ + @Generated + public static PFResult fromString(String name) { + return fromString(name, PFResult.class); + } + + /** + * Gets known PFResult values. + * + * @return known PFResult values. + */ + @Generated + public static Collection values() { + return values(PFResult.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFTestResult.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFTestResult.java new file mode 100644 index 0000000000000..3512826cede40 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PFTestResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Test result based on pass/fail criteria. + */ +public final class PFTestResult extends ExpandableStringEnum { + /** + * Pass/fail criteria has passed. + */ + @Generated + public static final PFTestResult PASSED = fromString("PASSED"); + + /** + * Pass/fail criteria is not applicable. + */ + @Generated + public static final PFTestResult NOT_APPLICABLE = fromString("NOT_APPLICABLE"); + + /** + * Pass/fail criteria has failed. + */ + @Generated + public static final PFTestResult FAILED = fromString("FAILED"); + + /** + * Creates a new instance of PFTestResult value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public PFTestResult() { + } + + /** + * Creates or finds a PFTestResult from its string representation. + * + * @param name a name to look for. + * @return the corresponding PFTestResult. + */ + @Generated + public static PFTestResult fromString(String name) { + return fromString(name, PFTestResult.class); + } + + /** + * Gets known PFTestResult values. + * + * @return known PFTestResult values. + */ + @Generated + public static Collection values() { + return values(PFTestResult.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PassFailCriteria.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PassFailCriteria.java new file mode 100644 index 0000000000000..edbc639eac27c --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PassFailCriteria.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Pass fail criteria for a test. + */ +@Fluent +public final class PassFailCriteria implements JsonSerializable { + /* + * Map of id and pass fail metrics { id : pass fail metrics }. + */ + @Generated + private Map passFailMetrics; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setPassFailCriteriaAccessor(new JsonMergePatchHelper.PassFailCriteriaAccessor() { + @Override + public PassFailCriteria prepareModelForJsonMergePatch(PassFailCriteria model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(PassFailCriteria model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of PassFailCriteria class. + */ + @Generated + public PassFailCriteria() { + } + + /** + * Get the passFailMetrics property: Map of id and pass fail metrics { id : pass fail metrics }. + * + * @return the passFailMetrics value. + */ + @Generated + public Map getPassFailMetrics() { + return this.passFailMetrics; + } + + /** + * Set the passFailMetrics property: Map of id and pass fail metrics { id : pass fail metrics }. + * + * @param passFailMetrics the passFailMetrics value to set. + * @return the PassFailCriteria object itself. + */ + @Generated + public PassFailCriteria setPassFailMetrics(Map passFailMetrics) { + this.passFailMetrics = passFailMetrics; + this.updatedProperties.add("passFailMetrics"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("passFailMetrics", this.passFailMetrics, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("passFailMetrics")) { + if (this.passFailMetrics == null) { + jsonWriter.writeNullField("passFailMetrics"); + } else { + jsonWriter.writeMapField("passFailMetrics", this.passFailMetrics, (writer, element) -> { + if (element != null) { + JsonMergePatchHelper.getPassFailMetricAccessor().prepareModelForJsonMergePatch(element, true); + writer.writeJson(element); + JsonMergePatchHelper.getPassFailMetricAccessor().prepareModelForJsonMergePatch(element, false); + } else { + writer.writeNull(); + } + }); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PassFailCriteria from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PassFailCriteria if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PassFailCriteria. + */ + @Generated + public static PassFailCriteria fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PassFailCriteria deserializedPassFailCriteria = new PassFailCriteria(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("passFailMetrics".equals(fieldName)) { + Map passFailMetrics + = reader.readMap(reader1 -> PassFailMetric.fromJson(reader1)); + deserializedPassFailCriteria.passFailMetrics = passFailMetrics; + } else { + reader.skipChildren(); + } + } + + return deserializedPassFailCriteria; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PassFailMetric.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PassFailMetric.java new file mode 100644 index 0000000000000..b94b4475597b1 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/PassFailMetric.java @@ -0,0 +1,386 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Pass fail metric. + */ +@Fluent +public final class PassFailMetric implements JsonSerializable { + /* + * The client metric on which the criteria should be applied. + */ + @Generated + private PFMetrics clientMetric; + + /* + * The aggregation function to be applied on the client metric. Allowed functions + * - ‘percentage’ - for error metric , ‘avg’, percentiles like ‘p50’, ‘p90’, & so on, ‘min’, + * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, + * ‘count’ - for requests + */ + @Generated + private PFAgFunc aggregate; + + /* + * The comparison operator. Supported types ‘>’, ‘<’ + */ + @Generated + private String condition; + + /* + * Request name for which the Pass fail criteria has to be applied + */ + @Generated + private String requestName; + + /* + * The value to compare with the client metric. Allowed values - ‘error : [0.0 , + * 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. + */ + @Generated + private Double value; + + /* + * Action taken after the threshold is met. Default is ‘continue’. + */ + @Generated + private PFAction action; + + /* + * The actual value of the client metric for the test run. + */ + @Generated + private Double actualValue; + + /* + * Outcome of the test run. + */ + @Generated + private PFResult result; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setPassFailMetricAccessor(new JsonMergePatchHelper.PassFailMetricAccessor() { + @Override + public PassFailMetric prepareModelForJsonMergePatch(PassFailMetric model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(PassFailMetric model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of PassFailMetric class. + */ + @Generated + public PassFailMetric() { + } + + /** + * Get the clientMetric property: The client metric on which the criteria should be applied. + * + * @return the clientMetric value. + */ + @Generated + public PFMetrics getClientMetric() { + return this.clientMetric; + } + + /** + * Set the clientMetric property: The client metric on which the criteria should be applied. + * + * @param clientMetric the clientMetric value to set. + * @return the PassFailMetric object itself. + */ + @Generated + public PassFailMetric setClientMetric(PFMetrics clientMetric) { + this.clientMetric = clientMetric; + this.updatedProperties.add("clientMetric"); + return this; + } + + /** + * Get the aggregate property: The aggregation function to be applied on the client metric. Allowed functions + * - ‘percentage’ - for error metric , ‘avg’, percentiles like ‘p50’, ‘p90’, & so on, ‘min’, + * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, + * ‘count’ - for requests. + * + * @return the aggregate value. + */ + @Generated + public PFAgFunc getAggregate() { + return this.aggregate; + } + + /** + * Set the aggregate property: The aggregation function to be applied on the client metric. Allowed functions + * - ‘percentage’ - for error metric , ‘avg’, percentiles like ‘p50’, ‘p90’, & so on, ‘min’, + * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, + * ‘count’ - for requests. + * + * @param aggregate the aggregate value to set. + * @return the PassFailMetric object itself. + */ + @Generated + public PassFailMetric setAggregate(PFAgFunc aggregate) { + this.aggregate = aggregate; + this.updatedProperties.add("aggregate"); + return this; + } + + /** + * Get the condition property: The comparison operator. Supported types ‘>’, ‘<’. + * + * @return the condition value. + */ + @Generated + public String getCondition() { + return this.condition; + } + + /** + * Set the condition property: The comparison operator. Supported types ‘>’, ‘<’. + * + * @param condition the condition value to set. + * @return the PassFailMetric object itself. + */ + @Generated + public PassFailMetric setCondition(String condition) { + this.condition = condition; + this.updatedProperties.add("condition"); + return this; + } + + /** + * Get the requestName property: Request name for which the Pass fail criteria has to be applied. + * + * @return the requestName value. + */ + @Generated + public String getRequestName() { + return this.requestName; + } + + /** + * Set the requestName property: Request name for which the Pass fail criteria has to be applied. + * + * @param requestName the requestName value to set. + * @return the PassFailMetric object itself. + */ + @Generated + public PassFailMetric setRequestName(String requestName) { + this.requestName = requestName; + this.updatedProperties.add("requestName"); + return this; + } + + /** + * Get the value property: The value to compare with the client metric. Allowed values - ‘error : [0.0 , + * 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. + * + * @return the value value. + */ + @Generated + public Double getValue() { + return this.value; + } + + /** + * Set the value property: The value to compare with the client metric. Allowed values - ‘error : [0.0 , + * 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. + * + * @param value the value value to set. + * @return the PassFailMetric object itself. + */ + @Generated + public PassFailMetric setValue(Double value) { + this.value = value; + this.updatedProperties.add("value"); + return this; + } + + /** + * Get the action property: Action taken after the threshold is met. Default is ‘continue’. + * + * @return the action value. + */ + @Generated + public PFAction getAction() { + return this.action; + } + + /** + * Set the action property: Action taken after the threshold is met. Default is ‘continue’. + * + * @param action the action value to set. + * @return the PassFailMetric object itself. + */ + @Generated + public PassFailMetric setAction(PFAction action) { + this.action = action; + this.updatedProperties.add("action"); + return this; + } + + /** + * Get the actualValue property: The actual value of the client metric for the test run. + * + * @return the actualValue value. + */ + @Generated + public Double getActualValue() { + return this.actualValue; + } + + /** + * Get the result property: Outcome of the test run. + * + * @return the result value. + */ + @Generated + public PFResult getResult() { + return this.result; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("clientMetric", + this.clientMetric == null ? null : this.clientMetric.toString()); + jsonWriter.writeStringField("aggregate", this.aggregate == null ? null : this.aggregate.toString()); + jsonWriter.writeStringField("condition", this.condition); + jsonWriter.writeStringField("requestName", this.requestName); + jsonWriter.writeNumberField("value", this.value); + jsonWriter.writeStringField("action", this.action == null ? null : this.action.toString()); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("clientMetric")) { + if (this.clientMetric == null) { + jsonWriter.writeNullField("clientMetric"); + } else { + jsonWriter.writeStringField("clientMetric", this.clientMetric.toString()); + } + } + if (updatedProperties.contains("aggregate")) { + if (this.aggregate == null) { + jsonWriter.writeNullField("aggregate"); + } else { + jsonWriter.writeStringField("aggregate", this.aggregate.toString()); + } + } + if (updatedProperties.contains("condition")) { + if (this.condition == null) { + jsonWriter.writeNullField("condition"); + } else { + jsonWriter.writeStringField("condition", this.condition); + } + } + if (updatedProperties.contains("requestName")) { + if (this.requestName == null) { + jsonWriter.writeNullField("requestName"); + } else { + jsonWriter.writeStringField("requestName", this.requestName); + } + } + if (updatedProperties.contains("value")) { + if (this.value == null) { + jsonWriter.writeNullField("value"); + } else { + jsonWriter.writeNumberField("value", this.value); + } + } + if (updatedProperties.contains("action")) { + if (this.action == null) { + jsonWriter.writeNullField("action"); + } else { + jsonWriter.writeStringField("action", this.action.toString()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PassFailMetric from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PassFailMetric if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PassFailMetric. + */ + @Generated + public static PassFailMetric fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PassFailMetric deserializedPassFailMetric = new PassFailMetric(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("clientMetric".equals(fieldName)) { + deserializedPassFailMetric.clientMetric = PFMetrics.fromString(reader.getString()); + } else if ("aggregate".equals(fieldName)) { + deserializedPassFailMetric.aggregate = PFAgFunc.fromString(reader.getString()); + } else if ("condition".equals(fieldName)) { + deserializedPassFailMetric.condition = reader.getString(); + } else if ("requestName".equals(fieldName)) { + deserializedPassFailMetric.requestName = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedPassFailMetric.value = reader.getNullable(JsonReader::getDouble); + } else if ("action".equals(fieldName)) { + deserializedPassFailMetric.action = PFAction.fromString(reader.getString()); + } else if ("actualValue".equals(fieldName)) { + deserializedPassFailMetric.actualValue = reader.getNullable(JsonReader::getDouble); + } else if ("result".equals(fieldName)) { + deserializedPassFailMetric.result = PFResult.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPassFailMetric; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/RecommendationCategory.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/RecommendationCategory.java new file mode 100644 index 0000000000000..79630dae1b432 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/RecommendationCategory.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Category of Recommendation. + */ +public final class RecommendationCategory extends ExpandableStringEnum { + /** + * The recommendation for this category optimizes the throughput/RPS (Requests per Second) of the app. + */ + @Generated + public static final RecommendationCategory THROUGHPUT_OPTIMIZED = fromString("ThroughputOptimized"); + + /** + * The recommendation for this category optimizes the cost of the app. + */ + @Generated + public static final RecommendationCategory COST_OPTIMIZED = fromString("CostOptimized"); + + /** + * Creates a new instance of RecommendationCategory value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public RecommendationCategory() { + } + + /** + * Creates or finds a RecommendationCategory from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecommendationCategory. + */ + @Generated + public static RecommendationCategory fromString(String name) { + return fromString(name, RecommendationCategory.class); + } + + /** + * Gets known RecommendationCategory values. + * + * @return known RecommendationCategory values. + */ + @Generated + public static Collection values() { + return values(RecommendationCategory.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/RegionalConfiguration.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/RegionalConfiguration.java new file mode 100644 index 0000000000000..d2395d658e09a --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/RegionalConfiguration.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Region distribution configuration for the load test. + */ +@Fluent +public final class RegionalConfiguration implements JsonSerializable { + /* + * The number of engine instances to execute load test in specified region. Supported values are in range of 1-400. + */ + @Generated + private int engineInstances; + + /* + * Azure region name. + * The region name should of format accepted by ARM, and should be a region supported by Azure Load Testing. For + * example, East US should be passed as "eastus". + * The region name must match one of the strings in the "Name" column returned from running the + * "az account list-locations -o table" Azure CLI command. + */ + @Generated + private String region; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setRegionalConfigurationAccessor(new JsonMergePatchHelper.RegionalConfigurationAccessor() { + @Override + public RegionalConfiguration prepareModelForJsonMergePatch(RegionalConfiguration model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(RegionalConfiguration model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of RegionalConfiguration class. + */ + @Generated + public RegionalConfiguration() { + } + + /** + * Get the engineInstances property: The number of engine instances to execute load test in specified region. + * Supported values are in range of 1-400. + * + * @return the engineInstances value. + */ + @Generated + public int getEngineInstances() { + return this.engineInstances; + } + + /** + * Set the engineInstances property: The number of engine instances to execute load test in specified region. + * Supported values are in range of 1-400. + *

Required when create the resource.

+ * + * @param engineInstances the engineInstances value to set. + * @return the RegionalConfiguration object itself. + */ + @Generated + public RegionalConfiguration setEngineInstances(int engineInstances) { + this.engineInstances = engineInstances; + this.updatedProperties.add("engineInstances"); + return this; + } + + /** + * Get the region property: Azure region name. + * The region name should of format accepted by ARM, and should be a region supported by Azure Load Testing. For + * example, East US should be passed as "eastus". + * The region name must match one of the strings in the "Name" column returned from running the "az account + * list-locations -o table" Azure CLI command. + * + * @return the region value. + */ + @Generated + public String getRegion() { + return this.region; + } + + /** + * Set the region property: Azure region name. + * The region name should of format accepted by ARM, and should be a region supported by Azure Load Testing. For + * example, East US should be passed as "eastus". + * The region name must match one of the strings in the "Name" column returned from running the "az account + * list-locations -o table" Azure CLI command. + *

Required when create the resource.

+ * + * @param region the region value to set. + * @return the RegionalConfiguration object itself. + */ + @Generated + public RegionalConfiguration setRegion(String region) { + this.region = region; + this.updatedProperties.add("region"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("engineInstances", this.engineInstances); + jsonWriter.writeStringField("region", this.region); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("engineInstances")) { + jsonWriter.writeIntField("engineInstances", this.engineInstances); + } + if (updatedProperties.contains("region")) { + if (this.region == null) { + jsonWriter.writeNullField("region"); + } else { + jsonWriter.writeStringField("region", this.region); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RegionalConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegionalConfiguration if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the RegionalConfiguration. + */ + @Generated + public static RegionalConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegionalConfiguration deserializedRegionalConfiguration = new RegionalConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("engineInstances".equals(fieldName)) { + deserializedRegionalConfiguration.engineInstances = reader.getInt(); + } else if ("region".equals(fieldName)) { + deserializedRegionalConfiguration.region = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRegionalConfiguration; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/RequestDataLevel.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/RequestDataLevel.java new file mode 100644 index 0000000000000..3eba79f91a9e5 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/RequestDataLevel.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Request data collection level for test run. + */ +public final class RequestDataLevel extends ExpandableStringEnum { + /** + * No request data will be collected. + */ + @Generated + public static final RequestDataLevel NONE = fromString("NONE"); + + /** + * Request data will be collected in case of failed requests. + */ + @Generated + public static final RequestDataLevel ERRORS = fromString("ERRORS"); + + /** + * Creates a new instance of RequestDataLevel value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public RequestDataLevel() { + } + + /** + * Creates or finds a RequestDataLevel from its string representation. + * + * @param name a name to look for. + * @return the corresponding RequestDataLevel. + */ + @Generated + public static RequestDataLevel fromString(String name) { + return fromString(name, RequestDataLevel.class); + } + + /** + * Gets known RequestDataLevel values. + * + * @return known RequestDataLevel values. + */ + @Generated + public static Collection values() { + return values(RequestDataLevel.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/ResourceKind.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/ResourceKind.java new file mode 100644 index 0000000000000..fbedbac3ed1cc --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/ResourceKind.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Kind of the resource on which test profile is created. + */ +public final class ResourceKind extends ExpandableStringEnum { + /** + * Resource is a Azure FunctionApp on Flex Consumption Plan. + */ + @Generated + public static final ResourceKind FUNCTIONS_FLEX_CONSUMPTION = fromString("FunctionsFlexConsumption"); + + /** + * Creates a new instance of ResourceKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ResourceKind() { + } + + /** + * Creates or finds a ResourceKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceKind. + */ + @Generated + public static ResourceKind fromString(String name) { + return fromString(name, ResourceKind.class); + } + + /** + * Gets known ResourceKind values. + * + * @return known ResourceKind values. + */ + @Generated + public static Collection values() { + return values(ResourceKind.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/ResourceMetric.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/ResourceMetric.java new file mode 100644 index 0000000000000..ac1cac74408f2 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/ResourceMetric.java @@ -0,0 +1,401 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Associated metric definition for particular metrics of the azure resource ( + * Refer : + * https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition). + */ +@Fluent +public final class ResourceMetric implements JsonSerializable { + /* + * Unique name for metric. + */ + @Generated + private String id; + + /* + * Azure resource id. + */ + @Generated + private String resourceId; + + /* + * Metric name space. + */ + @Generated + private String metricNamespace; + + /* + * Metric description. + */ + @Generated + private String displayDescription; + + /* + * The invariant value of metric name + */ + @Generated + private String name; + + /* + * Metric aggregation. + */ + @Generated + private String aggregation; + + /* + * Metric unit. + */ + @Generated + private String unit; + + /* + * Azure resource type. + */ + @Generated + private String resourceType; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setResourceMetricAccessor(new JsonMergePatchHelper.ResourceMetricAccessor() { + @Override + public ResourceMetric prepareModelForJsonMergePatch(ResourceMetric model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(ResourceMetric model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of ResourceMetric class. + */ + @Generated + public ResourceMetric() { + } + + /** + * Get the id property: Unique name for metric. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the resourceId property: Azure resource id. + * + * @return the resourceId value. + */ + @Generated + public String getResourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: Azure resource id. + *

Required when create the resource.

+ * + * @param resourceId the resourceId value to set. + * @return the ResourceMetric object itself. + */ + @Generated + public ResourceMetric setResourceId(String resourceId) { + this.resourceId = resourceId; + this.updatedProperties.add("resourceId"); + return this; + } + + /** + * Get the metricNamespace property: Metric name space. + * + * @return the metricNamespace value. + */ + @Generated + public String getMetricNamespace() { + return this.metricNamespace; + } + + /** + * Set the metricNamespace property: Metric name space. + *

Required when create the resource.

+ * + * @param metricNamespace the metricNamespace value to set. + * @return the ResourceMetric object itself. + */ + @Generated + public ResourceMetric setMetricNamespace(String metricNamespace) { + this.metricNamespace = metricNamespace; + this.updatedProperties.add("metricNamespace"); + return this; + } + + /** + * Get the displayDescription property: Metric description. + * + * @return the displayDescription value. + */ + @Generated + public String getDisplayDescription() { + return this.displayDescription; + } + + /** + * Set the displayDescription property: Metric description. + * + * @param displayDescription the displayDescription value to set. + * @return the ResourceMetric object itself. + */ + @Generated + public ResourceMetric setDisplayDescription(String displayDescription) { + this.displayDescription = displayDescription; + this.updatedProperties.add("displayDescription"); + return this; + } + + /** + * Get the name property: The invariant value of metric name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The invariant value of metric name. + *

Required when create the resource.

+ * + * @param name the name value to set. + * @return the ResourceMetric object itself. + */ + @Generated + public ResourceMetric setName(String name) { + this.name = name; + this.updatedProperties.add("name"); + return this; + } + + /** + * Get the aggregation property: Metric aggregation. + * + * @return the aggregation value. + */ + @Generated + public String getAggregation() { + return this.aggregation; + } + + /** + * Set the aggregation property: Metric aggregation. + *

Required when create the resource.

+ * + * @param aggregation the aggregation value to set. + * @return the ResourceMetric object itself. + */ + @Generated + public ResourceMetric setAggregation(String aggregation) { + this.aggregation = aggregation; + this.updatedProperties.add("aggregation"); + return this; + } + + /** + * Get the unit property: Metric unit. + * + * @return the unit value. + */ + @Generated + public String getUnit() { + return this.unit; + } + + /** + * Set the unit property: Metric unit. + * + * @param unit the unit value to set. + * @return the ResourceMetric object itself. + */ + @Generated + public ResourceMetric setUnit(String unit) { + this.unit = unit; + this.updatedProperties.add("unit"); + return this; + } + + /** + * Get the resourceType property: Azure resource type. + * + * @return the resourceType value. + */ + @Generated + public String getResourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: Azure resource type. + *

Required when create the resource.

+ * + * @param resourceType the resourceType value to set. + * @return the ResourceMetric object itself. + */ + @Generated + public ResourceMetric setResourceType(String resourceType) { + this.resourceType = resourceType; + this.updatedProperties.add("resourceType"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceId", this.resourceId); + jsonWriter.writeStringField("metricNamespace", this.metricNamespace); + jsonWriter.writeStringField("displayDescription", this.displayDescription); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("aggregation", this.aggregation); + jsonWriter.writeStringField("unit", this.unit); + jsonWriter.writeStringField("resourceType", this.resourceType); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("resourceId")) { + if (this.resourceId == null) { + jsonWriter.writeNullField("resourceId"); + } else { + jsonWriter.writeStringField("resourceId", this.resourceId); + } + } + if (updatedProperties.contains("metricNamespace")) { + if (this.metricNamespace == null) { + jsonWriter.writeNullField("metricNamespace"); + } else { + jsonWriter.writeStringField("metricNamespace", this.metricNamespace); + } + } + if (updatedProperties.contains("displayDescription")) { + if (this.displayDescription == null) { + jsonWriter.writeNullField("displayDescription"); + } else { + jsonWriter.writeStringField("displayDescription", this.displayDescription); + } + } + if (updatedProperties.contains("name")) { + if (this.name == null) { + jsonWriter.writeNullField("name"); + } else { + jsonWriter.writeStringField("name", this.name); + } + } + if (updatedProperties.contains("aggregation")) { + if (this.aggregation == null) { + jsonWriter.writeNullField("aggregation"); + } else { + jsonWriter.writeStringField("aggregation", this.aggregation); + } + } + if (updatedProperties.contains("unit")) { + if (this.unit == null) { + jsonWriter.writeNullField("unit"); + } else { + jsonWriter.writeStringField("unit", this.unit); + } + } + if (updatedProperties.contains("resourceType")) { + if (this.resourceType == null) { + jsonWriter.writeNullField("resourceType"); + } else { + jsonWriter.writeStringField("resourceType", this.resourceType); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceMetric from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceMetric if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceMetric. + */ + @Generated + public static ResourceMetric fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceMetric deserializedResourceMetric = new ResourceMetric(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedResourceMetric.id = reader.getString(); + } else if ("resourceId".equals(fieldName)) { + deserializedResourceMetric.resourceId = reader.getString(); + } else if ("metricNamespace".equals(fieldName)) { + deserializedResourceMetric.metricNamespace = reader.getString(); + } else if ("displayDescription".equals(fieldName)) { + deserializedResourceMetric.displayDescription = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedResourceMetric.name = reader.getString(); + } else if ("aggregation".equals(fieldName)) { + deserializedResourceMetric.aggregation = reader.getString(); + } else if ("unit".equals(fieldName)) { + deserializedResourceMetric.unit = reader.getString(); + } else if ("resourceType".equals(fieldName)) { + deserializedResourceMetric.resourceType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceMetric; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/Secret.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/Secret.java new file mode 100644 index 0000000000000..3f5c3740eb66e --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/Secret.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Secret. + */ +@Fluent +public final class Secret implements JsonSerializable { + /* + * The value of the secret for the respective type + */ + @Generated + private String value; + + /* + * Type of secret + */ + @Generated + private SecretType type; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setSecretAccessor(new JsonMergePatchHelper.SecretAccessor() { + @Override + public Secret prepareModelForJsonMergePatch(Secret model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(Secret model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of Secret class. + */ + @Generated + public Secret() { + } + + /** + * Get the value property: The value of the secret for the respective type. + * + * @return the value value. + */ + @Generated + public String getValue() { + return this.value; + } + + /** + * Set the value property: The value of the secret for the respective type. + * + * @param value the value value to set. + * @return the Secret object itself. + */ + @Generated + public Secret setValue(String value) { + this.value = value; + this.updatedProperties.add("value"); + return this; + } + + /** + * Get the type property: Type of secret. + * + * @return the type value. + */ + @Generated + public SecretType getType() { + return this.type; + } + + /** + * Set the type property: Type of secret. + * + * @param type the type value to set. + * @return the Secret object itself. + */ + @Generated + public Secret setType(SecretType type) { + this.type = type; + this.updatedProperties.add("type"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", this.value); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("value")) { + if (this.value == null) { + jsonWriter.writeNullField("value"); + } else { + jsonWriter.writeStringField("value", this.value); + } + } + if (updatedProperties.contains("type")) { + if (this.type == null) { + jsonWriter.writeNullField("type"); + } else { + jsonWriter.writeStringField("type", this.type.toString()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Secret from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Secret if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Secret. + */ + @Generated + public static Secret fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Secret deserializedSecret = new Secret(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedSecret.value = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecret.type = SecretType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSecret; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/SecretType.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/SecretType.java new file mode 100644 index 0000000000000..a62112d6590c8 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/SecretType.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Types of secrets supported. + */ +public final class SecretType extends ExpandableStringEnum { + /** + * If the secret is stored in an Azure Key Vault. + */ + @Generated + public static final SecretType AKV_SECRET_URI = fromString("AKV_SECRET_URI"); + + /** + * If the secret value provided as plain text. + */ + @Generated + public static final SecretType SECRET_VALUE = fromString("SECRET_VALUE"); + + /** + * Creates a new instance of SecretType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SecretType() { + } + + /** + * Creates or finds a SecretType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecretType. + */ + @Generated + public static SecretType fromString(String name) { + return fromString(name, SecretType.class); + } + + /** + * Gets known SecretType values. + * + * @return known SecretType values. + */ + @Generated + public static Collection values() { + return values(SecretType.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/Status.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/Status.java new file mode 100644 index 0000000000000..f23c1208712ce --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/Status.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Test run status. + */ +public final class Status extends ExpandableStringEnum { + /** + * Test run request is accepted. + */ + @Generated + public static final Status ACCEPTED = fromString("ACCEPTED"); + + /** + * Test run is not yet started. + */ + @Generated + public static final Status NOTSTARTED = fromString("NOTSTARTED"); + + /** + * Test run is provisioning. + */ + @Generated + public static final Status PROVISIONING = fromString("PROVISIONING"); + + /** + * Test run is provisioned. + */ + @Generated + public static final Status PROVISIONED = fromString("PROVISIONED"); + + /** + * Test run is getting configured. + */ + @Generated + public static final Status CONFIGURING = fromString("CONFIGURING"); + + /** + * Test run configuration is done. + */ + @Generated + public static final Status CONFIGURED = fromString("CONFIGURED"); + + /** + * Test run has started executing. + */ + @Generated + public static final Status EXECUTING = fromString("EXECUTING"); + + /** + * Test run execution is completed. + */ + @Generated + public static final Status EXECUTED = fromString("EXECUTED"); + + /** + * Test run is getting deprovisioned. + */ + @Generated + public static final Status DEPROVISIONING = fromString("DEPROVISIONING"); + + /** + * Test run is deprovisioned. + */ + @Generated + public static final Status DEPROVISIONED = fromString("DEPROVISIONED"); + + /** + * Test run is completed. + */ + @Generated + public static final Status DONE = fromString("DONE"); + + /** + * Test run is being cancelled. + */ + @Generated + public static final Status CANCELLING = fromString("CANCELLING"); + + /** + * Test run request is cancelled. + */ + @Generated + public static final Status CANCELLED = fromString("CANCELLED"); + + /** + * Test run request is failed. + */ + @Generated + public static final Status FAILED = fromString("FAILED"); + + /** + * Test run JMX file is validated. + */ + @Generated + public static final Status VALIDATION_SUCCESS = fromString("VALIDATION_SUCCESS"); + + /** + * Test run JMX file validation is failed. + */ + @Generated + public static final Status VALIDATION_FAILURE = fromString("VALIDATION_FAILURE"); + + /** + * Creates a new instance of Status value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public Status() { + } + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + @Generated + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** + * Gets known Status values. + * + * @return known Status values. + */ + @Generated + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TargetResourceConfigurations.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TargetResourceConfigurations.java new file mode 100644 index 0000000000000..b69acc753de29 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TargetResourceConfigurations.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Configurations of a target resource. This varies with the kind of resource. + */ +@Immutable +public class TargetResourceConfigurations implements JsonSerializable { + /* + * Kind of the resource for which the configurations apply. + */ + @Generated + private ResourceKind kind = ResourceKind.fromString("TargetResourceConfigurations"); + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper + .setTargetResourceConfigurationsAccessor(new JsonMergePatchHelper.TargetResourceConfigurationsAccessor() { + @Override + public TargetResourceConfigurations prepareModelForJsonMergePatch(TargetResourceConfigurations model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(TargetResourceConfigurations model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of TargetResourceConfigurations class. + */ + @Generated + public TargetResourceConfigurations() { + } + + /** + * Get the kind property: Kind of the resource for which the configurations apply. + * + * @return the kind value. + */ + @Generated + public ResourceKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetResourceConfigurations from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetResourceConfigurations if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TargetResourceConfigurations. + */ + @Generated + public static TargetResourceConfigurations fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("FunctionsFlexConsumption".equals(discriminatorValue)) { + return FunctionFlexConsumptionTargetResourceConfigurations.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static TargetResourceConfigurations fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetResourceConfigurations deserializedTargetResourceConfigurations = new TargetResourceConfigurations(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedTargetResourceConfigurations.kind = ResourceKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetResourceConfigurations; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/Test.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/Test.java new file mode 100644 index 0000000000000..eb85e42268111 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/Test.java @@ -0,0 +1,817 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Load test model. + */ +@Fluent +public final class Test implements JsonSerializable { + /* + * Pass fail criteria for a test. + */ + @Generated + private PassFailCriteria passFailCriteria; + + /* + * Auto stop criteria for a test. This will automatically stop a load test if the error percentage is high for a + * certain time window. + */ + @Generated + private AutoStopCriteria autoStopCriteria; + + /* + * Secrets can be stored in an Azure Key Vault or any other secret store. If the + * secret is stored in an Azure Key Vault, the value should be the secret + * identifier and the type should be AKV_SECRET_URI. If the secret is stored + * elsewhere, the secret value should be provided directly and the type should be + * SECRET_VALUE. + */ + @Generated + private Map secrets; + + /* + * Certificates metadata. + */ + @Generated + private CertificateMetadata certificate; + + /* + * Environment variables which are defined as a set of pairs. + */ + @Generated + private Map environmentVariables; + + /* + * The load test configuration. + */ + @Generated + private LoadTestConfiguration loadTestConfiguration; + + /* + * Id of the test run to be marked as baseline to view trends of client-side metrics from recent test runs + */ + @Generated + private String baselineTestRunId; + + /* + * The input artifacts for the test. + */ + @Generated + private TestInputArtifacts inputArtifacts; + + /* + * Unique test identifier for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen + * characters. + */ + @Generated + private String testId; + + /* + * The test description. + */ + @Generated + private String description; + + /* + * Display name of a test. + */ + @Generated + private String displayName; + + /* + * Subnet ID on which the load test instances should run. + */ + @Generated + private String subnetId; + + /* + * Kind of test. + */ + @Generated + private TestKind kind; + + /* + * Inject load test engines without deploying public IP for outbound access + */ + @Generated + private Boolean publicIPDisabled; + + /* + * Type of the managed identity referencing the Key vault. + */ + @Generated + private String keyvaultReferenceIdentityType; + + /* + * Resource Id of the managed identity referencing the Key vault. + */ + @Generated + private String keyvaultReferenceIdentityId; + + /* + * The creation datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime createdDateTime; + + /* + * The user that created. + */ + @Generated + private String createdBy; + + /* + * The last Modified datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime lastModifiedDateTime; + + /* + * The user that last modified. + */ + @Generated + private String lastModifiedBy; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setTestAccessor(new JsonMergePatchHelper.TestAccessor() { + @Override + public Test prepareModelForJsonMergePatch(Test model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(Test model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of Test class. + */ + @Generated + public Test() { + } + + /** + * Get the passFailCriteria property: Pass fail criteria for a test. + * + * @return the passFailCriteria value. + */ + @Generated + public PassFailCriteria getPassFailCriteria() { + return this.passFailCriteria; + } + + /** + * Set the passFailCriteria property: Pass fail criteria for a test. + * + * @param passFailCriteria the passFailCriteria value to set. + * @return the Test object itself. + */ + @Generated + public Test setPassFailCriteria(PassFailCriteria passFailCriteria) { + this.passFailCriteria = passFailCriteria; + this.updatedProperties.add("passFailCriteria"); + return this; + } + + /** + * Get the autoStopCriteria property: Auto stop criteria for a test. This will automatically stop a load test if the + * error percentage is high for a certain time window. + * + * @return the autoStopCriteria value. + */ + @Generated + public AutoStopCriteria getAutoStopCriteria() { + return this.autoStopCriteria; + } + + /** + * Set the autoStopCriteria property: Auto stop criteria for a test. This will automatically stop a load test if the + * error percentage is high for a certain time window. + * + * @param autoStopCriteria the autoStopCriteria value to set. + * @return the Test object itself. + */ + @Generated + public Test setAutoStopCriteria(AutoStopCriteria autoStopCriteria) { + this.autoStopCriteria = autoStopCriteria; + this.updatedProperties.add("autoStopCriteria"); + return this; + } + + /** + * Get the secrets property: Secrets can be stored in an Azure Key Vault or any other secret store. If the + * secret is stored in an Azure Key Vault, the value should be the secret + * identifier and the type should be AKV_SECRET_URI. If the secret is stored + * elsewhere, the secret value should be provided directly and the type should be + * SECRET_VALUE. + * + * @return the secrets value. + */ + @Generated + public Map getSecrets() { + return this.secrets; + } + + /** + * Set the secrets property: Secrets can be stored in an Azure Key Vault or any other secret store. If the + * secret is stored in an Azure Key Vault, the value should be the secret + * identifier and the type should be AKV_SECRET_URI. If the secret is stored + * elsewhere, the secret value should be provided directly and the type should be + * SECRET_VALUE. + * + * @param secrets the secrets value to set. + * @return the Test object itself. + */ + @Generated + public Test setSecrets(Map secrets) { + this.secrets = secrets; + this.updatedProperties.add("secrets"); + return this; + } + + /** + * Get the certificate property: Certificates metadata. + * + * @return the certificate value. + */ + @Generated + public CertificateMetadata getCertificate() { + return this.certificate; + } + + /** + * Set the certificate property: Certificates metadata. + * + * @param certificate the certificate value to set. + * @return the Test object itself. + */ + @Generated + public Test setCertificate(CertificateMetadata certificate) { + this.certificate = certificate; + this.updatedProperties.add("certificate"); + return this; + } + + /** + * Get the environmentVariables property: Environment variables which are defined as a set of <name,value> + * pairs. + * + * @return the environmentVariables value. + */ + @Generated + public Map getEnvironmentVariables() { + return this.environmentVariables; + } + + /** + * Set the environmentVariables property: Environment variables which are defined as a set of <name,value> + * pairs. + * + * @param environmentVariables the environmentVariables value to set. + * @return the Test object itself. + */ + @Generated + public Test setEnvironmentVariables(Map environmentVariables) { + this.environmentVariables = environmentVariables; + this.updatedProperties.add("environmentVariables"); + return this; + } + + /** + * Get the loadTestConfiguration property: The load test configuration. + * + * @return the loadTestConfiguration value. + */ + @Generated + public LoadTestConfiguration getLoadTestConfiguration() { + return this.loadTestConfiguration; + } + + /** + * Set the loadTestConfiguration property: The load test configuration. + * + * @param loadTestConfiguration the loadTestConfiguration value to set. + * @return the Test object itself. + */ + @Generated + public Test setLoadTestConfiguration(LoadTestConfiguration loadTestConfiguration) { + this.loadTestConfiguration = loadTestConfiguration; + this.updatedProperties.add("loadTestConfiguration"); + return this; + } + + /** + * Get the baselineTestRunId property: Id of the test run to be marked as baseline to view trends of client-side + * metrics from recent test runs. + * + * @return the baselineTestRunId value. + */ + @Generated + public String getBaselineTestRunId() { + return this.baselineTestRunId; + } + + /** + * Set the baselineTestRunId property: Id of the test run to be marked as baseline to view trends of client-side + * metrics from recent test runs. + * + * @param baselineTestRunId the baselineTestRunId value to set. + * @return the Test object itself. + */ + @Generated + public Test setBaselineTestRunId(String baselineTestRunId) { + this.baselineTestRunId = baselineTestRunId; + this.updatedProperties.add("baselineTestRunId"); + return this; + } + + /** + * Get the inputArtifacts property: The input artifacts for the test. + * + * @return the inputArtifacts value. + */ + @Generated + public TestInputArtifacts getInputArtifacts() { + return this.inputArtifacts; + } + + /** + * Get the testId property: Unique test identifier for the load test, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * + * @return the testId value. + */ + @Generated + public String getTestId() { + return this.testId; + } + + /** + * Get the description property: The test description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The test description. + * + * @param description the description value to set. + * @return the Test object itself. + */ + @Generated + public Test setDescription(String description) { + this.description = description; + this.updatedProperties.add("description"); + return this; + } + + /** + * Get the displayName property: Display name of a test. + * + * @return the displayName value. + */ + @Generated + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name of a test. + * + * @param displayName the displayName value to set. + * @return the Test object itself. + */ + @Generated + public Test setDisplayName(String displayName) { + this.displayName = displayName; + this.updatedProperties.add("displayName"); + return this; + } + + /** + * Get the subnetId property: Subnet ID on which the load test instances should run. + * + * @return the subnetId value. + */ + @Generated + public String getSubnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: Subnet ID on which the load test instances should run. + * + * @param subnetId the subnetId value to set. + * @return the Test object itself. + */ + @Generated + public Test setSubnetId(String subnetId) { + this.subnetId = subnetId; + this.updatedProperties.add("subnetId"); + return this; + } + + /** + * Get the kind property: Kind of test. + * + * @return the kind value. + */ + @Generated + public TestKind getKind() { + return this.kind; + } + + /** + * Set the kind property: Kind of test. + * + * @param kind the kind value to set. + * @return the Test object itself. + */ + @Generated + public Test setKind(TestKind kind) { + this.kind = kind; + this.updatedProperties.add("kind"); + return this; + } + + /** + * Get the publicIPDisabled property: Inject load test engines without deploying public IP for outbound access. + * + * @return the publicIPDisabled value. + */ + @Generated + public Boolean isPublicIPDisabled() { + return this.publicIPDisabled; + } + + /** + * Set the publicIPDisabled property: Inject load test engines without deploying public IP for outbound access. + * + * @param publicIPDisabled the publicIPDisabled value to set. + * @return the Test object itself. + */ + @Generated + public Test setPublicIPDisabled(Boolean publicIPDisabled) { + this.publicIPDisabled = publicIPDisabled; + this.updatedProperties.add("publicIPDisabled"); + return this; + } + + /** + * Get the keyvaultReferenceIdentityType property: Type of the managed identity referencing the Key vault. + * + * @return the keyvaultReferenceIdentityType value. + */ + @Generated + public String getKeyvaultReferenceIdentityType() { + return this.keyvaultReferenceIdentityType; + } + + /** + * Set the keyvaultReferenceIdentityType property: Type of the managed identity referencing the Key vault. + * + * @param keyvaultReferenceIdentityType the keyvaultReferenceIdentityType value to set. + * @return the Test object itself. + */ + @Generated + public Test setKeyvaultReferenceIdentityType(String keyvaultReferenceIdentityType) { + this.keyvaultReferenceIdentityType = keyvaultReferenceIdentityType; + this.updatedProperties.add("keyvaultReferenceIdentityType"); + return this; + } + + /** + * Get the keyvaultReferenceIdentityId property: Resource Id of the managed identity referencing the Key vault. + * + * @return the keyvaultReferenceIdentityId value. + */ + @Generated + public String getKeyvaultReferenceIdentityId() { + return this.keyvaultReferenceIdentityId; + } + + /** + * Set the keyvaultReferenceIdentityId property: Resource Id of the managed identity referencing the Key vault. + * + * @param keyvaultReferenceIdentityId the keyvaultReferenceIdentityId value to set. + * @return the Test object itself. + */ + @Generated + public Test setKeyvaultReferenceIdentityId(String keyvaultReferenceIdentityId) { + this.keyvaultReferenceIdentityId = keyvaultReferenceIdentityId; + this.updatedProperties.add("keyvaultReferenceIdentityId"); + return this; + } + + /** + * Get the createdDateTime property: The creation datetime(RFC 3339 literal format). + * + * @return the createdDateTime value. + */ + @Generated + public OffsetDateTime getCreatedDateTime() { + return this.createdDateTime; + } + + /** + * Get the createdBy property: The user that created. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the lastModifiedDateTime property: The last Modified datetime(RFC 3339 literal format). + * + * @return the lastModifiedDateTime value. + */ + @Generated + public OffsetDateTime getLastModifiedDateTime() { + return this.lastModifiedDateTime; + } + + /** + * Get the lastModifiedBy property: The user that last modified. + * + * @return the lastModifiedBy value. + */ + @Generated + public String getLastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("passFailCriteria", this.passFailCriteria); + jsonWriter.writeJsonField("autoStopCriteria", this.autoStopCriteria); + jsonWriter.writeMapField("secrets", this.secrets, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("certificate", this.certificate); + jsonWriter.writeMapField("environmentVariables", this.environmentVariables, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("loadTestConfiguration", this.loadTestConfiguration); + jsonWriter.writeStringField("baselineTestRunId", this.baselineTestRunId); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("subnetId", this.subnetId); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeBooleanField("publicIPDisabled", this.publicIPDisabled); + jsonWriter.writeStringField("keyvaultReferenceIdentityType", this.keyvaultReferenceIdentityType); + jsonWriter.writeStringField("keyvaultReferenceIdentityId", this.keyvaultReferenceIdentityId); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("passFailCriteria")) { + if (this.passFailCriteria == null) { + jsonWriter.writeNullField("passFailCriteria"); + } else { + JsonMergePatchHelper.getPassFailCriteriaAccessor() + .prepareModelForJsonMergePatch(this.passFailCriteria, true); + jsonWriter.writeJsonField("passFailCriteria", this.passFailCriteria); + JsonMergePatchHelper.getPassFailCriteriaAccessor() + .prepareModelForJsonMergePatch(this.passFailCriteria, false); + } + } + if (updatedProperties.contains("autoStopCriteria")) { + if (this.autoStopCriteria == null) { + jsonWriter.writeNullField("autoStopCriteria"); + } else { + JsonMergePatchHelper.getAutoStopCriteriaAccessor() + .prepareModelForJsonMergePatch(this.autoStopCriteria, true); + jsonWriter.writeJsonField("autoStopCriteria", this.autoStopCriteria); + JsonMergePatchHelper.getAutoStopCriteriaAccessor() + .prepareModelForJsonMergePatch(this.autoStopCriteria, false); + } + } + if (updatedProperties.contains("secrets")) { + if (this.secrets == null) { + jsonWriter.writeNullField("secrets"); + } else { + jsonWriter.writeMapField("secrets", this.secrets, (writer, element) -> { + if (element != null) { + JsonMergePatchHelper.getSecretAccessor().prepareModelForJsonMergePatch(element, true); + writer.writeJson(element); + JsonMergePatchHelper.getSecretAccessor().prepareModelForJsonMergePatch(element, false); + } else { + writer.writeNull(); + } + }); + } + } + if (updatedProperties.contains("certificate")) { + if (this.certificate == null) { + jsonWriter.writeNullField("certificate"); + } else { + JsonMergePatchHelper.getCertificateMetadataAccessor() + .prepareModelForJsonMergePatch(this.certificate, true); + jsonWriter.writeJsonField("certificate", this.certificate); + JsonMergePatchHelper.getCertificateMetadataAccessor() + .prepareModelForJsonMergePatch(this.certificate, false); + } + } + if (updatedProperties.contains("environmentVariables")) { + if (this.environmentVariables == null) { + jsonWriter.writeNullField("environmentVariables"); + } else { + jsonWriter.writeMapField("environmentVariables", this.environmentVariables, (writer, element) -> { + if (element != null) { + writer.writeString(element); + } else { + writer.writeNull(); + } + }); + } + } + if (updatedProperties.contains("loadTestConfiguration")) { + if (this.loadTestConfiguration == null) { + jsonWriter.writeNullField("loadTestConfiguration"); + } else { + JsonMergePatchHelper.getLoadTestConfigurationAccessor() + .prepareModelForJsonMergePatch(this.loadTestConfiguration, true); + jsonWriter.writeJsonField("loadTestConfiguration", this.loadTestConfiguration); + JsonMergePatchHelper.getLoadTestConfigurationAccessor() + .prepareModelForJsonMergePatch(this.loadTestConfiguration, false); + } + } + if (updatedProperties.contains("baselineTestRunId")) { + if (this.baselineTestRunId == null) { + jsonWriter.writeNullField("baselineTestRunId"); + } else { + jsonWriter.writeStringField("baselineTestRunId", this.baselineTestRunId); + } + } + if (updatedProperties.contains("description")) { + if (this.description == null) { + jsonWriter.writeNullField("description"); + } else { + jsonWriter.writeStringField("description", this.description); + } + } + if (updatedProperties.contains("displayName")) { + if (this.displayName == null) { + jsonWriter.writeNullField("displayName"); + } else { + jsonWriter.writeStringField("displayName", this.displayName); + } + } + if (updatedProperties.contains("subnetId")) { + if (this.subnetId == null) { + jsonWriter.writeNullField("subnetId"); + } else { + jsonWriter.writeStringField("subnetId", this.subnetId); + } + } + if (updatedProperties.contains("kind")) { + if (this.kind == null) { + jsonWriter.writeNullField("kind"); + } else { + jsonWriter.writeStringField("kind", this.kind.toString()); + } + } + if (updatedProperties.contains("publicIPDisabled")) { + if (this.publicIPDisabled == null) { + jsonWriter.writeNullField("publicIPDisabled"); + } else { + jsonWriter.writeBooleanField("publicIPDisabled", this.publicIPDisabled); + } + } + if (updatedProperties.contains("keyvaultReferenceIdentityType")) { + if (this.keyvaultReferenceIdentityType == null) { + jsonWriter.writeNullField("keyvaultReferenceIdentityType"); + } else { + jsonWriter.writeStringField("keyvaultReferenceIdentityType", this.keyvaultReferenceIdentityType); + } + } + if (updatedProperties.contains("keyvaultReferenceIdentityId")) { + if (this.keyvaultReferenceIdentityId == null) { + jsonWriter.writeNullField("keyvaultReferenceIdentityId"); + } else { + jsonWriter.writeStringField("keyvaultReferenceIdentityId", this.keyvaultReferenceIdentityId); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Test from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Test if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Test. + */ + @Generated + public static Test fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Test deserializedTest = new Test(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("testId".equals(fieldName)) { + deserializedTest.testId = reader.getString(); + } else if ("passFailCriteria".equals(fieldName)) { + deserializedTest.passFailCriteria = PassFailCriteria.fromJson(reader); + } else if ("autoStopCriteria".equals(fieldName)) { + deserializedTest.autoStopCriteria = AutoStopCriteria.fromJson(reader); + } else if ("secrets".equals(fieldName)) { + Map secrets = reader.readMap(reader1 -> Secret.fromJson(reader1)); + deserializedTest.secrets = secrets; + } else if ("certificate".equals(fieldName)) { + deserializedTest.certificate = CertificateMetadata.fromJson(reader); + } else if ("environmentVariables".equals(fieldName)) { + Map environmentVariables = reader.readMap(reader1 -> reader1.getString()); + deserializedTest.environmentVariables = environmentVariables; + } else if ("loadTestConfiguration".equals(fieldName)) { + deserializedTest.loadTestConfiguration = LoadTestConfiguration.fromJson(reader); + } else if ("baselineTestRunId".equals(fieldName)) { + deserializedTest.baselineTestRunId = reader.getString(); + } else if ("inputArtifacts".equals(fieldName)) { + deserializedTest.inputArtifacts = TestInputArtifacts.fromJson(reader); + } else if ("description".equals(fieldName)) { + deserializedTest.description = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedTest.displayName = reader.getString(); + } else if ("subnetId".equals(fieldName)) { + deserializedTest.subnetId = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedTest.kind = TestKind.fromString(reader.getString()); + } else if ("publicIPDisabled".equals(fieldName)) { + deserializedTest.publicIPDisabled = reader.getNullable(JsonReader::getBoolean); + } else if ("keyvaultReferenceIdentityType".equals(fieldName)) { + deserializedTest.keyvaultReferenceIdentityType = reader.getString(); + } else if ("keyvaultReferenceIdentityId".equals(fieldName)) { + deserializedTest.keyvaultReferenceIdentityId = reader.getString(); + } else if ("createdDateTime".equals(fieldName)) { + deserializedTest.createdDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedTest.createdBy = reader.getString(); + } else if ("lastModifiedDateTime".equals(fieldName)) { + deserializedTest.lastModifiedDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedBy".equals(fieldName)) { + deserializedTest.lastModifiedBy = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTest; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestAppComponents.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestAppComponents.java new file mode 100644 index 0000000000000..044d7405c6198 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestAppComponents.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Test app components. + */ +@Fluent +public final class TestAppComponents implements JsonSerializable { + /* + * Azure resource collection { resource id (fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + * : resource object } + */ + @Generated + private Map components; + + /* + * Test identifier + */ + @Generated + private String testId; + + /* + * The creation datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime createdDateTime; + + /* + * The user that created. + */ + @Generated + private String createdBy; + + /* + * The last Modified datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime lastModifiedDateTime; + + /* + * The user that last modified. + */ + @Generated + private String lastModifiedBy; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setTestAppComponentsAccessor(new JsonMergePatchHelper.TestAppComponentsAccessor() { + @Override + public TestAppComponents prepareModelForJsonMergePatch(TestAppComponents model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(TestAppComponents model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of TestAppComponents class. + */ + @Generated + public TestAppComponents() { + } + + /** + * Get the components property: Azure resource collection { resource id (fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + * : resource object }. + * + * @return the components value. + */ + @Generated + public Map getComponents() { + return this.components; + } + + /** + * Set the components property: Azure resource collection { resource id (fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + * : resource object }. + *

Required when create the resource.

+ * + * @param components the components value to set. + * @return the TestAppComponents object itself. + */ + @Generated + public TestAppComponents setComponents(Map components) { + this.components = components; + this.updatedProperties.add("components"); + return this; + } + + /** + * Get the testId property: Test identifier. + * + * @return the testId value. + */ + @Generated + public String getTestId() { + return this.testId; + } + + /** + * Get the createdDateTime property: The creation datetime(RFC 3339 literal format). + * + * @return the createdDateTime value. + */ + @Generated + public OffsetDateTime getCreatedDateTime() { + return this.createdDateTime; + } + + /** + * Get the createdBy property: The user that created. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the lastModifiedDateTime property: The last Modified datetime(RFC 3339 literal format). + * + * @return the lastModifiedDateTime value. + */ + @Generated + public OffsetDateTime getLastModifiedDateTime() { + return this.lastModifiedDateTime; + } + + /** + * Get the lastModifiedBy property: The user that last modified. + * + * @return the lastModifiedBy value. + */ + @Generated + public String getLastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("components", this.components, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("components")) { + if (this.components == null) { + jsonWriter.writeNullField("components"); + } else { + jsonWriter.writeMapField("components", this.components, (writer, element) -> { + if (element != null) { + JsonMergePatchHelper.getAppComponentAccessor().prepareModelForJsonMergePatch(element, true); + writer.writeJson(element); + JsonMergePatchHelper.getAppComponentAccessor().prepareModelForJsonMergePatch(element, false); + } else { + writer.writeNull(); + } + }); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestAppComponents from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestAppComponents if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TestAppComponents. + */ + @Generated + public static TestAppComponents fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestAppComponents deserializedTestAppComponents = new TestAppComponents(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("components".equals(fieldName)) { + Map components = reader.readMap(reader1 -> AppComponent.fromJson(reader1)); + deserializedTestAppComponents.components = components; + } else if ("testId".equals(fieldName)) { + deserializedTestAppComponents.testId = reader.getString(); + } else if ("createdDateTime".equals(fieldName)) { + deserializedTestAppComponents.createdDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedTestAppComponents.createdBy = reader.getString(); + } else if ("lastModifiedDateTime".equals(fieldName)) { + deserializedTestAppComponents.lastModifiedDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedBy".equals(fieldName)) { + deserializedTestAppComponents.lastModifiedBy = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTestAppComponents; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestFileInfo.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestFileInfo.java new file mode 100644 index 0000000000000..98a4f3b055f0a --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestFileInfo.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Test file info. + */ +@Immutable +public final class TestFileInfo implements JsonSerializable { + /* + * Name of the file. + */ + @Generated + private String fileName; + + /* + * File URL. + */ + @Generated + private String url; + + /* + * File type + */ + @Generated + private FileType fileType; + + /* + * Expiry time of the file (RFC 3339 literal format) + */ + @Generated + private OffsetDateTime expireDateTime; + + /* + * Validation status of the file + */ + @Generated + private FileStatus validationStatus; + + /* + * Validation failure error details + */ + @Generated + private String validationFailureDetails; + + /** + * Creates an instance of TestFileInfo class. + */ + @Generated + private TestFileInfo() { + } + + /** + * Get the fileName property: Name of the file. + * + * @return the fileName value. + */ + @Generated + public String getFileName() { + return this.fileName; + } + + /** + * Get the url property: File URL. + * + * @return the url value. + */ + @Generated + public String getUrl() { + return this.url; + } + + /** + * Get the fileType property: File type. + * + * @return the fileType value. + */ + @Generated + public FileType getFileType() { + return this.fileType; + } + + /** + * Get the expireDateTime property: Expiry time of the file (RFC 3339 literal format). + * + * @return the expireDateTime value. + */ + @Generated + public OffsetDateTime getExpireDateTime() { + return this.expireDateTime; + } + + /** + * Get the validationStatus property: Validation status of the file. + * + * @return the validationStatus value. + */ + @Generated + public FileStatus getValidationStatus() { + return this.validationStatus; + } + + /** + * Get the validationFailureDetails property: Validation failure error details. + * + * @return the validationFailureDetails value. + */ + @Generated + public String getValidationFailureDetails() { + return this.validationFailureDetails; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestFileInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestFileInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TestFileInfo. + */ + @Generated + public static TestFileInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestFileInfo deserializedTestFileInfo = new TestFileInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fileName".equals(fieldName)) { + deserializedTestFileInfo.fileName = reader.getString(); + } else if ("url".equals(fieldName)) { + deserializedTestFileInfo.url = reader.getString(); + } else if ("fileType".equals(fieldName)) { + deserializedTestFileInfo.fileType = FileType.fromString(reader.getString()); + } else if ("expireDateTime".equals(fieldName)) { + deserializedTestFileInfo.expireDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("validationStatus".equals(fieldName)) { + deserializedTestFileInfo.validationStatus = FileStatus.fromString(reader.getString()); + } else if ("validationFailureDetails".equals(fieldName)) { + deserializedTestFileInfo.validationFailureDetails = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTestFileInfo; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestInputArtifacts.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestInputArtifacts.java new file mode 100644 index 0000000000000..71fe52c0013b7 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestInputArtifacts.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The input artifacts for the test. + */ +@Immutable +public final class TestInputArtifacts implements JsonSerializable { + /* + * File info + */ + @Generated + private TestFileInfo configFileInfo; + + /* + * File info + */ + @Generated + private TestFileInfo testScriptFileInfo; + + /* + * File info + */ + @Generated + private TestFileInfo userPropFileInfo; + + /* + * File info + */ + @Generated + private TestFileInfo inputArtifactsZipFileInfo; + + /* + * The config json file for url based test + */ + @Generated + private TestFileInfo urlTestConfigFileInfo; + + /* + * Additional supported files for the test run + */ + @Generated + private List additionalFileInfo; + + /** + * Creates an instance of TestInputArtifacts class. + */ + @Generated + private TestInputArtifacts() { + } + + /** + * Get the configFileInfo property: File info. + * + * @return the configFileInfo value. + */ + @Generated + public TestFileInfo getConfigFileInfo() { + return this.configFileInfo; + } + + /** + * Get the testScriptFileInfo property: File info. + * + * @return the testScriptFileInfo value. + */ + @Generated + public TestFileInfo getTestScriptFileInfo() { + return this.testScriptFileInfo; + } + + /** + * Get the userPropFileInfo property: File info. + * + * @return the userPropFileInfo value. + */ + @Generated + public TestFileInfo getUserPropFileInfo() { + return this.userPropFileInfo; + } + + /** + * Get the inputArtifactsZipFileInfo property: File info. + * + * @return the inputArtifactsZipFileInfo value. + */ + @Generated + public TestFileInfo getInputArtifactsZipFileInfo() { + return this.inputArtifactsZipFileInfo; + } + + /** + * Get the urlTestConfigFileInfo property: The config json file for url based test. + * + * @return the urlTestConfigFileInfo value. + */ + @Generated + public TestFileInfo getUrlTestConfigFileInfo() { + return this.urlTestConfigFileInfo; + } + + /** + * Get the additionalFileInfo property: Additional supported files for the test run. + * + * @return the additionalFileInfo value. + */ + @Generated + public List getAdditionalFileInfo() { + return this.additionalFileInfo; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("configFileInfo", this.configFileInfo); + jsonWriter.writeJsonField("testScriptFileInfo", this.testScriptFileInfo); + jsonWriter.writeJsonField("userPropFileInfo", this.userPropFileInfo); + jsonWriter.writeJsonField("inputArtifactsZipFileInfo", this.inputArtifactsZipFileInfo); + jsonWriter.writeJsonField("urlTestConfigFileInfo", this.urlTestConfigFileInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestInputArtifacts from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestInputArtifacts if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TestInputArtifacts. + */ + @Generated + public static TestInputArtifacts fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestInputArtifacts deserializedTestInputArtifacts = new TestInputArtifacts(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("configFileInfo".equals(fieldName)) { + deserializedTestInputArtifacts.configFileInfo = TestFileInfo.fromJson(reader); + } else if ("testScriptFileInfo".equals(fieldName)) { + deserializedTestInputArtifacts.testScriptFileInfo = TestFileInfo.fromJson(reader); + } else if ("userPropFileInfo".equals(fieldName)) { + deserializedTestInputArtifacts.userPropFileInfo = TestFileInfo.fromJson(reader); + } else if ("inputArtifactsZipFileInfo".equals(fieldName)) { + deserializedTestInputArtifacts.inputArtifactsZipFileInfo = TestFileInfo.fromJson(reader); + } else if ("urlTestConfigFileInfo".equals(fieldName)) { + deserializedTestInputArtifacts.urlTestConfigFileInfo = TestFileInfo.fromJson(reader); + } else if ("additionalFileInfo".equals(fieldName)) { + List additionalFileInfo = reader.readArray(reader1 -> TestFileInfo.fromJson(reader1)); + deserializedTestInputArtifacts.additionalFileInfo = additionalFileInfo; + } else { + reader.skipChildren(); + } + } + + return deserializedTestInputArtifacts; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestKind.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestKind.java new file mode 100644 index 0000000000000..0b2370ab1d84b --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestKind.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Test kind. + */ +public final class TestKind extends ExpandableStringEnum { + /** + * URL Test. + */ + @Generated + public static final TestKind URL = fromString("URL"); + + /** + * JMX Test. + */ + @Generated + public static final TestKind JMX = fromString("JMX"); + + /** + * Locust Test. + */ + @Generated + public static final TestKind LOCUST = fromString("Locust"); + + /** + * Creates a new instance of TestKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public TestKind() { + } + + /** + * Creates or finds a TestKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding TestKind. + */ + @Generated + public static TestKind fromString(String name) { + return fromString(name, TestKind.class); + } + + /** + * Gets known TestKind values. + * + * @return known TestKind values. + */ + @Generated + public static Collection values() { + return values(TestKind.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestProfile.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestProfile.java new file mode 100644 index 0000000000000..23b32035faad8 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestProfile.java @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashSet; +import java.util.Set; + +/** + * Test Profile Model. + * + * The Test Profile Model. A Test Profile resource enables you to set up a test profile which contains various + * configurations for a supported resource type and a load test to execute on that resource. + */ +@Fluent +public final class TestProfile implements JsonSerializable { + /* + * Unique identifier for the test profile, must contain only lower-case alphabetic, numeric, underscore or hyphen + * characters. + */ + @Generated + private String testProfileId; + + /* + * Display name of the test profile. + */ + @Generated + private String displayName; + + /* + * Description for the test profile. + */ + @Generated + private String description; + + /* + * Associated test ID for the test profile. This property is required for creating a Test Profile and it's not + * allowed to be updated. + */ + @Generated + private String testId; + + /* + * Target resource ID on which the test profile is created. This property is required for creating a Test Profile + * and it's not allowed to be updated. + */ + @Generated + private String targetResourceId; + + /* + * Configurations of the target resource on which testing would be done. + */ + @Generated + private TargetResourceConfigurations targetResourceConfigurations; + + /* + * The creation datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime createdDateTime; + + /* + * The user that created. + */ + @Generated + private String createdBy; + + /* + * The last Modified datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime lastModifiedDateTime; + + /* + * The user that last modified. + */ + @Generated + private String lastModifiedBy; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setTestProfileAccessor(new JsonMergePatchHelper.TestProfileAccessor() { + @Override + public TestProfile prepareModelForJsonMergePatch(TestProfile model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(TestProfile model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of TestProfile class. + */ + @Generated + public TestProfile() { + } + + /** + * Get the testProfileId property: Unique identifier for the test profile, must contain only lower-case alphabetic, + * numeric, underscore or hyphen characters. + * + * @return the testProfileId value. + */ + @Generated + public String getTestProfileId() { + return this.testProfileId; + } + + /** + * Get the displayName property: Display name of the test profile. + * + * @return the displayName value. + */ + @Generated + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name of the test profile. + * + * @param displayName the displayName value to set. + * @return the TestProfile object itself. + */ + @Generated + public TestProfile setDisplayName(String displayName) { + this.displayName = displayName; + this.updatedProperties.add("displayName"); + return this; + } + + /** + * Get the description property: Description for the test profile. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: Description for the test profile. + * + * @param description the description value to set. + * @return the TestProfile object itself. + */ + @Generated + public TestProfile setDescription(String description) { + this.description = description; + this.updatedProperties.add("description"); + return this; + } + + /** + * Get the testId property: Associated test ID for the test profile. This property is required for creating a Test + * Profile and it's not allowed to be updated. + * + * @return the testId value. + */ + @Generated + public String getTestId() { + return this.testId; + } + + /** + * Set the testId property: Associated test ID for the test profile. This property is required for creating a Test + * Profile and it's not allowed to be updated. + * + * @param testId the testId value to set. + * @return the TestProfile object itself. + */ + @Generated + public TestProfile setTestId(String testId) { + this.testId = testId; + this.updatedProperties.add("testId"); + return this; + } + + /** + * Get the targetResourceId property: Target resource ID on which the test profile is created. This property is + * required for creating a Test Profile and it's not allowed to be updated. + * + * @return the targetResourceId value. + */ + @Generated + public String getTargetResourceId() { + return this.targetResourceId; + } + + /** + * Set the targetResourceId property: Target resource ID on which the test profile is created. This property is + * required for creating a Test Profile and it's not allowed to be updated. + * + * @param targetResourceId the targetResourceId value to set. + * @return the TestProfile object itself. + */ + @Generated + public TestProfile setTargetResourceId(String targetResourceId) { + this.targetResourceId = targetResourceId; + this.updatedProperties.add("targetResourceId"); + return this; + } + + /** + * Get the targetResourceConfigurations property: Configurations of the target resource on which testing would be + * done. + * + * @return the targetResourceConfigurations value. + */ + @Generated + public TargetResourceConfigurations getTargetResourceConfigurations() { + return this.targetResourceConfigurations; + } + + /** + * Set the targetResourceConfigurations property: Configurations of the target resource on which testing would be + * done. + * + * @param targetResourceConfigurations the targetResourceConfigurations value to set. + * @return the TestProfile object itself. + */ + @Generated + public TestProfile setTargetResourceConfigurations(TargetResourceConfigurations targetResourceConfigurations) { + this.targetResourceConfigurations = targetResourceConfigurations; + this.updatedProperties.add("targetResourceConfigurations"); + return this; + } + + /** + * Get the createdDateTime property: The creation datetime(RFC 3339 literal format). + * + * @return the createdDateTime value. + */ + @Generated + public OffsetDateTime getCreatedDateTime() { + return this.createdDateTime; + } + + /** + * Get the createdBy property: The user that created. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the lastModifiedDateTime property: The last Modified datetime(RFC 3339 literal format). + * + * @return the lastModifiedDateTime value. + */ + @Generated + public OffsetDateTime getLastModifiedDateTime() { + return this.lastModifiedDateTime; + } + + /** + * Get the lastModifiedBy property: The user that last modified. + * + * @return the lastModifiedBy value. + */ + @Generated + public String getLastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("testId", this.testId); + jsonWriter.writeStringField("targetResourceId", this.targetResourceId); + jsonWriter.writeJsonField("targetResourceConfigurations", this.targetResourceConfigurations); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("displayName")) { + if (this.displayName == null) { + jsonWriter.writeNullField("displayName"); + } else { + jsonWriter.writeStringField("displayName", this.displayName); + } + } + if (updatedProperties.contains("description")) { + if (this.description == null) { + jsonWriter.writeNullField("description"); + } else { + jsonWriter.writeStringField("description", this.description); + } + } + if (updatedProperties.contains("testId")) { + if (this.testId == null) { + jsonWriter.writeNullField("testId"); + } else { + jsonWriter.writeStringField("testId", this.testId); + } + } + if (updatedProperties.contains("targetResourceId")) { + if (this.targetResourceId == null) { + jsonWriter.writeNullField("targetResourceId"); + } else { + jsonWriter.writeStringField("targetResourceId", this.targetResourceId); + } + } + if (updatedProperties.contains("targetResourceConfigurations")) { + if (this.targetResourceConfigurations == null) { + jsonWriter.writeNullField("targetResourceConfigurations"); + } else { + JsonMergePatchHelper.getTargetResourceConfigurationsAccessor() + .prepareModelForJsonMergePatch(this.targetResourceConfigurations, true); + jsonWriter.writeJsonField("targetResourceConfigurations", this.targetResourceConfigurations); + JsonMergePatchHelper.getTargetResourceConfigurationsAccessor() + .prepareModelForJsonMergePatch(this.targetResourceConfigurations, false); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestProfile if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TestProfile. + */ + @Generated + public static TestProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestProfile deserializedTestProfile = new TestProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("testProfileId".equals(fieldName)) { + deserializedTestProfile.testProfileId = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedTestProfile.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedTestProfile.description = reader.getString(); + } else if ("testId".equals(fieldName)) { + deserializedTestProfile.testId = reader.getString(); + } else if ("targetResourceId".equals(fieldName)) { + deserializedTestProfile.targetResourceId = reader.getString(); + } else if ("targetResourceConfigurations".equals(fieldName)) { + deserializedTestProfile.targetResourceConfigurations + = TargetResourceConfigurations.fromJson(reader); + } else if ("createdDateTime".equals(fieldName)) { + deserializedTestProfile.createdDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedTestProfile.createdBy = reader.getString(); + } else if ("lastModifiedDateTime".equals(fieldName)) { + deserializedTestProfile.lastModifiedDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedBy".equals(fieldName)) { + deserializedTestProfile.lastModifiedBy = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTestProfile; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestProfileRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestProfileRun.java new file mode 100644 index 0000000000000..ffe3e242d5b91 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestProfileRun.java @@ -0,0 +1,499 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Test Profile Run model. + * + * The Test Profile Run Model. Test Profile Run resource enables you to instantiate an already created test profile and + * run load tests to get recommendations on the optimal configuration for the target resource. + */ +@Fluent +public final class TestProfileRun implements JsonSerializable { + /* + * Unique identifier for the test profile run, must contain only lower-case alphabetic, numeric, underscore or + * hyphen characters. + */ + @Generated + private String testProfileRunId; + + /* + * Display name for the test profile run. + */ + @Generated + private String displayName; + + /* + * The test profile run description + */ + @Generated + private String description; + + /* + * Associated test profile ID for the test profile run. This is required to create a test profile run and can't be + * updated. + */ + @Generated + private String testProfileId; + + /* + * Target resource ID on which the test profile run is created + */ + @Generated + private String targetResourceId; + + /* + * Configurations of the target resource on which the test profile ran. + */ + @Generated + private TargetResourceConfigurations targetResourceConfigurations; + + /* + * The test profile run status. + */ + @Generated + private TestProfileRunStatus status; + + /* + * Error details if there is any failure in test profile run. These errors are specific to the Test Profile Run. + */ + @Generated + private List errorDetails; + + /* + * The test profile run start DateTime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime startDateTime; + + /* + * The test profile run end DateTime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime endDateTime; + + /* + * Test profile run duration in seconds. + */ + @Generated + private Long durationInSeconds; + + /* + * Details of the test runs ran as part of the test profile run. + * Key is the testRunId of the corresponding testRun. + */ + @Generated + private Map testRunDetails; + + /* + * Recommendations provided based on a successful test profile run. + */ + @Generated + private List recommendations; + + /* + * The creation datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime createdDateTime; + + /* + * The user that created. + */ + @Generated + private String createdBy; + + /* + * The last Modified datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime lastModifiedDateTime; + + /* + * The user that last modified. + */ + @Generated + private String lastModifiedBy; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setTestProfileRunAccessor(new JsonMergePatchHelper.TestProfileRunAccessor() { + @Override + public TestProfileRun prepareModelForJsonMergePatch(TestProfileRun model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(TestProfileRun model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of TestProfileRun class. + */ + @Generated + public TestProfileRun() { + } + + /** + * Get the testProfileRunId property: Unique identifier for the test profile run, must contain only lower-case + * alphabetic, numeric, underscore or hyphen characters. + * + * @return the testProfileRunId value. + */ + @Generated + public String getTestProfileRunId() { + return this.testProfileRunId; + } + + /** + * Get the displayName property: Display name for the test profile run. + * + * @return the displayName value. + */ + @Generated + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name for the test profile run. + * + * @param displayName the displayName value to set. + * @return the TestProfileRun object itself. + */ + @Generated + public TestProfileRun setDisplayName(String displayName) { + this.displayName = displayName; + this.updatedProperties.add("displayName"); + return this; + } + + /** + * Get the description property: The test profile run description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The test profile run description. + * + * @param description the description value to set. + * @return the TestProfileRun object itself. + */ + @Generated + public TestProfileRun setDescription(String description) { + this.description = description; + this.updatedProperties.add("description"); + return this; + } + + /** + * Get the testProfileId property: Associated test profile ID for the test profile run. This is required to create a + * test profile run and can't be updated. + * + * @return the testProfileId value. + */ + @Generated + public String getTestProfileId() { + return this.testProfileId; + } + + /** + * Set the testProfileId property: Associated test profile ID for the test profile run. This is required to create a + * test profile run and can't be updated. + * + * @param testProfileId the testProfileId value to set. + * @return the TestProfileRun object itself. + */ + @Generated + public TestProfileRun setTestProfileId(String testProfileId) { + this.testProfileId = testProfileId; + this.updatedProperties.add("testProfileId"); + return this; + } + + /** + * Get the targetResourceId property: Target resource ID on which the test profile run is created. + * + * @return the targetResourceId value. + */ + @Generated + public String getTargetResourceId() { + return this.targetResourceId; + } + + /** + * Get the targetResourceConfigurations property: Configurations of the target resource on which the test profile + * ran. + * + * @return the targetResourceConfigurations value. + */ + @Generated + public TargetResourceConfigurations getTargetResourceConfigurations() { + return this.targetResourceConfigurations; + } + + /** + * Get the status property: The test profile run status. + * + * @return the status value. + */ + @Generated + public TestProfileRunStatus getStatus() { + return this.status; + } + + /** + * Get the errorDetails property: Error details if there is any failure in test profile run. These errors are + * specific to the Test Profile Run. + * + * @return the errorDetails value. + */ + @Generated + public List getErrorDetails() { + return this.errorDetails; + } + + /** + * Get the startDateTime property: The test profile run start DateTime(RFC 3339 literal format). + * + * @return the startDateTime value. + */ + @Generated + public OffsetDateTime getStartDateTime() { + return this.startDateTime; + } + + /** + * Get the endDateTime property: The test profile run end DateTime(RFC 3339 literal format). + * + * @return the endDateTime value. + */ + @Generated + public OffsetDateTime getEndDateTime() { + return this.endDateTime; + } + + /** + * Get the durationInSeconds property: Test profile run duration in seconds. + * + * @return the durationInSeconds value. + */ + @Generated + public Long getDurationInSeconds() { + return this.durationInSeconds; + } + + /** + * Get the testRunDetails property: Details of the test runs ran as part of the test profile run. + * Key is the testRunId of the corresponding testRun. + * + * @return the testRunDetails value. + */ + @Generated + public Map getTestRunDetails() { + return this.testRunDetails; + } + + /** + * Get the recommendations property: Recommendations provided based on a successful test profile run. + * + * @return the recommendations value. + */ + @Generated + public List getRecommendations() { + return this.recommendations; + } + + /** + * Get the createdDateTime property: The creation datetime(RFC 3339 literal format). + * + * @return the createdDateTime value. + */ + @Generated + public OffsetDateTime getCreatedDateTime() { + return this.createdDateTime; + } + + /** + * Get the createdBy property: The user that created. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the lastModifiedDateTime property: The last Modified datetime(RFC 3339 literal format). + * + * @return the lastModifiedDateTime value. + */ + @Generated + public OffsetDateTime getLastModifiedDateTime() { + return this.lastModifiedDateTime; + } + + /** + * Get the lastModifiedBy property: The user that last modified. + * + * @return the lastModifiedBy value. + */ + @Generated + public String getLastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("testProfileId", this.testProfileId); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("displayName")) { + if (this.displayName == null) { + jsonWriter.writeNullField("displayName"); + } else { + jsonWriter.writeStringField("displayName", this.displayName); + } + } + if (updatedProperties.contains("description")) { + if (this.description == null) { + jsonWriter.writeNullField("description"); + } else { + jsonWriter.writeStringField("description", this.description); + } + } + if (updatedProperties.contains("testProfileId")) { + if (this.testProfileId == null) { + jsonWriter.writeNullField("testProfileId"); + } else { + jsonWriter.writeStringField("testProfileId", this.testProfileId); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestProfileRun from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestProfileRun if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TestProfileRun. + */ + @Generated + public static TestProfileRun fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestProfileRun deserializedTestProfileRun = new TestProfileRun(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("testProfileRunId".equals(fieldName)) { + deserializedTestProfileRun.testProfileRunId = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedTestProfileRun.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedTestProfileRun.description = reader.getString(); + } else if ("testProfileId".equals(fieldName)) { + deserializedTestProfileRun.testProfileId = reader.getString(); + } else if ("targetResourceId".equals(fieldName)) { + deserializedTestProfileRun.targetResourceId = reader.getString(); + } else if ("targetResourceConfigurations".equals(fieldName)) { + deserializedTestProfileRun.targetResourceConfigurations + = TargetResourceConfigurations.fromJson(reader); + } else if ("status".equals(fieldName)) { + deserializedTestProfileRun.status = TestProfileRunStatus.fromString(reader.getString()); + } else if ("errorDetails".equals(fieldName)) { + List errorDetails = reader.readArray(reader1 -> ErrorDetails.fromJson(reader1)); + deserializedTestProfileRun.errorDetails = errorDetails; + } else if ("startDateTime".equals(fieldName)) { + deserializedTestProfileRun.startDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endDateTime".equals(fieldName)) { + deserializedTestProfileRun.endDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("durationInSeconds".equals(fieldName)) { + deserializedTestProfileRun.durationInSeconds = reader.getNullable(JsonReader::getLong); + } else if ("testRunDetails".equals(fieldName)) { + Map testRunDetails + = reader.readMap(reader1 -> TestRunDetail.fromJson(reader1)); + deserializedTestProfileRun.testRunDetails = testRunDetails; + } else if ("recommendations".equals(fieldName)) { + List recommendations + = reader.readArray(reader1 -> TestProfileRunRecommendation.fromJson(reader1)); + deserializedTestProfileRun.recommendations = recommendations; + } else if ("createdDateTime".equals(fieldName)) { + deserializedTestProfileRun.createdDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedTestProfileRun.createdBy = reader.getString(); + } else if ("lastModifiedDateTime".equals(fieldName)) { + deserializedTestProfileRun.lastModifiedDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedBy".equals(fieldName)) { + deserializedTestProfileRun.lastModifiedBy = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTestProfileRun; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestProfileRunRecommendation.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestProfileRunRecommendation.java new file mode 100644 index 0000000000000..c4c91ed107dce --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestProfileRunRecommendation.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A recommendation object that provides a list of configuration that optimizes its category. + */ +@Immutable +public final class TestProfileRunRecommendation implements JsonSerializable { + /* + * Category of the recommendation. + */ + @Generated + private final RecommendationCategory category; + + /* + * List of configurations IDs for which the recommendation is applicable. These are a subset of the provided target + * resource configurations. + */ + @Generated + private List configurations; + + /** + * Creates an instance of TestProfileRunRecommendation class. + * + * @param category the category value to set. + */ + @Generated + private TestProfileRunRecommendation(RecommendationCategory category) { + this.category = category; + } + + /** + * Get the category property: Category of the recommendation. + * + * @return the category value. + */ + @Generated + public RecommendationCategory getCategory() { + return this.category; + } + + /** + * Get the configurations property: List of configurations IDs for which the recommendation is applicable. These are + * a subset of the provided target resource configurations. + * + * @return the configurations value. + */ + @Generated + public List getConfigurations() { + return this.configurations; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("category", this.category == null ? null : this.category.toString()); + jsonWriter.writeArrayField("configurations", this.configurations, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestProfileRunRecommendation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestProfileRunRecommendation if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TestProfileRunRecommendation. + */ + @Generated + public static TestProfileRunRecommendation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecommendationCategory category = null; + List configurations = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("category".equals(fieldName)) { + category = RecommendationCategory.fromString(reader.getString()); + } else if ("configurations".equals(fieldName)) { + configurations = reader.readArray(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + TestProfileRunRecommendation deserializedTestProfileRunRecommendation + = new TestProfileRunRecommendation(category); + deserializedTestProfileRunRecommendation.configurations = configurations; + + return deserializedTestProfileRunRecommendation; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestProfileRunStatus.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestProfileRunStatus.java new file mode 100644 index 0000000000000..650bff10bbee8 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestProfileRunStatus.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Test profile run status. + */ +public final class TestProfileRunStatus extends ExpandableStringEnum { + /** + * Test profile run request is accepted. + */ + @Generated + public static final TestProfileRunStatus ACCEPTED = fromString("ACCEPTED"); + + /** + * Test profile run is not yet started. + */ + @Generated + public static final TestProfileRunStatus NOTSTARTED = fromString("NOTSTARTED"); + + /** + * Test profile run has started executing. + */ + @Generated + public static final TestProfileRunStatus EXECUTING = fromString("EXECUTING"); + + /** + * Test profile run has completed successfully. + */ + @Generated + public static final TestProfileRunStatus DONE = fromString("DONE"); + + /** + * Test profile run is being cancelled. + */ + @Generated + public static final TestProfileRunStatus CANCELLING = fromString("CANCELLING"); + + /** + * Test profile run is cancelled. + */ + @Generated + public static final TestProfileRunStatus CANCELLED = fromString("CANCELLED"); + + /** + * Test profile run has failed. + */ + @Generated + public static final TestProfileRunStatus FAILED = fromString("FAILED"); + + /** + * Creates a new instance of TestProfileRunStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public TestProfileRunStatus() { + } + + /** + * Creates or finds a TestProfileRunStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding TestProfileRunStatus. + */ + @Generated + public static TestProfileRunStatus fromString(String name) { + return fromString(name, TestProfileRunStatus.class); + } + + /** + * Gets known TestProfileRunStatus values. + * + * @return known TestProfileRunStatus values. + */ + @Generated + public static Collection values() { + return values(TestProfileRunStatus.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRun.java new file mode 100644 index 0000000000000..1b5a6bf00edf7 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRun.java @@ -0,0 +1,977 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Load test run model. + */ +@Fluent +public final class TestRun implements JsonSerializable { + /* + * Unique test run identifier for the load test run, must contain only lower-case alphabetic, numeric, underscore or + * hyphen characters. + */ + @Generated + private String testRunId; + + /* + * Pass fail criteria for a test. + */ + @Generated + private PassFailCriteria passFailCriteria; + + /* + * Auto stop criteria for a test. This will automatically stop a load test if the error percentage is high for a + * certain time window. + */ + @Generated + private AutoStopCriteria autoStopCriteria; + + /* + * Secrets can be stored in an Azure Key Vault or any other secret store. If the + * secret is stored in an Azure Key Vault, the value should be the secret + * identifier and the type should be AKV_SECRET_URI. If the secret is stored + * elsewhere, the secret value should be provided directly and the type should be + * SECRET_VALUE. + */ + @Generated + private Map secrets; + + /* + * Certificates metadata + */ + @Generated + private CertificateMetadata certificate; + + /* + * Environment variables which are defined as a set of pairs. + */ + @Generated + private Map environmentVariables; + + /* + * Error details if there is any failure in load test run + */ + @Generated + private List errorDetails; + + /* + * Test run statistics. Key is the sampler name and value is the set of statistics for performance metrics like + * response time, throughput, etc. from the load test run. + * The sampler name is the same as the name mentioned in the test script. + * Sampler name "Total" represents the aggregated statistics of all the samplers. + */ + @Generated + private Map testRunStatistics; + + /* + * Regional statistics. Key is the Azure region name and value is the test run statistics. + * The region name should of format accepted by ARM, and should be a region supported by Azure Load Testing. For + * example, East US should be passed as "eastus". + * The region name must match one of the strings in the "Name" column returned from running the + * "az account list-locations -o table" Azure CLI command. + */ + @Generated + private Map regionalStatistics; + + /* + * The load test configuration. + */ + @Generated + private LoadTestConfiguration loadTestConfiguration; + + /* + * Collection of test run artifacts + */ + @Generated + private TestRunArtifacts testArtifacts; + + /* + * Test result for pass/Fail criteria used during the test run. + */ + @Generated + private PFTestResult testResult; + + /* + * Number of virtual users, for which test has been run. + */ + @Generated + private Integer virtualUsers; + + /* + * Display name of a testRun. + */ + @Generated + private String displayName; + + /* + * Associated test Id. + */ + @Generated + private String testId; + + /* + * The test run description. + */ + @Generated + private String description; + + /* + * The test run status. + */ + @Generated + private Status status; + + /* + * The test run start DateTime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime startDateTime; + + /* + * The test run end DateTime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime endDateTime; + + /* + * Test run initiated time. + */ + @Generated + private OffsetDateTime executedDateTime; + + /* + * Portal url. + */ + @Generated + private String portalUrl; + + /* + * Test run duration in milliseconds. + */ + @Generated + private Long duration; + + /* + * Subnet ID on which the load test instances should run. + */ + @Generated + private String subnetId; + + /* + * Type of test. + */ + @Generated + private TestKind kind; + + /* + * Request data collection level for test run + */ + @Generated + private RequestDataLevel requestDataLevel; + + /* + * Enable or disable debug level logging. True if debug logs are enabled for the test run. False otherwise + */ + @Generated + private Boolean debugLogsEnabled; + + /* + * Inject load test engines without deploying public IP for outbound access + */ + @Generated + private Boolean publicIPDisabled; + + /* + * The creation datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime createdDateTime; + + /* + * The user that created. + */ + @Generated + private String createdBy; + + /* + * The last Modified datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime lastModifiedDateTime; + + /* + * The user that last modified. + */ + @Generated + private String lastModifiedBy; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setTestRunAccessor(new JsonMergePatchHelper.TestRunAccessor() { + @Override + public TestRun prepareModelForJsonMergePatch(TestRun model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(TestRun model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of TestRun class. + */ + @Generated + public TestRun() { + } + + /** + * Get the testRunId property: Unique test run identifier for the load test run, must contain only lower-case + * alphabetic, numeric, underscore or hyphen characters. + * + * @return the testRunId value. + */ + @Generated + public String getTestRunId() { + return this.testRunId; + } + + /** + * Get the passFailCriteria property: Pass fail criteria for a test. + * + * @return the passFailCriteria value. + */ + @Generated + public PassFailCriteria getPassFailCriteria() { + return this.passFailCriteria; + } + + /** + * Set the passFailCriteria property: Pass fail criteria for a test. + * + * @param passFailCriteria the passFailCriteria value to set. + * @return the TestRun object itself. + */ + @Generated + public TestRun setPassFailCriteria(PassFailCriteria passFailCriteria) { + this.passFailCriteria = passFailCriteria; + this.updatedProperties.add("passFailCriteria"); + return this; + } + + /** + * Get the autoStopCriteria property: Auto stop criteria for a test. This will automatically stop a load test if the + * error percentage is high for a certain time window. + * + * @return the autoStopCriteria value. + */ + @Generated + public AutoStopCriteria getAutoStopCriteria() { + return this.autoStopCriteria; + } + + /** + * Set the autoStopCriteria property: Auto stop criteria for a test. This will automatically stop a load test if the + * error percentage is high for a certain time window. + * + * @param autoStopCriteria the autoStopCriteria value to set. + * @return the TestRun object itself. + */ + @Generated + public TestRun setAutoStopCriteria(AutoStopCriteria autoStopCriteria) { + this.autoStopCriteria = autoStopCriteria; + this.updatedProperties.add("autoStopCriteria"); + return this; + } + + /** + * Get the secrets property: Secrets can be stored in an Azure Key Vault or any other secret store. If the + * secret is stored in an Azure Key Vault, the value should be the secret + * identifier and the type should be AKV_SECRET_URI. If the secret is stored + * elsewhere, the secret value should be provided directly and the type should be + * SECRET_VALUE. + * + * @return the secrets value. + */ + @Generated + public Map getSecrets() { + return this.secrets; + } + + /** + * Set the secrets property: Secrets can be stored in an Azure Key Vault or any other secret store. If the + * secret is stored in an Azure Key Vault, the value should be the secret + * identifier and the type should be AKV_SECRET_URI. If the secret is stored + * elsewhere, the secret value should be provided directly and the type should be + * SECRET_VALUE. + * + * @param secrets the secrets value to set. + * @return the TestRun object itself. + */ + @Generated + public TestRun setSecrets(Map secrets) { + this.secrets = secrets; + this.updatedProperties.add("secrets"); + return this; + } + + /** + * Get the certificate property: Certificates metadata. + * + * @return the certificate value. + */ + @Generated + public CertificateMetadata getCertificate() { + return this.certificate; + } + + /** + * Set the certificate property: Certificates metadata. + * + * @param certificate the certificate value to set. + * @return the TestRun object itself. + */ + @Generated + public TestRun setCertificate(CertificateMetadata certificate) { + this.certificate = certificate; + this.updatedProperties.add("certificate"); + return this; + } + + /** + * Get the environmentVariables property: Environment variables which are defined as a set of <name,value> + * pairs. + * + * @return the environmentVariables value. + */ + @Generated + public Map getEnvironmentVariables() { + return this.environmentVariables; + } + + /** + * Set the environmentVariables property: Environment variables which are defined as a set of <name,value> + * pairs. + * + * @param environmentVariables the environmentVariables value to set. + * @return the TestRun object itself. + */ + @Generated + public TestRun setEnvironmentVariables(Map environmentVariables) { + this.environmentVariables = environmentVariables; + this.updatedProperties.add("environmentVariables"); + return this; + } + + /** + * Get the errorDetails property: Error details if there is any failure in load test run. + * + * @return the errorDetails value. + */ + @Generated + public List getErrorDetails() { + return this.errorDetails; + } + + /** + * Get the testRunStatistics property: Test run statistics. Key is the sampler name and value is the set of + * statistics for performance metrics like response time, throughput, etc. from the load test run. + * The sampler name is the same as the name mentioned in the test script. + * Sampler name "Total" represents the aggregated statistics of all the samplers. + * + * @return the testRunStatistics value. + */ + @Generated + public Map getTestRunStatistics() { + return this.testRunStatistics; + } + + /** + * Get the regionalStatistics property: Regional statistics. Key is the Azure region name and value is the test run + * statistics. + * The region name should of format accepted by ARM, and should be a region supported by Azure Load Testing. For + * example, East US should be passed as "eastus". + * The region name must match one of the strings in the "Name" column returned from running the "az account + * list-locations -o table" Azure CLI command. + * + * @return the regionalStatistics value. + */ + @Generated + public Map getRegionalStatistics() { + return this.regionalStatistics; + } + + /** + * Get the loadTestConfiguration property: The load test configuration. + * + * @return the loadTestConfiguration value. + */ + @Generated + public LoadTestConfiguration getLoadTestConfiguration() { + return this.loadTestConfiguration; + } + + /** + * Set the loadTestConfiguration property: The load test configuration. + * + * @param loadTestConfiguration the loadTestConfiguration value to set. + * @return the TestRun object itself. + */ + @Generated + public TestRun setLoadTestConfiguration(LoadTestConfiguration loadTestConfiguration) { + this.loadTestConfiguration = loadTestConfiguration; + this.updatedProperties.add("loadTestConfiguration"); + return this; + } + + /** + * Get the testArtifacts property: Collection of test run artifacts. + * + * @return the testArtifacts value. + */ + @Generated + public TestRunArtifacts getTestArtifacts() { + return this.testArtifacts; + } + + /** + * Get the testResult property: Test result for pass/Fail criteria used during the test run. + * + * @return the testResult value. + */ + @Generated + public PFTestResult getTestResult() { + return this.testResult; + } + + /** + * Get the virtualUsers property: Number of virtual users, for which test has been run. + * + * @return the virtualUsers value. + */ + @Generated + public Integer getVirtualUsers() { + return this.virtualUsers; + } + + /** + * Get the displayName property: Display name of a testRun. + * + * @return the displayName value. + */ + @Generated + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name of a testRun. + * + * @param displayName the displayName value to set. + * @return the TestRun object itself. + */ + @Generated + public TestRun setDisplayName(String displayName) { + this.displayName = displayName; + this.updatedProperties.add("displayName"); + return this; + } + + /** + * Get the testId property: Associated test Id. + * + * @return the testId value. + */ + @Generated + public String getTestId() { + return this.testId; + } + + /** + * Set the testId property: Associated test Id. + * + * @param testId the testId value to set. + * @return the TestRun object itself. + */ + @Generated + public TestRun setTestId(String testId) { + this.testId = testId; + this.updatedProperties.add("testId"); + return this; + } + + /** + * Get the description property: The test run description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The test run description. + * + * @param description the description value to set. + * @return the TestRun object itself. + */ + @Generated + public TestRun setDescription(String description) { + this.description = description; + this.updatedProperties.add("description"); + return this; + } + + /** + * Get the status property: The test run status. + * + * @return the status value. + */ + @Generated + public Status getStatus() { + return this.status; + } + + /** + * Get the startDateTime property: The test run start DateTime(RFC 3339 literal format). + * + * @return the startDateTime value. + */ + @Generated + public OffsetDateTime getStartDateTime() { + return this.startDateTime; + } + + /** + * Get the endDateTime property: The test run end DateTime(RFC 3339 literal format). + * + * @return the endDateTime value. + */ + @Generated + public OffsetDateTime getEndDateTime() { + return this.endDateTime; + } + + /** + * Get the executedDateTime property: Test run initiated time. + * + * @return the executedDateTime value. + */ + @Generated + public OffsetDateTime getExecutedDateTime() { + return this.executedDateTime; + } + + /** + * Get the portalUrl property: Portal url. + * + * @return the portalUrl value. + */ + @Generated + public String getPortalUrl() { + return this.portalUrl; + } + + /** + * Get the duration property: Test run duration in milliseconds. + * + * @return the duration value. + */ + @Generated + public Long getDuration() { + return this.duration; + } + + /** + * Get the subnetId property: Subnet ID on which the load test instances should run. + * + * @return the subnetId value. + */ + @Generated + public String getSubnetId() { + return this.subnetId; + } + + /** + * Get the kind property: Type of test. + * + * @return the kind value. + */ + @Generated + public TestKind getKind() { + return this.kind; + } + + /** + * Get the requestDataLevel property: Request data collection level for test run. + * + * @return the requestDataLevel value. + */ + @Generated + public RequestDataLevel getRequestDataLevel() { + return this.requestDataLevel; + } + + /** + * Set the requestDataLevel property: Request data collection level for test run. + * + * @param requestDataLevel the requestDataLevel value to set. + * @return the TestRun object itself. + */ + @Generated + public TestRun setRequestDataLevel(RequestDataLevel requestDataLevel) { + this.requestDataLevel = requestDataLevel; + this.updatedProperties.add("requestDataLevel"); + return this; + } + + /** + * Get the debugLogsEnabled property: Enable or disable debug level logging. True if debug logs are enabled for the + * test run. False otherwise. + * + * @return the debugLogsEnabled value. + */ + @Generated + public Boolean isDebugLogsEnabled() { + return this.debugLogsEnabled; + } + + /** + * Set the debugLogsEnabled property: Enable or disable debug level logging. True if debug logs are enabled for the + * test run. False otherwise. + * + * @param debugLogsEnabled the debugLogsEnabled value to set. + * @return the TestRun object itself. + */ + @Generated + public TestRun setDebugLogsEnabled(Boolean debugLogsEnabled) { + this.debugLogsEnabled = debugLogsEnabled; + this.updatedProperties.add("debugLogsEnabled"); + return this; + } + + /** + * Get the publicIPDisabled property: Inject load test engines without deploying public IP for outbound access. + * + * @return the publicIPDisabled value. + */ + @Generated + public Boolean isPublicIPDisabled() { + return this.publicIPDisabled; + } + + /** + * Get the createdDateTime property: The creation datetime(RFC 3339 literal format). + * + * @return the createdDateTime value. + */ + @Generated + public OffsetDateTime getCreatedDateTime() { + return this.createdDateTime; + } + + /** + * Get the createdBy property: The user that created. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the lastModifiedDateTime property: The last Modified datetime(RFC 3339 literal format). + * + * @return the lastModifiedDateTime value. + */ + @Generated + public OffsetDateTime getLastModifiedDateTime() { + return this.lastModifiedDateTime; + } + + /** + * Get the lastModifiedBy property: The user that last modified. + * + * @return the lastModifiedBy value. + */ + @Generated + public String getLastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("passFailCriteria", this.passFailCriteria); + jsonWriter.writeJsonField("autoStopCriteria", this.autoStopCriteria); + jsonWriter.writeMapField("secrets", this.secrets, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("certificate", this.certificate); + jsonWriter.writeMapField("environmentVariables", this.environmentVariables, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("loadTestConfiguration", this.loadTestConfiguration); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("testId", this.testId); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("requestDataLevel", + this.requestDataLevel == null ? null : this.requestDataLevel.toString()); + jsonWriter.writeBooleanField("debugLogsEnabled", this.debugLogsEnabled); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("passFailCriteria")) { + if (this.passFailCriteria == null) { + jsonWriter.writeNullField("passFailCriteria"); + } else { + JsonMergePatchHelper.getPassFailCriteriaAccessor() + .prepareModelForJsonMergePatch(this.passFailCriteria, true); + jsonWriter.writeJsonField("passFailCriteria", this.passFailCriteria); + JsonMergePatchHelper.getPassFailCriteriaAccessor() + .prepareModelForJsonMergePatch(this.passFailCriteria, false); + } + } + if (updatedProperties.contains("autoStopCriteria")) { + if (this.autoStopCriteria == null) { + jsonWriter.writeNullField("autoStopCriteria"); + } else { + JsonMergePatchHelper.getAutoStopCriteriaAccessor() + .prepareModelForJsonMergePatch(this.autoStopCriteria, true); + jsonWriter.writeJsonField("autoStopCriteria", this.autoStopCriteria); + JsonMergePatchHelper.getAutoStopCriteriaAccessor() + .prepareModelForJsonMergePatch(this.autoStopCriteria, false); + } + } + if (updatedProperties.contains("secrets")) { + if (this.secrets == null) { + jsonWriter.writeNullField("secrets"); + } else { + jsonWriter.writeMapField("secrets", this.secrets, (writer, element) -> { + if (element != null) { + JsonMergePatchHelper.getSecretAccessor().prepareModelForJsonMergePatch(element, true); + writer.writeJson(element); + JsonMergePatchHelper.getSecretAccessor().prepareModelForJsonMergePatch(element, false); + } else { + writer.writeNull(); + } + }); + } + } + if (updatedProperties.contains("certificate")) { + if (this.certificate == null) { + jsonWriter.writeNullField("certificate"); + } else { + JsonMergePatchHelper.getCertificateMetadataAccessor() + .prepareModelForJsonMergePatch(this.certificate, true); + jsonWriter.writeJsonField("certificate", this.certificate); + JsonMergePatchHelper.getCertificateMetadataAccessor() + .prepareModelForJsonMergePatch(this.certificate, false); + } + } + if (updatedProperties.contains("environmentVariables")) { + if (this.environmentVariables == null) { + jsonWriter.writeNullField("environmentVariables"); + } else { + jsonWriter.writeMapField("environmentVariables", this.environmentVariables, (writer, element) -> { + if (element != null) { + writer.writeString(element); + } else { + writer.writeNull(); + } + }); + } + } + if (updatedProperties.contains("loadTestConfiguration")) { + if (this.loadTestConfiguration == null) { + jsonWriter.writeNullField("loadTestConfiguration"); + } else { + JsonMergePatchHelper.getLoadTestConfigurationAccessor() + .prepareModelForJsonMergePatch(this.loadTestConfiguration, true); + jsonWriter.writeJsonField("loadTestConfiguration", this.loadTestConfiguration); + JsonMergePatchHelper.getLoadTestConfigurationAccessor() + .prepareModelForJsonMergePatch(this.loadTestConfiguration, false); + } + } + if (updatedProperties.contains("displayName")) { + if (this.displayName == null) { + jsonWriter.writeNullField("displayName"); + } else { + jsonWriter.writeStringField("displayName", this.displayName); + } + } + if (updatedProperties.contains("testId")) { + if (this.testId == null) { + jsonWriter.writeNullField("testId"); + } else { + jsonWriter.writeStringField("testId", this.testId); + } + } + if (updatedProperties.contains("description")) { + if (this.description == null) { + jsonWriter.writeNullField("description"); + } else { + jsonWriter.writeStringField("description", this.description); + } + } + if (updatedProperties.contains("requestDataLevel")) { + if (this.requestDataLevel == null) { + jsonWriter.writeNullField("requestDataLevel"); + } else { + jsonWriter.writeStringField("requestDataLevel", this.requestDataLevel.toString()); + } + } + if (updatedProperties.contains("debugLogsEnabled")) { + if (this.debugLogsEnabled == null) { + jsonWriter.writeNullField("debugLogsEnabled"); + } else { + jsonWriter.writeBooleanField("debugLogsEnabled", this.debugLogsEnabled); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestRun from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestRun if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TestRun. + */ + @Generated + public static TestRun fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestRun deserializedTestRun = new TestRun(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("testRunId".equals(fieldName)) { + deserializedTestRun.testRunId = reader.getString(); + } else if ("passFailCriteria".equals(fieldName)) { + deserializedTestRun.passFailCriteria = PassFailCriteria.fromJson(reader); + } else if ("autoStopCriteria".equals(fieldName)) { + deserializedTestRun.autoStopCriteria = AutoStopCriteria.fromJson(reader); + } else if ("secrets".equals(fieldName)) { + Map secrets = reader.readMap(reader1 -> Secret.fromJson(reader1)); + deserializedTestRun.secrets = secrets; + } else if ("certificate".equals(fieldName)) { + deserializedTestRun.certificate = CertificateMetadata.fromJson(reader); + } else if ("environmentVariables".equals(fieldName)) { + Map environmentVariables = reader.readMap(reader1 -> reader1.getString()); + deserializedTestRun.environmentVariables = environmentVariables; + } else if ("errorDetails".equals(fieldName)) { + List errorDetails = reader.readArray(reader1 -> ErrorDetails.fromJson(reader1)); + deserializedTestRun.errorDetails = errorDetails; + } else if ("testRunStatistics".equals(fieldName)) { + Map testRunStatistics + = reader.readMap(reader1 -> TestRunStatistics.fromJson(reader1)); + deserializedTestRun.testRunStatistics = testRunStatistics; + } else if ("regionalStatistics".equals(fieldName)) { + Map regionalStatistics + = reader.readMap(reader1 -> TestRunStatistics.fromJson(reader1)); + deserializedTestRun.regionalStatistics = regionalStatistics; + } else if ("loadTestConfiguration".equals(fieldName)) { + deserializedTestRun.loadTestConfiguration = LoadTestConfiguration.fromJson(reader); + } else if ("testArtifacts".equals(fieldName)) { + deserializedTestRun.testArtifacts = TestRunArtifacts.fromJson(reader); + } else if ("testResult".equals(fieldName)) { + deserializedTestRun.testResult = PFTestResult.fromString(reader.getString()); + } else if ("virtualUsers".equals(fieldName)) { + deserializedTestRun.virtualUsers = reader.getNullable(JsonReader::getInt); + } else if ("displayName".equals(fieldName)) { + deserializedTestRun.displayName = reader.getString(); + } else if ("testId".equals(fieldName)) { + deserializedTestRun.testId = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedTestRun.description = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedTestRun.status = Status.fromString(reader.getString()); + } else if ("startDateTime".equals(fieldName)) { + deserializedTestRun.startDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endDateTime".equals(fieldName)) { + deserializedTestRun.endDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("executedDateTime".equals(fieldName)) { + deserializedTestRun.executedDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("portalUrl".equals(fieldName)) { + deserializedTestRun.portalUrl = reader.getString(); + } else if ("duration".equals(fieldName)) { + deserializedTestRun.duration = reader.getNullable(JsonReader::getLong); + } else if ("subnetId".equals(fieldName)) { + deserializedTestRun.subnetId = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedTestRun.kind = TestKind.fromString(reader.getString()); + } else if ("requestDataLevel".equals(fieldName)) { + deserializedTestRun.requestDataLevel = RequestDataLevel.fromString(reader.getString()); + } else if ("debugLogsEnabled".equals(fieldName)) { + deserializedTestRun.debugLogsEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("publicIPDisabled".equals(fieldName)) { + deserializedTestRun.publicIPDisabled = reader.getNullable(JsonReader::getBoolean); + } else if ("createdDateTime".equals(fieldName)) { + deserializedTestRun.createdDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedTestRun.createdBy = reader.getString(); + } else if ("lastModifiedDateTime".equals(fieldName)) { + deserializedTestRun.lastModifiedDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedBy".equals(fieldName)) { + deserializedTestRun.lastModifiedBy = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTestRun; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunAppComponents.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunAppComponents.java new file mode 100644 index 0000000000000..0f459e9edc481 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunAppComponents.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Test run app component. + */ +@Fluent +public final class TestRunAppComponents implements JsonSerializable { + /* + * Azure resource collection { resource id (fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + * : resource object } + */ + @Generated + private Map components; + + /* + * Test run identifier + */ + @Generated + private String testRunId; + + /* + * The creation datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime createdDateTime; + + /* + * The user that created. + */ + @Generated + private String createdBy; + + /* + * The last Modified datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime lastModifiedDateTime; + + /* + * The user that last modified. + */ + @Generated + private String lastModifiedBy; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setTestRunAppComponentsAccessor(new JsonMergePatchHelper.TestRunAppComponentsAccessor() { + @Override + public TestRunAppComponents prepareModelForJsonMergePatch(TestRunAppComponents model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(TestRunAppComponents model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of TestRunAppComponents class. + */ + @Generated + public TestRunAppComponents() { + } + + /** + * Get the components property: Azure resource collection { resource id (fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + * : resource object }. + * + * @return the components value. + */ + @Generated + public Map getComponents() { + return this.components; + } + + /** + * Set the components property: Azure resource collection { resource id (fully qualified resource Id e.g + * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) + * : resource object }. + *

Required when create the resource.

+ * + * @param components the components value to set. + * @return the TestRunAppComponents object itself. + */ + @Generated + public TestRunAppComponents setComponents(Map components) { + this.components = components; + this.updatedProperties.add("components"); + return this; + } + + /** + * Get the testRunId property: Test run identifier. + * + * @return the testRunId value. + */ + @Generated + public String getTestRunId() { + return this.testRunId; + } + + /** + * Get the createdDateTime property: The creation datetime(RFC 3339 literal format). + * + * @return the createdDateTime value. + */ + @Generated + public OffsetDateTime getCreatedDateTime() { + return this.createdDateTime; + } + + /** + * Get the createdBy property: The user that created. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the lastModifiedDateTime property: The last Modified datetime(RFC 3339 literal format). + * + * @return the lastModifiedDateTime value. + */ + @Generated + public OffsetDateTime getLastModifiedDateTime() { + return this.lastModifiedDateTime; + } + + /** + * Get the lastModifiedBy property: The user that last modified. + * + * @return the lastModifiedBy value. + */ + @Generated + public String getLastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("components", this.components, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("components")) { + if (this.components == null) { + jsonWriter.writeNullField("components"); + } else { + jsonWriter.writeMapField("components", this.components, (writer, element) -> { + if (element != null) { + JsonMergePatchHelper.getAppComponentAccessor().prepareModelForJsonMergePatch(element, true); + writer.writeJson(element); + JsonMergePatchHelper.getAppComponentAccessor().prepareModelForJsonMergePatch(element, false); + } else { + writer.writeNull(); + } + }); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestRunAppComponents from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestRunAppComponents if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TestRunAppComponents. + */ + @Generated + public static TestRunAppComponents fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestRunAppComponents deserializedTestRunAppComponents = new TestRunAppComponents(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("components".equals(fieldName)) { + Map components = reader.readMap(reader1 -> AppComponent.fromJson(reader1)); + deserializedTestRunAppComponents.components = components; + } else if ("testRunId".equals(fieldName)) { + deserializedTestRunAppComponents.testRunId = reader.getString(); + } else if ("createdDateTime".equals(fieldName)) { + deserializedTestRunAppComponents.createdDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedTestRunAppComponents.createdBy = reader.getString(); + } else if ("lastModifiedDateTime".equals(fieldName)) { + deserializedTestRunAppComponents.lastModifiedDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedBy".equals(fieldName)) { + deserializedTestRunAppComponents.lastModifiedBy = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTestRunAppComponents; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunArtifacts.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunArtifacts.java new file mode 100644 index 0000000000000..c9a65870dc736 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunArtifacts.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Collection of test run artifacts. + */ +@Immutable +public final class TestRunArtifacts implements JsonSerializable { + /* + * The input artifacts for the test run. + */ + @Generated + private TestRunInputArtifacts inputArtifacts; + + /* + * The output artifacts for the test run. + */ + @Generated + private TestRunOutputArtifacts outputArtifacts; + + /** + * Creates an instance of TestRunArtifacts class. + */ + @Generated + private TestRunArtifacts() { + } + + /** + * Get the inputArtifacts property: The input artifacts for the test run. + * + * @return the inputArtifacts value. + */ + @Generated + public TestRunInputArtifacts getInputArtifacts() { + return this.inputArtifacts; + } + + /** + * Get the outputArtifacts property: The output artifacts for the test run. + * + * @return the outputArtifacts value. + */ + @Generated + public TestRunOutputArtifacts getOutputArtifacts() { + return this.outputArtifacts; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("outputArtifacts", this.outputArtifacts); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestRunArtifacts from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestRunArtifacts if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TestRunArtifacts. + */ + @Generated + public static TestRunArtifacts fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestRunArtifacts deserializedTestRunArtifacts = new TestRunArtifacts(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputArtifacts".equals(fieldName)) { + deserializedTestRunArtifacts.inputArtifacts = TestRunInputArtifacts.fromJson(reader); + } else if ("outputArtifacts".equals(fieldName)) { + deserializedTestRunArtifacts.outputArtifacts = TestRunOutputArtifacts.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTestRunArtifacts; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunDetail.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunDetail.java new file mode 100644 index 0000000000000..b429c1cda80d1 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunDetail.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Details of a particular test run for a test profile run. + */ +@Immutable +public final class TestRunDetail implements JsonSerializable { + /* + * Status of the test run. + */ + @Generated + private final Status status; + + /* + * ID of the configuration on which the test ran. + */ + @Generated + private final String configurationId; + + /* + * Key value pair of extra properties associated with the test run. + */ + @Generated + private final Map properties; + + /** + * Creates an instance of TestRunDetail class. + * + * @param status the status value to set. + * @param configurationId the configurationId value to set. + * @param properties the properties value to set. + */ + @Generated + private TestRunDetail(Status status, String configurationId, Map properties) { + this.status = status; + this.configurationId = configurationId; + this.properties = properties; + } + + /** + * Get the status property: Status of the test run. + * + * @return the status value. + */ + @Generated + public Status getStatus() { + return this.status; + } + + /** + * Get the configurationId property: ID of the configuration on which the test ran. + * + * @return the configurationId value. + */ + @Generated + public String getConfigurationId() { + return this.configurationId; + } + + /** + * Get the properties property: Key value pair of extra properties associated with the test run. + * + * @return the properties value. + */ + @Generated + public Map getProperties() { + return this.properties; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("configurationId", this.configurationId); + jsonWriter.writeMapField("properties", this.properties, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestRunDetail from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestRunDetail if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TestRunDetail. + */ + @Generated + public static TestRunDetail fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Status status = null; + String configurationId = null; + Map properties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + status = Status.fromString(reader.getString()); + } else if ("configurationId".equals(fieldName)) { + configurationId = reader.getString(); + } else if ("properties".equals(fieldName)) { + properties = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + return new TestRunDetail(status, configurationId, properties); + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunFileInfo.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunFileInfo.java new file mode 100644 index 0000000000000..b5dc1ddaddc2c --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunFileInfo.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Test run file info. + */ +@Immutable +public final class TestRunFileInfo implements JsonSerializable { + /* + * Name of the file. + */ + @Generated + private String fileName; + + /* + * File URL. + */ + @Generated + private String url; + + /* + * File type + */ + @Generated + private FileType fileType; + + /* + * Expiry time of the file (RFC 3339 literal format) + */ + @Generated + private OffsetDateTime expireDateTime; + + /* + * Validation status of the file + */ + @Generated + private FileStatus validationStatus; + + /* + * Validation failure error details + */ + @Generated + private String validationFailureDetails; + + /** + * Creates an instance of TestRunFileInfo class. + */ + @Generated + private TestRunFileInfo() { + } + + /** + * Get the fileName property: Name of the file. + * + * @return the fileName value. + */ + @Generated + public String getFileName() { + return this.fileName; + } + + /** + * Get the url property: File URL. + * + * @return the url value. + */ + @Generated + public String getUrl() { + return this.url; + } + + /** + * Get the fileType property: File type. + * + * @return the fileType value. + */ + @Generated + public FileType getFileType() { + return this.fileType; + } + + /** + * Get the expireDateTime property: Expiry time of the file (RFC 3339 literal format). + * + * @return the expireDateTime value. + */ + @Generated + public OffsetDateTime getExpireDateTime() { + return this.expireDateTime; + } + + /** + * Get the validationStatus property: Validation status of the file. + * + * @return the validationStatus value. + */ + @Generated + public FileStatus getValidationStatus() { + return this.validationStatus; + } + + /** + * Get the validationFailureDetails property: Validation failure error details. + * + * @return the validationFailureDetails value. + */ + @Generated + public String getValidationFailureDetails() { + return this.validationFailureDetails; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestRunFileInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestRunFileInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TestRunFileInfo. + */ + @Generated + public static TestRunFileInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestRunFileInfo deserializedTestRunFileInfo = new TestRunFileInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fileName".equals(fieldName)) { + deserializedTestRunFileInfo.fileName = reader.getString(); + } else if ("url".equals(fieldName)) { + deserializedTestRunFileInfo.url = reader.getString(); + } else if ("fileType".equals(fieldName)) { + deserializedTestRunFileInfo.fileType = FileType.fromString(reader.getString()); + } else if ("expireDateTime".equals(fieldName)) { + deserializedTestRunFileInfo.expireDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("validationStatus".equals(fieldName)) { + deserializedTestRunFileInfo.validationStatus = FileStatus.fromString(reader.getString()); + } else if ("validationFailureDetails".equals(fieldName)) { + deserializedTestRunFileInfo.validationFailureDetails = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTestRunFileInfo; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunInputArtifacts.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunInputArtifacts.java new file mode 100644 index 0000000000000..9745bb6c4c142 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunInputArtifacts.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The input artifacts for the test run. + */ +@Immutable +public final class TestRunInputArtifacts implements JsonSerializable { + /* + * File info + */ + @Generated + private TestRunFileInfo configFileInfo; + + /* + * File info + */ + @Generated + private TestRunFileInfo testScriptFileInfo; + + /* + * File info + */ + @Generated + private TestRunFileInfo userPropFileInfo; + + /* + * File info + */ + @Generated + private TestRunFileInfo inputArtifactsZipFileInfo; + + /* + * The config json file for url based test + */ + @Generated + private TestRunFileInfo urlTestConfigFileInfo; + + /* + * Additional supported files for the test run + */ + @Generated + private List additionalFileInfo; + + /** + * Creates an instance of TestRunInputArtifacts class. + */ + @Generated + private TestRunInputArtifacts() { + } + + /** + * Get the configFileInfo property: File info. + * + * @return the configFileInfo value. + */ + @Generated + public TestRunFileInfo getConfigFileInfo() { + return this.configFileInfo; + } + + /** + * Get the testScriptFileInfo property: File info. + * + * @return the testScriptFileInfo value. + */ + @Generated + public TestRunFileInfo getTestScriptFileInfo() { + return this.testScriptFileInfo; + } + + /** + * Get the userPropFileInfo property: File info. + * + * @return the userPropFileInfo value. + */ + @Generated + public TestRunFileInfo getUserPropFileInfo() { + return this.userPropFileInfo; + } + + /** + * Get the inputArtifactsZipFileInfo property: File info. + * + * @return the inputArtifactsZipFileInfo value. + */ + @Generated + public TestRunFileInfo getInputArtifactsZipFileInfo() { + return this.inputArtifactsZipFileInfo; + } + + /** + * Get the urlTestConfigFileInfo property: The config json file for url based test. + * + * @return the urlTestConfigFileInfo value. + */ + @Generated + public TestRunFileInfo getUrlTestConfigFileInfo() { + return this.urlTestConfigFileInfo; + } + + /** + * Get the additionalFileInfo property: Additional supported files for the test run. + * + * @return the additionalFileInfo value. + */ + @Generated + public List getAdditionalFileInfo() { + return this.additionalFileInfo; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("configFileInfo", this.configFileInfo); + jsonWriter.writeJsonField("testScriptFileInfo", this.testScriptFileInfo); + jsonWriter.writeJsonField("userPropFileInfo", this.userPropFileInfo); + jsonWriter.writeJsonField("inputArtifactsZipFileInfo", this.inputArtifactsZipFileInfo); + jsonWriter.writeJsonField("urlTestConfigFileInfo", this.urlTestConfigFileInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestRunInputArtifacts from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestRunInputArtifacts if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TestRunInputArtifacts. + */ + @Generated + public static TestRunInputArtifacts fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestRunInputArtifacts deserializedTestRunInputArtifacts = new TestRunInputArtifacts(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("configFileInfo".equals(fieldName)) { + deserializedTestRunInputArtifacts.configFileInfo = TestRunFileInfo.fromJson(reader); + } else if ("testScriptFileInfo".equals(fieldName)) { + deserializedTestRunInputArtifacts.testScriptFileInfo = TestRunFileInfo.fromJson(reader); + } else if ("userPropFileInfo".equals(fieldName)) { + deserializedTestRunInputArtifacts.userPropFileInfo = TestRunFileInfo.fromJson(reader); + } else if ("inputArtifactsZipFileInfo".equals(fieldName)) { + deserializedTestRunInputArtifacts.inputArtifactsZipFileInfo = TestRunFileInfo.fromJson(reader); + } else if ("urlTestConfigFileInfo".equals(fieldName)) { + deserializedTestRunInputArtifacts.urlTestConfigFileInfo = TestRunFileInfo.fromJson(reader); + } else if ("additionalFileInfo".equals(fieldName)) { + List additionalFileInfo + = reader.readArray(reader1 -> TestRunFileInfo.fromJson(reader1)); + deserializedTestRunInputArtifacts.additionalFileInfo = additionalFileInfo; + } else { + reader.skipChildren(); + } + } + + return deserializedTestRunInputArtifacts; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunOutputArtifacts.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunOutputArtifacts.java new file mode 100644 index 0000000000000..80a4b4940c337 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunOutputArtifacts.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The output artifacts for the test run. + */ +@Immutable +public final class TestRunOutputArtifacts implements JsonSerializable { + /* + * File info + */ + @Generated + private TestRunFileInfo resultFileInfo; + + /* + * File info + */ + @Generated + private TestRunFileInfo logsFileInfo; + + /* + * The container for test run artifacts. + */ + @Generated + private ArtifactsContainerInfo artifactsContainerInfo; + + /* + * The report file for the test run. + */ + @Generated + private TestRunFileInfo reportFileInfo; + + /** + * Creates an instance of TestRunOutputArtifacts class. + */ + @Generated + private TestRunOutputArtifacts() { + } + + /** + * Get the resultFileInfo property: File info. + * + * @return the resultFileInfo value. + */ + @Generated + public TestRunFileInfo getResultFileInfo() { + return this.resultFileInfo; + } + + /** + * Get the logsFileInfo property: File info. + * + * @return the logsFileInfo value. + */ + @Generated + public TestRunFileInfo getLogsFileInfo() { + return this.logsFileInfo; + } + + /** + * Get the artifactsContainerInfo property: The container for test run artifacts. + * + * @return the artifactsContainerInfo value. + */ + @Generated + public ArtifactsContainerInfo getArtifactsContainerInfo() { + return this.artifactsContainerInfo; + } + + /** + * Get the reportFileInfo property: The report file for the test run. + * + * @return the reportFileInfo value. + */ + @Generated + public TestRunFileInfo getReportFileInfo() { + return this.reportFileInfo; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resultFileInfo", this.resultFileInfo); + jsonWriter.writeJsonField("logsFileInfo", this.logsFileInfo); + jsonWriter.writeJsonField("artifactsContainerInfo", this.artifactsContainerInfo); + jsonWriter.writeJsonField("reportFileInfo", this.reportFileInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestRunOutputArtifacts from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestRunOutputArtifacts if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TestRunOutputArtifacts. + */ + @Generated + public static TestRunOutputArtifacts fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestRunOutputArtifacts deserializedTestRunOutputArtifacts = new TestRunOutputArtifacts(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resultFileInfo".equals(fieldName)) { + deserializedTestRunOutputArtifacts.resultFileInfo = TestRunFileInfo.fromJson(reader); + } else if ("logsFileInfo".equals(fieldName)) { + deserializedTestRunOutputArtifacts.logsFileInfo = TestRunFileInfo.fromJson(reader); + } else if ("artifactsContainerInfo".equals(fieldName)) { + deserializedTestRunOutputArtifacts.artifactsContainerInfo = ArtifactsContainerInfo.fromJson(reader); + } else if ("reportFileInfo".equals(fieldName)) { + deserializedTestRunOutputArtifacts.reportFileInfo = TestRunFileInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTestRunOutputArtifacts; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunServerMetricConfig.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunServerMetricConfig.java new file mode 100644 index 0000000000000..f49a22f441cb1 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunServerMetricConfig.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Test run server metrics configuration. + */ +@Fluent +public final class TestRunServerMetricConfig implements JsonSerializable { + /* + * Test run identifier + */ + @Generated + private String testRunId; + + /* + * Azure resource metrics collection {metric id : metrics object} (Refer : + * https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + * for metric id). + */ + @Generated + private Map metrics; + + /* + * The creation datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime createdDateTime; + + /* + * The user that created. + */ + @Generated + private String createdBy; + + /* + * The last Modified datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime lastModifiedDateTime; + + /* + * The user that last modified. + */ + @Generated + private String lastModifiedBy; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper + .setTestRunServerMetricConfigAccessor(new JsonMergePatchHelper.TestRunServerMetricConfigAccessor() { + @Override + public TestRunServerMetricConfig prepareModelForJsonMergePatch(TestRunServerMetricConfig model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(TestRunServerMetricConfig model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of TestRunServerMetricConfig class. + */ + @Generated + public TestRunServerMetricConfig() { + } + + /** + * Get the testRunId property: Test run identifier. + * + * @return the testRunId value. + */ + @Generated + public String getTestRunId() { + return this.testRunId; + } + + /** + * Get the metrics property: Azure resource metrics collection {metric id : metrics object} (Refer : + * https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + * for metric id). + * + * @return the metrics value. + */ + @Generated + public Map getMetrics() { + return this.metrics; + } + + /** + * Set the metrics property: Azure resource metrics collection {metric id : metrics object} (Refer : + * https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + * for metric id). + * + * @param metrics the metrics value to set. + * @return the TestRunServerMetricConfig object itself. + */ + @Generated + public TestRunServerMetricConfig setMetrics(Map metrics) { + this.metrics = metrics; + this.updatedProperties.add("metrics"); + return this; + } + + /** + * Get the createdDateTime property: The creation datetime(RFC 3339 literal format). + * + * @return the createdDateTime value. + */ + @Generated + public OffsetDateTime getCreatedDateTime() { + return this.createdDateTime; + } + + /** + * Get the createdBy property: The user that created. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the lastModifiedDateTime property: The last Modified datetime(RFC 3339 literal format). + * + * @return the lastModifiedDateTime value. + */ + @Generated + public OffsetDateTime getLastModifiedDateTime() { + return this.lastModifiedDateTime; + } + + /** + * Get the lastModifiedBy property: The user that last modified. + * + * @return the lastModifiedBy value. + */ + @Generated + public String getLastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("metrics", this.metrics, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("metrics")) { + if (this.metrics == null) { + jsonWriter.writeNullField("metrics"); + } else { + jsonWriter.writeMapField("metrics", this.metrics, (writer, element) -> { + if (element != null) { + JsonMergePatchHelper.getResourceMetricAccessor().prepareModelForJsonMergePatch(element, true); + writer.writeJson(element); + JsonMergePatchHelper.getResourceMetricAccessor().prepareModelForJsonMergePatch(element, false); + } else { + writer.writeNull(); + } + }); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestRunServerMetricConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestRunServerMetricConfig if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TestRunServerMetricConfig. + */ + @Generated + public static TestRunServerMetricConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestRunServerMetricConfig deserializedTestRunServerMetricConfig = new TestRunServerMetricConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("testRunId".equals(fieldName)) { + deserializedTestRunServerMetricConfig.testRunId = reader.getString(); + } else if ("metrics".equals(fieldName)) { + Map metrics = reader.readMap(reader1 -> ResourceMetric.fromJson(reader1)); + deserializedTestRunServerMetricConfig.metrics = metrics; + } else if ("createdDateTime".equals(fieldName)) { + deserializedTestRunServerMetricConfig.createdDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedTestRunServerMetricConfig.createdBy = reader.getString(); + } else if ("lastModifiedDateTime".equals(fieldName)) { + deserializedTestRunServerMetricConfig.lastModifiedDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedBy".equals(fieldName)) { + deserializedTestRunServerMetricConfig.lastModifiedBy = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTestRunServerMetricConfig; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunStatistics.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunStatistics.java new file mode 100644 index 0000000000000..88583aebf7ead --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestRunStatistics.java @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Test run statistics. + */ +@Immutable +public final class TestRunStatistics implements JsonSerializable { + /* + * Transaction name. + */ + @Generated + private String transaction; + + /* + * Sampler count. + */ + @Generated + private Double sampleCount; + + /* + * Error count. + */ + @Generated + private Double errorCount; + + /* + * Error percentage. + */ + @Generated + private Double errorPct; + + /* + * Mean response time. + */ + @Generated + private Double meanResTime; + + /* + * Median response time. + */ + @Generated + private Double medianResTime; + + /* + * Max response time. + */ + @Generated + private Double maxResTime; + + /* + * Minimum response time. + */ + @Generated + private Double minResTime; + + /* + * 90 percentile response time. + */ + @Generated + private Double pct1ResTime; + + /* + * 95 percentile response time. + */ + @Generated + private Double pct2ResTime; + + /* + * 99 percentile response time. + */ + @Generated + private Double pct3ResTime; + + /* + * 75 percentile response time. + */ + @Generated + private Double pct75ResTime; + + /* + * 96 percentile response time. + */ + @Generated + private Double pct96ResTime; + + /* + * 97 percentile response time. + */ + @Generated + private Double pct97ResTime; + + /* + * 98 percentile response time. + */ + @Generated + private Double pct98ResTime; + + /* + * 99.9 percentile response time. + */ + @Generated + private Double pct999ResTime; + + /* + * 99.99 percentile response time. + */ + @Generated + private Double pct9999ResTime; + + /* + * Throughput. + */ + @Generated + private Double throughput; + + /* + * Received network bytes. + */ + @Generated + private Double receivedKBytesPerSec; + + /* + * Send network bytes. + */ + @Generated + private Double sentKBytesPerSec; + + /** + * Creates an instance of TestRunStatistics class. + */ + @Generated + private TestRunStatistics() { + } + + /** + * Get the transaction property: Transaction name. + * + * @return the transaction value. + */ + @Generated + public String getTransaction() { + return this.transaction; + } + + /** + * Get the sampleCount property: Sampler count. + * + * @return the sampleCount value. + */ + @Generated + public Double getSampleCount() { + return this.sampleCount; + } + + /** + * Get the errorCount property: Error count. + * + * @return the errorCount value. + */ + @Generated + public Double getErrorCount() { + return this.errorCount; + } + + /** + * Get the errorPct property: Error percentage. + * + * @return the errorPct value. + */ + @Generated + public Double getErrorPct() { + return this.errorPct; + } + + /** + * Get the meanResTime property: Mean response time. + * + * @return the meanResTime value. + */ + @Generated + public Double getMeanResTime() { + return this.meanResTime; + } + + /** + * Get the medianResTime property: Median response time. + * + * @return the medianResTime value. + */ + @Generated + public Double getMedianResTime() { + return this.medianResTime; + } + + /** + * Get the maxResTime property: Max response time. + * + * @return the maxResTime value. + */ + @Generated + public Double getMaxResTime() { + return this.maxResTime; + } + + /** + * Get the minResTime property: Minimum response time. + * + * @return the minResTime value. + */ + @Generated + public Double getMinResTime() { + return this.minResTime; + } + + /** + * Get the pct1ResTime property: 90 percentile response time. + * + * @return the pct1ResTime value. + */ + @Generated + public Double getPct1ResTime() { + return this.pct1ResTime; + } + + /** + * Get the pct2ResTime property: 95 percentile response time. + * + * @return the pct2ResTime value. + */ + @Generated + public Double getPct2ResTime() { + return this.pct2ResTime; + } + + /** + * Get the pct3ResTime property: 99 percentile response time. + * + * @return the pct3ResTime value. + */ + @Generated + public Double getPct3ResTime() { + return this.pct3ResTime; + } + + /** + * Get the pct75ResTime property: 75 percentile response time. + * + * @return the pct75ResTime value. + */ + @Generated + public Double getPct75ResTime() { + return this.pct75ResTime; + } + + /** + * Get the pct96ResTime property: 96 percentile response time. + * + * @return the pct96ResTime value. + */ + @Generated + public Double getPct96ResTime() { + return this.pct96ResTime; + } + + /** + * Get the pct97ResTime property: 97 percentile response time. + * + * @return the pct97ResTime value. + */ + @Generated + public Double getPct97ResTime() { + return this.pct97ResTime; + } + + /** + * Get the pct98ResTime property: 98 percentile response time. + * + * @return the pct98ResTime value. + */ + @Generated + public Double getPct98ResTime() { + return this.pct98ResTime; + } + + /** + * Get the pct999ResTime property: 99.9 percentile response time. + * + * @return the pct999ResTime value. + */ + @Generated + public Double getPct999ResTime() { + return this.pct999ResTime; + } + + /** + * Get the pct9999ResTime property: 99.99 percentile response time. + * + * @return the pct9999ResTime value. + */ + @Generated + public Double getPct9999ResTime() { + return this.pct9999ResTime; + } + + /** + * Get the throughput property: Throughput. + * + * @return the throughput value. + */ + @Generated + public Double getThroughput() { + return this.throughput; + } + + /** + * Get the receivedKBytesPerSec property: Received network bytes. + * + * @return the receivedKBytesPerSec value. + */ + @Generated + public Double getReceivedKBytesPerSec() { + return this.receivedKBytesPerSec; + } + + /** + * Get the sentKBytesPerSec property: Send network bytes. + * + * @return the sentKBytesPerSec value. + */ + @Generated + public Double getSentKBytesPerSec() { + return this.sentKBytesPerSec; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestRunStatistics from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestRunStatistics if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TestRunStatistics. + */ + @Generated + public static TestRunStatistics fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestRunStatistics deserializedTestRunStatistics = new TestRunStatistics(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("transaction".equals(fieldName)) { + deserializedTestRunStatistics.transaction = reader.getString(); + } else if ("sampleCount".equals(fieldName)) { + deserializedTestRunStatistics.sampleCount = reader.getNullable(JsonReader::getDouble); + } else if ("errorCount".equals(fieldName)) { + deserializedTestRunStatistics.errorCount = reader.getNullable(JsonReader::getDouble); + } else if ("errorPct".equals(fieldName)) { + deserializedTestRunStatistics.errorPct = reader.getNullable(JsonReader::getDouble); + } else if ("meanResTime".equals(fieldName)) { + deserializedTestRunStatistics.meanResTime = reader.getNullable(JsonReader::getDouble); + } else if ("medianResTime".equals(fieldName)) { + deserializedTestRunStatistics.medianResTime = reader.getNullable(JsonReader::getDouble); + } else if ("maxResTime".equals(fieldName)) { + deserializedTestRunStatistics.maxResTime = reader.getNullable(JsonReader::getDouble); + } else if ("minResTime".equals(fieldName)) { + deserializedTestRunStatistics.minResTime = reader.getNullable(JsonReader::getDouble); + } else if ("pct1ResTime".equals(fieldName)) { + deserializedTestRunStatistics.pct1ResTime = reader.getNullable(JsonReader::getDouble); + } else if ("pct2ResTime".equals(fieldName)) { + deserializedTestRunStatistics.pct2ResTime = reader.getNullable(JsonReader::getDouble); + } else if ("pct3ResTime".equals(fieldName)) { + deserializedTestRunStatistics.pct3ResTime = reader.getNullable(JsonReader::getDouble); + } else if ("pct75ResTime".equals(fieldName)) { + deserializedTestRunStatistics.pct75ResTime = reader.getNullable(JsonReader::getDouble); + } else if ("pct96ResTime".equals(fieldName)) { + deserializedTestRunStatistics.pct96ResTime = reader.getNullable(JsonReader::getDouble); + } else if ("pct97ResTime".equals(fieldName)) { + deserializedTestRunStatistics.pct97ResTime = reader.getNullable(JsonReader::getDouble); + } else if ("pct98ResTime".equals(fieldName)) { + deserializedTestRunStatistics.pct98ResTime = reader.getNullable(JsonReader::getDouble); + } else if ("pct999ResTime".equals(fieldName)) { + deserializedTestRunStatistics.pct999ResTime = reader.getNullable(JsonReader::getDouble); + } else if ("pct9999ResTime".equals(fieldName)) { + deserializedTestRunStatistics.pct9999ResTime = reader.getNullable(JsonReader::getDouble); + } else if ("throughput".equals(fieldName)) { + deserializedTestRunStatistics.throughput = reader.getNullable(JsonReader::getDouble); + } else if ("receivedKBytesPerSec".equals(fieldName)) { + deserializedTestRunStatistics.receivedKBytesPerSec = reader.getNullable(JsonReader::getDouble); + } else if ("sentKBytesPerSec".equals(fieldName)) { + deserializedTestRunStatistics.sentKBytesPerSec = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedTestRunStatistics; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestServerMetricConfig.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestServerMetricConfig.java new file mode 100644 index 0000000000000..8f40fe95cba70 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TestServerMetricConfig.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.developer.loadtesting.implementation.JsonMergePatchHelper; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Test server metrics configuration. + */ +@Fluent +public final class TestServerMetricConfig implements JsonSerializable { + /* + * Test identifier + */ + @Generated + private String testId; + + /* + * Azure resource metrics collection {metric id : metrics object} (Refer : + * https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + * for metric id). + */ + @Generated + private Map metrics; + + /* + * The creation datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime createdDateTime; + + /* + * The user that created. + */ + @Generated + private String createdBy; + + /* + * The last Modified datetime(RFC 3339 literal format). + */ + @Generated + private OffsetDateTime lastModifiedDateTime; + + /* + * The user that last modified. + */ + @Generated + private String lastModifiedBy; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper + .setTestServerMetricConfigAccessor(new JsonMergePatchHelper.TestServerMetricConfigAccessor() { + @Override + public TestServerMetricConfig prepareModelForJsonMergePatch(TestServerMetricConfig model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(TestServerMetricConfig model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of TestServerMetricConfig class. + */ + @Generated + public TestServerMetricConfig() { + } + + /** + * Get the testId property: Test identifier. + * + * @return the testId value. + */ + @Generated + public String getTestId() { + return this.testId; + } + + /** + * Get the metrics property: Azure resource metrics collection {metric id : metrics object} (Refer : + * https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + * for metric id). + * + * @return the metrics value. + */ + @Generated + public Map getMetrics() { + return this.metrics; + } + + /** + * Set the metrics property: Azure resource metrics collection {metric id : metrics object} (Refer : + * https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + * for metric id). + *

Required when create the resource.

+ * + * @param metrics the metrics value to set. + * @return the TestServerMetricConfig object itself. + */ + @Generated + public TestServerMetricConfig setMetrics(Map metrics) { + this.metrics = metrics; + this.updatedProperties.add("metrics"); + return this; + } + + /** + * Get the createdDateTime property: The creation datetime(RFC 3339 literal format). + * + * @return the createdDateTime value. + */ + @Generated + public OffsetDateTime getCreatedDateTime() { + return this.createdDateTime; + } + + /** + * Get the createdBy property: The user that created. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the lastModifiedDateTime property: The last Modified datetime(RFC 3339 literal format). + * + * @return the lastModifiedDateTime value. + */ + @Generated + public OffsetDateTime getLastModifiedDateTime() { + return this.lastModifiedDateTime; + } + + /** + * Get the lastModifiedBy property: The user that last modified. + * + * @return the lastModifiedBy value. + */ + @Generated + public String getLastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("metrics", this.metrics, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("metrics")) { + if (this.metrics == null) { + jsonWriter.writeNullField("metrics"); + } else { + jsonWriter.writeMapField("metrics", this.metrics, (writer, element) -> { + if (element != null) { + JsonMergePatchHelper.getResourceMetricAccessor().prepareModelForJsonMergePatch(element, true); + writer.writeJson(element); + JsonMergePatchHelper.getResourceMetricAccessor().prepareModelForJsonMergePatch(element, false); + } else { + writer.writeNull(); + } + }); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestServerMetricConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestServerMetricConfig if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TestServerMetricConfig. + */ + @Generated + public static TestServerMetricConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestServerMetricConfig deserializedTestServerMetricConfig = new TestServerMetricConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("testId".equals(fieldName)) { + deserializedTestServerMetricConfig.testId = reader.getString(); + } else if ("metrics".equals(fieldName)) { + Map metrics = reader.readMap(reader1 -> ResourceMetric.fromJson(reader1)); + deserializedTestServerMetricConfig.metrics = metrics; + } else if ("createdDateTime".equals(fieldName)) { + deserializedTestServerMetricConfig.createdDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedTestServerMetricConfig.createdBy = reader.getString(); + } else if ("lastModifiedDateTime".equals(fieldName)) { + deserializedTestServerMetricConfig.lastModifiedDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedBy".equals(fieldName)) { + deserializedTestServerMetricConfig.lastModifiedBy = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTestServerMetricConfig; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TimeGrain.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TimeGrain.java new file mode 100644 index 0000000000000..412ce5968cbe1 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TimeGrain.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Time Grain. + */ +public final class TimeGrain extends ExpandableStringEnum { + /** + * 5 seconds, available only if test run duration is less than 10 minutes. + */ + @Generated + public static final TimeGrain PT5S = fromString("PT5S"); + + /** + * 10 seconds, available only if test run duration is less than 10 minutes. + */ + @Generated + public static final TimeGrain PT10S = fromString("PT10S"); + + /** + * 1 minute. + */ + @Generated + public static final TimeGrain PT1M = fromString("PT1M"); + + /** + * 5 minutes, available only if test run duration is greater than 1 minute. + */ + @Generated + public static final TimeGrain PT5M = fromString("PT5M"); + + /** + * 1 hour, available only if test run duration is greater than 1 minute. + */ + @Generated + public static final TimeGrain PT1H = fromString("PT1H"); + + /** + * Creates a new instance of TimeGrain value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public TimeGrain() { + } + + /** + * Creates or finds a TimeGrain from its string representation. + * + * @param name a name to look for. + * @return the corresponding TimeGrain. + */ + @Generated + public static TimeGrain fromString(String name) { + return fromString(name, TimeGrain.class); + } + + /** + * Gets known TimeGrain values. + * + * @return known TimeGrain values. + */ + @Generated + public static Collection values() { + return values(TimeGrain.class); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TimeSeriesElement.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TimeSeriesElement.java new file mode 100644 index 0000000000000..5f6a146ce2c01 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/TimeSeriesElement.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The time series returned when a data query is performed. + */ +@Immutable +public final class TimeSeriesElement implements JsonSerializable { + /* + * An array of data points representing the metric values. + */ + @Generated + private List data; + + /* + * The dimension values + */ + @Generated + private List dimensionValues; + + /** + * Creates an instance of TimeSeriesElement class. + */ + @Generated + private TimeSeriesElement() { + } + + /** + * Get the data property: An array of data points representing the metric values. + * + * @return the data value. + */ + @Generated + public List getData() { + return this.data; + } + + /** + * Get the dimensionValues property: The dimension values. + * + * @return the dimensionValues value. + */ + @Generated + public List getDimensionValues() { + return this.dimensionValues; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("data", this.data, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("dimensionValues", this.dimensionValues, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TimeSeriesElement from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TimeSeriesElement if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TimeSeriesElement. + */ + @Generated + public static TimeSeriesElement fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TimeSeriesElement deserializedTimeSeriesElement = new TimeSeriesElement(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("data".equals(fieldName)) { + List data = reader.readArray(reader1 -> MetricValue.fromJson(reader1)); + deserializedTimeSeriesElement.data = data; + } else if ("dimensionValues".equals(fieldName)) { + List dimensionValues + = reader.readArray(reader1 -> DimensionValue.fromJson(reader1)); + deserializedTimeSeriesElement.dimensionValues = dimensionValues; + } else { + reader.skipChildren(); + } + } + + return deserializedTimeSeriesElement; + }); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/package-info.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/package-info.java new file mode 100644 index 0000000000000..5d42324765d89 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for LoadTesting. + * These APIs allow end users to create, view and run load tests using Azure Load Test Service. + * + */ +package com.azure.developer.loadtesting.models; diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/package-info.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/package-info.java index 009f697b68704..d248dd96db41c 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/package-info.java +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/com/azure/developer/loadtesting/package-info.java @@ -1,8 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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 containing the classes for LoadTesting. + * 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/loadtesting/azure-developer-loadtesting/src/main/java/module-info.java b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/module-info.java index 2c7ca0c94217c..1cb370bd813dd 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/src/main/java/module-info.java +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/java/module-info.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. module com.azure.developer.loadtesting { requires transitive com.azure.core; - requires com.azure.json; - exports com.azure.developer.loadtesting; -} + exports com.azure.developer.loadtesting.models; + opens com.azure.developer.loadtesting.models to com.azure.core; +} \ No newline at end of file diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/main/resources/META-INF/azure-developer-loadtesting_apiview_properties.json b/sdk/loadtesting/azure-developer-loadtesting/src/main/resources/META-INF/azure-developer-loadtesting_apiview_properties.json new file mode 100644 index 0000000000000..a9a257f049e63 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/main/resources/META-INF/azure-developer-loadtesting_apiview_properties.json @@ -0,0 +1,207 @@ +{ + "flavor": "azure", + "CrossLanguageDefinitionId": { + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient": "Customizations.AdministrationOperations", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.createOrUpdateAppComponents": "Customizations.AdministrationOperations.createOrUpdateAppComponents", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.createOrUpdateAppComponentsWithResponse": "Customizations.AdministrationOperations.createOrUpdateAppComponents", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.createOrUpdateServerMetricsConfig": "Customizations.AdministrationOperations.createOrUpdateServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.createOrUpdateServerMetricsConfigWithResponse": "Customizations.AdministrationOperations.createOrUpdateServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.createOrUpdateTest": "Customizations.AdministrationOperations.createOrUpdateTest", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.createOrUpdateTestWithResponse": "Customizations.AdministrationOperations.createOrUpdateTest", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.deleteTest": "Customizations.AdministrationOperations.deleteTest", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.deleteTestFile": "Customizations.AdministrationOperations.deleteTestFile", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.deleteTestFileWithResponse": "Customizations.AdministrationOperations.deleteTestFile", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.deleteTestWithResponse": "Customizations.AdministrationOperations.deleteTest", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.getAppComponents": "Customizations.AdministrationOperations.getAppComponents", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.getAppComponentsWithResponse": "Customizations.AdministrationOperations.getAppComponents", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.getServerMetricsConfig": "Customizations.AdministrationOperations.getServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.getServerMetricsConfigWithResponse": "Customizations.AdministrationOperations.getServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.getTest": "Customizations.AdministrationOperations.getTest", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.getTestFile": "Customizations.AdministrationOperations.getTestFile", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.getTestFileWithResponse": "Customizations.AdministrationOperations.getTestFile", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.getTestWithResponse": "Customizations.AdministrationOperations.getTest", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.listTestFiles": "Customizations.AdministrationOperations.listTestFiles", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.listTests": "Customizations.AdministrationOperations.listTests", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.uploadTestFile": "Customizations.AdministrationOperations.uploadTestFile", + "com.azure.developer.loadtesting.LoadTestAdministrationAsyncClient.uploadTestFileWithResponse": "Customizations.AdministrationOperations.uploadTestFile", + "com.azure.developer.loadtesting.LoadTestAdministrationClient": "Customizations.AdministrationOperations", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.createOrUpdateAppComponents": "Customizations.AdministrationOperations.createOrUpdateAppComponents", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.createOrUpdateAppComponentsWithResponse": "Customizations.AdministrationOperations.createOrUpdateAppComponents", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.createOrUpdateServerMetricsConfig": "Customizations.AdministrationOperations.createOrUpdateServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.createOrUpdateServerMetricsConfigWithResponse": "Customizations.AdministrationOperations.createOrUpdateServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.createOrUpdateTest": "Customizations.AdministrationOperations.createOrUpdateTest", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.createOrUpdateTestWithResponse": "Customizations.AdministrationOperations.createOrUpdateTest", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.deleteTest": "Customizations.AdministrationOperations.deleteTest", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.deleteTestFile": "Customizations.AdministrationOperations.deleteTestFile", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.deleteTestFileWithResponse": "Customizations.AdministrationOperations.deleteTestFile", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.deleteTestWithResponse": "Customizations.AdministrationOperations.deleteTest", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.getAppComponents": "Customizations.AdministrationOperations.getAppComponents", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.getAppComponentsWithResponse": "Customizations.AdministrationOperations.getAppComponents", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.getServerMetricsConfig": "Customizations.AdministrationOperations.getServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.getServerMetricsConfigWithResponse": "Customizations.AdministrationOperations.getServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.getTest": "Customizations.AdministrationOperations.getTest", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.getTestFile": "Customizations.AdministrationOperations.getTestFile", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.getTestFileWithResponse": "Customizations.AdministrationOperations.getTestFile", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.getTestWithResponse": "Customizations.AdministrationOperations.getTest", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.listTestFiles": "Customizations.AdministrationOperations.listTestFiles", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.listTests": "Customizations.AdministrationOperations.listTests", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.uploadTestFile": "Customizations.AdministrationOperations.uploadTestFile", + "com.azure.developer.loadtesting.LoadTestAdministrationClient.uploadTestFileWithResponse": "Customizations.AdministrationOperations.uploadTestFile", + "com.azure.developer.loadtesting.LoadTestAdministrationClientBuilder": "Customizations.AdministrationOperations", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient": "Customizations.TestRunOperations", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.createOrUpdateAppComponents": "Customizations.TestRunOperations.createOrUpdateAppComponents", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.createOrUpdateAppComponentsWithResponse": "Customizations.TestRunOperations.createOrUpdateAppComponents", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.createOrUpdateServerMetricsConfig": "Customizations.TestRunOperations.createOrUpdateServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.createOrUpdateServerMetricsConfigWithResponse": "Customizations.TestRunOperations.createOrUpdateServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.createOrUpdateTestRun": "Customizations.TestRunOperations.createOrUpdateTestRun", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.createOrUpdateTestRunWithResponse": "Customizations.TestRunOperations.createOrUpdateTestRun", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.deleteTestRun": "Customizations.TestRunOperations.deleteTestRun", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.deleteTestRunWithResponse": "Customizations.TestRunOperations.deleteTestRun", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.getAppComponents": "Customizations.TestRunOperations.getAppComponents", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.getAppComponentsWithResponse": "Customizations.TestRunOperations.getAppComponents", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.getMetricDefinitions": "Customizations.TestRunOperations.listMetricDefinitions", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.getMetricDefinitionsWithResponse": "Customizations.TestRunOperations.listMetricDefinitions", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.getMetricNamespaces": "Customizations.TestRunOperations.listMetricNamespaces", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.getMetricNamespacesWithResponse": "Customizations.TestRunOperations.listMetricNamespaces", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.getServerMetricsConfig": "Customizations.TestRunOperations.getServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.getServerMetricsConfigWithResponse": "Customizations.TestRunOperations.getServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.getTestRun": "Customizations.TestRunOperations.getTestRun", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.getTestRunFile": "Customizations.TestRunOperations.getTestRunFile", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.getTestRunFileWithResponse": "Customizations.TestRunOperations.getTestRunFile", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.getTestRunWithResponse": "Customizations.TestRunOperations.getTestRun", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.listMetricDimensionValues": "Customizations.TestRunOperations.listMetricDimensionValues", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.listMetricDimensionValuesWithResponse": "Customizations.TestRunOperations.listMetricDimensionValues", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.listMetrics": "Customizations.TestRunOperations.listMetrics", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.listTestRuns": "Customizations.TestRunOperations.listTestRuns", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.stopTestRun": "Customizations.TestRunOperations.stop", + "com.azure.developer.loadtesting.LoadTestRunAsyncClient.stopTestRunWithResponse": "Customizations.TestRunOperations.stop", + "com.azure.developer.loadtesting.LoadTestRunClient": "Customizations.TestRunOperations", + "com.azure.developer.loadtesting.LoadTestRunClient.createOrUpdateAppComponents": "Customizations.TestRunOperations.createOrUpdateAppComponents", + "com.azure.developer.loadtesting.LoadTestRunClient.createOrUpdateAppComponentsWithResponse": "Customizations.TestRunOperations.createOrUpdateAppComponents", + "com.azure.developer.loadtesting.LoadTestRunClient.createOrUpdateServerMetricsConfig": "Customizations.TestRunOperations.createOrUpdateServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestRunClient.createOrUpdateServerMetricsConfigWithResponse": "Customizations.TestRunOperations.createOrUpdateServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestRunClient.createOrUpdateTestRun": "Customizations.TestRunOperations.createOrUpdateTestRun", + "com.azure.developer.loadtesting.LoadTestRunClient.createOrUpdateTestRunWithResponse": "Customizations.TestRunOperations.createOrUpdateTestRun", + "com.azure.developer.loadtesting.LoadTestRunClient.deleteTestRun": "Customizations.TestRunOperations.deleteTestRun", + "com.azure.developer.loadtesting.LoadTestRunClient.deleteTestRunWithResponse": "Customizations.TestRunOperations.deleteTestRun", + "com.azure.developer.loadtesting.LoadTestRunClient.getAppComponents": "Customizations.TestRunOperations.getAppComponents", + "com.azure.developer.loadtesting.LoadTestRunClient.getAppComponentsWithResponse": "Customizations.TestRunOperations.getAppComponents", + "com.azure.developer.loadtesting.LoadTestRunClient.getMetricDefinitions": "Customizations.TestRunOperations.listMetricDefinitions", + "com.azure.developer.loadtesting.LoadTestRunClient.getMetricDefinitionsWithResponse": "Customizations.TestRunOperations.listMetricDefinitions", + "com.azure.developer.loadtesting.LoadTestRunClient.getMetricNamespaces": "Customizations.TestRunOperations.listMetricNamespaces", + "com.azure.developer.loadtesting.LoadTestRunClient.getMetricNamespacesWithResponse": "Customizations.TestRunOperations.listMetricNamespaces", + "com.azure.developer.loadtesting.LoadTestRunClient.getServerMetricsConfig": "Customizations.TestRunOperations.getServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestRunClient.getServerMetricsConfigWithResponse": "Customizations.TestRunOperations.getServerMetricsConfig", + "com.azure.developer.loadtesting.LoadTestRunClient.getTestRun": "Customizations.TestRunOperations.getTestRun", + "com.azure.developer.loadtesting.LoadTestRunClient.getTestRunFile": "Customizations.TestRunOperations.getTestRunFile", + "com.azure.developer.loadtesting.LoadTestRunClient.getTestRunFileWithResponse": "Customizations.TestRunOperations.getTestRunFile", + "com.azure.developer.loadtesting.LoadTestRunClient.getTestRunWithResponse": "Customizations.TestRunOperations.getTestRun", + "com.azure.developer.loadtesting.LoadTestRunClient.listMetricDimensionValues": "Customizations.TestRunOperations.listMetricDimensionValues", + "com.azure.developer.loadtesting.LoadTestRunClient.listMetricDimensionValuesWithResponse": "Customizations.TestRunOperations.listMetricDimensionValues", + "com.azure.developer.loadtesting.LoadTestRunClient.listMetrics": "Customizations.TestRunOperations.listMetrics", + "com.azure.developer.loadtesting.LoadTestRunClient.listTestRuns": "Customizations.TestRunOperations.listTestRuns", + "com.azure.developer.loadtesting.LoadTestRunClient.stopTestRun": "Customizations.TestRunOperations.stop", + "com.azure.developer.loadtesting.LoadTestRunClient.stopTestRunWithResponse": "Customizations.TestRunOperations.stop", + "com.azure.developer.loadtesting.LoadTestRunClientBuilder": "Customizations.TestRunOperations", + "com.azure.developer.loadtesting.TestProfileAdministrationAsyncClient": "Customizations.TestProfileAdministrationOperations", + "com.azure.developer.loadtesting.TestProfileAdministrationAsyncClient.createOrUpdateTestProfile": "Customizations.TestProfileAdministrationOperations.createOrUpdateTestProfile", + "com.azure.developer.loadtesting.TestProfileAdministrationAsyncClient.createOrUpdateTestProfileWithResponse": "Customizations.TestProfileAdministrationOperations.createOrUpdateTestProfile", + "com.azure.developer.loadtesting.TestProfileAdministrationAsyncClient.deleteTestProfile": "Customizations.TestProfileAdministrationOperations.deleteTestProfile", + "com.azure.developer.loadtesting.TestProfileAdministrationAsyncClient.deleteTestProfileWithResponse": "Customizations.TestProfileAdministrationOperations.deleteTestProfile", + "com.azure.developer.loadtesting.TestProfileAdministrationAsyncClient.getTestProfile": "Customizations.TestProfileAdministrationOperations.getTestProfile", + "com.azure.developer.loadtesting.TestProfileAdministrationAsyncClient.getTestProfileWithResponse": "Customizations.TestProfileAdministrationOperations.getTestProfile", + "com.azure.developer.loadtesting.TestProfileAdministrationAsyncClient.listTestProfiles": "Customizations.TestProfileAdministrationOperations.listTestProfiles", + "com.azure.developer.loadtesting.TestProfileAdministrationClient": "Customizations.TestProfileAdministrationOperations", + "com.azure.developer.loadtesting.TestProfileAdministrationClient.createOrUpdateTestProfile": "Customizations.TestProfileAdministrationOperations.createOrUpdateTestProfile", + "com.azure.developer.loadtesting.TestProfileAdministrationClient.createOrUpdateTestProfileWithResponse": "Customizations.TestProfileAdministrationOperations.createOrUpdateTestProfile", + "com.azure.developer.loadtesting.TestProfileAdministrationClient.deleteTestProfile": "Customizations.TestProfileAdministrationOperations.deleteTestProfile", + "com.azure.developer.loadtesting.TestProfileAdministrationClient.deleteTestProfileWithResponse": "Customizations.TestProfileAdministrationOperations.deleteTestProfile", + "com.azure.developer.loadtesting.TestProfileAdministrationClient.getTestProfile": "Customizations.TestProfileAdministrationOperations.getTestProfile", + "com.azure.developer.loadtesting.TestProfileAdministrationClient.getTestProfileWithResponse": "Customizations.TestProfileAdministrationOperations.getTestProfile", + "com.azure.developer.loadtesting.TestProfileAdministrationClient.listTestProfiles": "Customizations.TestProfileAdministrationOperations.listTestProfiles", + "com.azure.developer.loadtesting.TestProfileAdministrationClientBuilder": "Customizations.TestProfileAdministrationOperations", + "com.azure.developer.loadtesting.TestProfileRunAsyncClient": "Customizations.TestProfileRunOperations", + "com.azure.developer.loadtesting.TestProfileRunAsyncClient.createOrUpdateTestProfileRun": "Customizations.TestProfileRunOperations.createOrUpdateTestProfileRun", + "com.azure.developer.loadtesting.TestProfileRunAsyncClient.createOrUpdateTestProfileRunWithResponse": "Customizations.TestProfileRunOperations.createOrUpdateTestProfileRun", + "com.azure.developer.loadtesting.TestProfileRunAsyncClient.deleteTestProfileRun": "Customizations.TestProfileRunOperations.deleteTestProfileRun", + "com.azure.developer.loadtesting.TestProfileRunAsyncClient.deleteTestProfileRunWithResponse": "Customizations.TestProfileRunOperations.deleteTestProfileRun", + "com.azure.developer.loadtesting.TestProfileRunAsyncClient.getTestProfileRun": "Customizations.TestProfileRunOperations.getTestProfileRun", + "com.azure.developer.loadtesting.TestProfileRunAsyncClient.getTestProfileRunWithResponse": "Customizations.TestProfileRunOperations.getTestProfileRun", + "com.azure.developer.loadtesting.TestProfileRunAsyncClient.listTestProfileRuns": "Customizations.TestProfileRunOperations.listTestProfileRuns", + "com.azure.developer.loadtesting.TestProfileRunAsyncClient.stopTestProfileRun": "Customizations.TestProfileRunOperations.stop", + "com.azure.developer.loadtesting.TestProfileRunAsyncClient.stopTestProfileRunWithResponse": "Customizations.TestProfileRunOperations.stop", + "com.azure.developer.loadtesting.TestProfileRunClient": "Customizations.TestProfileRunOperations", + "com.azure.developer.loadtesting.TestProfileRunClient.createOrUpdateTestProfileRun": "Customizations.TestProfileRunOperations.createOrUpdateTestProfileRun", + "com.azure.developer.loadtesting.TestProfileRunClient.createOrUpdateTestProfileRunWithResponse": "Customizations.TestProfileRunOperations.createOrUpdateTestProfileRun", + "com.azure.developer.loadtesting.TestProfileRunClient.deleteTestProfileRun": "Customizations.TestProfileRunOperations.deleteTestProfileRun", + "com.azure.developer.loadtesting.TestProfileRunClient.deleteTestProfileRunWithResponse": "Customizations.TestProfileRunOperations.deleteTestProfileRun", + "com.azure.developer.loadtesting.TestProfileRunClient.getTestProfileRun": "Customizations.TestProfileRunOperations.getTestProfileRun", + "com.azure.developer.loadtesting.TestProfileRunClient.getTestProfileRunWithResponse": "Customizations.TestProfileRunOperations.getTestProfileRun", + "com.azure.developer.loadtesting.TestProfileRunClient.listTestProfileRuns": "Customizations.TestProfileRunOperations.listTestProfileRuns", + "com.azure.developer.loadtesting.TestProfileRunClient.stopTestProfileRun": "Customizations.TestProfileRunOperations.stop", + "com.azure.developer.loadtesting.TestProfileRunClient.stopTestProfileRunWithResponse": "Customizations.TestProfileRunOperations.stop", + "com.azure.developer.loadtesting.TestProfileRunClientBuilder": "Customizations.TestProfileRunOperations", + "com.azure.developer.loadtesting.models.AggregationType": "Microsoft.LoadTestService.AggregationType", + "com.azure.developer.loadtesting.models.AppComponent": "Microsoft.LoadTestService.AppComponent", + "com.azure.developer.loadtesting.models.ArtifactsContainerInfo": "Microsoft.LoadTestService.ArtifactsContainerInfo", + "com.azure.developer.loadtesting.models.AutoStopCriteria": "Microsoft.LoadTestService.AutoStopCriteria", + "com.azure.developer.loadtesting.models.CertificateMetadata": "Microsoft.LoadTestService.CertificateMetadata", + "com.azure.developer.loadtesting.models.CertificateType": "Microsoft.LoadTestService.CertificateType", + "com.azure.developer.loadtesting.models.DimensionFilter": "Microsoft.LoadTestService.DimensionFilter", + "com.azure.developer.loadtesting.models.DimensionValue": "Microsoft.LoadTestService.DimensionValue", + "com.azure.developer.loadtesting.models.DimensionValueList": "Microsoft.LoadTestService.DimensionValueList", + "com.azure.developer.loadtesting.models.ErrorDetails": "Microsoft.LoadTestService.ErrorDetails", + "com.azure.developer.loadtesting.models.FileStatus": "Microsoft.LoadTestService.FileStatus", + "com.azure.developer.loadtesting.models.FileType": "Microsoft.LoadTestService.FileType", + "com.azure.developer.loadtesting.models.FunctionFlexConsumptionResourceConfiguration": "Microsoft.LoadTestService.FunctionFlexConsumptionResourceConfiguration", + "com.azure.developer.loadtesting.models.FunctionFlexConsumptionTargetResourceConfigurations": "Microsoft.LoadTestService.FunctionFlexConsumptionTargetResourceConfigurations", + "com.azure.developer.loadtesting.models.LoadTestConfiguration": "Microsoft.LoadTestService.LoadTestConfiguration", + "com.azure.developer.loadtesting.models.MetricAvailability": "Microsoft.LoadTestService.MetricAvailability", + "com.azure.developer.loadtesting.models.MetricDefinition": "Microsoft.LoadTestService.MetricDefinition", + "com.azure.developer.loadtesting.models.MetricDefinitionCollection": "Microsoft.LoadTestService.MetricDefinitionCollection", + "com.azure.developer.loadtesting.models.MetricNamespace": "Microsoft.LoadTestService.MetricNamespace", + "com.azure.developer.loadtesting.models.MetricNamespaceCollection": "Microsoft.LoadTestService.MetricNamespaceCollection", + "com.azure.developer.loadtesting.models.MetricRequestPayload": "Microsoft.LoadTestService.MetricRequestPayload", + "com.azure.developer.loadtesting.models.MetricUnit": "Microsoft.LoadTestService.MetricUnit", + "com.azure.developer.loadtesting.models.MetricValue": "Microsoft.LoadTestService.MetricValue", + "com.azure.developer.loadtesting.models.NameAndDesc": "Microsoft.LoadTestService.NameAndDesc", + "com.azure.developer.loadtesting.models.OptionalLoadTestConfig": "Microsoft.LoadTestService.OptionalLoadTestConfig", + "com.azure.developer.loadtesting.models.PFAction": "Microsoft.LoadTestService.PFAction", + "com.azure.developer.loadtesting.models.PFAgFunc": "Microsoft.LoadTestService.PFAgFunc", + "com.azure.developer.loadtesting.models.PFMetrics": "Microsoft.LoadTestService.PFMetrics", + "com.azure.developer.loadtesting.models.PFResult": "Microsoft.LoadTestService.PFResult", + "com.azure.developer.loadtesting.models.PFTestResult": "Microsoft.LoadTestService.PFTestResult", + "com.azure.developer.loadtesting.models.PassFailCriteria": "Microsoft.LoadTestService.PassFailCriteria", + "com.azure.developer.loadtesting.models.PassFailMetric": "Microsoft.LoadTestService.PassFailMetric", + "com.azure.developer.loadtesting.models.RecommendationCategory": "Microsoft.LoadTestService.RecommendationCategory", + "com.azure.developer.loadtesting.models.RegionalConfiguration": "Microsoft.LoadTestService.RegionalConfiguration", + "com.azure.developer.loadtesting.models.RequestDataLevel": "Microsoft.LoadTestService.RequestDataLevel", + "com.azure.developer.loadtesting.models.ResourceKind": "Microsoft.LoadTestService.ResourceKind", + "com.azure.developer.loadtesting.models.ResourceMetric": "Microsoft.LoadTestService.ResourceMetric", + "com.azure.developer.loadtesting.models.Secret": "Microsoft.LoadTestService.Secret", + "com.azure.developer.loadtesting.models.SecretType": "Microsoft.LoadTestService.SecretType", + "com.azure.developer.loadtesting.models.Status": "Microsoft.LoadTestService.Status", + "com.azure.developer.loadtesting.models.TargetResourceConfigurations": "Microsoft.LoadTestService.TargetResourceConfigurations", + "com.azure.developer.loadtesting.models.Test": "Microsoft.LoadTestService.Test", + "com.azure.developer.loadtesting.models.TestAppComponents": "Microsoft.LoadTestService.TestAppComponents", + "com.azure.developer.loadtesting.models.TestFileInfo": "Microsoft.LoadTestService.TestFileInfo", + "com.azure.developer.loadtesting.models.TestInputArtifacts": "Microsoft.LoadTestService.TestInputArtifacts", + "com.azure.developer.loadtesting.models.TestKind": "Microsoft.LoadTestService.TestKind", + "com.azure.developer.loadtesting.models.TestProfile": "Microsoft.LoadTestService.TestProfile", + "com.azure.developer.loadtesting.models.TestProfileRun": "Microsoft.LoadTestService.TestProfileRun", + "com.azure.developer.loadtesting.models.TestProfileRunRecommendation": "Microsoft.LoadTestService.TestProfileRunRecommendation", + "com.azure.developer.loadtesting.models.TestProfileRunStatus": "Microsoft.LoadTestService.TestProfileRunStatus", + "com.azure.developer.loadtesting.models.TestRun": "Microsoft.LoadTestService.TestRun", + "com.azure.developer.loadtesting.models.TestRunAppComponents": "Microsoft.LoadTestService.TestRunAppComponents", + "com.azure.developer.loadtesting.models.TestRunArtifacts": "Microsoft.LoadTestService.TestRunArtifacts", + "com.azure.developer.loadtesting.models.TestRunDetail": "Microsoft.LoadTestService.TestRunDetail", + "com.azure.developer.loadtesting.models.TestRunFileInfo": "Microsoft.LoadTestService.TestRunFileInfo", + "com.azure.developer.loadtesting.models.TestRunInputArtifacts": "Microsoft.LoadTestService.TestRunInputArtifacts", + "com.azure.developer.loadtesting.models.TestRunOutputArtifacts": "Microsoft.LoadTestService.TestRunOutputArtifacts", + "com.azure.developer.loadtesting.models.TestRunServerMetricConfig": "Microsoft.LoadTestService.TestRunServerMetricConfig", + "com.azure.developer.loadtesting.models.TestRunStatistics": "Microsoft.LoadTestService.TestRunStatistics", + "com.azure.developer.loadtesting.models.TestServerMetricConfig": "Microsoft.LoadTestService.TestServerMetricConfig", + "com.azure.developer.loadtesting.models.TimeGrain": "Microsoft.LoadTestService.TimeGrain", + "com.azure.developer.loadtesting.models.TimeSeriesElement": "Microsoft.LoadTestService.TimeSeriesElement" + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/README.md b/sdk/loadtesting/azure-developer-loadtesting/src/samples/README.md deleted file mode 100644 index 2c0b655fa8c41..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/samples/README.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -page_type: sample -languages: - - java -products: - - azure - - azure-load-testing -urlFragment: developer-loadtesting-samples ---- - -# Azure Developer Loadtesting Samples client library for Java - -This document explains samples and how to use them. - -## Examples - - Following section document various examples. - -### Hello World Samples - -* [HelloWorld.java][sample_helloWorld] - Contains samples for following scenarios: - * Authenticate client - * Create Load Test - * Upload Test File - * Create and start Test Run, and get metrics - -### List Operations Samples - -* [ListOperations.java][sample_list] and [ListOperationsAsync.java][sample_listAsync] - Contains samples for following scenarios: - * List Load Tests - * List Test Runs - * List Load Test files - -### Long Running Operations Samples - -* [LongRunningOperations.java][sample_longRunning] and [LongRunningOperationsAsync.java][sample_longRunningAsync] - Contains samples for following scenarios: - * Upload and validate Load Test file - * Start and monitor Test Run - -## Troubleshooting - -### General - -Load Testing clients raise exceptions. For example, if you try to get a load test or test run resource after it is deleted a `404` error is returned, indicating resource not found. In the following snippet, the error is handled gracefully by catching the exception and displaying additional information about the error. - -```java -try { - testRunClient.getTestRunWithResponse("FAKE_TEST_RUN_ID", null); -} catch (ResourceNotFoundException e) { - System.out.println(e.getMessage()); -} -``` - - -[sample_helloWorld]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/HelloWorld.java -[sample_list]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ListOperations.java -[sample_listAsync]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ListOperationsAsync.java -[sample_longRunning]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/LongRunningOperations.java -[sample_longRunningAsync]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/LongRunningOperationsAsync.java diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/HelloWorld.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/HelloWorld.java deleted file mode 100644 index f5b8484ac39c7..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/HelloWorld.java +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.developer.loadtesting; - -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.SyncPoller; -import com.azure.identity.DefaultAzureCredentialBuilder; -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; - -import java.io.File; -import java.io.IOException; -import java.time.Duration; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Sample demonstrates how to create and successfully run a test. - */ -@SuppressWarnings("unchecked") -public final class HelloWorld { - /** - * Authenticates with the load testing resource and shows how to list tests, test files and test runs for a given - * resource. - * - * @param args Unused. Arguments to the program. - * - * @throws ClientAuthenticationException - when the credentials have insufficient permissions for load test - * resource. - * @throws ResourceNotFoundException - when test with `testId` does not exist when listing files. - */ - public static void main(String[] args) { - // Initialize the clients - LoadTestAdministrationClient adminClient = new LoadTestAdministrationClientBuilder() - .credential(new DefaultAzureCredentialBuilder().build()) - .endpoint("") - .buildClient(); - LoadTestRunClient testRunClient = new LoadTestRunClientBuilder() - .credential(new DefaultAzureCredentialBuilder().build()) - .endpoint("") - .buildClient(); - - // Constants and parameters - final String testId = "6758667a-a57c-47e5-9cef-9b1f1432daca"; - final String testRunId = "f758667a-c5ac-269a-dce1-5c1f14f2d142"; - final String testFileName = "test-script.jmx"; - final String testFilePath = "C:/path/to/file/sample-script.jmx"; - - /* - * BEGIN: Create test - */ - // 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("loadTestConfiguration", 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 = adminClient.createOrUpdateTestWithResponse(testId, test, null); - - System.out.println(testOutResponse.getValue().toString()); - /* - * END: Create test - */ - - /* - * BEGIN: Upload test file - */ - // extract file contents to BinaryData - BinaryData fileData = BinaryData.fromFile(new File(testFilePath).toPath()); - - // receive response with BinaryData content - // NOTE: file name should be passed as input argument `testFileName`. File name in local path is ignored - PollResponse fileUrlOut = adminClient.beginUploadTestFile(testId, testFileName, fileData, null) - .waitForCompletion(Duration.ofMinutes(2)); - - System.out.println(fileUrlOut.getValue().toString()); - /* - * END: Upload test file - */ - - /* - * BEGIN: Start test run - */ - // construct Test Run object using nested String:Object Maps - Map testRunMap = new HashMap<>(); - testRunMap.put("testId", testId); - testRunMap.put("displayName", "SDK-Created-TestRun"); - - // convert the object Map to JSON BinaryData - BinaryData testRun = BinaryData.fromObject(testRunMap); - - // receive response with BinaryData content - SyncPoller testRunPoller = testRunClient.beginTestRun(testRunId, testRun, null); - - System.out.println(testRunPoller.poll().getValue().toString()); - /* - * END: Start test run - */ - - /* - * BEGIN: Stop test run - */ - try { - Thread.sleep(10 * 1000); - } catch (InterruptedException e) { - // handle interruption - } - - Response stoppedTestRunOut = testRunClient.stopTestRunWithResponse(testRunId, null); - - System.out.println(stoppedTestRunOut.getValue().toString()); - /* - * END: Stop test run - */ - - /* - * BEGIN: List metrics - */ - // wait for test to reach terminal state - PollResponse testRunOut = testRunPoller.poll(); - String testStatus = null, startDateTime = null, endDateTime = null; - - while (!testRunOut.getStatus().isComplete()) { - testRunOut = testRunPoller.poll(); - - // parse JSON and read status value - try (JsonReader jsonReader = JsonProviders.createReader(testRunOut.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - testStatus = jsonTree.get("status").toString(); - System.out.println("Status of test run: " + testStatus); - } catch (IOException e) { - e.printStackTrace(); - // handle error condition - } - - // wait and check test status every 5 seconds - try { - Thread.sleep(5 * 1000); - } catch (InterruptedException e) { - // handle interruption - } - } - - try (JsonReader jsonReader = JsonProviders.createReader(testRunPoller.getFinalResult().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - startDateTime = jsonTree.get("startDateTime").toString(); - endDateTime = jsonTree.get("endDateTime").toString(); - System.out.println("Status of test run: " + testStatus); - } catch (IOException e) { - e.printStackTrace(); - // handle error condition - } - - // get list of all metric namespaces and pick the first one - Response metricNamespacesOut = testRunClient.getMetricNamespacesWithResponse(testRunId, null); - String metricNamespace = null; - - // parse JSON and read first value - try (JsonReader jsonReader = JsonProviders.createReader(metricNamespacesOut.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - List> metricNamespaces = (List>) jsonTree.get("value"); - metricNamespace = metricNamespaces.get(0).get("metricNamespaceName").toString(); - } catch (IOException e) { - e.printStackTrace(); - // handle error condition - } - - // get list of all metric definitions and pick the first one - Response metricDefinitionsOut = testRunClient.getMetricDefinitionsWithResponse(testRunId, metricNamespace, null); - String metricName = null; - - // parse JSON and read first value - try (JsonReader jsonReader = JsonProviders.createReader(metricDefinitionsOut.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - List metricDefinitions = (List) jsonTree.get("value"); - Map firstMetricDefinition = (Map) metricDefinitions.get(0); - Map name = (Map) firstMetricDefinition.get("name"); - metricName = name.get("value").toString(); - } catch (IOException e) { - e.printStackTrace(); - // handle error condition - } - - // fetch client metrics using metric namespace and metric name - PagedIterable clientMetricsOut = testRunClient.listMetrics(testRunId, metricName, metricNamespace, startDateTime + '/' + endDateTime, null); - - clientMetricsOut.forEach((clientMetric) -> { - System.out.println(clientMetric.toString()); - }); - /* - * END: List metrics - */ - } -} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ListOperations.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ListOperations.java deleted file mode 100644 index 8a32237de35b6..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ListOperations.java +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.developer.loadtesting; - -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.azure.identity.DefaultAzureCredentialBuilder; -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; - -import java.io.IOException; -import java.util.Map; - -/** - * Sample demonstrates how to list tests, test files and test runs for a given resource. - */ -public final class ListOperations { - /** - * Authenticates with the load testing resource and shows how to list tests, test files and test runs - * for a given resource. - * - * @param args Unused. Arguments to the program. - * - * @throws ClientAuthenticationException - when the credentials have insufficient permissions for load test resource. - * @throws ResourceNotFoundException - when test with `testId` does not exist when listing files. - */ - public static void main(String[] args) { - listTests(); - listTestRuns(); - listTestFiles(); - } - - public static void listTests() { - // BEGIN: java-listOperations-sample-listTests - LoadTestAdministrationClient client = new LoadTestAdministrationClientBuilder() - .credential(new DefaultAzureCredentialBuilder().build()) - .endpoint("") - .buildClient(); - - RequestOptions reqOpts = new RequestOptions() - .addQueryParam("orderBy", "lastModifiedDateTime") - .addQueryParam("maxPageSize", "10"); - - PagedIterable tests = client.listTests(reqOpts); - - tests.forEach(testBinary -> { - try (JsonReader jsonReader = JsonProviders.createReader(testBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - String testId = jsonTree.get("testId").toString(); - String displayName = (jsonTree.get("displayName") != null) - ? jsonTree.get("displayName").toString() - : ""; - System.out.println(String.format("%s\t%s", testId, displayName)); - } catch (IOException e) { - e.printStackTrace(); - } - }); - // END: java-listOperations-sample-listTests - } - - public static void listTestRuns() { - // BEGIN: java-listOperations-sample-listTestRuns - LoadTestRunClient client = new LoadTestRunClientBuilder() - .credential(new DefaultAzureCredentialBuilder().build()) - .endpoint("") - .buildClient(); - - RequestOptions reqOpts = new RequestOptions() - .addQueryParam("search", "scenario1") - .addQueryParam("orderBy", "lastModifiedDateTime") - .addQueryParam("status", "EXECUTING,DONE") - .addQueryParam("maxPageSize", "10"); - - PagedIterable testRuns = client.listTestRuns(reqOpts); - - testRuns.forEach(testRunBinary -> { - try (JsonReader jsonReader = JsonProviders.createReader(testRunBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - String testRunId = jsonTree.get("testRunId").toString(); - String testId = jsonTree.get("testId").toString(); - String displayName = (jsonTree.get("displayName") != null) - ? jsonTree.get("displayName").toString() - : ""; - System.out.println(String.format("%s\t%s\t%s", testRunId, testId, displayName)); - } catch (IOException e) { - e.printStackTrace(); - } - }); - // END: java-listOperations-sample-listTestRuns - } - - public static void listTestFiles() { - // BEGIN: java-listOperations-sample-listTestFiles - LoadTestAdministrationClient client = new LoadTestAdministrationClientBuilder() - .credential(new DefaultAzureCredentialBuilder().build()) - .endpoint("") - .buildClient(); - - String inputTestId = "12345678-1234-1234-1234-123456789abc"; - PagedIterable files = client.listTestFiles(inputTestId, null); - - files.forEach(fileBinary -> { - try (JsonReader jsonReader = JsonProviders.createReader(fileBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - String blobUrl = jsonTree.get("url").toString(); - String fileName = jsonTree.get("fileName").toString(); - String fileType = jsonTree.get("fileType").toString(); - System.out.println(String.format("%s\t%s\t%s", fileName, fileType, blobUrl)); - } catch (IOException e) { - e.printStackTrace(); - } - }); - // END: java-listOperations-sample-listTestFiles - } -} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ListOperationsAsync.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ListOperationsAsync.java deleted file mode 100644 index 604f2013cb309..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ListOperationsAsync.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.developer.loadtesting; - -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.azure.identity.DefaultAzureCredentialBuilder; -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; - -import java.io.IOException; -import java.util.Map; - -/** - * Sample demonstrates how to list tests, test files and test runs for a given resource. - */ -public final class ListOperationsAsync { - /** - * Authenticates with the load testing resource and shows how to list tests, test files and test runs - * for a given resource. - * - * @param args Unused. Arguments to the program. - * - * @throws ClientAuthenticationException - when the credentials have insufficient permissions for load test resource. - * @throws ResourceNotFoundException - when test with `testId` does not exist when listing files. - */ - public static void main(String[] args) { - listTests(); - listTestRuns(); - listTestFiles(); - } - - public static void listTests() { - // BEGIN: java-listOperationsAsync-sample-listTests - LoadTestAdministrationAsyncClient client = new LoadTestAdministrationClientBuilder() - .credential(new DefaultAzureCredentialBuilder().build()) - .endpoint("") - .buildAsyncClient(); - - RequestOptions reqOpts = new RequestOptions() - .addQueryParam("orderBy", "lastModifiedDateTime") - .addQueryParam("maxPageSize", "10"); - - PagedFlux tests = client.listTests(reqOpts); - - tests.subscribe(testBinary -> { - try (JsonReader jsonReader = JsonProviders.createReader(testBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - String testId = jsonTree.get("testId").toString(); - String displayName = (jsonTree.get("displayName") != null) - ? jsonTree.get("displayName").toString() - : ""; - System.out.println(String.format("%s\t%s", testId, displayName)); - } catch (IOException e) { - e.printStackTrace(); - } - }); - // END: java-listOperationsAsync-sample-listTests - } - - public static void listTestRuns() { - // BEGIN: java-listOperationsAsync-sample-listTestRuns - LoadTestRunAsyncClient client = new LoadTestRunClientBuilder() - .credential(new DefaultAzureCredentialBuilder().build()) - .endpoint("") - .buildAsyncClient(); - - RequestOptions reqOpts = new RequestOptions() - .addQueryParam("search", "scenario1") - .addQueryParam("orderBy", "lastModifiedDateTime") - .addQueryParam("status", "EXECUTING,DONE") - .addQueryParam("maxPageSize", "10"); - - PagedFlux testRuns = client.listTestRuns(reqOpts); - - testRuns.subscribe(testRunBinary -> { - try (JsonReader jsonReader = JsonProviders.createReader(testRunBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - String testRunId = jsonTree.get("testRunId").toString(); - String testId = jsonTree.get("testId").toString(); - String displayName = (jsonTree.get("displayName") != null) - ? jsonTree.get("displayName").toString() - : ""; - System.out.println(String.format("%s\t%s\t%s", testRunId, testId, displayName)); - } catch (IOException e) { - e.printStackTrace(); - } - }); - // END: java-listOperationsAsync-sample-listTestRuns - } - - public static void listTestFiles() { - // BEGIN: java-listOperationsAsync-sample-listTestFiles - LoadTestAdministrationAsyncClient client = new LoadTestAdministrationClientBuilder() - .credential(new DefaultAzureCredentialBuilder().build()) - .endpoint("") - .buildAsyncClient(); - - String inputTestId = "12345678-1234-1234-1234-123456789abc"; - - PagedFlux files = client.listTestFiles(inputTestId, null); - - files.subscribe(fileBinary -> { - try (JsonReader jsonReader = JsonProviders.createReader(fileBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - String blobUrl = jsonTree.get("url").toString(); - String fileName = jsonTree.get("fileName").toString(); - String fileType = jsonTree.get("fileType").toString(); - System.out.println(String.format("%s\t%s\t%s", fileName, fileType, blobUrl)); - } catch (IOException e) { - e.printStackTrace(); - } - }); - // END: java-listOperationsAsync-sample-listTestFiles - } -} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/LongRunningOperations.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/LongRunningOperations.java deleted file mode 100644 index bd5c0ba29cde2..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/LongRunningOperations.java +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.developer.loadtesting; - -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.SyncPoller; -import com.azure.identity.DefaultAzureCredentialBuilder; -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; - -import java.io.File; -import java.io.IOException; -import java.time.Duration; -import java.util.HashMap; -import java.util.Map; - -/** - * Sample demonstrates how to upload and validate a test file, and running a test run. - * - * Authenticates with the load testing resource and shows how to upload and validate a test file, and running a test run - * in a given resource. - * - * @throws ClientAuthenticationException - when the credentials have insufficient permissions for load test resource. - * @throws ResourceNotFoundException - when test with `testId` does not exist when uploading file. - */ -public final class LongRunningOperations { - public void beginUploadTestFile() { - // BEGIN: java-longRunningOperations-sample-beginUploadTestFile - LoadTestAdministrationClient client = new LoadTestAdministrationClientBuilder() - .credential(new DefaultAzureCredentialBuilder().build()) - .endpoint("") - .buildClient(); - - String inputTestId = "12345678-1234-1234-1234-123456789abc"; - String inputFileName = "input-test-file.jmx"; - BinaryData fileData = BinaryData.fromFile(new File("C:/fakepath/input-file.jmx").toPath()); - /* Note: file name passed as input argument is used, over the name in local file path */ - - Duration pollInterval = Duration.ofSeconds(1); - - RequestOptions reqOpts = new RequestOptions() - .addQueryParam("fileType", "JMX_FILE"); - - SyncPoller poller = client.beginUploadTestFile(inputTestId, inputFileName, fileData, reqOpts); - poller = poller.setPollInterval(pollInterval); - - PollResponse pollResponse = poller.poll(); - - while (pollResponse.getStatus() == LongRunningOperationStatus.IN_PROGRESS - || pollResponse.getStatus() == LongRunningOperationStatus.NOT_STARTED) { - - try (JsonReader jsonReader = JsonProviders.createReader(pollResponse.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - String validationStatus = jsonTree.get("validationStatus").toString(); - System.out.println("Validation Status: " + validationStatus); - } catch (IOException e) { - e.printStackTrace(); - } - - try { - Thread.sleep(pollInterval.toMillis()); - } catch (InterruptedException e) { - // handle interruption - } - - pollResponse = poller.poll(); - } - - poller.waitForCompletion(); - - BinaryData fileBinary = poller.getFinalResult(); - - try (JsonReader jsonReader = JsonProviders.createReader(fileBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - String url = jsonTree.get("url").toString(); - String fileName = jsonTree.get("fileName").toString(); - String fileType = jsonTree.get("fileType").toString(); - String validationStatus = jsonTree.get("validationStatus").toString(); - System.out.println(String.format("%s\t%s\t%s\t%s", fileName, fileType, url, validationStatus)); - } catch (IOException e) { - e.printStackTrace(); - } - // END: java-longRunningOperations-sample-beginUploadTestFile - } - - public void beginTestRun() { - // BEGIN: java-longRunningOperations-sample-beginTestRun - LoadTestRunClient client = new LoadTestRunClientBuilder() - .credential(new DefaultAzureCredentialBuilder().build()) - .endpoint("") - .buildClient(); - - String inputTestRunId = "12345678-1234-1234-1234-123456789abc"; - String inputTestId = "87654321-1234-1234-1234-123456789abc"; - - Map testRunMap = new HashMap<>(); - testRunMap.put("testId", inputTestId); - testRunMap.put("displayName", "Sample Test Run"); - testRunMap.put("description", "Java SDK Sample Test Run"); - - Duration pollInterval = Duration.ofSeconds(5); - - BinaryData inputTestRunBinary = BinaryData.fromObject(testRunMap); - - SyncPoller poller = client.beginTestRun(inputTestRunId, inputTestRunBinary, null); - poller = poller.setPollInterval(pollInterval); - - PollResponse pollResponse = poller.poll(); - - while (pollResponse.getStatus() == LongRunningOperationStatus.IN_PROGRESS - || pollResponse.getStatus() == LongRunningOperationStatus.NOT_STARTED) { - - BinaryData testRunBinary = pollResponse.getValue(); - - System.out.println("Test Run all info: " + testRunBinary.toString()); - - try { - Thread.sleep(pollInterval.toMillis()); - } catch (InterruptedException e) { - // handle interruption - } - - pollResponse = poller.poll(); - } - - poller.waitForCompletion(); - BinaryData testRunBinary = poller.getFinalResult(); - - try (JsonReader jsonReader = JsonProviders.createReader(testRunBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - String testId = jsonTree.get("testId").toString(); - String testRunId = jsonTree.get("testRunId").toString(); - String status = jsonTree.get("status").toString(); - System.out.println(String.format("%s\t%s\t%s", testId, testRunId, status)); - } catch (IOException e) { - e.printStackTrace(); - } - // END: java-longRunningOperations-sample-beginTestRun - } -} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/LongRunningOperationsAsync.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/LongRunningOperationsAsync.java deleted file mode 100644 index f3b01b173a7d0..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/LongRunningOperationsAsync.java +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.developer.loadtesting; - -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.PollerFlux; -import com.azure.identity.DefaultAzureCredentialBuilder; -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; - -import java.io.File; -import java.io.IOException; -import java.time.Duration; -import java.util.HashMap; -import java.util.Map; - -/** - * Sample demonstrates how to upload and validat a test file, and running a test run. - * - * Authenticates with the load testing resource and shows how to upload and validat a test file, and running a test run - * in a given resource. - * - * @throws ClientAuthenticationException - when the credentials have insufficient permissions for load test resource. - * @throws ResourceNotFoundException - when test with `testId` does not exist when uploading file. - */ -public final class LongRunningOperationsAsync { - public void beginUploadTestFile() { - // BEGIN: java-longRunningOperationsAsync-sample-beginUploadTestFile - LoadTestAdministrationAsyncClient client = new LoadTestAdministrationClientBuilder() - .credential(new DefaultAzureCredentialBuilder().build()) - .endpoint("") - .buildAsyncClient(); - - String inputTestId = "12345678-1234-1234-1234-123456789abc"; - String inputFileName = "input-test-file.jmx"; - BinaryData fileData = BinaryData.fromFile(new File("C:/fakepath/input-file.jmx").toPath()); - /* Note: file name passed as input argument is used, over the name in local file path */ - - Duration pollInterval = Duration.ofSeconds(1); - - RequestOptions reqOpts = new RequestOptions() - .addQueryParam("fileType", "JMX_FILE"); - - PollerFlux poller = client.beginUploadTestFile(inputTestId, inputFileName, fileData, reqOpts); - poller = poller.setPollInterval(pollInterval); - - poller.subscribe(pollResponse -> { - try (JsonReader jsonReader = JsonProviders.createReader(pollResponse.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - String validationStatus = jsonTree.get("validationStatus").toString(); - System.out.println("Validation Status: " + validationStatus); - } catch (IOException e) { - e.printStackTrace(); - } - }); - - AsyncPollResponse pollResponse = poller.blockLast(); - BinaryData fileBinary = pollResponse.getFinalResult().block(); - - try (JsonReader jsonReader = JsonProviders.createReader(fileBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - String url = jsonTree.get("url").toString(); - String fileName = jsonTree.get("fileName").toString(); - String fileType = jsonTree.get("fileType").toString(); - String validationStatus = jsonTree.get("validationStatus").toString(); - System.out.println(String.format("%s\t%s\t%s\t%s", fileName, fileType, url, validationStatus)); - } catch (IOException e) { - e.printStackTrace(); - } - // END: java-longRunningOperationsAsync-sample-beginUploadTestFile - } - - public void beginTestRun() { - // BEGIN: java-longRunningOperationsAsync-sample-beginTestRun - LoadTestRunAsyncClient client = new LoadTestRunClientBuilder() - .credential(new DefaultAzureCredentialBuilder().build()) - .endpoint("") - .buildAsyncClient(); - - String inputTestRunId = "12345678-1234-1234-1234-123456789abc"; - String inputTestId = "87654321-1234-1234-1234-123456789abc"; - - Map testRunMap = new HashMap(); - testRunMap.put("testId", inputTestId); - testRunMap.put("displayName", "Sample Test Run"); - testRunMap.put("description", "Java SDK Sample Test Run"); - - Duration pollInterval = Duration.ofSeconds(5); - - BinaryData inputTestRunBinary = BinaryData.fromObject(testRunMap); - - PollerFlux poller = client.beginTestRun(inputTestRunId, inputTestRunBinary, null); - poller = poller.setPollInterval(pollInterval); - - poller.subscribe(pollResponse -> { - BinaryData testRunBinary = pollResponse.getValue(); - System.out.println("Test Run all info: " + testRunBinary.toString()); - }); - - AsyncPollResponse pollResponse = poller.blockLast(); - BinaryData testRunBinary = pollResponse.getFinalResult().block(); - - try (JsonReader jsonReader = JsonProviders.createReader(testRunBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - String testId = jsonTree.get("testId").toString(); - String testRunId = jsonTree.get("testRunId").toString(); - String status = jsonTree.get("status").toString(); - System.out.println(String.format("%s\t%s\t%s", testId, testRunId, status)); - } catch (IOException e) { - e.printStackTrace(); - } - // END: java-longRunningOperationsAsync-sample-beginTestRun - } -} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ReadmeSamples.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ReadmeSamples.java index 9eb37551d645f..41f33cd07e61e 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ReadmeSamples.java +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/ReadmeSamples.java @@ -1,226 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.developer.loadtesting; -import com.azure.core.credential.TokenCredential; -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 com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.SyncPoller; -import com.azure.identity.DefaultAzureCredentialBuilder; -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; - -import java.io.File; -import java.io.IOException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@SuppressWarnings("unchecked") 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 - LoadTestAdministrationClient adminClient = new LoadTestAdministrationClientBuilder() - .credential(credential) - .endpoint("") - .buildClient(); - LoadTestRunClient testRunClient = new LoadTestRunClientBuilder() - .credential(credential) - .endpoint("") - .buildClient(); - - RequestOptions reqOpts = new RequestOptions() - .addQueryParam("orderBy", "lastModifiedDateTime") - .addQueryParam("maxPageSize", "10"); - adminClient.listTests(reqOpts); - - reqOpts = new RequestOptions() - .addQueryParam("orderBy", "lastModifiedDateTime") - .addQueryParam("status", "EXECUTING,DONE") - .addQueryParam("maxPageSize", "10"); - testRunClient.listTestRuns(reqOpts); - // END: java-readme-sample-auth - } - - public void createTest() { - // BEGIN: java-readme-sample-createTest - LoadTestAdministrationClient adminClient = new LoadTestAdministrationClientBuilder() - .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("loadTestConfiguration", 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 = adminClient.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 - LoadTestAdministrationClient adminClient = new LoadTestAdministrationClientBuilder() - .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 - PollResponse fileUrlOut = adminClient.beginUploadTestFile("test12345", "sample-file.jmx", fileData, null) - .waitForCompletion(Duration.ofMinutes(2)); - System.out.println(fileUrlOut.getValue().toString()); - // END: java-readme-sample-uploadTestFile - } - - public void runTest() { - // BEGIN: java-readme-sample-runTest - LoadTestRunClient testRunClient = new LoadTestRunClientBuilder() - .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); - - // start test with poller - SyncPoller poller = testRunClient.beginTestRun("testrun12345", testRun, null); - Duration pollInterval = Duration.ofSeconds(5); - poller = poller.setPollInterval(pollInterval); - - // wait for test to reach terminal state - Map jsonTree = null; - String testStatus; - PollResponse pollResponse = poller.poll(); - while (pollResponse.getStatus() == LongRunningOperationStatus.IN_PROGRESS - || pollResponse.getStatus() == LongRunningOperationStatus.NOT_STARTED) { - - try (JsonReader jsonReader = JsonProviders.createReader(pollResponse.getValue().toBytes())) { - jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - testStatus = jsonTree.get("status").toString(); - System.out.println("Test run status: " + testStatus); - } catch (IOException e) { - System.out.println("Error processing JSON response"); - // handle error condition - } - - // wait and check test status every 5 seconds - try { - Thread.sleep(pollInterval.toMillis()); - } catch (InterruptedException e) { - // handle interruption - } - - pollResponse = poller.poll(); - } - - poller.waitForCompletion(); - BinaryData testRunBinary = poller.getFinalResult(); - - try (JsonReader jsonReader = JsonProviders.createReader(testRunBinary.toBytes())) { - jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - testStatus = jsonTree.get("status").toString(); - System.out.println("Test run status: " + testStatus); - } catch (IOException e) { - System.out.println("Error processing JSON response"); - // handle error condition - } - - String startDateTime = jsonTree.get("startDateTime").toString(); - String endDateTime = jsonTree.get("endDateTime").toString(); - OffsetDateTime startOffsetDateTime = OffsetDateTime.parse(startDateTime); - OffsetDateTime endOffsetDateTime = OffsetDateTime.parse(endDateTime); - - // get list of all metric namespaces and pick the first one - Response metricNamespacesOut = testRunClient.getMetricNamespacesWithResponse("testrun12345", null); - String metricNamespace = null; - // parse JSON and read first value - try (JsonReader jsonReader = JsonProviders.createReader(metricNamespacesOut.getValue().toBytes())) { - jsonTree = jsonReader.readMap(JsonReader::readUntyped); - List metricNamespaces = (List) jsonTree.get("value"); - Map namespaceMap = (Map) metricNamespaces.get(0); - metricNamespace = namespaceMap.get("name").toString(); - } catch (IOException e) { - System.out.println("Error processing JSON response"); - // handle error condition - } - - // get list of all metric definitions and pick the first one - Response metricDefinitionsOut = testRunClient.getMetricDefinitionsWithResponse("testrun12345", metricNamespace, null); - String metricName = null; - // parse JSON and read first value - try (JsonReader jsonReader = JsonProviders.createReader(metricDefinitionsOut.getValue().toBytes())) { - jsonTree = jsonReader.readMap(JsonReader::readUntyped); - List metricDefinitions = (List) jsonTree.get("value"); - Map definitionMap = (Map) metricDefinitions.get(0); - Map nameMap = (Map) definitionMap.get("name"); - metricName = nameMap.get("value").toString(); - } catch (IOException e) { - System.out.println("Error processing JSON response"); - // handle error condition - } - - // fetch client metrics using metric namespace and metric name - PagedIterable clientMetricsOut = testRunClient.listMetrics("testrun12345", metricName, metricNamespace, startDateTime + '/' + endDateTime, null); - clientMetricsOut.forEach((clientMetric) -> { - System.out.println(clientMetric.toString()); - }); - // END: java-readme-sample-runTest + public void readmeSamples() { + // BEGIN: com.azure.developer.loadtesting.readme + // END: com.azure.developer.loadtesting.readme } } diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/AddOrUpdateAppComponentsToALoadTest.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/AddOrUpdateAppComponentsToALoadTest.java new file mode 100644 index 0000000000000..3c239eb7c3964 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/AddOrUpdateAppComponentsToALoadTest.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestAdministrationClient; +import com.azure.developer.loadtesting.LoadTestAdministrationClientBuilder; +import com.azure.developer.loadtesting.models.AppComponent; +import com.azure.developer.loadtesting.models.TestAppComponents; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.util.HashMap; +import java.util.Map; + +public class AddOrUpdateAppComponentsToALoadTest { + public static void main(String[] args) { + LoadTestAdministrationClient loadTestAdministrationClient + = new LoadTestAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.createorupdateappcomponents.addorupdateappcomponentstoaloadtest + TestAppComponents response = loadTestAdministrationClient.createOrUpdateAppComponents( + "ee843bd9-a6d4-4364-a45c-427a03c39fa7", + new TestAppComponents().setComponents(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + new AppComponent().setResourceName("appcomponentresource") + .setResourceType("microsoft.insights/components") + .setDisplayName("Performance_LoadTest_Insights") + .setKind("web")))); + // END:com.azure.developer.loadtesting.generated.createorupdateappcomponents.addorupdateappcomponentstoaloadtest + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/AddOrUpdateAppComponentsToALoadTestRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/AddOrUpdateAppComponentsToALoadTestRun.java new file mode 100644 index 0000000000000..9f616eec63707 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/AddOrUpdateAppComponentsToALoadTestRun.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestRunClient; +import com.azure.developer.loadtesting.LoadTestRunClientBuilder; +import com.azure.developer.loadtesting.models.AppComponent; +import com.azure.developer.loadtesting.models.TestRunAppComponents; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.util.HashMap; +import java.util.Map; + +public class AddOrUpdateAppComponentsToALoadTestRun { + public static void main(String[] args) { + LoadTestRunClient loadTestRunClient + = new LoadTestRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.createorupdateappcomponents.addorupdateappcomponentstoaloadtestrun + TestRunAppComponents response = loadTestRunClient.createOrUpdateAppComponents( + "ee843bd9-a6d4-4364-a45c-427a03c39fa7", + new TestRunAppComponents().setComponents(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + new AppComponent().setResourceName("appcomponentresource") + .setResourceType("microsoft.insights/components") + .setDisplayName("Performance_LoadTest_Insights") + .setKind("web")))); + // END:com.azure.developer.loadtesting.generated.createorupdateappcomponents.addorupdateappcomponentstoaloadtestrun + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/AddOrUpdateServerMetricsConfigurationForALoadTest.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/AddOrUpdateServerMetricsConfigurationForALoadTest.java new file mode 100644 index 0000000000000..d7c92a5b4940e --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/AddOrUpdateServerMetricsConfigurationForALoadTest.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestAdministrationClient; +import com.azure.developer.loadtesting.LoadTestAdministrationClientBuilder; +import com.azure.developer.loadtesting.models.ResourceMetric; +import com.azure.developer.loadtesting.models.TestServerMetricConfig; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.util.HashMap; +import java.util.Map; + +public class AddOrUpdateServerMetricsConfigurationForALoadTest { + public static void main(String[] args) { + LoadTestAdministrationClient loadTestAdministrationClient + = new LoadTestAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.createorupdateservermetricsconfig.addorupdateservermetricsconfigurationforaloadtest + TestServerMetricConfig response = loadTestAdministrationClient.createOrUpdateServerMetricsConfig( + "edc6e529-d009-4b99-b763-ca492e3a2823", + new TestServerMetricConfig().setMetrics(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration", + new ResourceMetric().setResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource") + .setMetricNamespace("microsoft.insights/components") + .setDisplayDescription("sample description") + .setName("requests/duration") + .setAggregation("Average") + .setResourceType("microsoft.insights/components")))); + // END:com.azure.developer.loadtesting.generated.createorupdateservermetricsconfig.addorupdateservermetricsconfigurationforaloadtest + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/AddOrUpdateServerMetricsConfigurationForALoadTestRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/AddOrUpdateServerMetricsConfigurationForALoadTestRun.java new file mode 100644 index 0000000000000..0036d1218019e --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/AddOrUpdateServerMetricsConfigurationForALoadTestRun.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestRunClient; +import com.azure.developer.loadtesting.LoadTestRunClientBuilder; +import com.azure.developer.loadtesting.models.ResourceMetric; +import com.azure.developer.loadtesting.models.TestRunServerMetricConfig; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.util.HashMap; +import java.util.Map; + +public class AddOrUpdateServerMetricsConfigurationForALoadTestRun { + public static void main(String[] args) { + LoadTestRunClient loadTestRunClient + = new LoadTestRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.createorupdateservermetricsconfig.addorupdateservermetricsconfigurationforaloadtestrun + TestRunServerMetricConfig response = loadTestRunClient.createOrUpdateServerMetricsConfig( + "edc6e529-d009-4b99-b763-ca492e3a2823", + new TestRunServerMetricConfig().setMetrics(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration", + new ResourceMetric().setResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource") + .setMetricNamespace("microsoft.insights/components") + .setDisplayDescription("sample description") + .setName("requests/duration") + .setAggregation("Average") + .setResourceType("microsoft.insights/components")))); + // END:com.azure.developer.loadtesting.generated.createorupdateservermetricsconfig.addorupdateservermetricsconfigurationforaloadtestrun + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/CreateOrUpdateALoadTest.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/CreateOrUpdateALoadTest.java new file mode 100644 index 0000000000000..eca37246676f0 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/CreateOrUpdateALoadTest.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestAdministrationClient; +import com.azure.developer.loadtesting.LoadTestAdministrationClientBuilder; +import com.azure.developer.loadtesting.models.AutoStopCriteria; +import com.azure.developer.loadtesting.models.LoadTestConfiguration; +import com.azure.developer.loadtesting.models.PassFailCriteria; +import com.azure.developer.loadtesting.models.PassFailMetric; +import com.azure.developer.loadtesting.models.PFAction; +import com.azure.developer.loadtesting.models.PFAgFunc; +import com.azure.developer.loadtesting.models.PFMetrics; +import com.azure.developer.loadtesting.models.Secret; +import com.azure.developer.loadtesting.models.SecretType; +import com.azure.developer.loadtesting.models.Test; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.util.HashMap; +import java.util.Map; + +public class CreateOrUpdateALoadTest { + public static void main(String[] args) { + LoadTestAdministrationClient loadTestAdministrationClient + = new LoadTestAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.createorupdatetest.createorupdatealoadtest + Test response + = loadTestAdministrationClient.createOrUpdateTest("12345678-1234-1234-1234-123456789012", + new Test() + .setPassFailCriteria( + new PassFailCriteria().setPassFailMetrics(mapOf("fefd759d-7fe8-4f83-8b6d-aeebe0f491fe", + new PassFailMetric().setClientMetric(PFMetrics.RESPONSE_TIME_MS) + .setAggregate(PFAgFunc.PERCENTAGE) + .setCondition(">") + .setValue(20.0D) + .setAction(PFAction.CONTINUE)))) + .setAutoStopCriteria(new AutoStopCriteria().setAutoStopDisabled(true) + .setErrorRate(70.0D) + .setErrorRateTimeWindowInSeconds(60)) + .setSecrets(mapOf("secret1", + new Secret().setValue( + "https://samplevault.vault.azure.net/secrets/samplesecret/f113f91fd4c44a368049849c164db827") + .setType(SecretType.AKV_SECRET_URI))) + .setEnvironmentVariables(mapOf("envvar1", "sampletext")) + .setLoadTestConfiguration(new LoadTestConfiguration().setEngineInstances(6).setSplitAllCSVs(true)) + .setDescription("sample description") + .setDisplayName("Performance_LoadTest") + .setSubnetId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Network/virtualNetworks/samplenetworkresource/subnets/AAAAA0A0A0") + .setKeyvaultReferenceIdentityType("fakeTokenPlaceholder") + .setKeyvaultReferenceIdentityId("fakeTokenPlaceholder")); + // END:com.azure.developer.loadtesting.generated.createorupdatetest.createorupdatealoadtest + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/CreateOrUpdateATestProfile.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/CreateOrUpdateATestProfile.java new file mode 100644 index 0000000000000..81dec7cd1f018 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/CreateOrUpdateATestProfile.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.TestProfileAdministrationClient; +import com.azure.developer.loadtesting.TestProfileAdministrationClientBuilder; +import com.azure.developer.loadtesting.models.FunctionFlexConsumptionResourceConfiguration; +import com.azure.developer.loadtesting.models.FunctionFlexConsumptionTargetResourceConfigurations; +import com.azure.developer.loadtesting.models.TestProfile; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.util.HashMap; +import java.util.Map; + +public class CreateOrUpdateATestProfile { + public static void main(String[] args) { + TestProfileAdministrationClient testProfileAdministrationClient + = new TestProfileAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.createorupdatetestprofile.createorupdateatestprofile + TestProfile response = testProfileAdministrationClient.createOrUpdateTestProfile( + "12345678-1234-1234-1234-123456789012", + new TestProfile().setDisplayName("Performance_TestProfile") + .setDescription("sample description") + .setTestId("12346-abcd-6789") + .setTargetResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Web/sites/myfunctionapp") + .setTargetResourceConfigurations( + new FunctionFlexConsumptionTargetResourceConfigurations().setConfigurations(mapOf("config1", + new FunctionFlexConsumptionResourceConfiguration().setInstanceMemoryMB(2048L) + .setHttpConcurrency(16L), + "config2", new FunctionFlexConsumptionResourceConfiguration().setInstanceMemoryMB(4096L) + .setHttpConcurrency(16L))))); + // END:com.azure.developer.loadtesting.generated.createorupdatetestprofile.createorupdateatestprofile + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/CreateUpdateAndStartALoadTestRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/CreateUpdateAndStartALoadTestRun.java new file mode 100644 index 0000000000000..590fa37cc1c46 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/CreateUpdateAndStartALoadTestRun.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestRunClient; +import com.azure.developer.loadtesting.LoadTestRunClientBuilder; +import com.azure.developer.loadtesting.models.AutoStopCriteria; +import com.azure.developer.loadtesting.models.LoadTestConfiguration; +import com.azure.developer.loadtesting.models.PassFailCriteria; +import com.azure.developer.loadtesting.models.PassFailMetric; +import com.azure.developer.loadtesting.models.PFAction; +import com.azure.developer.loadtesting.models.PFAgFunc; +import com.azure.developer.loadtesting.models.PFMetrics; +import com.azure.developer.loadtesting.models.RequestDataLevel; +import com.azure.developer.loadtesting.models.Secret; +import com.azure.developer.loadtesting.models.SecretType; +import com.azure.developer.loadtesting.models.TestRun; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.util.HashMap; +import java.util.Map; + +public class CreateUpdateAndStartALoadTestRun { + public static void main(String[] args) { + LoadTestRunClient loadTestRunClient + = new LoadTestRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.createorupdatetestrun.createupdateandstartaloadtestrun + TestRun response = loadTestRunClient.createOrUpdateTestRun("12316678-1234-1234-1234-122451189012", new TestRun() + .setPassFailCriteria(new PassFailCriteria().setPassFailMetrics(mapOf("fefd759d-7fe8-4f83-8b6d-aeebe0f491fe", + new PassFailMetric().setClientMetric(PFMetrics.RESPONSE_TIME_MS) + .setAggregate(PFAgFunc.PERCENTAGE) + .setCondition(">") + .setValue(20.0D) + .setAction(PFAction.CONTINUE)))) + .setAutoStopCriteria(new AutoStopCriteria().setAutoStopDisabled(true) + .setErrorRate(70.0D) + .setErrorRateTimeWindowInSeconds(60)) + .setSecrets(mapOf("secret1", + new Secret() + .setValue( + "https://samplevault.vault.azure.net/secrets/samplesecret/f113f91fd4c44a368049849c164db827") + .setType(SecretType.AKV_SECRET_URI))) + .setEnvironmentVariables(mapOf("envvar1", "sampletext")) + .setLoadTestConfiguration(new LoadTestConfiguration().setEngineInstances(6).setSplitAllCSVs(true)) + .setDisplayName("Performance_LoadTest_Run1") + .setTestId("12345678-1234-1234-1234-123456789012") + .setDescription("sample description") + .setRequestDataLevel(RequestDataLevel.NONE) + .setDebugLogsEnabled(true), "12345678-1234-1234-1234-123456789012"); + // END:com.azure.developer.loadtesting.generated.createorupdatetestrun.createupdateandstartaloadtestrun + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/CreateUpdateAndStartATestProfileRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/CreateUpdateAndStartATestProfileRun.java new file mode 100644 index 0000000000000..54398840d62b2 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/CreateUpdateAndStartATestProfileRun.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.TestProfileRunClient; +import com.azure.developer.loadtesting.TestProfileRunClientBuilder; +import com.azure.developer.loadtesting.models.TestProfileRun; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class CreateUpdateAndStartATestProfileRun { + public static void main(String[] args) { + TestProfileRunClient testProfileRunClient + = new TestProfileRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.createorupdatetestprofilerun.createupdateandstartatestprofilerun + TestProfileRun response + = testProfileRunClient.createOrUpdateTestProfileRun("12316678-1234-1234-1234-122451189012", + new TestProfileRun().setDisplayName("Performance_TestProfile_Run1") + .setDescription("sample description") + .setTestProfileId("12345678-1234-1234-1234-123456789012")); + // END:com.azure.developer.loadtesting.generated.createorupdatetestprofilerun.createupdateandstartatestprofilerun + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeleteAFileFromALoadTest.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeleteAFileFromALoadTest.java new file mode 100644 index 0000000000000..5b28b14c73262 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeleteAFileFromALoadTest.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestAdministrationClient; +import com.azure.developer.loadtesting.LoadTestAdministrationClientBuilder; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class DeleteAFileFromALoadTest { + public static void main(String[] args) { + LoadTestAdministrationClient loadTestAdministrationClient + = new LoadTestAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.deletetestfile.deleteafilefromaloadtest + loadTestAdministrationClient.deleteTestFile("12345678-1234-1234-1234-123456789012", "app.jmx"); + // END:com.azure.developer.loadtesting.generated.deletetestfile.deleteafilefromaloadtest + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeleteALoadTest.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeleteALoadTest.java new file mode 100644 index 0000000000000..d394da4d9860d --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeleteALoadTest.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestAdministrationClient; +import com.azure.developer.loadtesting.LoadTestAdministrationClientBuilder; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class DeleteALoadTest { + public static void main(String[] args) { + LoadTestAdministrationClient loadTestAdministrationClient + = new LoadTestAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.deletetest.deletealoadtest + loadTestAdministrationClient.deleteTest("12345678-1234-1234-1234-123456789012"); + // END:com.azure.developer.loadtesting.generated.deletetest.deletealoadtest + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeleteALoadTestRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeleteALoadTestRun.java new file mode 100644 index 0000000000000..5416944b18715 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeleteALoadTestRun.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestRunClient; +import com.azure.developer.loadtesting.LoadTestRunClientBuilder; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class DeleteALoadTestRun { + public static void main(String[] args) { + LoadTestRunClient loadTestRunClient + = new LoadTestRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.deletetestrun.deletealoadtestrun + loadTestRunClient.deleteTestRun("12316678-1234-1234-1234-122451189012"); + // END:com.azure.developer.loadtesting.generated.deletetestrun.deletealoadtestrun + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeleteATestProfile.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeleteATestProfile.java new file mode 100644 index 0000000000000..8b40be3ae5732 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeleteATestProfile.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.TestProfileAdministrationClient; +import com.azure.developer.loadtesting.TestProfileAdministrationClientBuilder; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class DeleteATestProfile { + public static void main(String[] args) { + TestProfileAdministrationClient testProfileAdministrationClient + = new TestProfileAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.deletetestprofile.deleteatestprofile + testProfileAdministrationClient.deleteTestProfile("12345678-1234-1234-1234-123456789012"); + // END:com.azure.developer.loadtesting.generated.deletetestprofile.deleteatestprofile + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeletesATestProfileRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeletesATestProfileRun.java new file mode 100644 index 0000000000000..137bcfb6c6fe8 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/DeletesATestProfileRun.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.TestProfileRunClient; +import com.azure.developer.loadtesting.TestProfileRunClientBuilder; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class DeletesATestProfileRun { + public static void main(String[] args) { + TestProfileRunClient testProfileRunClient + = new TestProfileRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.deletetestprofilerun.deletesatestprofilerun + testProfileRunClient.deleteTestProfileRun("12316678-1234-1234-1234-122451189012"); + // END:com.azure.developer.loadtesting.generated.deletetestprofilerun.deletesatestprofilerun + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAFileAssociatedToALoadTestRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAFileAssociatedToALoadTestRun.java new file mode 100644 index 0000000000000..23a0972d141ef --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAFileAssociatedToALoadTestRun.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestRunClient; +import com.azure.developer.loadtesting.LoadTestRunClientBuilder; +import com.azure.developer.loadtesting.models.TestRunFileInfo; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetAFileAssociatedToALoadTestRun { + public static void main(String[] args) { + LoadTestRunClient loadTestRunClient + = new LoadTestRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.gettestrunfile.getafileassociatedtoaloadtestrun + TestRunFileInfo response + = loadTestRunClient.getTestRunFile("12316678-1234-1234-1234-122451189012", "sample.jmx"); + // END:com.azure.developer.loadtesting.generated.gettestrunfile.getafileassociatedtoaloadtestrun + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAFileFromALoadTest.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAFileFromALoadTest.java new file mode 100644 index 0000000000000..2cba77bb41d6f --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAFileFromALoadTest.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestAdministrationClient; +import com.azure.developer.loadtesting.LoadTestAdministrationClientBuilder; +import com.azure.developer.loadtesting.models.TestFileInfo; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetAFileFromALoadTest { + public static void main(String[] args) { + LoadTestAdministrationClient loadTestAdministrationClient + = new LoadTestAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.gettestfile.getafilefromaloadtest + TestFileInfo response + = loadTestAdministrationClient.getTestFile("12345678-1234-1234-1234-123456789012", "sample.jmx"); + // END:com.azure.developer.loadtesting.generated.gettestfile.getafilefromaloadtest + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetALoadTest.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetALoadTest.java new file mode 100644 index 0000000000000..589eb63c9d8de --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetALoadTest.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestAdministrationClient; +import com.azure.developer.loadtesting.LoadTestAdministrationClientBuilder; +import com.azure.developer.loadtesting.models.Test; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetALoadTest { + public static void main(String[] args) { + LoadTestAdministrationClient loadTestAdministrationClient + = new LoadTestAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.gettest.getaloadtest + Test response = loadTestAdministrationClient.getTest("12345678-1234-1234-1234-123456789012"); + // END:com.azure.developer.loadtesting.generated.gettest.getaloadtest + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetALoadTestRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetALoadTestRun.java new file mode 100644 index 0000000000000..2407f0e7d207e --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetALoadTestRun.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestRunClient; +import com.azure.developer.loadtesting.LoadTestRunClientBuilder; +import com.azure.developer.loadtesting.models.TestRun; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetALoadTestRun { + public static void main(String[] args) { + LoadTestRunClient loadTestRunClient + = new LoadTestRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.gettestrun.getaloadtestrun + TestRun response = loadTestRunClient.getTestRun("12316678-1234-1234-1234-122451189012"); + // END:com.azure.developer.loadtesting.generated.gettestrun.getaloadtestrun + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetATestProfile.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetATestProfile.java new file mode 100644 index 0000000000000..eab1ea7db4f13 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetATestProfile.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.TestProfileAdministrationClient; +import com.azure.developer.loadtesting.TestProfileAdministrationClientBuilder; +import com.azure.developer.loadtesting.models.TestProfile; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetATestProfile { + public static void main(String[] args) { + TestProfileAdministrationClient testProfileAdministrationClient + = new TestProfileAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.gettestprofile.getatestprofile + TestProfile response = testProfileAdministrationClient.getTestProfile("12345678-1234-1234-1234-123456789012"); + // END:com.azure.developer.loadtesting.generated.gettestprofile.getatestprofile + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetATestProfileRunAfterTheRunHasExecuted.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetATestProfileRunAfterTheRunHasExecuted.java new file mode 100644 index 0000000000000..d04fd97892070 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetATestProfileRunAfterTheRunHasExecuted.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.TestProfileRunClient; +import com.azure.developer.loadtesting.TestProfileRunClientBuilder; +import com.azure.developer.loadtesting.models.TestProfileRun; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetATestProfileRunAfterTheRunHasExecuted { + public static void main(String[] args) { + TestProfileRunClient testProfileRunClient + = new TestProfileRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.gettestprofilerun.getatestprofilerunaftertherunhasexecuted + TestProfileRun response = testProfileRunClient.getTestProfileRun("12316678-1234-1234-1234-122451189012"); + // END:com.azure.developer.loadtesting.generated.gettestprofilerun.getatestprofilerunaftertherunhasexecuted + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetATestProfileRunWhileTheRunIsExecuting.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetATestProfileRunWhileTheRunIsExecuting.java new file mode 100644 index 0000000000000..98b9d10a936c1 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetATestProfileRunWhileTheRunIsExecuting.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.TestProfileRunClient; +import com.azure.developer.loadtesting.TestProfileRunClientBuilder; +import com.azure.developer.loadtesting.models.TestProfileRun; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetATestProfileRunWhileTheRunIsExecuting { + public static void main(String[] args) { + TestProfileRunClient testProfileRunClient + = new TestProfileRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.gettestprofilerun.getatestprofilerunwhiletherunisexecuting + TestProfileRun response = testProfileRunClient.getTestProfileRun("12316678-1234-1234-1234-122451189012"); + // END:com.azure.developer.loadtesting.generated.gettestprofilerun.getatestprofilerunwhiletherunisexecuting + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAllLoadTests.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAllLoadTests.java new file mode 100644 index 0000000000000..b9b048db0f260 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAllLoadTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestAdministrationClient; +import com.azure.developer.loadtesting.LoadTestAdministrationClientBuilder; +import com.azure.developer.loadtesting.models.Test; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetAllLoadTests { + public static void main(String[] args) { + LoadTestAdministrationClient loadTestAdministrationClient + = new LoadTestAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.listtests.getallloadtests + PagedIterable response + = loadTestAdministrationClient.listTests("executedDateTime", "Performance_LoadTest", null, null); + // END:com.azure.developer.loadtesting.generated.listtests.getallloadtests + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAllTestFiles.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAllTestFiles.java new file mode 100644 index 0000000000000..65c97a53beb86 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAllTestFiles.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestAdministrationClient; +import com.azure.developer.loadtesting.LoadTestAdministrationClientBuilder; +import com.azure.developer.loadtesting.models.TestFileInfo; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetAllTestFiles { + public static void main(String[] args) { + LoadTestAdministrationClient loadTestAdministrationClient + = new LoadTestAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.listtestfiles.getalltestfiles + PagedIterable response + = loadTestAdministrationClient.listTestFiles("12345678-1234-1234-1234-123456789012"); + // END:com.azure.developer.loadtesting.generated.listtestfiles.getalltestfiles + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAllTestProfileRunsForTheSpecifiedFilters.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAllTestProfileRunsForTheSpecifiedFilters.java new file mode 100644 index 0000000000000..5bb793ba6970a --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAllTestProfileRunsForTheSpecifiedFilters.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.TestProfileRunClient; +import com.azure.developer.loadtesting.TestProfileRunClientBuilder; +import com.azure.developer.loadtesting.models.TestProfileRun; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.time.OffsetDateTime; + +public class GetAllTestProfileRunsForTheSpecifiedFilters { + public static void main(String[] args) { + TestProfileRunClient testProfileRunClient + = new TestProfileRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.listtestprofileruns.getalltestprofilerunsforthespecifiedfilters + PagedIterable response = testProfileRunClient.listTestProfileRuns( + OffsetDateTime.parse("2024-05-01T16:00:46.072Z"), OffsetDateTime.parse("2024-05-01T16:50:46.072Z"), + OffsetDateTime.parse("2024-05-01T16:00:46.072Z"), OffsetDateTime.parse("2024-05-01T16:50:46.072Z"), null, + null, null, "12345678-1234-1234-1234-123456789012", "ACCEPTED"); + // END:com.azure.developer.loadtesting.generated.listtestprofileruns.getalltestprofilerunsforthespecifiedfilters + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAllTestProfilesForTheSpecifiedFilters.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAllTestProfilesForTheSpecifiedFilters.java new file mode 100644 index 0000000000000..19a5534d6d5be --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAllTestProfilesForTheSpecifiedFilters.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.TestProfileAdministrationClient; +import com.azure.developer.loadtesting.TestProfileAdministrationClientBuilder; +import com.azure.developer.loadtesting.models.TestProfile; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.time.OffsetDateTime; + +public class GetAllTestProfilesForTheSpecifiedFilters { + public static void main(String[] args) { + TestProfileAdministrationClient testProfileAdministrationClient + = new TestProfileAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.listtestprofiles.getalltestprofilesforthespecifiedfilters + PagedIterable response = testProfileAdministrationClient.listTestProfiles( + OffsetDateTime.parse("2024-05-01T16:00:46.072Z"), OffsetDateTime.parse("2024-05-01T16:50:46.072Z"), + "12345678-1234-1234-1234-123456789012", "12346-abcd-6789"); + // END:com.azure.developer.loadtesting.generated.listtestprofiles.getalltestprofilesforthespecifiedfilters + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAssociatedAppComponentForTheGivenTest.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAssociatedAppComponentForTheGivenTest.java new file mode 100644 index 0000000000000..9f37a60c4bf02 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAssociatedAppComponentForTheGivenTest.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestAdministrationClient; +import com.azure.developer.loadtesting.LoadTestAdministrationClientBuilder; +import com.azure.developer.loadtesting.models.TestAppComponents; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetAssociatedAppComponentForTheGivenTest { + public static void main(String[] args) { + LoadTestAdministrationClient loadTestAdministrationClient + = new LoadTestAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.getappcomponents.getassociatedappcomponentforthegiventest + TestAppComponents response + = loadTestAdministrationClient.getAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7"); + // END:com.azure.developer.loadtesting.generated.getappcomponents.getassociatedappcomponentforthegiventest + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAssociatedAppComponentForTheGivenTestRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAssociatedAppComponentForTheGivenTestRun.java new file mode 100644 index 0000000000000..8d19b95162e5f --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/GetAssociatedAppComponentForTheGivenTestRun.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestRunClient; +import com.azure.developer.loadtesting.LoadTestRunClientBuilder; +import com.azure.developer.loadtesting.models.TestRunAppComponents; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetAssociatedAppComponentForTheGivenTestRun { + public static void main(String[] args) { + LoadTestRunClient loadTestRunClient + = new LoadTestRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.getappcomponents.getassociatedappcomponentforthegiventestrun + TestRunAppComponents response = loadTestRunClient.getAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7"); + // END:com.azure.developer.loadtesting.generated.getappcomponents.getassociatedappcomponentforthegiventestrun + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListServerMetricsConfigurationForTheGivenTest.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListServerMetricsConfigurationForTheGivenTest.java new file mode 100644 index 0000000000000..b295941a47e1e --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListServerMetricsConfigurationForTheGivenTest.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestAdministrationClient; +import com.azure.developer.loadtesting.LoadTestAdministrationClientBuilder; +import com.azure.developer.loadtesting.models.TestServerMetricConfig; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class ListServerMetricsConfigurationForTheGivenTest { + public static void main(String[] args) { + LoadTestAdministrationClient loadTestAdministrationClient + = new LoadTestAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.getservermetricsconfig.listservermetricsconfigurationforthegiventest + TestServerMetricConfig response + = loadTestAdministrationClient.getServerMetricsConfig("12345678-1234-1234-1234-123456789012"); + // END:com.azure.developer.loadtesting.generated.getservermetricsconfig.listservermetricsconfigurationforthegiventest + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListServerMetricsConfigurationForTheGivenTestRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListServerMetricsConfigurationForTheGivenTestRun.java new file mode 100644 index 0000000000000..90c7e35e4651a --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListServerMetricsConfigurationForTheGivenTestRun.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestRunClient; +import com.azure.developer.loadtesting.LoadTestRunClientBuilder; +import com.azure.developer.loadtesting.models.TestRunServerMetricConfig; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class ListServerMetricsConfigurationForTheGivenTestRun { + public static void main(String[] args) { + LoadTestRunClient loadTestRunClient + = new LoadTestRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.getservermetricsconfig.listservermetricsconfigurationforthegiventestrun + TestRunServerMetricConfig response + = loadTestRunClient.getServerMetricsConfig("12345678-1234-1234-1234-123456789012"); + // END:com.azure.developer.loadtesting.generated.getservermetricsconfig.listservermetricsconfigurationforthegiventestrun + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTestRuns.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTestRuns.java new file mode 100644 index 0000000000000..c874fc2259910 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTestRuns.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestRunClient; +import com.azure.developer.loadtesting.LoadTestRunClientBuilder; +import com.azure.developer.loadtesting.models.TestRun; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.time.OffsetDateTime; + +public class ListTestRuns { + public static void main(String[] args) { + LoadTestRunClient loadTestRunClient + = new LoadTestRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.listtestruns.listtestruns + PagedIterable response + = loadTestRunClient.listTestRuns("executedDateTime", "Performance_LoadTest_Run1", + "12345678-1234-1234-1234-123456789012", OffsetDateTime.parse("2021-12-05T16:43:48.805Z"), + OffsetDateTime.parse("2021-12-05T16:43:48.805Z"), "DONE,EXECUTING"); + // END:com.azure.developer.loadtesting.generated.listtestruns.listtestruns + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTheDimensionValuesForTheGivenMetricDimensionName.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTheDimensionValuesForTheGivenMetricDimensionName.java new file mode 100644 index 0000000000000..880e67d41a94e --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTheDimensionValuesForTheGivenMetricDimensionName.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestRunClient; +import com.azure.developer.loadtesting.LoadTestRunClientBuilder; +import com.azure.developer.loadtesting.models.DimensionValueList; +import com.azure.developer.loadtesting.models.TimeGrain; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class ListTheDimensionValuesForTheGivenMetricDimensionName { + public static void main(String[] args) { + LoadTestRunClient loadTestRunClient + = new LoadTestRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.listmetricdimensionvalues.listthedimensionvaluesforthegivenmetricdimensionname + DimensionValueList response + = loadTestRunClient.listMetricDimensionValues("12316678-1234-1234-1234-122451189012", "SamplerName", + "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", TimeGrain.PT1H); + // END:com.azure.developer.loadtesting.generated.listmetricdimensionvalues.listthedimensionvaluesforthegivenmetricdimensionname + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTheMetricDefinitionsForALoadTestRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTheMetricDefinitionsForALoadTestRun.java new file mode 100644 index 0000000000000..28051e19aaeef --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTheMetricDefinitionsForALoadTestRun.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestRunClient; +import com.azure.developer.loadtesting.LoadTestRunClientBuilder; +import com.azure.developer.loadtesting.models.MetricDefinitionCollection; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class ListTheMetricDefinitionsForALoadTestRun { + public static void main(String[] args) { + LoadTestRunClient loadTestRunClient + = new LoadTestRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.getmetricdefinitions.listthemetricdefinitionsforaloadtestrun + MetricDefinitionCollection response + = loadTestRunClient.getMetricDefinitions("12316678-1234-1234-1234-122451189012", "LoadTestRunMetrics"); + // END:com.azure.developer.loadtesting.generated.getmetricdefinitions.listthemetricdefinitionsforaloadtestrun + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTheMetricNamespacesForALoadTestRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTheMetricNamespacesForALoadTestRun.java new file mode 100644 index 0000000000000..ba3eb963ed627 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTheMetricNamespacesForALoadTestRun.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestRunClient; +import com.azure.developer.loadtesting.LoadTestRunClientBuilder; +import com.azure.developer.loadtesting.models.MetricNamespaceCollection; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class ListTheMetricNamespacesForALoadTestRun { + public static void main(String[] args) { + LoadTestRunClient loadTestRunClient + = new LoadTestRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.getmetricnamespaces.listthemetricnamespacesforaloadtestrun + MetricNamespaceCollection response + = loadTestRunClient.getMetricNamespaces("12316678-1234-1234-1234-122451189012"); + // END:com.azure.developer.loadtesting.generated.getmetricnamespaces.listthemetricnamespacesforaloadtestrun + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTheMetricValuesForALoadTestRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTheMetricValuesForALoadTestRun.java new file mode 100644 index 0000000000000..0f48e5b1fe2d8 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/ListTheMetricValuesForALoadTestRun.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestRunClient; +import com.azure.developer.loadtesting.LoadTestRunClientBuilder; +import com.azure.developer.loadtesting.models.DimensionFilter; +import com.azure.developer.loadtesting.models.MetricRequestPayload; +import com.azure.developer.loadtesting.models.TimeGrain; +import com.azure.developer.loadtesting.models.TimeSeriesElement; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.util.Arrays; + +public class ListTheMetricValuesForALoadTestRun { + public static void main(String[] args) { + LoadTestRunClient loadTestRunClient + = new LoadTestRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.listmetrics.listthemetricvaluesforaloadtestrun + PagedIterable response = loadTestRunClient.listMetrics( + "12316678-1234-1234-1234-122451189012", "ActiveThreads", "LoadTestRunMetrics", + "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", "Average", TimeGrain.PT1H, + new MetricRequestPayload().setFilters( + Arrays.asList(new DimensionFilter().setName("SamplerName").setValues(Arrays.asList("HTTP Request"))))); + // END:com.azure.developer.loadtesting.generated.listmetrics.listthemetricvaluesforaloadtestrun + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/StopATestProfileRun.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/StopATestProfileRun.java new file mode 100644 index 0000000000000..2c1685e65ecd2 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/StopATestProfileRun.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.TestProfileRunClient; +import com.azure.developer.loadtesting.TestProfileRunClientBuilder; +import com.azure.developer.loadtesting.models.TestProfileRun; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class StopATestProfileRun { + public static void main(String[] args) { + TestProfileRunClient testProfileRunClient + = new TestProfileRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.stoptestprofilerun.stopatestprofilerun + TestProfileRun response = testProfileRunClient.stopTestProfileRun("12316678-1234-1234-1234-122451189012"); + // END:com.azure.developer.loadtesting.generated.stoptestprofilerun.stopatestprofilerun + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/StopTestRunByName.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/StopTestRunByName.java new file mode 100644 index 0000000000000..587f9164ac543 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/StopTestRunByName.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestRunClient; +import com.azure.developer.loadtesting.LoadTestRunClientBuilder; +import com.azure.developer.loadtesting.models.TestRun; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class StopTestRunByName { + public static void main(String[] args) { + LoadTestRunClient loadTestRunClient + = new LoadTestRunClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.stoptestrun.stoptestrunbyname + TestRun response = loadTestRunClient.stopTestRun("12316678-1234-1234-1234-122451189012"); + // END:com.azure.developer.loadtesting.generated.stoptestrun.stoptestrunbyname + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/UploadInputFileForAGivenTestName.java b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/UploadInputFileForAGivenTestName.java new file mode 100644 index 0000000000000..8ae93c766a015 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/src/samples/java/com/azure/developer/loadtesting/generated/UploadInputFileForAGivenTestName.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.loadtesting.generated; + +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; +import com.azure.developer.loadtesting.LoadTestAdministrationClient; +import com.azure.developer.loadtesting.LoadTestAdministrationClientBuilder; +import com.azure.developer.loadtesting.models.FileType; +import com.azure.developer.loadtesting.models.TestFileInfo; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.nio.charset.StandardCharsets; + +public class UploadInputFileForAGivenTestName { + public static void main(String[] args) { + LoadTestAdministrationClient loadTestAdministrationClient + = new LoadTestAdministrationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.developer.loadtesting.generated.uploadtestfile.uploadinputfileforagiventestname + TestFileInfo response = loadTestAdministrationClient.uploadTestFile("12345678-1234-1234-1234-123456789012", + "sample.jmx", BinaryData.fromBytes("application/octet-stream content".getBytes(StandardCharsets.UTF_8)), + FileType.ADDITIONAL_ARTIFACTS); + // END:com.azure.developer.loadtesting.generated.uploadtestfile.uploadinputfileforagiventestname + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestAdministrationAsyncTests.java b/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestAdministrationAsyncTests.java deleted file mode 100644 index df421250494dc..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestAdministrationAsyncTests.java +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.developer.loadtesting; - -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.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; -import org.junit.jupiter.api.MethodOrderer; -import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestMethodOrder; -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; - -@TestMethodOrder(MethodOrderer.OrderAnnotation.class) -public final class LoadTestAdministrationAsyncTests extends LoadTestingClientTestBase { - - // Helpers - - private Map getTestBodyFromDict() { - Map testMap = new HashMap<>(); - testMap.put("displayName", "Java SDK Sample Test Async"); - testMap.put("description", "Sample Test Async"); - - Map loadTestConfigMap = new HashMap<>(); - loadTestConfigMap.put("engineInstances", 1); - testMap.put("loadTestConfiguration", 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; - } - - private BinaryData getFileBodyFromResource(String fileName) { - URL url = LoadTestAdministrationAsyncTests.class.getClassLoader().getResource(fileName); - - return BinaryData.fromFile(new File(url.getPath()).toPath()); - } - - // Puts and Patches - - @Test - @Order(1) - public void createOrUpdateTest() { - BinaryData body = BinaryData.fromObject(getTestBodyFromDict()); - Mono> monoResponse = getLoadTestAdministrationAsyncClient() - .createOrUpdateTestWithResponse(newTestIdAsync, body, null); - StepVerifier.create(monoResponse) - .assertNext(response -> assertTrue(Arrays.asList(200, 201).contains(response.getStatusCode()))) - .verifyComplete(); - } - - @Test - @Order(2) - public void beginUploadTestFileAdditionalFiles() { - BinaryData file = getFileBodyFromResource(uploadCsvFileName); - RequestOptions requestOptions = new RequestOptions().addQueryParam("fileType", "ADDITIONAL_ARTIFACTS"); - PollerFlux poller = getLoadTestAdministrationAsyncClient() - .beginUploadTestFile(newTestIdAsync, uploadCsvFileName, file, requestOptions); - poller = setPlaybackPollerFluxPollInterval(poller); - - StepVerifier.create(poller.last()) - .assertNext(pollResponse -> - assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, pollResponse.getStatus())) - .verifyComplete(); - } - - @Test - @Order(3) - public void beginUploadTestFileTestScript() { - BinaryData file = getFileBodyFromResource(uploadJmxFileName); - RequestOptions fileUploadRequestOptions = new RequestOptions().addQueryParam("fileType", "JMX_FILE"); - PollerFlux poller = getLoadTestAdministrationAsyncClient() - .beginUploadTestFile(newTestIdAsync, uploadJmxFileName, file, fileUploadRequestOptions); - poller = setPlaybackPollerFluxPollInterval(poller); - - StepVerifier.create(poller.takeUntil(pollResponse -> pollResponse.getStatus().isComplete()) - .last() - .flatMap(AsyncPollResponse::getFinalResult)) - .assertNext(fileBinary -> { - try (JsonReader jsonReader = JsonProviders.createReader(fileBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals("VALIDATION_SUCCESS", jsonTree.get("validationStatus")); - assertEquals(uploadJmxFileName, jsonTree.get("fileName")); - } catch (IOException e) { - fail("Encountered exception while reading test file data", e); - } - }) - .verifyComplete(); - } - - @Test - @Order(4) - public void createOrUpdateAppComponents() { - BinaryData body = BinaryData.fromObject(getAppComponentBodyFromDict()); - Mono> monoResponse = getLoadTestAdministrationAsyncClient() - .createOrUpdateAppComponentsWithResponse(newTestIdAsync, body, null); - - StepVerifier.create(monoResponse) - .assertNext(response -> assertTrue(Arrays.asList(200, 201).contains(response.getStatusCode()))) - .verifyComplete(); - } - - @Test - @Order(5) - public void createOrUpdateServerMetricsConfig() { - BinaryData body = BinaryData.fromObject(getServerMetricsBodyFromDict()); - Mono> monoResponse = getLoadTestAdministrationAsyncClient() - .createOrUpdateServerMetricsConfigWithResponse(newTestIdAsync, body, null); - - StepVerifier.create(monoResponse) - .assertNext(response -> assertTrue(Arrays.asList(200, 201).contains(response.getStatusCode()))) - .verifyComplete(); - } - - // Gets - - @Test - @Order(6) - public void getTestFile() { - Mono> monoResponse = getLoadTestAdministrationAsyncClient() - .getTestFileWithResponse(newTestIdAsync, uploadJmxFileName, null); - - StepVerifier.create(monoResponse) - .assertNext(response -> { - assertEquals(200, response.getStatusCode()); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals(uploadJmxFileName, jsonTree.get("fileName")); - assertEquals("JMX_FILE", jsonTree.get("fileType")); - } catch (IOException e) { - fail("Encountered exception while reading test file data", e); - } - }) - .verifyComplete(); - } - - @Test - @Order(7) - public void getTest() { - Mono> monoResponse = getLoadTestAdministrationAsyncClient() - .getTestWithResponse(newTestIdAsync, null); - - StepVerifier.create(monoResponse) - .assertNext(response -> { - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals(newTestIdAsync, jsonTree.get("testId")); - } catch (IOException e) { - fail("Encountered exception while reading test data", e); - } - - assertEquals(200, response.getStatusCode()); - }) - .verifyComplete(); - } - - @SuppressWarnings("unchecked") - @Test - @Order(8) - public void getAppComponents() { - Mono> monoResponse = getLoadTestAdministrationAsyncClient() - .getAppComponentsWithResponse(newTestIdAsync, null); - - StepVerifier.create(monoResponse) - .assertNext(response -> { - assertEquals(200, response.getStatusCode()); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - Map components = (Map) jsonTree.get("components"); - - assertTrue(components.containsKey(defaultAppComponentResourceId)); - - Map appComponentResource = - (Map) components.get(defaultAppComponentResourceId); - - assertTrue(defaultAppComponentResourceId - .equalsIgnoreCase(appComponentResource.get("resourceId").toString())); - } catch (IOException e) { - fail("Encountered exception while reading app components", e); - } - }) - .verifyComplete(); - } - - @SuppressWarnings("unchecked") - @Test - @Order(9) - public void getServerMetricsConfig() { - Mono> monoResponse = getLoadTestAdministrationAsyncClient() - .getServerMetricsConfigWithResponse(newTestIdAsync, null); - - StepVerifier.create(monoResponse) - .assertNext(response -> { - assertEquals(200, response.getStatusCode()); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - Map components = (Map) jsonTree.get("metrics"); - - assertTrue(components.containsKey(defaultServerMetricId)); - - Map appComponentResource = - (Map) components.get(defaultServerMetricId); - - assertTrue(defaultServerMetricId.equalsIgnoreCase(appComponentResource.get("id").toString())); - } catch (IOException e) { - fail("Encountered exception while reading server metrics", e); - } - }) - .verifyComplete(); - } - - // Lists - - @Test - @Order(10) - public void listTestFiles() { - PagedFlux response = getLoadTestAdministrationAsyncClient().listTestFiles(newTestIdAsync, null); - - StepVerifier.create(response) - .expectNextMatches(fileBinary -> { - try (JsonReader jsonReader = JsonProviders.createReader(fileBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals(uploadJmxFileName, jsonTree.get("fileName")); - assertEquals("JMX_FILE", jsonTree.get("fileType")); - - return true; - } catch (IOException e) { - // no-op - } - - return false; - }) - .thenConsumeWhile(fileBinary -> true) - .verifyComplete(); - } - - @Test - @Order(11) - public void listTests() { - RequestOptions reqOpts = new RequestOptions().addQueryParam("orderBy", "lastModifiedDateTime desc"); - PagedFlux response = getLoadTestAdministrationAsyncClient().listTests(reqOpts); - - StepVerifier.create(response) - .expectNextMatches(testBinary -> { - try (JsonReader jsonReader = JsonProviders.createReader(testBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - return newTestIdAsync.equals(jsonTree.get("testId")); - } catch (IOException e) { - return false; - } - }) - .thenConsumeWhile(fileBinary -> true) - .verifyComplete(); - } - - // Deletes - - @Test - @Order(12) - public void deleteTestFile() { - StepVerifier.create(getLoadTestAdministrationAsyncClient() - .deleteTestFileWithResponse(newTestIdAsync, uploadCsvFileName, null)) - .expectNextCount(1) - .verifyComplete(); - StepVerifier.create(getLoadTestAdministrationAsyncClient() - .deleteTestFileWithResponse(newTestIdAsync, uploadJmxFileName, null)) - .expectNextCount(1) - .verifyComplete(); - } - - @Test - @Order(13) - public void deleteTest() { - StepVerifier.create(getLoadTestAdministrationAsyncClient() - .deleteTestWithResponse(newTestIdAsync, null)) - .expectNextCount(1) - .verifyComplete(); - } -} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestAdministrationTests.java b/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestAdministrationTests.java deleted file mode 100644 index 988be406416fa..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestAdministrationTests.java +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.developer.loadtesting; - -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 com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.SyncPoller; -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; -import org.junit.jupiter.api.MethodOrderer; -import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestMethodOrder; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; - -@TestMethodOrder(MethodOrderer.OrderAnnotation.class) -public final class LoadTestAdministrationTests extends LoadTestingClientTestBase { - - // Helpers - - 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("loadTestConfiguration", 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; - } - - private BinaryData getFileBodyFromResource(String fileName) { - URL url = LoadTestAdministrationTests.class.getClassLoader().getResource(fileName); - - return BinaryData.fromFile(new File(url.getPath()).toPath()); - } - - // Puts and Patches - - @Test - @Order(1) - public void createOrUpdateTest() { - BinaryData body = BinaryData.fromObject(getTestBodyFromDict()); - Response response = - getLoadTestAdministrationClient().createOrUpdateTestWithResponse(newTestId, body, null); - - assertTrue(Arrays.asList(200, 201).contains(response.getStatusCode())); - } - - @Test - @Order(2) - public void beginUploadTestFileAdditionalFiles() { - BinaryData file = getFileBodyFromResource(uploadCsvFileName); - RequestOptions requestOptions = new RequestOptions().addQueryParam("fileType", "ADDITIONAL_ARTIFACTS"); - PollResponse response = getLoadTestAdministrationClient() - .beginUploadTestFile(newTestId, uploadCsvFileName, file, requestOptions) - .poll(); - - assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, response.getStatus()); - } - - @Test - @Order(3) - public void beginUploadTestFileTestScript() { - BinaryData file = getFileBodyFromResource(uploadJmxFileName); - RequestOptions fileUploadRequestOptions = new RequestOptions().addQueryParam("fileType", "JMX_FILE"); - SyncPoller poller = getLoadTestAdministrationClient() - .beginUploadTestFile(newTestId, uploadJmxFileName, file, fileUploadRequestOptions); - poller = setPlaybackSyncPollerPollInterval(poller); - PollResponse response = poller.waitForCompletion(); - BinaryData fileBinary = poller.getFinalResult(); - - try (JsonReader jsonReader = JsonProviders.createReader(fileBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals("VALIDATION_SUCCESS", jsonTree.get("validationStatus")); - assertEquals(uploadJmxFileName, jsonTree.get("fileName")); - } catch (IOException e) { - fail("Encountered exception while reading test file data", e); - } - - assertNotNull(response.getValue()); - } - - @Test - @Order(4) - public void createOrUpdateAppComponents() { - BinaryData body = BinaryData.fromObject(getAppComponentBodyFromDict()); - Response response = getLoadTestAdministrationClient() - .createOrUpdateAppComponentsWithResponse(newTestId, body, null); - - assertTrue(Arrays.asList(200, 201).contains(response.getStatusCode())); - } - - @Test - @Order(5) - public void createOrUpdateServerMetricsConfig() { - BinaryData body = BinaryData.fromObject(getServerMetricsBodyFromDict()); - Response response = getLoadTestAdministrationClient() - .createOrUpdateServerMetricsConfigWithResponse(newTestId, body, null); - - assertTrue(Arrays.asList(200, 201).contains(response.getStatusCode())); - } - - // Gets - - @Test - @Order(6) - public void getTestFile() { - Response response = getLoadTestAdministrationClient() - .getTestFileWithResponse(newTestId, uploadJmxFileName, null); - - assertEquals(200, response.getStatusCode()); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals(uploadJmxFileName, jsonTree.get("fileName")); - assertEquals("JMX_FILE", jsonTree.get("fileType")); - } catch (IOException e) { - fail("Encountered exception while reading test file data", e); - } - } - - @Test - @Order(7) - public void getTest() { - Response response = getLoadTestAdministrationClient().getTestWithResponse(newTestId, null); - - assertEquals(200, response.getStatusCode()); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals(newTestId, jsonTree.get("testId")); - } catch (IOException e) { - fail("Encountered exception while reading test data", e); - } - } - - @SuppressWarnings("unchecked") - @Test - @Order(8) - public void getAppComponents() { - Response response = getLoadTestAdministrationClient().getAppComponentsWithResponse(newTestId, null); - - assertEquals(200, response.getStatusCode()); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - Map components = (Map) jsonTree.get("components"); - - assertTrue(components.containsKey(defaultAppComponentResourceId)); - - Map appComponentResource = - (Map) components.get(defaultAppComponentResourceId); - - assertTrue(defaultAppComponentResourceId - .equalsIgnoreCase(appComponentResource.get("resourceId").toString())); - } catch (IOException e) { - fail("Encountered exception while reading test data", e); - } - } - - @SuppressWarnings("unchecked") - @Test - @Order(9) - public void getServerMetricsConfig() { - Response response = getLoadTestAdministrationClient() - .getServerMetricsConfigWithResponse(newTestId, null); - - assertEquals(200, response.getStatusCode()); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - Map components = (Map) jsonTree.get("metrics"); - - assertTrue(components.containsKey(defaultServerMetricId)); - - Map appComponentResource = - (Map) components.get(defaultServerMetricId); - - assertTrue(defaultServerMetricId.equalsIgnoreCase(appComponentResource.get("id").toString())); - } catch (IOException e) { - fail("Encountered exception while reading test data", e); - } - } - - // Lists - - @Test - @Order(10) - public void listTestFiles() { - PagedIterable response = getLoadTestAdministrationClient().listTestFiles(newTestId, null); - boolean found = response.stream().anyMatch((fileBinary) -> { - try (JsonReader jsonReader = JsonProviders.createReader(fileBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals(uploadJmxFileName, jsonTree.get("fileName")); - assertEquals("JMX_FILE", jsonTree.get("fileType")); - - return true; - } catch (IOException e) { - // no-op - } - - return false; - }); - - assertTrue(found); - } - - @Test - @Order(11) - public void listTests() { - RequestOptions reqOpts = new RequestOptions().addQueryParam("orderBy", "lastModifiedDateTime desc"); - PagedIterable response = getLoadTestAdministrationClient().listTests(reqOpts); - boolean found = response.stream().anyMatch((testBinary) -> { - try (JsonReader jsonReader = JsonProviders.createReader(testBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - return newTestId.equals(jsonTree.get("testId")); - } catch (IOException e) { - return false; - } - }); - - assertTrue(found); - } - - // Deletes - - @Test - @Order(12) - public void deleteTestFile() { - assertDoesNotThrow(() -> { - getLoadTestAdministrationClient().deleteTestFileWithResponse(newTestId, uploadCsvFileName, null); - }); - assertDoesNotThrow(() -> { - getLoadTestAdministrationClient().deleteTestFileWithResponse(newTestId, uploadJmxFileName, null); - }); - } - - @Test - @Order(13) - public void deleteTest() { - assertDoesNotThrow(() -> { - getLoadTestAdministrationClient().deleteTestWithResponse(newTestId, null); - }); - } -} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestRunAsyncTests.java b/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestRunAsyncTests.java deleted file mode 100644 index 1d71c1feeab43..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestRunAsyncTests.java +++ /dev/null @@ -1,345 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.developer.loadtesting; - -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.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.PollerFlux; -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; -import org.junit.jupiter.api.MethodOrderer; -import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestMethodOrder; -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; - -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; - -@TestMethodOrder(MethodOrderer.OrderAnnotation.class) -public final class LoadTestRunAsyncTests extends LoadTestingClientTestBase { - - // Helpers - - private Map getTestRunBodyFromDict(String testId) { - Map testRunMap = new HashMap<>(); - testRunMap.put("testId", testId); - testRunMap.put("displayName", "Java SDK Sample Test Run Async"); - testRunMap.put("description", "Sample Test Run Async"); - - return testRunMap; - } - - // Puts and Patches - - @Test - @Order(1) - public void beginTestRun() { - BinaryData body = BinaryData.fromObject(getTestRunBodyFromDict(existingTestId)); - PollerFlux poller = getLoadTestRunAsyncClient().beginTestRun(newTestRunIdAsync, body, - null); - poller = setPlaybackPollerFluxPollInterval(poller); - StepVerifier.create(poller.takeUntil(pollResponse -> pollResponse.getStatus().isComplete()) - .last() - .flatMap(AsyncPollResponse::getFinalResult)) - .assertNext(testRunBinary -> { - try (JsonReader jsonReader = JsonProviders.createReader(testRunBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals(newTestRunIdAsync, jsonTree.get("testRunId")); - assertEquals("DONE", jsonTree.get("status")); - } catch (IOException e) { - fail("Encountered exception while reading test run data", e); - } - }) - .verifyComplete(); - } - - @Test - @Order(2) - public void createOrUpdateAppComponents() { - BinaryData body = BinaryData.fromObject(getAppComponentBodyFromDict()); - Mono> monoResponse = getLoadTestRunAsyncClient() - .createOrUpdateAppComponentsWithResponse(newTestRunIdAsync, body, null); - - StepVerifier.create(monoResponse) - .assertNext(response -> assertTrue(Arrays.asList(200, 201).contains(response.getStatusCode()))) - .verifyComplete(); - } - - @Test - @Order(3) - public void createOrUpdateServerMetricsConfig() { - BinaryData body = BinaryData.fromObject(getServerMetricsBodyFromDict()); - Mono> monoResponse = getLoadTestRunAsyncClient() - .createOrUpdateServerMetricsConfigWithResponse(newTestRunIdAsync, body, null); - - StepVerifier.create(monoResponse) - .assertNext(response -> assertTrue(Arrays.asList(200, 201).contains(response.getStatusCode()))) - .verifyComplete(); - } - - // Gets - - @Test - @Order(4) - public void getTestRunFile() { - Mono> monoResponse = getLoadTestRunAsyncClient() - .getTestRunFileWithResponse(newTestRunIdAsync, uploadJmxFileName, null); - - StepVerifier.create(monoResponse) - .assertNext(response -> { - assertEquals(200, response.getStatusCode()); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals(uploadJmxFileName, jsonTree.get("fileName")); - assertEquals("JMX_FILE", jsonTree.get("fileType")); - } catch (IOException e) { - fail("Encountered exception while reading test run file data", e); - } - }) - .verifyComplete(); - } - - @Test - @Order(5) - public void getTestRun() { - Mono> monoResponse = getLoadTestRunAsyncClient() - .getTestRunWithResponse(newTestRunIdAsync, null); - - StepVerifier.create(monoResponse) - .assertNext(response -> { - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals(newTestRunIdAsync, jsonTree.get("testRunId")); - } catch (IOException e) { - fail("Encountered exception while reading test run data", e); - } - - assertEquals(200, response.getStatusCode()); - }) - .verifyComplete(); - } - - @SuppressWarnings("unchecked") - @Test - @Order(6) - public void getAppComponents() { - Mono> monoResponse = getLoadTestRunAsyncClient() - .getAppComponentsWithResponse(newTestRunIdAsync, null); - - StepVerifier.create(monoResponse).assertNext(response -> { - assertEquals(200, response.getStatusCode()); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - Map components = (Map) jsonTree.get("components"); - - assertTrue(components.containsKey(defaultAppComponentResourceId)); - - Map appComponentResource = - (Map) components.get(defaultAppComponentResourceId); - - assertTrue(defaultAppComponentResourceId - .equalsIgnoreCase(appComponentResource.get("resourceId").toString())); - } catch (IOException e) { - fail("Encountered exception while reading app components", e); - } - }).verifyComplete(); - } - - @SuppressWarnings("unchecked") - @Test - @Order(7) - public void getServerMetricsConfig() { - Mono> monoResponse = getLoadTestRunAsyncClient() - .getServerMetricsConfigWithResponse(newTestRunIdAsync, null); - - StepVerifier.create(monoResponse) - .assertNext(response -> { - assertEquals(200, response.getStatusCode()); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - Map components = (Map) jsonTree.get("metrics"); - - assertTrue(components.containsKey(defaultServerMetricId)); - - Map appComponentResource = - (Map) components.get(defaultServerMetricId); - - assertTrue(defaultServerMetricId.equalsIgnoreCase(appComponentResource.get("id").toString())); - } catch (IOException e) { - fail("Encountered exception while reading server metrics", e); - } - }) - .verifyComplete(); - } - - @SuppressWarnings({ "WriteOnlyObject", "unchecked" }) - @Test - @Order(8) - public void listMetricNamespaces() { - Mono> monoResponse = getLoadTestRunAsyncClient() - .getMetricNamespacesWithResponse(newTestRunIdAsync, null); - - StepVerifier.create(monoResponse) - .assertNext(response -> { - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - List metricNamespaces = (List) jsonTree.get("value"); - AtomicBoolean found = new AtomicBoolean(false); - - metricNamespaces.forEach(namespace -> { - Map namespaceMap = (Map) namespace; - - if (namespaceMap.get("name").equals("LoadTestRunMetrics")) { - found.set(true); - } - }); - - assertTrue(found.get()); - } catch (IOException e) { - fail("Encountered exception while reading metric namespaces", e); - } - }) - .verifyComplete(); - } - - @SuppressWarnings("unchecked") - @Test - @Order(9) - public void listMetricDefinitions() { - Mono> monoResponse = getLoadTestRunAsyncClient() - .getMetricDefinitionsWithResponse(newTestRunIdAsync, "LoadTestRunMetrics", null); - - StepVerifier.create(monoResponse).assertNext(response -> { - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - List metricDefinitions = (List) jsonTree.get("value"); - AtomicBoolean found = new AtomicBoolean(false); - - metricDefinitions.forEach(definition -> { - Map definitionMap = (Map) definition; - - if (definitionMap.get("namespace").equals("LoadTestRunMetrics") - && definitionMap.get("name") != null - && definitionMap.containsKey("dimensions")) { - - found.set(true); - } - }); - - assertTrue(found.get()); - } catch (IOException e) { - fail("Encountered exception while reading metric definitions", e); - } - }).verifyComplete(); - } - - @SuppressWarnings("unchecked") - @Test - @Order(10) - public void listMetrics() { - Mono monoBoolean = getLoadTestRunAsyncClient() - .getTestRunWithResponse(newTestRunIdAsync, null) - .flatMap(response -> { - String startDateTime = "", endDateTime = ""; - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - startDateTime = jsonTree.get("startDateTime").toString(); - endDateTime = jsonTree.get("endDateTime").toString(); - } catch (IOException e) { - fail("Encountered exception while reading metrics data", e); - } - - String timespan = startDateTime + "/" + endDateTime; - PagedFlux metricsResponse = getLoadTestRunAsyncClient() - .listMetrics(newTestRunIdAsync, "VirtualUsers", "LoadTestRunMetrics", timespan, null); - - return metricsResponse.any(metricsBinary -> { - AtomicBoolean found = new AtomicBoolean(false); - - try (JsonReader jsonReader = JsonProviders.createReader(metricsBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - if (jsonTree.containsKey("data")) { - List data = (List) jsonTree.get("data"); - - data.forEach(metric -> { - Map metricMap = (Map) metric; - - if (metricMap.containsKey("value")) { - found.set(true); - } - }); - } - } catch (IOException e) { - // no-op - } - - return found.get(); - }); - }); - - StepVerifier.create(monoBoolean) - .expectNext(true) - .thenConsumeWhile(ignored -> true) - .verifyComplete(); - } - - // Lists - - @Test - @Order(11) - public void listTestRuns() { - RequestOptions reqOpts = new RequestOptions().addQueryParam("testId", existingTestId); - PagedFlux response = getLoadTestRunAsyncClient().listTestRuns(reqOpts); - - StepVerifier.create(response) - .expectNextMatches(testRunBinary -> { - try (JsonReader jsonReader = JsonProviders.createReader(testRunBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals(newTestRunIdAsync, jsonTree.get("testRunId")); - assertEquals(existingTestId, jsonTree.get("testId")); - - return true; - } catch (IOException e) { - // no-op - } - - return false; - }) - .thenConsumeWhile(testRunBinary -> true) - .verifyComplete(); - } - - // Deletes - - @Test - @Order(12) - public void deleteTestRun() { - StepVerifier.create(getLoadTestRunAsyncClient().deleteTestRunWithResponse(newTestRunIdAsync, null)) - .expectNextCount(1) - .verifyComplete(); - } -} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestRunTests.java b/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestRunTests.java deleted file mode 100644 index 7b70c618757a4..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestRunTests.java +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.developer.loadtesting; - -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 com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.SyncPoller; -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; -import org.junit.jupiter.api.MethodOrderer; -import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestMethodOrder; - -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; - -@SuppressWarnings("unchecked") -@TestMethodOrder(MethodOrderer.OrderAnnotation.class) -public final class LoadTestRunTests extends LoadTestingClientTestBase { - - // Helpers - - private Map getTestRunBodyFromDict(String testId) { - Map testRunMap = new HashMap<>(); - testRunMap.put("testId", testId); - testRunMap.put("displayName", "Java SDK Sample Test Run"); - testRunMap.put("description", "Sample Test Run"); - - return testRunMap; - } - - // Puts and Patches - - @Test - @Order(1) - public void beginTestRun() { - BinaryData body = BinaryData.fromObject(getTestRunBodyFromDict(existingTestId)); - SyncPoller poller = getLoadTestRunClient().beginTestRun(newTestRunId, body, null); - poller = setPlaybackSyncPollerPollInterval(poller); - PollResponse response = poller.waitForCompletion(); - BinaryData testRunBinary = poller.getFinalResult(); - - try (JsonReader jsonReader = JsonProviders.createReader(testRunBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals(newTestRunId, jsonTree.get("testRunId")); - assertEquals("DONE", jsonTree.get("status")); - } catch (IOException e) { - fail("Encountered exception while reading test run data", e); - } - - assertNotNull(response.getValue()); - } - - @Test - @Order(2) - public void createOrUpdateAppComponents() { - BinaryData body = BinaryData.fromObject(getAppComponentBodyFromDict()); - Response response = getLoadTestRunClient() - .createOrUpdateAppComponentsWithResponse(newTestRunId, body, null); - - assertTrue(Arrays.asList(200, 201).contains(response.getStatusCode())); - } - - @Test - @Order(3) - public void createOrUpdateServerMetricsConfig() { - BinaryData body = BinaryData.fromObject(getServerMetricsBodyFromDict()); - Response response = getLoadTestRunClient() - .createOrUpdateServerMetricsConfigWithResponse(newTestRunId, body, null); - - assertTrue(Arrays.asList(200, 201).contains(response.getStatusCode())); - } - - // Gets - - @Test - @Order(4) - public void getTestRunFile() { - Response response = getLoadTestRunClient() - .getTestRunFileWithResponse(newTestRunId, uploadJmxFileName, null); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals(uploadJmxFileName, jsonTree.get("fileName")); - assertEquals("JMX_FILE", jsonTree.get("fileType")); - } catch (IOException e) { - fail("Encountered exception while reading test run file data", e); - } - - assertEquals(200, response.getStatusCode()); - } - - @Test - @Order(5) - public void getTestRun() { - Response response = getLoadTestRunClient().getTestRunWithResponse(newTestRunId, null); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals(newTestRunId, jsonTree.get("testRunId")); - } catch (IOException e) { - fail("Encountered exception while reading test run data", e); - } - - assertEquals(200, response.getStatusCode()); - } - - @SuppressWarnings("unchecked") - @Test - @Order(6) - public void getAppComponents() { - Response response = getLoadTestRunClient().getAppComponentsWithResponse(newTestRunId, null); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - Map components = (Map) jsonTree.get("components"); - - assertTrue(components.containsKey(defaultAppComponentResourceId)); - - Map appComponentResource = - (Map) components.get(defaultAppComponentResourceId); - - assertTrue(defaultAppComponentResourceId - .equalsIgnoreCase(appComponentResource.get("resourceId").toString())); - } catch (IOException e) { - fail("Encountered exception while reading app components", e); - } - - assertEquals(200, response.getStatusCode()); - } - - @SuppressWarnings("unchecked") - @Test - @Order(7) - public void getServerMetricsConfig() { - Response response = getLoadTestRunClient().getServerMetricsConfigWithResponse(newTestRunId, null); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - Map components = (Map) jsonTree.get("metrics"); - - assertTrue(components.containsKey(defaultServerMetricId)); - - Map appComponentResource = - (Map) components.get(defaultServerMetricId); - - assertTrue(defaultServerMetricId.equalsIgnoreCase(appComponentResource.get("id").toString())); - } catch (IOException e) { - fail("Encountered exception while reading server metrics", e); - } - - assertEquals(200, response.getStatusCode()); - } - - @SuppressWarnings("unchecked") - @Test - @Order(8) - public void listMetricNamespaces() { - Response response = getLoadTestRunClient().getMetricNamespacesWithResponse(newTestRunId, null); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - List metricNamespaces = (List) jsonTree.get("value"); - AtomicBoolean found = new AtomicBoolean(false); - - metricNamespaces.forEach(namespace -> { - Map namespaceMap = (Map) namespace; - - if (namespaceMap.get("name").equals("LoadTestRunMetrics")) { - found.set(true); - } - }); - - assertTrue(found.get()); - } catch (IOException e) { - fail("Encountered exception while reading metric namespaces", e); - } - } - - @Test - @Order(9) - public void listMetricDefinitions() { - Response response = getLoadTestRunClient() - .getMetricDefinitionsWithResponse(newTestRunId, "LoadTestRunMetrics", null); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - List metricDefinitions = (List) jsonTree.get("value"); - AtomicBoolean found = new AtomicBoolean(false); - - metricDefinitions.forEach(definition -> { - Map definitionMap = (Map) definition; - - if (definitionMap.get("namespace").equals("LoadTestRunMetrics") - && definitionMap.get("name") != null - && definitionMap.containsKey("dimensions")) { - - found.set(true); - } - }); - - assertTrue(found.get()); - } catch (IOException e) { - fail("Encountered exception while reading metric definitions", e); - } - } - - @Test - @Order(10) - public void listMetrics() { - String startDateTime = "", endDateTime = ""; - Response response = getLoadTestRunClient().getTestRunWithResponse(newTestRunId, null); - - try (JsonReader jsonReader = JsonProviders.createReader(response.getValue().toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - startDateTime = jsonTree.get("startDateTime").toString(); - endDateTime = jsonTree.get("endDateTime").toString(); - } catch (IOException e) { - fail("Encountered exception while reading metrics data", e); - } - - String timespan = startDateTime + "/" + endDateTime; - PagedIterable metricsResponse = getLoadTestRunClient() - .listMetrics(newTestRunId, "VirtualUsers", "LoadTestRunMetrics", timespan, null); - boolean valid = metricsResponse.stream().anyMatch(metricsBinary -> { - AtomicBoolean found = new AtomicBoolean(false); - - try (JsonReader jsonReader = JsonProviders.createReader(metricsBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - if (jsonTree.containsKey("data")) { - List data = (List) jsonTree.get("data"); - - data.forEach(metric -> { - Map metricMap = (Map) metric; - - if (metricMap.containsKey("value")) { - found.set(true); - } - }); - } - } catch (IOException e) { - // no-op - } - - return found.get(); - }); - - assertTrue(valid); - } - - // Lists - - @Test - @Order(11) - public void listTestRuns() { - RequestOptions reqOpts = new RequestOptions().addQueryParam("testId", existingTestId); - PagedIterable response = getLoadTestRunClient().listTestRuns(reqOpts); - boolean found = response.stream().anyMatch(testRunBinary -> { - try (JsonReader jsonReader = JsonProviders.createReader(testRunBinary.toBytes())) { - Map jsonTree = jsonReader.readMap(JsonReader::readUntyped); - - assertEquals(newTestRunId, jsonTree.get("testRunId")); - assertEquals(existingTestId, jsonTree.get("testId")); - - return true; - } catch (IOException e) { - // no-op - } - - return false; - }); - - assertTrue(found); - } - - // Deletes - - @Test - @Order(12) - public void deleteTestRun() { - assertDoesNotThrow(() -> { - getLoadTestRunClient().deleteTestRunWithResponse(newTestRunId, null); - }); - } -} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestingClientTestBase.java b/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestingClientTestBase.java deleted file mode 100644 index 66c0ed8952e0f..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/test/java/com/azure/developer/loadtesting/LoadTestingClientTestBase.java +++ /dev/null @@ -1,258 +0,0 @@ -// 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.credential.TokenCredential; -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.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.test.http.AssertingHttpClientBuilder; -import com.azure.core.test.models.TestProxyRequestMatcher; -import com.azure.core.test.models.TestProxyRequestMatcher.TestProxyRequestMatcherType; -import com.azure.core.test.models.TestProxySanitizer; -import com.azure.core.test.models.TestProxySanitizerType; -import com.azure.core.test.utils.MockTokenCredential; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.identity.AzureCliCredentialBuilder; -import com.azure.identity.AzureDeveloperCliCredentialBuilder; -import com.azure.identity.AzurePipelinesCredentialBuilder; -import com.azure.identity.AzurePowerShellCredentialBuilder; -import com.azure.identity.ChainedTokenCredentialBuilder; -import com.azure.identity.DefaultAzureCredentialBuilder; -import com.azure.identity.EnvironmentCredentialBuilder; -import reactor.core.publisher.Mono; - -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -class LoadTestingClientTestBase extends TestProxyTestBase { - private static final String URL_REGEX = "(?<=http:\\/\\/|https:\\/\\/)([^\\/?]+)"; - private final String defaultEndpoint = "REDACTED.eastus.cnt-prod.loadtesting.azure.com"; - - protected final String existingTestId = Configuration.getGlobalConfiguration().get("EXISTING_TEST_ID", - "11111111-1234-1234-1234-123456789012"); - protected final String newTestId = Configuration.getGlobalConfiguration().get("NEW_TEST_ID", - "22222222-1234-1234-1234-123456789012"); - protected final String newTestIdAsync = Configuration.getGlobalConfiguration().get("NEW_TEST_ID", - "22223333-1234-1234-1234-123456789012"); - protected final String newTestRunId = Configuration.getGlobalConfiguration().get("NEW_TEST_RUN_ID", - "33333333-1234-1234-1234-123456789012"); - protected final String newTestRunIdAsync = Configuration.getGlobalConfiguration().get("NEW_TEST_RUN_ID_2", - "44444444-1234-1234-1234-123456789012"); - protected final String uploadJmxFileName = Configuration.getGlobalConfiguration().get("UPLOAD_JMX_FILE_NAME", - "sample-JMX-file.jmx"); - protected final String uploadCsvFileName = Configuration.getGlobalConfiguration().get("UPLOAD_CSV_FILE_NAME", - "additional-data.csv"); - protected final String defaultAppComponentResourceId = Configuration.getGlobalConfiguration().get( - "APP_COMPONENT_RESOURCE_ID", - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource"); - protected final String defaultServerMetricId = Configuration.getGlobalConfiguration().get("SERVER_METRIC_ID", - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration"); - - @Override - protected void beforeTest() { - if (getTestMode() != TestMode.LIVE) { - List sanitizers = new ArrayList<>(); - sanitizers.add(new TestProxySanitizer("Location", - "https://[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}", - "https://REDACTED", TestProxySanitizerType.HEADER)); - sanitizers.add(new TestProxySanitizer(URL_REGEX, "REDACTED", TestProxySanitizerType.BODY_REGEX)); - interceptorManager.addSanitizers(sanitizers); - // Remove `operation-location`, `id` and `name` sanitizers from the list of common sanitizers. - interceptorManager.removeSanitizers("AZSDK2030", "AZSDK3430", "AZSDK3493"); - } - - if (getTestMode() == TestMode.PLAYBACK) { - List matchers = new ArrayList<>(); - matchers.add(new TestProxyRequestMatcher(TestProxyRequestMatcherType.BODILESS)); - interceptorManager.addMatchers(matchers); - } - } - - // Helpers - - protected LoadTestAdministrationClient getLoadTestAdministrationClient() { - return getLoadTestAdministrationClientBuilder(false).buildClient(); - } - - protected LoadTestAdministrationAsyncClient getLoadTestAdministrationAsyncClient() { - return getLoadTestAdministrationClientBuilder(true).buildAsyncClient(); - } - - protected LoadTestRunClient getLoadTestRunClient() { - return getLoadTestRunClientBuilder(false).buildClient(); - } - - protected LoadTestRunAsyncClient getLoadTestRunAsyncClient() { - return getLoadTestRunClientBuilder(true).buildAsyncClient(); - } - - protected Map getAppComponentBodyFromDict() { - Map appCompMap = new HashMap(); - Map compsMap = new HashMap(); - Map compMap = new HashMap(); - compMap.put("resourceId", defaultAppComponentResourceId); - compMap.put("resourceType", "microsoft.insights/components"); - compMap.put("resourceName", "appcomponentresource"); - compMap.put("displayName", "Performance_LoadTest_Insights"); - compMap.put("kind", "web"); - - compsMap.put(defaultAppComponentResourceId, compMap); - appCompMap.put("components", compsMap); - - return appCompMap; - } - - protected Map getServerMetricsBodyFromDict() { - Map serverMetricsMap = new HashMap(); - Map metricsMap = new HashMap(); - Map metricMap = new HashMap(); - metricMap.put("resourceId", defaultAppComponentResourceId); - metricMap.put("metricNamespace", "microsoft.insights/components"); - metricMap.put("name", "requests/duration"); - metricMap.put("aggregation", "Average"); - metricMap.put("resourceType", "microsoft.insights/components"); - - metricsMap.put(defaultServerMetricId, metricMap); - serverMetricsMap.put("metrics", metricsMap); - - return serverMetricsMap; - } - - private TokenCredential getTokenCredential() { - String authorityHost = Configuration.getGlobalConfiguration().get("AUTHORITY_HOST"); - - switch (getTestMode()) { - case RECORD: - DefaultAzureCredentialBuilder defaultAzureCredentialBuilder = new DefaultAzureCredentialBuilder(); - - if (authorityHost != null && !authorityHost.isEmpty()) { - defaultAzureCredentialBuilder.authorityHost(authorityHost); - } - - return defaultAzureCredentialBuilder.build(); - case LIVE: - Configuration config = Configuration.getGlobalConfiguration(); - EnvironmentCredentialBuilder environmentCredentialBuilder = new EnvironmentCredentialBuilder(); - - if (authorityHost != null && !authorityHost.isEmpty()) { - environmentCredentialBuilder.authorityHost(authorityHost); - } - - ChainedTokenCredentialBuilder chainedTokenCredentialBuilder = new ChainedTokenCredentialBuilder() - .addLast(environmentCredentialBuilder.build()) - .addLast(new AzureCliCredentialBuilder().build()) - .addLast(new AzureDeveloperCliCredentialBuilder().build()) - .addLast(new AzurePowerShellCredentialBuilder().build()); - - String serviceConnectionId = config.get("AZURESUBSCRIPTION_SERVICE_CONNECTION_ID"); - String clientId = config.get("AZURESUBSCRIPTION_CLIENT_ID"); - String tenantId = config.get("AZURESUBSCRIPTION_TENANT_ID"); - String systemAccessToken = config.get("SYSTEM_ACCESSTOKEN"); - - if (!CoreUtils.isNullOrEmpty(serviceConnectionId) - && !CoreUtils.isNullOrEmpty(clientId) - && !CoreUtils.isNullOrEmpty(tenantId) - && !CoreUtils.isNullOrEmpty(systemAccessToken)) { - - chainedTokenCredentialBuilder.addLast(new AzurePipelinesCredentialBuilder() - .systemAccessToken(systemAccessToken) - .clientId(clientId) - .tenantId(tenantId) - .serviceConnectionId(serviceConnectionId) - .build()); - } - - return chainedTokenCredentialBuilder.build(); - default: - // On PLAYBACK mode - return new MockTokenCredential(); - } - } - - private HttpClient buildAsyncAssertingClient(HttpClient httpClient) { - return new AssertingHttpClientBuilder(httpClient) - .assertAsync() - .build(); - } - - private HttpClient buildSyncAssertingClient(HttpClient httpClient) { - return new AssertingHttpClientBuilder(httpClient) - .assertSync() - .build(); - } - - private HttpClient getTestModeHttpClient() { - HttpClient httpClient; - if (getTestMode() == TestMode.PLAYBACK) { - httpClient = interceptorManager.getPlaybackClient(); - } else { - httpClient = HttpClient.createDefault(); - } - return httpClient; - } - - private LoadTestAdministrationClientBuilder getLoadTestAdministrationClientBuilder(boolean async) { - HttpClient httpClient = getTestModeHttpClient(); - - if (async) { - httpClient = buildAsyncAssertingClient(httpClient); - } else { - httpClient = buildSyncAssertingClient(httpClient); - } - - LoadTestAdministrationClientBuilder loadTestAdministrationClientBuilder = new LoadTestAdministrationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", defaultEndpoint)) - .httpClient(httpClient) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - - if (getTestMode() == TestMode.PLAYBACK) { - loadTestAdministrationClientBuilder - .credential(new MockTokenCredential()); - } else if (getTestMode() == TestMode.RECORD) { - loadTestAdministrationClientBuilder - .addPolicy(interceptorManager.getRecordPolicy()) - .credential(getTokenCredential()); - } else if (getTestMode() == TestMode.LIVE) { - loadTestAdministrationClientBuilder.credential(getTokenCredential()); - } - - return loadTestAdministrationClientBuilder; - } - - private LoadTestRunClientBuilder getLoadTestRunClientBuilder(boolean async) { - HttpClient httpClient = getTestModeHttpClient(); - - if (async) { - httpClient = buildAsyncAssertingClient(httpClient); - } else { - httpClient = buildSyncAssertingClient(httpClient); - } - - LoadTestRunClientBuilder loadTestRunClientBuilder = new LoadTestRunClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", defaultEndpoint)) - .httpClient(httpClient) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - - if (getTestMode() == TestMode.PLAYBACK) { - loadTestRunClientBuilder - .credential(request -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX))); - } else if (getTestMode() == TestMode.RECORD) { - loadTestRunClientBuilder - .addPolicy(interceptorManager.getRecordPolicy()) - .credential(getTokenCredential()); - } else if (getTestMode() == TestMode.LIVE) { - loadTestRunClientBuilder.credential(getTokenCredential()); - } - - return loadTestRunClientBuilder; - } -} diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/test/resources/additional-data.csv b/sdk/loadtesting/azure-developer-loadtesting/src/test/resources/additional-data.csv deleted file mode 100644 index 96dbf5b98a393..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/test/resources/additional-data.csv +++ /dev/null @@ -1,2 +0,0 @@ -a,b,c,d -1,2,3,4 diff --git a/sdk/loadtesting/azure-developer-loadtesting/src/test/resources/sample-JMX-file.jmx b/sdk/loadtesting/azure-developer-loadtesting/src/test/resources/sample-JMX-file.jmx deleted file mode 100644 index 52feae899c0d3..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/src/test/resources/sample-JMX-file.jmx +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - 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/loadtesting/azure-developer-loadtesting/swagger/autorest.md b/sdk/loadtesting/azure-developer-loadtesting/swagger/autorest.md deleted file mode 100644 index 42a36534b9793..0000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/swagger/autorest.md +++ /dev/null @@ -1,59 +0,0 @@ -# Azure Load Test Service for Java - -> see https://aka.ms/autorest - -This is the AutoRest configuration file for Load Test Service. - ---- -## Getting Started -To build the SDKs for Load Test Service, simply [Install Autorest](https://aka.ms/autorest) and in this folder, run: - -> `autorest` - -To see additional help and options, run: - -> `autorest --help` - -### Setup -```ps -npm install -g autorest -``` - -### Generation - -```ps -cd -autorest -``` - -### Configuration - -```yaml -use: '@autorest/java@4.1.26' -output-folder: ../ -java: true -input-file: https://github.com/Azure/azure-rest-api-specs/blob/3e27c70e7c02c07b458bc0e94716c3d82d3fdd19/specification/loadtestservice/data-plane/Microsoft.LoadTestService/stable/2022-11-01/loadtestservice.json -title: LoadTestingClient -namespace: com.azure.developer.loadtesting -artifact-id: azure-developer-loadtesting -enable-sync-stack: true -generate-builder-per-client: true -data-plane: true -security: AADToken -security-scopes: https://cnt-prod.loadtesting.azure.com/.default -partial-update: true -stream-style-serialization: true -service-versions: -- '2022-11-01' -directive: -- rename-operation: - from: LoadTestRun_ListMetricNamespaces - to: LoadTestRun_GetMetricNamespaces -- rename-operation: - from: LoadTestRun_ListMetricDefinitions - to: LoadTestRun_GetMetricDefinitions -- where-operation: LoadTestRun_ListMetrics - transform: $['parameters'][3]['x-ms-client-name'] = 'metricName' -- where-operation: LoadTestRun_ListMetricDimensionValues - transform: $['parameters'][3]['x-ms-client-name'] = 'metricName' -``` diff --git a/sdk/loadtesting/azure-developer-loadtesting/tsp-location.yaml b/sdk/loadtesting/azure-developer-loadtesting/tsp-location.yaml new file mode 100644 index 0000000000000..6febaa0b90f19 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/loadtestservice/LoadTestService +commit: 79970e07d1956a072e69c5edc2df82e839e4d04c +repo: Azure/azure-rest-api-specs +additionalDirectories: