diff --git a/sdk/loadtesting/load-testing-rest/CHANGELOG.md b/sdk/loadtesting/load-testing-rest/CHANGELOG.md deleted file mode 100644 index 5c6f7c889afc..000000000000 --- a/sdk/loadtesting/load-testing-rest/CHANGELOG.md +++ /dev/null @@ -1,46 +0,0 @@ -# Release History - -## 1.1.0-beta.1 (2025-03-20) - -Updated the client library to use API Version 2025-05-01-preview. This adds all the capabilities that were introduced until this API version. - -### Features Added - -- Support for AutoStop Criteria -- Support for Quick Load Tests with RPS Inputs -- Support for URL Tests with JSON based test plans -- Support for Locust Load Tests -- Support for Multi Region Load Tests -- Support for Disabling Public IP Deployment for Private Load Tests -- Support for uploading ZIP Artifacts -- Support for all Test Profiles & Test Profile Run Scenarios - -## 1.0.1 (2025-01-20) - -### Other Changes - -- Add NOT_VALIDATED to the list of terminal states for the file validation poller. - -## 1.0.0 (2023-03-07) - -First stable release of Azure Load Testing client library for Javascript. - -## 1.0.0-beta.2 (2023-01-26) - -Second preview release of Azure Load Testing client library for Javascript. - -### Features Added - -- Added `LoadTestClient.getLongRunningPoller` Long-Running operation helper - -### Breaking Changes - -- 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` - -## 1.0.0-beta.1 (2022-10-19) - -### Features Added - -Initial release of the Azure LoadTesting package diff --git a/sdk/loadtesting/load-testing-rest/LICENSE b/sdk/loadtesting/load-testing-rest/LICENSE deleted file mode 100644 index b2f52a2bad4e..000000000000 --- a/sdk/loadtesting/load-testing-rest/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) Microsoft Corporation. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/sdk/loadtesting/load-testing-rest/README.md b/sdk/loadtesting/load-testing-rest/README.md deleted file mode 100644 index 0c15ddb87f81..000000000000 --- a/sdk/loadtesting/load-testing-rest/README.md +++ /dev/null @@ -1,282 +0,0 @@ -# Azure Load Testing client library for JavaScript - -Azure Load Testing provides client library in JavaScript 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. - -**Please rely heavily on our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this 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] - -## Getting started - -### Currently supported environments - -- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) -- Latest versions of Safari, Chrome, Edge and Firefox - -### Prerequisites - -- You must have an [Azure subscription](https://azure.microsoft.com/free/) and [Azure Load Test Service Resource](https://learn.microsoft.com/azure/load-testing/) to use this package. You can create the resource via the [Azure Portal](https://portal.azure.com), or the [Azure CLI](https://learn.microsoft.com/cli/azure). - -### Install the `@azure-rest/load-testing` package - -Install the Azure Load Testing client REST client library for JavaScript with `npm`: - -```bash -npm install @azure-rest/load-testing -``` - -### Create and authenticate a `AzureLoadTesting` client - -To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token), -provide an instance of the desired credential type obtained from the -[@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library. - -To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity) - -After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from `@azure/identity` to use. -As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential) -can be used to authenticate the client. - -Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: -AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET - -```ts snippet:ReadmeSampleCreateClient_Node -import AzureLoadTesting from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; - -const endpoint = "https://"; -const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); -``` - -## Key concepts - -The following components make up the Azure Load Testing Service. The Azure Load Test client library for JavaScript allows you to interact with each of these components through the use of a dedicated client object. - -#### 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 Engine - -A test engine is computing infrastructure that runs the Apache JMeter or Locust test script. You can scale out your load test by configuring the number of test engines. The test script runs in parallel across the specified number of test engines. - -### Test Run - -A test run represents one execution of a load test. It collects the logs associated with running the Apache JMeter or Locust 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. To obtain the data-plane endpoint for your resource, follow [this documentation][obtaining_data_plane_uri]. - -**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 - -```ts snippet:ReadmeSampleCreateLoadTest -import AzureLoadTesting from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; - -const endpoint = "https://"; -const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - -const TEST_ID = "some-test-id"; -const DISPLAY_NAME = "my-load-test"; - -await client.path("/tests/{testId}", TEST_ID).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: DISPLAY_NAME, - description: "", - loadTestConfiguration: { - engineInstances: 1, - splitAllCSVs: false, - }, - secrets: {}, - environmentVariables: {}, - passFailCriteria: { passFailMetrics: {} }, - }, -}); -``` - -### Uploading Test script file to a Test - -```ts snippet:ReadmeSampleUploadTestScriptFile -import AzureLoadTesting, { isUnexpected, getLongRunningPoller } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; -import { createReadStream } from "node:fs"; - -const endpoint = "https://"; -const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - -const TEST_ID = "some-test-id"; -const readStream = createReadStream("./sample.jmx"); - -const fileUploadResult = await client - .path("/tests/{testId}/files/{fileName}", TEST_ID, "sample.jmx") - .put({ - contentType: "application/octet-stream", - body: readStream, - }); - -if (isUnexpected(fileUploadResult)) { - throw fileUploadResult.body.error; -} - -const fileValidatePoller = await getLongRunningPoller(client, fileUploadResult); -const fileValidateResult = await fileValidatePoller.pollUntilDone(); -``` - -### Running a Test and fetching Metrics - -```ts snippet:ReadmeSampleRunTest -import AzureLoadTesting, { isUnexpected, getLongRunningPoller } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; - -const endpoint = "https://"; -const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - -const TEST_ID = "some-test-id"; -const DISPLAY_NAME = "my-load-test"; -const TEST_RUN_ID = "some-test-run-id"; - -// Creating/Updating the test run -const testRunCreationResult = await client.path("/test-runs/{testRunId}", TEST_RUN_ID).patch({ - contentType: "application/merge-patch+json", - body: { - testId: TEST_ID, - displayName: DISPLAY_NAME, - }, -}); - -if (isUnexpected(testRunCreationResult)) { - throw testRunCreationResult.body.error; -} - -const testRunPoller = await getLongRunningPoller(client, testRunCreationResult); -const testRunResult = await testRunPoller.pollUntilDone(); - -const testRunStarttime = testRunResult.body.startDateTime; -const testRunEndTime = testRunResult.body.endDateTime; - -// get list of all metric namespaces and pick the first one -const metricNamespaces = await client - .path("/test-runs/{testRunId}/metric-namespaces", TEST_RUN_ID) - .get(); - -if (isUnexpected(metricNamespaces)) { - throw metricNamespaces.body.error; -} - -const metricNamespace = metricNamespaces.body.value[0]; - -if (metricNamespace.name === undefined) { - throw "No Metric Namespace name is defined."; -} - -// get list of all metric definitions and pick the first one -const metricDefinitions = await client - .path("/test-runs/{testRunId}/metric-definitions", TEST_RUN_ID) - .get({ - queryParameters: { - metricNamespace: metricNamespace.name, - }, - }); - -if (isUnexpected(metricDefinitions)) { - throw metricDefinitions.body.error; -} - -const metricDefinition = metricDefinitions.body.value[0]; - -if (metricDefinition.name === undefined) { - throw "No Metric Namespace name is defined."; -} - -// fetch client metrics using metric namespace and metric name -const metricsResult = await client.path("/test-runs/{testRunId}/metrics", TEST_RUN_ID).post({ - queryParameters: { - metricname: metricDefinition.name, - metricNamespace: metricNamespace.name, - timespan: testRunStarttime + "/" + testRunEndTime, - }, -}); - -if (isUnexpected(metricsResult)) { - throw metricsResult.body.error; -} - -for (const timeSeries of metricsResult.body.value) { - console.log(timeSeries); -} -``` - -## Troubleshooting - -### Logging - -Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: - -```ts snippet:SetLogLevel -import { setLogLevel } from "@azure/logger"; - -setLogLevel("info"); -``` - -For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). - -## Next steps - -Azure Loading Testing JavaScript 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-js/blob/main/CONTRIBUTING.md) to learn more on how to build and test the code. - -1. Fork it -2. Create your feature branch (`git checkout -b my-new-feature`) -3. Commit your changes (`git commit -am 'Add some feature'`) -4. Push to the branch (`git push origin my-new-feature`) -5. Create new Pull Request - -## Related Projects - -- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) - - - -[source_code]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtesting/load-testing-rest/src -[sample_code]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtesting/load-testing-rest/samples/v1-beta -[api_reference_doc]: https://learn.microsoft.com/rest/api/loadtesting/ -[obtaining_data_plane_uri]: https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri -[product_documentation]: https://azure.microsoft.com/services/load-testing/ -[azure_subscription]: https://azure.microsoft.com/free/ diff --git a/sdk/loadtesting/load-testing-rest/api-extractor.json b/sdk/loadtesting/load-testing-rest/api-extractor.json deleted file mode 100644 index 52de93127a2c..000000000000 --- a/sdk/loadtesting/load-testing-rest/api-extractor.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - "mainEntryPointFilePath": "dist/esm/index.d.ts", - "docModel": { - "enabled": true - }, - "apiReport": { - "enabled": true, - "reportFolder": "./review" - }, - "dtsRollup": { - "enabled": true, - "untrimmedFilePath": "", - "publicTrimmedFilePath": "dist/load-testing.d.ts" - }, - "messages": { - "tsdocMessageReporting": { - "default": { - "logLevel": "none" - } - }, - "extractorMessageReporting": { - "ae-missing-release-tag": { - "logLevel": "none" - }, - "ae-unresolved-link": { - "logLevel": "none" - } - } - } -} diff --git a/sdk/loadtesting/load-testing-rest/assets.json b/sdk/loadtesting/load-testing-rest/assets.json deleted file mode 100644 index 1ea75c8986e2..000000000000 --- a/sdk/loadtesting/load-testing-rest/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "js", - "TagPrefix": "js/loadtesting/load-testing-rest", - "Tag": "js/loadtesting/load-testing-rest_a0471fa480" -} diff --git a/sdk/loadtesting/load-testing-rest/eslint.config.mjs b/sdk/loadtesting/load-testing-rest/eslint.config.mjs deleted file mode 100644 index 7e90a7fc519b..000000000000 --- a/sdk/loadtesting/load-testing-rest/eslint.config.mjs +++ /dev/null @@ -1,9 +0,0 @@ -import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; - -export default azsdkEslint.config([ - { - rules: { - "tsdoc/syntax": "warn", - }, - }, -]); diff --git a/sdk/loadtesting/load-testing-rest/package.json b/sdk/loadtesting/load-testing-rest/package.json deleted file mode 100644 index 7714c964a887..000000000000 --- a/sdk/loadtesting/load-testing-rest/package.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "name": "@azure-rest/load-testing", - "sdk-type": "client", - "author": "Microsoft Corporation", - "version": "1.1.0-beta.1", - "description": "This package contains Microsoft Azure LoadTestingClient client library.", - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], - "license": "MIT", - "main": "./dist/commonjs/index.js", - "module": "./dist/esm/index.js", - "types": "./dist/commonjs/index.d.ts", - "repository": "github:Azure/azure-sdk-for-js", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "files": [ - "dist/", - "README.md", - "LICENSE", - "review/", - "CHANGELOG.md" - ], - "//sampleConfiguration": { - "productName": "Azure Load Testing", - "productSlugs": [ - "azure", - "azure-load-testing" - ], - "requiredResources": { - "Azure Load Testing Resource": "https://learn.microsoft.com/azure/load-testing/" - } - }, - "engines": { - "node": ">=18.0.0" - }, - "scripts": { - "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", - "build:samples": "echo skipped.", - "build:test": "echo skipped.", - "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"", - "clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "execute:samples": "echo skipped", - "extract-api": "dev-tool run vendored rimraf review && dev-tool run extract-api", - "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"", - "generate:client": "autorest --typescript swagger/README.md && npm run format", - "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser", - "integration-test:node": "dev-tool run test:vitest --esm", - "lint": "eslint package.json api-extractor.json src test", - "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", - "pack": "npm pack 2>&1", - "test": "npm run clean && npm run build:test && npm run unit-test", - "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser", - "test:node": "npm run clean && npm run build:test && npm run unit-test:node", - "unit-test": "npm run unit-test:node && npm run unit-test:browser", - "unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser", - "unit-test:node": "dev-tool run test:vitest", - "update-snippets": "dev-tool run update-snippets" - }, - "sideEffects": false, - "autoPublish": false, - "dependencies": { - "@azure-rest/core-client": "^2.3.1", - "@azure/abort-controller": "^2.1.2", - "@azure/core-auth": "^1.9.0", - "@azure/core-lro": "^2.7.2", - "@azure/core-paging": "^1.6.2", - "@azure/core-rest-pipeline": "^1.19.0", - "@azure/core-util": "^1.11.0", - "@azure/logger": "^1.1.4", - "tslib": "^2.8.1" - }, - "devDependencies": { - "@azure-tools/test-credential": "^2.0.0", - "@azure-tools/test-recorder": "^4.1.0", - "@azure-tools/test-utils-vitest": "^1.0.0", - "@azure/dev-tool": "^1.0.0", - "@azure/eslint-plugin-azure-sdk": "^3.0.0", - "@azure/identity": "^4.6.0", - "@types/node": "^18.0.0", - "@vitest/browser": "^3.0.9", - "@vitest/coverage-istanbul": "^3.0.9", - "autorest": "latest", - "dotenv": "^16.0.0", - "eslint": "^9.9.0", - "playwright": "^1.50.1", - "typescript": "~5.8.2", - "vitest": "^3.0.9" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtesting/load-testing-rest/README.md", - "//metadata": { - "constantPaths": [ - { - "path": "swagger/README.md", - "prefix": "package-version" - }, - { - "path": "src/azureLoadTesting.ts", - "prefix": "userAgentInfo" - } - ] - }, - "browser": "./dist/browser/index.js", - "type": "module", - "tshy": { - "project": "./tsconfig.src.json", - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts" - }, - "dialects": [ - "esm", - "commonjs" - ], - "esmDialects": [ - "browser", - "react-native" - ], - "selfLink": false - }, - "exports": { - "./package.json": "./package.json", - ".": { - "browser": { - "types": "./dist/browser/index.d.ts", - "default": "./dist/browser/index.js" - }, - "react-native": { - "types": "./dist/react-native/index.d.ts", - "default": "./dist/react-native/index.js" - }, - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - } - }, - "react-native": "./dist/react-native/index.js" -} diff --git a/sdk/loadtesting/load-testing-rest/review/load-testing.api.md b/sdk/loadtesting/load-testing-rest/review/load-testing.api.md deleted file mode 100644 index c1c984c1cd81..000000000000 --- a/sdk/loadtesting/load-testing-rest/review/load-testing.api.md +++ /dev/null @@ -1,3110 +0,0 @@ -## API Report File for "@azure-rest/load-testing" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { ErrorResponse } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { OperationState } from '@azure/core-lro'; -import type { PathUncheckedResponse } from '@azure-rest/core-client'; -import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { SimplePollerLike } from '@azure/core-lro'; -import type { StreamableMethod } from '@azure-rest/core-client'; -import type { TokenCredential } from '@azure/core-auth'; - -// @public -export type AggregationOutput = string; - -// @public -export interface AppComponent { - displayName?: string; - kind?: string; - resourceName: string; - resourceType: string; -} - -// @public -export interface AppComponentOutput { - displayName?: string; - kind?: string; - readonly resourceGroup?: string; - readonly resourceId: string; - resourceName: string; - resourceType: string; - readonly subscriptionId?: string; -} - -// @public -export interface ArtifactsContainerInfo { - expireDateTime?: Date | string; - url?: string; -} - -// @public -export interface ArtifactsContainerInfoOutput { - expireDateTime?: string; - url?: string; -} - -// @public -export interface AutoStopCriteria { - autoStopDisabled?: boolean; - errorRate?: number; - errorRateTimeWindowInSeconds?: number; -} - -// @public -export interface AutoStopCriteriaOutput { - autoStopDisabled?: boolean; - errorRate?: number; - errorRateTimeWindowInSeconds?: number; -} - -// @public (undocumented) -export type AzureLoadTestingClient = Client & { - path: Routes; -}; - -// @public -export interface AzureLoadTestingClientOptions extends ClientOptions { - apiVersion?: string; -} - -// @public -export interface CertificateMetadata { - name?: string; - type?: CertificateType; - value?: string; -} - -// @public -export interface CertificateMetadataOutput { - name?: string; - type?: CertificateTypeOutput; - value?: string; -} - -// @public -export type CertificateType = string; - -// @public -export type CertificateTypeOutput = string; - -// @public -function createClient(endpointParam: string, credentials: TokenCredential, { apiVersion, ...options }?: AzureLoadTestingClientOptions): AzureLoadTestingClient; -export default createClient; - -// @public -export type CreatedByType = string; - -// @public -export type CreatedByTypeOutput = string; - -// @public -export interface DailyRecurrence extends RecurrenceParent { - frequency: "Daily"; - interval: number; -} - -// @public -export interface DailyRecurrenceOutput extends RecurrenceOutputParent { - frequency: "Daily"; - interval: number; -} - -// @public -export interface DimensionFilter { - name?: string; - values?: string[]; -} - -// @public -export interface DimensionValueListOutput { - readonly name?: string; - nextLink?: string; - value?: string[]; -} - -// @public -export interface DimensionValueOutput { - name?: string; - value?: string; -} - -// @public -export interface ErrorDetails { -} - -// @public -export interface ErrorDetailsOutput { - readonly message?: string; -} - -// @public -export type FileType = string; - -// @public -export type FileTypeOutput = string; - -// @public -export type FileUploadAndValidatePoller = SimplePollerLike, LoadTestAdministrationGetTestFile200Response>; - -// @public -export type FileValidationStatus = string; - -// @public -export type FileValidationStatusOutput = string; - -// @public -export type Frequency = string; - -// @public -export type FrequencyOutput = string; - -// @public -export interface FunctionFlexConsumptionResourceConfiguration { - httpConcurrency?: number; - instanceMemoryMB: number; -} - -// @public -export interface FunctionFlexConsumptionResourceConfigurationOutput { - httpConcurrency?: number; - instanceMemoryMB: number; -} - -// @public -export interface FunctionFlexConsumptionTargetResourceConfigurations extends TargetResourceConfigurationsParent { - configurations?: Record; - kind: "FunctionsFlexConsumption"; -} - -// @public -export interface FunctionFlexConsumptionTargetResourceConfigurationsOutput extends TargetResourceConfigurationsOutputParent { - configurations?: Record; - kind: "FunctionsFlexConsumption"; -} - -// @public -export type GetArrayType = T extends Array ? TData : never; - -// @public (undocumented) -export function getLongRunningPoller(client: AzureLoadTestingClient, initialResponse: TestUploadFileSuccessResponse): Promise; - -// @public (undocumented) -export function getLongRunningPoller(client: AzureLoadTestingClient, initialResponse: TestRunCreateOrUpdateSuccessResponse): Promise; - -// @public (undocumented) -export function getLongRunningPoller(client: AzureLoadTestingClient, initialResponse: TestProfileRunCreateOrUpdateSuccessResponse): Promise; - -// @public -export type GetPage = (pageLink: string) => Promise<{ - page: TPage; - nextPageLink?: string; -}>; - -// @public -export interface HourlyRecurrence extends RecurrenceParent { - frequency: "Hourly"; - interval: number; -} - -// @public -export interface HourlyRecurrenceOutput extends RecurrenceOutputParent { - frequency: "Hourly"; - interval: number; -} - -// @public (undocumented) -export function isUnexpected(response: LoadTestAdministrationCreateOrUpdateTest200Response | LoadTestAdministrationCreateOrUpdateTest201Response | LoadTestAdministrationCreateOrUpdateTestDefaultResponse): response is LoadTestAdministrationCreateOrUpdateTestDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestAdministrationDeleteTest204Response | LoadTestAdministrationDeleteTestDefaultResponse): response is LoadTestAdministrationDeleteTestDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestAdministrationGetTest200Response | LoadTestAdministrationGetTestDefaultResponse): response is LoadTestAdministrationGetTestDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestAdministrationListTests200Response | LoadTestAdministrationListTestsDefaultResponse): response is LoadTestAdministrationListTestsDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestAdministrationUploadTestFile201Response | LoadTestAdministrationUploadTestFileDefaultResponse): response is LoadTestAdministrationUploadTestFileDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestAdministrationGetTestFile200Response | LoadTestAdministrationGetTestFileDefaultResponse): response is LoadTestAdministrationGetTestFileDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestAdministrationDeleteTestFile204Response | LoadTestAdministrationDeleteTestFileDefaultResponse): response is LoadTestAdministrationDeleteTestFileDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestAdministrationListTestFiles200Response | LoadTestAdministrationListTestFilesDefaultResponse): response is LoadTestAdministrationListTestFilesDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestAdministrationCreateOrUpdateAppComponents200Response | LoadTestAdministrationCreateOrUpdateAppComponents201Response | LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse): response is LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestAdministrationGetAppComponents200Response | LoadTestAdministrationGetAppComponentsDefaultResponse): response is LoadTestAdministrationGetAppComponentsDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response | LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response | LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse): response is LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestAdministrationGetServerMetricsConfig200Response | LoadTestAdministrationGetServerMetricsConfigDefaultResponse): response is LoadTestAdministrationGetServerMetricsConfigDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: TestProfileAdministrationCreateOrUpdateTestProfile200Response | TestProfileAdministrationCreateOrUpdateTestProfile201Response | TestProfileAdministrationCreateOrUpdateTestProfileDefaultResponse): response is TestProfileAdministrationCreateOrUpdateTestProfileDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: TestProfileAdministrationDeleteTestProfile204Response | TestProfileAdministrationDeleteTestProfileDefaultResponse): response is TestProfileAdministrationDeleteTestProfileDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: TestProfileAdministrationGetTestProfile200Response | TestProfileAdministrationGetTestProfileDefaultResponse): response is TestProfileAdministrationGetTestProfileDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: TestProfileAdministrationListTestProfiles200Response | TestProfileAdministrationListTestProfilesDefaultResponse): response is TestProfileAdministrationListTestProfilesDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestRunGetTestRun200Response | LoadTestRunGetTestRunDefaultResponse): response is LoadTestRunGetTestRunDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestRunCreateOrUpdateTestRun200Response | LoadTestRunCreateOrUpdateTestRun201Response | LoadTestRunCreateOrUpdateTestRunDefaultResponse): response is LoadTestRunCreateOrUpdateTestRunDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestRunDeleteTestRun204Response | LoadTestRunDeleteTestRunDefaultResponse): response is LoadTestRunDeleteTestRunDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestRunListTestRuns200Response | LoadTestRunListTestRunsDefaultResponse): response is LoadTestRunListTestRunsDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestRunGetTestRunFile200Response | LoadTestRunGetTestRunFileDefaultResponse): response is LoadTestRunGetTestRunFileDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestRunStop200Response | LoadTestRunStopDefaultResponse): response is LoadTestRunStopDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestRunListMetricNamespaces200Response | LoadTestRunListMetricNamespacesDefaultResponse): response is LoadTestRunListMetricNamespacesDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestRunListMetricDefinitions200Response | LoadTestRunListMetricDefinitionsDefaultResponse): response is LoadTestRunListMetricDefinitionsDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestRunListMetrics200Response | LoadTestRunListMetricsDefaultResponse): response is LoadTestRunListMetricsDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestRunListMetricDimensionValues200Response | LoadTestRunListMetricDimensionValuesDefaultResponse): response is LoadTestRunListMetricDimensionValuesDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestRunCreateOrUpdateAppComponents200Response | LoadTestRunCreateOrUpdateAppComponents201Response | LoadTestRunCreateOrUpdateAppComponentsDefaultResponse): response is LoadTestRunCreateOrUpdateAppComponentsDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestRunGetAppComponents200Response | LoadTestRunGetAppComponentsDefaultResponse): response is LoadTestRunGetAppComponentsDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestRunCreateOrUpdateServerMetricsConfig200Response | LoadTestRunCreateOrUpdateServerMetricsConfig201Response | LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse): response is LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: LoadTestRunGetServerMetricsConfig200Response | LoadTestRunGetServerMetricsConfigDefaultResponse): response is LoadTestRunGetServerMetricsConfigDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: TestProfileRunAdministrationGetTestProfileRun200Response | TestProfileRunAdministrationGetTestProfileRunDefaultResponse): response is TestProfileRunAdministrationGetTestProfileRunDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: TestProfileRunAdministrationCreateOrUpdateTestProfileRun200Response | TestProfileRunAdministrationCreateOrUpdateTestProfileRun201Response | TestProfileRunAdministrationCreateOrUpdateTestProfileRunDefaultResponse): response is TestProfileRunAdministrationCreateOrUpdateTestProfileRunDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: TestProfileRunAdministrationDeleteTestProfileRun204Response | TestProfileRunAdministrationDeleteTestProfileRunDefaultResponse): response is TestProfileRunAdministrationDeleteTestProfileRunDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: TestProfileRunAdministrationStop200Response | TestProfileRunAdministrationStopDefaultResponse): response is TestProfileRunAdministrationStopDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: TestProfileRunAdministrationListTestProfileRuns200Response | TestProfileRunAdministrationListTestProfileRunsDefaultResponse): response is TestProfileRunAdministrationListTestProfileRunsDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: TriggerAdministrationGetTrigger200Response | TriggerAdministrationGetTriggerDefaultResponse): response is TriggerAdministrationGetTriggerDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: TriggerAdministrationCreateOrUpdateTrigger200Response | TriggerAdministrationCreateOrUpdateTrigger201Response | TriggerAdministrationCreateOrUpdateTriggerDefaultResponse): response is TriggerAdministrationCreateOrUpdateTriggerDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: TriggerAdministrationDeleteTrigger204Response | TriggerAdministrationDeleteTriggerDefaultResponse): response is TriggerAdministrationDeleteTriggerDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: TriggerAdministrationListTrigger200Response | TriggerAdministrationListTriggerDefaultResponse): response is TriggerAdministrationListTriggerDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: NotificationRuleAdministrationGetNotificationRule200Response | NotificationRuleAdministrationGetNotificationRuleDefaultResponse): response is NotificationRuleAdministrationGetNotificationRuleDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: NotificationRuleAdministrationCreateOrUpdateNotificationRule200Response | NotificationRuleAdministrationCreateOrUpdateNotificationRule201Response | NotificationRuleAdministrationCreateOrUpdateNotificationRuleDefaultResponse): response is NotificationRuleAdministrationCreateOrUpdateNotificationRuleDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: NotificationRuleAdministrationDeleteNotificationRule204Response | NotificationRuleAdministrationDeleteNotificationRuleDefaultResponse): response is NotificationRuleAdministrationDeleteNotificationRuleDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: NotificationRuleAdministrationListNotificationRule200Response | NotificationRuleAdministrationListNotificationRuleDefaultResponse): response is NotificationRuleAdministrationListNotificationRuleDefaultResponse; - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateAppComponents { - get(options?: LoadTestAdministrationGetAppComponentsParameters): StreamableMethod; - patch(options: LoadTestAdministrationCreateOrUpdateAppComponentsParameters): StreamableMethod; -} - -// @public -export interface LoadTestAdministrationCreateOrUpdateAppComponents200Response extends HttpResponse { - // (undocumented) - body: TestAppComponentsOutput; - // (undocumented) - status: "200"; -} - -// @public -export interface LoadTestAdministrationCreateOrUpdateAppComponents201Response extends HttpResponse { - // (undocumented) - body: TestAppComponentsOutput; - // (undocumented) - status: "201"; -} - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateAppComponentsBodyParam { - body: TestAppComponentsResourceMergeAndPatch; -} - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateAppComponentsDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestAdministrationCreateOrUpdateAppComponentsDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateAppComponentsMediaTypesParam { - contentType: "application/merge-patch+json"; -} - -// @public (undocumented) -export type LoadTestAdministrationCreateOrUpdateAppComponentsParameters = LoadTestAdministrationCreateOrUpdateAppComponentsMediaTypesParam & LoadTestAdministrationCreateOrUpdateAppComponentsBodyParam & RequestParameters; - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfig { - get(options?: LoadTestAdministrationGetServerMetricsConfigParameters): StreamableMethod; - patch(options: LoadTestAdministrationCreateOrUpdateServerMetricsConfigParameters): StreamableMethod; -} - -// @public -export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response extends HttpResponse { - // (undocumented) - body: TestServerMetricsConfigurationOutput; - // (undocumented) - status: "200"; -} - -// @public -export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response extends HttpResponse { - // (undocumented) - body: TestServerMetricsConfigurationOutput; - // (undocumented) - status: "201"; -} - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigBodyParam { - body: TestServerMetricsConfigurationResourceMergeAndPatch; -} - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigMediaTypesParam { - contentType: "application/merge-patch+json"; -} - -// @public (undocumented) -export type LoadTestAdministrationCreateOrUpdateServerMetricsConfigParameters = LoadTestAdministrationCreateOrUpdateServerMetricsConfigMediaTypesParam & LoadTestAdministrationCreateOrUpdateServerMetricsConfigBodyParam & RequestParameters; - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateTest { - delete(options?: LoadTestAdministrationDeleteTestParameters): StreamableMethod; - get(options?: LoadTestAdministrationGetTestParameters): StreamableMethod; - patch(options: LoadTestAdministrationCreateOrUpdateTestParameters): StreamableMethod; -} - -// @public -export interface LoadTestAdministrationCreateOrUpdateTest200Response extends HttpResponse { - // (undocumented) - body: TestOutput; - // (undocumented) - status: "200"; -} - -// @public -export interface LoadTestAdministrationCreateOrUpdateTest201Response extends HttpResponse { - // (undocumented) - body: TestOutput; - // (undocumented) - status: "201"; -} - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateTestBodyParam { - body: TestResourceMergeAndPatch; -} - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateTestDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateTestDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestAdministrationCreateOrUpdateTestDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationCreateOrUpdateTestMediaTypesParam { - contentType: "application/merge-patch+json"; -} - -// @public (undocumented) -export type LoadTestAdministrationCreateOrUpdateTestParameters = LoadTestAdministrationCreateOrUpdateTestMediaTypesParam & LoadTestAdministrationCreateOrUpdateTestBodyParam & RequestParameters; - -// @public -export interface LoadTestAdministrationDeleteTest204Response extends HttpResponse { - // (undocumented) - status: "204"; -} - -// @public (undocumented) -export interface LoadTestAdministrationDeleteTestDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationDeleteTestDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestAdministrationDeleteTestDefaultHeaders; - // (undocumented) - status: string; -} - -// @public -export interface LoadTestAdministrationDeleteTestFile204Response extends HttpResponse { - // (undocumented) - status: "204"; -} - -// @public (undocumented) -export interface LoadTestAdministrationDeleteTestFileDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationDeleteTestFileDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestAdministrationDeleteTestFileDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestAdministrationDeleteTestFileParameters = RequestParameters; - -// @public (undocumented) -export type LoadTestAdministrationDeleteTestParameters = RequestParameters; - -// @public -export interface LoadTestAdministrationGetAppComponents200Response extends HttpResponse { - // (undocumented) - body: TestAppComponentsOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestAdministrationGetAppComponentsDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationGetAppComponentsDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestAdministrationGetAppComponentsDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestAdministrationGetAppComponentsParameters = RequestParameters; - -// @public -export interface LoadTestAdministrationGetServerMetricsConfig200Response extends HttpResponse { - // (undocumented) - body: TestServerMetricsConfigurationOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestAdministrationGetServerMetricsConfigDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationGetServerMetricsConfigDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestAdministrationGetServerMetricsConfigDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestAdministrationGetServerMetricsConfigParameters = RequestParameters; - -// @public -export interface LoadTestAdministrationGetTest200Response extends HttpResponse { - // (undocumented) - body: TestOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestAdministrationGetTestDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationGetTestDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestAdministrationGetTestDefaultHeaders; - // (undocumented) - status: string; -} - -// @public -export interface LoadTestAdministrationGetTestFile200Response extends HttpResponse { - // (undocumented) - body: TestFileInfoOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestAdministrationGetTestFileDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationGetTestFileDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestAdministrationGetTestFileDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestAdministrationGetTestFileParameters = RequestParameters; - -// @public (undocumented) -export type LoadTestAdministrationGetTestParameters = RequestParameters; - -// @public (undocumented) -export interface LoadTestAdministrationListTestFiles { - get(options?: LoadTestAdministrationListTestFilesParameters): StreamableMethod; -} - -// @public -export interface LoadTestAdministrationListTestFiles200Response extends HttpResponse { - // (undocumented) - body: PagedTestFileInfoOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestAdministrationListTestFilesDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationListTestFilesDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestAdministrationListTestFilesDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestAdministrationListTestFilesParameters = RequestParameters; - -// @public (undocumented) -export interface LoadTestAdministrationListTests { - get(options?: LoadTestAdministrationListTestsParameters): StreamableMethod; -} - -// @public -export interface LoadTestAdministrationListTests200Response extends HttpResponse { - // (undocumented) - body: PagedTestOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestAdministrationListTestsDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationListTestsDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestAdministrationListTestsDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestAdministrationListTestsParameters = LoadTestAdministrationListTestsQueryParam & RequestParameters; - -// @public (undocumented) -export interface LoadTestAdministrationListTestsQueryParam { - // (undocumented) - queryParameters?: LoadTestAdministrationListTestsQueryParamProperties; -} - -// @public (undocumented) -export interface LoadTestAdministrationListTestsQueryParamProperties { - lastModifiedEndTime?: Date | string; - lastModifiedStartTime?: Date | string; - maxpagesize?: number; - orderby?: string; - search?: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationUploadTestFile { - delete(options?: LoadTestAdministrationDeleteTestFileParameters): StreamableMethod; - get(options?: LoadTestAdministrationGetTestFileParameters): StreamableMethod; - put(options: LoadTestAdministrationUploadTestFileParameters): StreamableMethod; -} - -// @public -export interface LoadTestAdministrationUploadTestFile201Response extends HttpResponse { - // (undocumented) - body: TestFileInfoOutput; - // (undocumented) - status: "201"; -} - -// @public (undocumented) -export interface LoadTestAdministrationUploadTestFileBodyParam { - body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream; -} - -// @public (undocumented) -export interface LoadTestAdministrationUploadTestFileDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationUploadTestFileDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestAdministrationUploadTestFileDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export interface LoadTestAdministrationUploadTestFileMediaTypesParam { - contentType: "application/octet-stream"; -} - -// @public (undocumented) -export type LoadTestAdministrationUploadTestFileParameters = LoadTestAdministrationUploadTestFileQueryParam & LoadTestAdministrationUploadTestFileMediaTypesParam & LoadTestAdministrationUploadTestFileBodyParam & RequestParameters; - -// @public (undocumented) -export interface LoadTestAdministrationUploadTestFileQueryParam { - // (undocumented) - queryParameters?: LoadTestAdministrationUploadTestFileQueryParamProperties; -} - -// @public (undocumented) -export interface LoadTestAdministrationUploadTestFileQueryParamProperties { - fileType?: FileType; -} - -// @public -export interface LoadTestConfiguration { - engineInstances?: number; - optionalLoadTestConfig?: OptionalLoadTestConfiguration; - quickStartTest?: boolean; - regionalLoadTestConfig?: Array; - splitAllCSVs?: boolean; -} - -// @public -export interface LoadTestConfigurationOutput { - engineInstances?: number; - optionalLoadTestConfig?: OptionalLoadTestConfigurationOutput; - quickStartTest?: boolean; - regionalLoadTestConfig?: Array; - splitAllCSVs?: boolean; -} - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateAppComponents { - get(options?: LoadTestRunGetAppComponentsParameters): StreamableMethod; - patch(options: LoadTestRunCreateOrUpdateAppComponentsParameters): StreamableMethod; -} - -// @public -export interface LoadTestRunCreateOrUpdateAppComponents200Response extends HttpResponse { - // (undocumented) - body: TestRunAppComponentsOutput; - // (undocumented) - status: "200"; -} - -// @public -export interface LoadTestRunCreateOrUpdateAppComponents201Response extends HttpResponse { - // (undocumented) - body: TestRunAppComponentsOutput; - // (undocumented) - status: "201"; -} - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateAppComponentsBodyParam { - body: TestRunAppComponentsResourceMergeAndPatch; -} - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateAppComponentsDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateAppComponentsDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestRunCreateOrUpdateAppComponentsDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateAppComponentsMediaTypesParam { - contentType: "application/merge-patch+json"; -} - -// @public (undocumented) -export type LoadTestRunCreateOrUpdateAppComponentsParameters = LoadTestRunCreateOrUpdateAppComponentsMediaTypesParam & LoadTestRunCreateOrUpdateAppComponentsBodyParam & RequestParameters; - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateServerMetricsConfig { - get(options?: LoadTestRunGetServerMetricsConfigParameters): StreamableMethod; - patch(options: LoadTestRunCreateOrUpdateServerMetricsConfigParameters): StreamableMethod; -} - -// @public -export interface LoadTestRunCreateOrUpdateServerMetricsConfig200Response extends HttpResponse { - // (undocumented) - body: TestRunServerMetricsConfigurationOutput; - // (undocumented) - status: "200"; -} - -// @public -export interface LoadTestRunCreateOrUpdateServerMetricsConfig201Response extends HttpResponse { - // (undocumented) - body: TestRunServerMetricsConfigurationOutput; - // (undocumented) - status: "201"; -} - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateServerMetricsConfigBodyParam { - body: TestRunServerMetricsConfigurationResourceMergeAndPatch; -} - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateServerMetricsConfigDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestRunCreateOrUpdateServerMetricsConfigDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateServerMetricsConfigMediaTypesParam { - contentType: "application/merge-patch+json"; -} - -// @public (undocumented) -export type LoadTestRunCreateOrUpdateServerMetricsConfigParameters = LoadTestRunCreateOrUpdateServerMetricsConfigMediaTypesParam & LoadTestRunCreateOrUpdateServerMetricsConfigBodyParam & RequestParameters; - -// @public -export interface LoadTestRunCreateOrUpdateTestRun200Response extends HttpResponse { - // (undocumented) - body: TestRunOutput; - // (undocumented) - status: "200"; -} - -// @public -export interface LoadTestRunCreateOrUpdateTestRun201Response extends HttpResponse { - // (undocumented) - body: TestRunOutput; - // (undocumented) - status: "201"; -} - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateTestRunBodyParam { - body: TestRunResourceMergeAndPatch; -} - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateTestRunDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateTestRunDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestRunCreateOrUpdateTestRunDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateTestRunMediaTypesParam { - contentType: "application/merge-patch+json"; -} - -// @public (undocumented) -export type LoadTestRunCreateOrUpdateTestRunParameters = LoadTestRunCreateOrUpdateTestRunQueryParam & LoadTestRunCreateOrUpdateTestRunMediaTypesParam & LoadTestRunCreateOrUpdateTestRunBodyParam & RequestParameters; - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateTestRunQueryParam { - // (undocumented) - queryParameters?: LoadTestRunCreateOrUpdateTestRunQueryParamProperties; -} - -// @public (undocumented) -export interface LoadTestRunCreateOrUpdateTestRunQueryParamProperties { - oldTestRunId?: string; -} - -// @public -export interface LoadTestRunDeleteTestRun204Response extends HttpResponse { - // (undocumented) - status: "204"; -} - -// @public (undocumented) -export interface LoadTestRunDeleteTestRunDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestRunDeleteTestRunDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestRunDeleteTestRunDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestRunDeleteTestRunParameters = RequestParameters; - -// @public -export interface LoadTestRunGetAppComponents200Response extends HttpResponse { - // (undocumented) - body: TestRunAppComponentsOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestRunGetAppComponentsDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestRunGetAppComponentsDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestRunGetAppComponentsDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestRunGetAppComponentsParameters = RequestParameters; - -// @public -export interface LoadTestRunGetServerMetricsConfig200Response extends HttpResponse { - // (undocumented) - body: TestRunServerMetricsConfigurationOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestRunGetServerMetricsConfigDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestRunGetServerMetricsConfigDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestRunGetServerMetricsConfigDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestRunGetServerMetricsConfigParameters = RequestParameters; - -// @public (undocumented) -export interface LoadTestRunGetTestRun { - delete(options?: LoadTestRunDeleteTestRunParameters): StreamableMethod; - get(options?: LoadTestRunGetTestRunParameters): StreamableMethod; - patch(options: LoadTestRunCreateOrUpdateTestRunParameters): StreamableMethod; -} - -// @public -export interface LoadTestRunGetTestRun200Response extends HttpResponse { - // (undocumented) - body: TestRunOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestRunGetTestRunDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestRunGetTestRunDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestRunGetTestRunDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export interface LoadTestRunGetTestRunFile { - get(options?: LoadTestRunGetTestRunFileParameters): StreamableMethod; -} - -// @public -export interface LoadTestRunGetTestRunFile200Response extends HttpResponse { - // (undocumented) - body: TestRunFileInfoOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestRunGetTestRunFileDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestRunGetTestRunFileDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestRunGetTestRunFileDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestRunGetTestRunFileParameters = RequestParameters; - -// @public (undocumented) -export type LoadTestRunGetTestRunParameters = RequestParameters; - -// @public (undocumented) -export interface LoadTestRunListMetricDefinitions { - get(options: LoadTestRunListMetricDefinitionsParameters): StreamableMethod; -} - -// @public -export interface LoadTestRunListMetricDefinitions200Response extends HttpResponse { - // (undocumented) - body: MetricDefinitionCollectionOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestRunListMetricDefinitionsDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestRunListMetricDefinitionsDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestRunListMetricDefinitionsDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestRunListMetricDefinitionsParameters = LoadTestRunListMetricDefinitionsQueryParam & RequestParameters; - -// @public (undocumented) -export interface LoadTestRunListMetricDefinitionsQueryParam { - // (undocumented) - queryParameters: LoadTestRunListMetricDefinitionsQueryParamProperties; -} - -// @public (undocumented) -export interface LoadTestRunListMetricDefinitionsQueryParamProperties { - metricNamespace: string; -} - -// @public (undocumented) -export interface LoadTestRunListMetricDimensionValues { - get(options: LoadTestRunListMetricDimensionValuesParameters): StreamableMethod; -} - -// @public -export interface LoadTestRunListMetricDimensionValues200Response extends HttpResponse { - // (undocumented) - body: DimensionValueListOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestRunListMetricDimensionValuesDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestRunListMetricDimensionValuesDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestRunListMetricDimensionValuesDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestRunListMetricDimensionValuesParameters = LoadTestRunListMetricDimensionValuesQueryParam & RequestParameters; - -// @public (undocumented) -export interface LoadTestRunListMetricDimensionValuesQueryParam { - // (undocumented) - queryParameters: LoadTestRunListMetricDimensionValuesQueryParamProperties; -} - -// @public (undocumented) -export interface LoadTestRunListMetricDimensionValuesQueryParamProperties { - interval?: TimeGrain; - metricname: string; - metricNamespace: string; - timespan: string; -} - -// @public (undocumented) -export interface LoadTestRunListMetricNamespaces { - get(options?: LoadTestRunListMetricNamespacesParameters): StreamableMethod; -} - -// @public -export interface LoadTestRunListMetricNamespaces200Response extends HttpResponse { - // (undocumented) - body: MetricNamespaceCollectionOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestRunListMetricNamespacesDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestRunListMetricNamespacesDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestRunListMetricNamespacesDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestRunListMetricNamespacesParameters = RequestParameters; - -// @public (undocumented) -export interface LoadTestRunListMetrics { - post(options: LoadTestRunListMetricsParameters): StreamableMethod; -} - -// @public -export interface LoadTestRunListMetrics200Response extends HttpResponse { - // (undocumented) - body: MetricsOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestRunListMetricsBodyParam { - body?: MetricRequestPayload; -} - -// @public (undocumented) -export interface LoadTestRunListMetricsDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestRunListMetricsDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestRunListMetricsDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestRunListMetricsParameters = LoadTestRunListMetricsQueryParam & LoadTestRunListMetricsBodyParam & RequestParameters; - -// @public (undocumented) -export interface LoadTestRunListMetricsQueryParam { - // (undocumented) - queryParameters: LoadTestRunListMetricsQueryParamProperties; -} - -// @public (undocumented) -export interface LoadTestRunListMetricsQueryParamProperties { - aggregation?: string; - interval?: TimeGrain; - metricname: string; - metricNamespace: string; - timespan: string; -} - -// @public (undocumented) -export interface LoadTestRunListTestRuns { - get(options?: LoadTestRunListTestRunsParameters): StreamableMethod; -} - -// @public -export interface LoadTestRunListTestRuns200Response extends HttpResponse { - // (undocumented) - body: PagedTestRunOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestRunListTestRunsDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestRunListTestRunsDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestRunListTestRunsDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestRunListTestRunsParameters = LoadTestRunListTestRunsQueryParam & RequestParameters; - -// @public (undocumented) -export interface LoadTestRunListTestRunsQueryParam { - // (undocumented) - queryParameters?: LoadTestRunListTestRunsQueryParamProperties; -} - -// @public (undocumented) -export interface LoadTestRunListTestRunsQueryParamProperties { - executionFrom?: Date | string; - executionTo?: Date | string; - maxpagesize?: number; - orderby?: string; - search?: string; - status?: string; - testId?: string; -} - -// @public (undocumented) -export interface LoadTestRunStop { - post(options?: LoadTestRunStopParameters): StreamableMethod; -} - -// @public -export interface LoadTestRunStop200Response extends HttpResponse { - // (undocumented) - body: TestRunOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface LoadTestRunStopDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface LoadTestRunStopDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & LoadTestRunStopDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type LoadTestRunStopParameters = RequestParameters; - -// @public -export type ManagedIdentityType = string; - -// @public -export type ManagedIdentityTypeOutput = string; - -// @public -export interface MetricAvailabilityOutput { - timeGrain?: TimeGrainOutput; -} - -// @public -export interface MetricDefinitionCollectionOutput { - value: Array; -} - -// @public -export interface MetricDefinitionOutput { - description?: string; - dimensions?: Array; - metricAvailabilities?: Array; - name?: string; - namespace?: string; - primaryAggregationType?: AggregationOutput; - supportedAggregationTypes?: string[]; - unit?: MetricUnitOutput; -} - -// @public -export interface MetricNamespaceCollectionOutput { - value: Array; -} - -// @public -export interface MetricNamespaceOutput { - description?: string; - name?: string; -} - -// @public -export interface MetricRequestPayload { - filters?: Array; -} - -// @public -export interface MetricsOutput { - nextLink?: string; - value: Array; -} - -// @public -export type MetricUnitOutput = string; - -// @public -export interface MetricValueOutput { - timestamp?: string; - value?: number; -} - -// @public -export interface MonthlyRecurrenceByDates extends RecurrenceParent { - datesInMonth?: number[]; - frequency: "MonthlyByDates"; - interval?: number; -} - -// @public -export interface MonthlyRecurrenceByDatesOutput extends RecurrenceOutputParent { - datesInMonth?: number[]; - frequency: "MonthlyByDates"; - interval?: number; -} - -// @public -export interface MonthlyRecurrenceByWeekDays extends RecurrenceParent { - frequency: "MonthlyByDays"; - index: number; - interval: number; - weekDaysInMonth?: WeekDays[]; -} - -// @public -export interface MonthlyRecurrenceByWeekDaysOutput extends RecurrenceOutputParent { - frequency: "MonthlyByDays"; - index: number; - interval: number; - weekDaysInMonth?: WeekDaysOutput[]; -} - -// @public -export interface NameAndDescriptionOutput { - description?: string; - name?: string; -} - -// @public -export type NotificationEventType = string; - -// @public -export type NotificationEventTypeOutput = string; - -// @public -export type NotificationRule = NotificationRuleParent | TestsNotificationRule; - -// @public -export interface NotificationRuleAdministrationCreateOrUpdateNotificationRule200Response extends HttpResponse { - // (undocumented) - body: NotificationRuleOutput; - // (undocumented) - status: "200"; -} - -// @public -export interface NotificationRuleAdministrationCreateOrUpdateNotificationRule201Response extends HttpResponse { - // (undocumented) - body: NotificationRuleOutput; - // (undocumented) - status: "201"; -} - -// @public (undocumented) -export interface NotificationRuleAdministrationCreateOrUpdateNotificationRuleBodyParam { - body: NotificationRuleResourceMergeAndPatch; -} - -// @public (undocumented) -export interface NotificationRuleAdministrationCreateOrUpdateNotificationRuleDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface NotificationRuleAdministrationCreateOrUpdateNotificationRuleDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & NotificationRuleAdministrationCreateOrUpdateNotificationRuleDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export interface NotificationRuleAdministrationCreateOrUpdateNotificationRuleMediaTypesParam { - contentType: "application/merge-patch+json"; -} - -// @public (undocumented) -export type NotificationRuleAdministrationCreateOrUpdateNotificationRuleParameters = NotificationRuleAdministrationCreateOrUpdateNotificationRuleMediaTypesParam & NotificationRuleAdministrationCreateOrUpdateNotificationRuleBodyParam & RequestParameters; - -// @public -export interface NotificationRuleAdministrationDeleteNotificationRule204Response extends HttpResponse { - // (undocumented) - status: "204"; -} - -// @public (undocumented) -export interface NotificationRuleAdministrationDeleteNotificationRuleDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface NotificationRuleAdministrationDeleteNotificationRuleDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & NotificationRuleAdministrationDeleteNotificationRuleDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type NotificationRuleAdministrationDeleteNotificationRuleParameters = RequestParameters; - -// @public (undocumented) -export interface NotificationRuleAdministrationGetNotificationRule { - delete(options?: NotificationRuleAdministrationDeleteNotificationRuleParameters): StreamableMethod; - get(options?: NotificationRuleAdministrationGetNotificationRuleParameters): StreamableMethod; - patch(options: NotificationRuleAdministrationCreateOrUpdateNotificationRuleParameters): StreamableMethod; -} - -// @public -export interface NotificationRuleAdministrationGetNotificationRule200Response extends HttpResponse { - // (undocumented) - body: NotificationRuleOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface NotificationRuleAdministrationGetNotificationRuleDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface NotificationRuleAdministrationGetNotificationRuleDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & NotificationRuleAdministrationGetNotificationRuleDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type NotificationRuleAdministrationGetNotificationRuleParameters = RequestParameters; - -// @public (undocumented) -export interface NotificationRuleAdministrationListNotificationRule { - get(options?: NotificationRuleAdministrationListNotificationRuleParameters): StreamableMethod; -} - -// @public -export interface NotificationRuleAdministrationListNotificationRule200Response extends HttpResponse { - // (undocumented) - body: PagedNotificationRuleOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface NotificationRuleAdministrationListNotificationRuleDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface NotificationRuleAdministrationListNotificationRuleDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & NotificationRuleAdministrationListNotificationRuleDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type NotificationRuleAdministrationListNotificationRuleParameters = NotificationRuleAdministrationListNotificationRuleQueryParam & RequestParameters; - -// @public (undocumented) -export interface NotificationRuleAdministrationListNotificationRuleQueryParam { - // (undocumented) - queryParameters?: NotificationRuleAdministrationListNotificationRuleQueryParamProperties; -} - -// @public (undocumented) -export interface NotificationRuleAdministrationListNotificationRuleQueryParamProperties { - lastModifiedEndTime?: Date | string; - lastModifiedStartTime?: Date | string; - maxpagesize?: number; - scopes?: string; - testIds?: string; -} - -// @public -export type NotificationRuleOutput = NotificationRuleOutputParent | TestsNotificationRuleOutput; - -// @public -export interface NotificationRuleOutputParent { - actionGroupIds: string[]; - readonly createdBy?: string; - readonly createdDateTime?: string; - displayName: string; - readonly lastModifiedBy?: string; - readonly lastModifiedDateTime?: string; - readonly notificationRuleId: string; - // (undocumented) - scope: NotificationScopeTypeOutput; -} - -// @public -export interface NotificationRuleParent { - actionGroupIds: string[]; - displayName: string; - // (undocumented) - scope: NotificationScopeType; -} - -// @public -export type NotificationRuleResourceMergeAndPatch = Partial; - -// @public -export type NotificationScopeType = string; - -// @public -export type NotificationScopeTypeOutput = string; - -// @public -export interface OptionalLoadTestConfiguration { - duration?: number; - endpointUrl?: string; - maxResponseTimeInMs?: number; - rampUpTime?: number; - requestsPerSecond?: number; - virtualUsers?: number; -} - -// @public -export interface OptionalLoadTestConfigurationOutput { - duration?: number; - endpointUrl?: string; - maxResponseTimeInMs?: number; - rampUpTime?: number; - requestsPerSecond?: number; - virtualUsers?: number; -} - -// @public -export interface PagedAsyncIterableIterator { - [Symbol.asyncIterator](): PagedAsyncIterableIterator; - byPage: (settings?: TPageSettings) => AsyncIterableIterator; - next(): Promise>; -} - -// @public -export interface PagedNotificationRuleOutput { - nextLink?: string; - value: Array; -} - -// @public -export interface PagedTestFileInfoOutput { - nextLink?: string; - value: Array; -} - -// @public -export interface PagedTestOutput { - nextLink?: string; - value: Array; -} - -// @public -export interface PagedTestProfileOutput { - nextLink?: string; - value: Array; -} - -// @public -export interface PagedTestProfileRunOutput { - nextLink?: string; - value: Array; -} - -// @public -export interface PagedTestRunOutput { - nextLink?: string; - value: Array; -} - -// @public -export interface PagedTriggerOutput { - nextLink?: string; - value: Array; -} - -// @public -export interface PageSettings { - continuationToken?: string; -} - -// @public -export function paginate(client: Client, initialResponse: TResponse, options?: PagingOptions): PagedAsyncIterableIterator>; - -// @public -export type PaginateReturn = TResult extends { - body: { - value?: infer TPage; - }; -} ? GetArrayType : Array; - -// @public -export interface PagingOptions { - customGetPage?: GetPage[]>; -} - -// @public -export type PassFailAction = string; - -// @public -export type PassFailActionOutput = string; - -// @public -export type PassFailAggregationFunction = string; - -// @public -export type PassFailAggregationFunctionOutput = string; - -// @public -export interface PassFailCriteria { - passFailMetrics?: Record; - passFailServerMetrics?: Record; -} - -// @public -export interface PassFailCriteriaOutput { - passFailMetrics?: Record; - passFailServerMetrics?: Record; -} - -// @public -export interface PassFailMetric { - action?: PassFailAction; - aggregate?: PassFailAggregationFunction; - clientMetric?: PFMetrics; - condition?: string; - requestName?: string; - value?: number; -} - -// @public -export interface PassFailMetricOutput { - action?: PassFailActionOutput; - readonly actualValue?: number; - aggregate?: PassFailAggregationFunctionOutput; - clientMetric?: PFMetricsOutput; - condition?: string; - requestName?: string; - readonly result?: PassFailResultOutput; - value?: number; -} - -// @public -export type PassFailResult = string; - -// @public -export type PassFailResultOutput = string; - -// @public -export interface PassFailServerMetric { - action?: PassFailAction; - aggregation: string; - condition: string; - metricName: string; - metricNamespace: string; - resourceId: string; - value: number; -} - -// @public -export interface PassFailServerMetricOutput { - action?: PassFailActionOutput; - readonly actualValue?: number; - aggregation: string; - condition: string; - metricName: string; - metricNamespace: string; - resourceId: string; - readonly result?: PassFailResultOutput; - value: number; -} - -// @public -export type PassFailTestResult = string; - -// @public -export type PassFailTestResultOutput = string; - -// @public -export type PFMetrics = string; - -// @public -export type PFMetricsOutput = string; - -// @public (undocumented) -export interface PolledOperationOptions { - updateIntervalInMs?: number; -} - -// @public -export type RecommendationCategory = string; - -// @public -export type RecommendationCategoryOutput = string; - -// @public -export type Recurrence = RecurrenceParent | DailyRecurrence | HourlyRecurrence | MonthlyRecurrenceByWeekDays | MonthlyRecurrenceByDates | RecurrenceWithCron | WeeklyRecurrence; - -// @public -export interface RecurrenceEnd { - endDateTime?: Date | string; - numberOfOccurrences?: number; -} - -// @public -export interface RecurrenceEndOutput { - endDateTime?: string; - numberOfOccurrences?: number; -} - -// @public -export type RecurrenceOutput = RecurrenceOutputParent | DailyRecurrenceOutput | HourlyRecurrenceOutput | MonthlyRecurrenceByWeekDaysOutput | MonthlyRecurrenceByDatesOutput | RecurrenceWithCronOutput | WeeklyRecurrenceOutput; - -// @public -export interface RecurrenceOutputParent { - // (undocumented) - frequency: FrequencyOutput; - recurrenceEnd?: RecurrenceEndOutput; -} - -// @public -export interface RecurrenceParent { - // (undocumented) - frequency: Frequency; - recurrenceEnd?: RecurrenceEnd; -} - -// @public -export interface RecurrenceStatus { - nextScheduledDateTimes?: Date[] | string[]; - remainingOccurrences?: number; -} - -// @public -export interface RecurrenceStatusOutput { - nextScheduledDateTimes?: string[]; - remainingOccurrences?: number; -} - -// @public -export interface RecurrenceWithCron extends RecurrenceParent { - cronExpression: string; - frequency: "Cron"; -} - -// @public -export interface RecurrenceWithCronOutput extends RecurrenceOutputParent { - cronExpression: string; - frequency: "Cron"; -} - -// @public -export interface RegionalConfiguration { - engineInstances: number; - region: string; -} - -// @public -export interface RegionalConfigurationOutput { - engineInstances: number; - region: string; -} - -// @public -export type RequestDataLevel = string; - -// @public -export type RequestDataLevelOutput = string; - -// @public -export type ResourceKind = string; - -// @public -export type ResourceKindOutput = string; - -// @public -export interface ResourceMetric { - aggregation: string; - displayDescription?: string; - metricNamespace: string; - name: string; - resourceId: string; - resourceType: string; - unit?: string; -} - -// @public -export interface ResourceMetricOutput { - aggregation: string; - displayDescription?: string; - readonly id?: string; - metricNamespace: string; - name: string; - resourceId: string; - resourceType: string; - unit?: string; -} - -// @public (undocumented) -export interface Routes { - (path: "/tests/{testId}", testId: string): LoadTestAdministrationCreateOrUpdateTest; - (path: "/tests"): LoadTestAdministrationListTests; - (path: "/tests/{testId}/files/{fileName}", testId: string, fileName: string): LoadTestAdministrationUploadTestFile; - (path: "/tests/{testId}/files", testId: string): LoadTestAdministrationListTestFiles; - (path: "/tests/{testId}/app-components", testId: string): LoadTestAdministrationCreateOrUpdateAppComponents; - (path: "/tests/{testId}/server-metrics-config", testId: string): LoadTestAdministrationCreateOrUpdateServerMetricsConfig; - (path: "/test-profiles/{testProfileId}", testProfileId: string): TestProfileAdministrationCreateOrUpdateTestProfile; - (path: "/test-profiles"): TestProfileAdministrationListTestProfiles; - (path: "/test-runs/{testRunId}", testRunId: string): LoadTestRunGetTestRun; - (path: "/test-runs"): LoadTestRunListTestRuns; - (path: "/test-runs/{testRunId}/files/{fileName}", testRunId: string, fileName: string): LoadTestRunGetTestRunFile; - (path: "/test-runs/{testRunId}:stop", testRunId: string): LoadTestRunStop; - (path: "/test-runs/{testRunId}/metric-namespaces", testRunId: string): LoadTestRunListMetricNamespaces; - (path: "/test-runs/{testRunId}/metric-definitions", testRunId: string): LoadTestRunListMetricDefinitions; - (path: "/test-runs/{testRunId}/metrics", testRunId: string): LoadTestRunListMetrics; - (path: "/test-runs/{testRunId}/metric-dimensions/{name}/values", testRunId: string, name: string): LoadTestRunListMetricDimensionValues; - (path: "/test-runs/{testRunId}/app-components", testRunId: string): LoadTestRunCreateOrUpdateAppComponents; - (path: "/test-runs/{testRunId}/server-metrics-config", testRunId: string): LoadTestRunCreateOrUpdateServerMetricsConfig; - (path: "/test-profile-runs/{testProfileRunId}", testProfileRunId: string): TestProfileRunAdministrationGetTestProfileRun; - (path: "/test-profile-runs/{testProfileRunId}:stop", testProfileRunId: string): TestProfileRunAdministrationStop; - (path: "/test-profile-runs"): TestProfileRunAdministrationListTestProfileRuns; - (path: "/triggers/{triggerId}", triggerId: string): TriggerAdministrationGetTrigger; - (path: "/triggers"): TriggerAdministrationListTrigger; - (path: "/notification-rules/{notificationRuleId}", notificationRuleId: string): NotificationRuleAdministrationGetNotificationRule; - (path: "/notification-rules"): NotificationRuleAdministrationListNotificationRule; -} - -// @public -export interface ScheduleTestsTrigger extends TriggerParent { - kind: "ScheduleTestsTrigger"; - recurrence?: Recurrence; - startDateTime?: Date | string; - testIds: string[]; -} - -// @public -export interface ScheduleTestsTriggerOutput extends TriggerOutputParent { - kind: "ScheduleTestsTrigger"; - recurrence?: RecurrenceOutput; - // (undocumented) - readonly recurrenceStatus?: RecurrenceStatusOutput; - startDateTime?: string; - testIds: string[]; -} - -// @public -export interface Secret { - type?: SecretType; - value?: string; -} - -// @public -export interface SecretOutput { - type?: SecretTypeOutput; - value?: string; -} - -// @public -export type SecretType = string; - -// @public -export type SecretTypeOutput = string; - -// @public -export interface StateDetails { - message?: string; -} - -// @public -export interface StateDetailsOutput { - message?: string; -} - -// @public -export type TargetResourceConfigurations = TargetResourceConfigurationsParent | FunctionFlexConsumptionTargetResourceConfigurations; - -// @public -export type TargetResourceConfigurationsOutput = TargetResourceConfigurationsOutputParent | FunctionFlexConsumptionTargetResourceConfigurationsOutput; - -// @public -export interface TargetResourceConfigurationsOutputParent { - // (undocumented) - kind: ResourceKindOutput; -} - -// @public -export interface TargetResourceConfigurationsParent { - // (undocumented) - kind: ResourceKind; -} - -// @public -export interface Test { - autoStopCriteria?: AutoStopCriteria; - baselineTestRunId?: string; - certificate?: CertificateMetadata; - description?: string; - displayName?: string; - engineBuiltInIdentityIds?: string[]; - engineBuiltInIdentityType?: ManagedIdentityType; - environmentVariables?: Record; - keyvaultReferenceIdentityId?: string; - keyvaultReferenceIdentityType?: string; - kind?: TestKind; - loadTestConfiguration?: LoadTestConfiguration; - metricsReferenceIdentityId?: string; - metricsReferenceIdentityType?: ManagedIdentityType; - passFailCriteria?: PassFailCriteria; - publicIPDisabled?: boolean; - secrets?: Record; - subnetId?: string; -} - -// @public -export interface TestAppComponents { - components: Record; -} - -// @public -export interface TestAppComponentsOutput { - components: Record; - readonly createdBy?: string; - readonly createdDateTime?: string; - readonly lastModifiedBy?: string; - readonly lastModifiedDateTime?: string; - readonly testId?: string; -} - -// @public -export type TestAppComponentsResourceMergeAndPatch = Partial; - -// @public -export interface TestFileInfo { - fileName: string; -} - -// @public -export interface TestFileInfoOutput { - readonly expireDateTime?: string; - fileName: string; - readonly fileType?: FileTypeOutput; - readonly url?: string; - readonly validationFailureDetails?: string; - readonly validationStatus?: FileValidationStatusOutput; -} - -// @public -export interface TestInputArtifacts { - configFileInfo?: TestFileInfo; - inputArtifactsZipFileInfo?: TestFileInfo; - testScriptFileInfo?: TestFileInfo; - urlTestConfigFileInfo?: TestFileInfo; - userPropFileInfo?: TestFileInfo; -} - -// @public -export interface TestInputArtifactsOutput { - readonly additionalFileInfo?: Array; - configFileInfo?: TestFileInfoOutput; - inputArtifactsZipFileInfo?: TestFileInfoOutput; - testScriptFileInfo?: TestFileInfoOutput; - urlTestConfigFileInfo?: TestFileInfoOutput; - userPropFileInfo?: TestFileInfoOutput; -} - -// @public -export type TestKind = string; - -// @public -export type TestKindOutput = string; - -// @public -export interface TestOutput { - autoStopCriteria?: AutoStopCriteriaOutput; - baselineTestRunId?: string; - certificate?: CertificateMetadataOutput; - readonly createdBy?: string; - readonly createdDateTime?: string; - description?: string; - displayName?: string; - engineBuiltInIdentityIds?: string[]; - engineBuiltInIdentityType?: ManagedIdentityTypeOutput; - environmentVariables?: Record; - readonly inputArtifacts?: TestInputArtifactsOutput; - keyvaultReferenceIdentityId?: string; - keyvaultReferenceIdentityType?: string; - kind?: TestKindOutput; - readonly lastModifiedBy?: string; - readonly lastModifiedDateTime?: string; - loadTestConfiguration?: LoadTestConfigurationOutput; - metricsReferenceIdentityId?: string; - metricsReferenceIdentityType?: ManagedIdentityTypeOutput; - passFailCriteria?: PassFailCriteriaOutput; - publicIPDisabled?: boolean; - secrets?: Record; - subnetId?: string; - readonly testId: string; -} - -// @public -export interface TestProfile { - description?: string; - displayName?: string; - targetResourceConfigurations?: TargetResourceConfigurations; - targetResourceId?: string; - testId?: string; -} - -// @public (undocumented) -export interface TestProfileAdministrationCreateOrUpdateTestProfile { - delete(options?: TestProfileAdministrationDeleteTestProfileParameters): StreamableMethod; - get(options?: TestProfileAdministrationGetTestProfileParameters): StreamableMethod; - patch(options: TestProfileAdministrationCreateOrUpdateTestProfileParameters): StreamableMethod; -} - -// @public -export interface TestProfileAdministrationCreateOrUpdateTestProfile200Response extends HttpResponse { - // (undocumented) - body: TestProfileOutput; - // (undocumented) - status: "200"; -} - -// @public -export interface TestProfileAdministrationCreateOrUpdateTestProfile201Response extends HttpResponse { - // (undocumented) - body: TestProfileOutput; - // (undocumented) - status: "201"; -} - -// @public (undocumented) -export interface TestProfileAdministrationCreateOrUpdateTestProfileBodyParam { - body: TestProfileResourceMergeAndPatch; -} - -// @public (undocumented) -export interface TestProfileAdministrationCreateOrUpdateTestProfileDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface TestProfileAdministrationCreateOrUpdateTestProfileDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & TestProfileAdministrationCreateOrUpdateTestProfileDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export interface TestProfileAdministrationCreateOrUpdateTestProfileMediaTypesParam { - contentType: "application/merge-patch+json"; -} - -// @public (undocumented) -export type TestProfileAdministrationCreateOrUpdateTestProfileParameters = TestProfileAdministrationCreateOrUpdateTestProfileMediaTypesParam & TestProfileAdministrationCreateOrUpdateTestProfileBodyParam & RequestParameters; - -// @public -export interface TestProfileAdministrationDeleteTestProfile204Response extends HttpResponse { - // (undocumented) - status: "204"; -} - -// @public (undocumented) -export interface TestProfileAdministrationDeleteTestProfileDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface TestProfileAdministrationDeleteTestProfileDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & TestProfileAdministrationDeleteTestProfileDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type TestProfileAdministrationDeleteTestProfileParameters = RequestParameters; - -// @public -export interface TestProfileAdministrationGetTestProfile200Response extends HttpResponse { - // (undocumented) - body: TestProfileOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface TestProfileAdministrationGetTestProfileDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface TestProfileAdministrationGetTestProfileDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & TestProfileAdministrationGetTestProfileDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type TestProfileAdministrationGetTestProfileParameters = RequestParameters; - -// @public (undocumented) -export interface TestProfileAdministrationListTestProfiles { - get(options?: TestProfileAdministrationListTestProfilesParameters): StreamableMethod; -} - -// @public -export interface TestProfileAdministrationListTestProfiles200Response extends HttpResponse { - // (undocumented) - body: PagedTestProfileOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface TestProfileAdministrationListTestProfilesDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface TestProfileAdministrationListTestProfilesDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & TestProfileAdministrationListTestProfilesDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type TestProfileAdministrationListTestProfilesParameters = TestProfileAdministrationListTestProfilesQueryParam & RequestParameters; - -// @public (undocumented) -export interface TestProfileAdministrationListTestProfilesQueryParam { - // (undocumented) - queryParameters?: TestProfileAdministrationListTestProfilesQueryParamProperties; -} - -// @public (undocumented) -export interface TestProfileAdministrationListTestProfilesQueryParamProperties { - lastModifiedEndTime?: Date | string; - lastModifiedStartTime?: Date | string; - maxpagesize?: number; - testIds?: string[] | TestProfileAdministrationListTestProfilesTestIdsQueryParam; - testProfileIds?: string[] | TestProfileAdministrationListTestProfilesTestProfileIdsQueryParam; -} - -// @public -export interface TestProfileAdministrationListTestProfilesTestIdsQueryParam { - explode: false; - style: "form"; - value: string[]; -} - -// @public -export interface TestProfileAdministrationListTestProfilesTestProfileIdsQueryParam { - explode: false; - style: "form"; - value: string[]; -} - -// @public -export interface TestProfileOutput { - readonly createdBy?: string; - readonly createdDateTime?: string; - description?: string; - displayName?: string; - readonly lastModifiedBy?: string; - readonly lastModifiedDateTime?: string; - targetResourceConfigurations?: TargetResourceConfigurationsOutput; - targetResourceId?: string; - testId?: string; - readonly testProfileId: string; -} - -// @public -export type TestProfileResourceMergeAndPatch = Partial; - -// @public -export interface TestProfileRun { - description?: string; - displayName?: string; - testProfileId?: string; -} - -// @public -export interface TestProfileRunAdministrationCreateOrUpdateTestProfileRun200Response extends HttpResponse { - // (undocumented) - body: TestProfileRunOutput; - // (undocumented) - status: "200"; -} - -// @public -export interface TestProfileRunAdministrationCreateOrUpdateTestProfileRun201Response extends HttpResponse { - // (undocumented) - body: TestProfileRunOutput; - // (undocumented) - status: "201"; -} - -// @public (undocumented) -export interface TestProfileRunAdministrationCreateOrUpdateTestProfileRunBodyParam { - body: TestProfileRunResourceMergeAndPatch; -} - -// @public (undocumented) -export interface TestProfileRunAdministrationCreateOrUpdateTestProfileRunDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface TestProfileRunAdministrationCreateOrUpdateTestProfileRunDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & TestProfileRunAdministrationCreateOrUpdateTestProfileRunDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export interface TestProfileRunAdministrationCreateOrUpdateTestProfileRunMediaTypesParam { - contentType: "application/merge-patch+json"; -} - -// @public (undocumented) -export type TestProfileRunAdministrationCreateOrUpdateTestProfileRunParameters = TestProfileRunAdministrationCreateOrUpdateTestProfileRunMediaTypesParam & TestProfileRunAdministrationCreateOrUpdateTestProfileRunBodyParam & RequestParameters; - -// @public -export interface TestProfileRunAdministrationDeleteTestProfileRun204Response extends HttpResponse { - // (undocumented) - status: "204"; -} - -// @public (undocumented) -export interface TestProfileRunAdministrationDeleteTestProfileRunDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface TestProfileRunAdministrationDeleteTestProfileRunDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & TestProfileRunAdministrationDeleteTestProfileRunDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type TestProfileRunAdministrationDeleteTestProfileRunParameters = RequestParameters; - -// @public (undocumented) -export interface TestProfileRunAdministrationGetTestProfileRun { - delete(options?: TestProfileRunAdministrationDeleteTestProfileRunParameters): StreamableMethod; - get(options?: TestProfileRunAdministrationGetTestProfileRunParameters): StreamableMethod; - patch(options: TestProfileRunAdministrationCreateOrUpdateTestProfileRunParameters): StreamableMethod; -} - -// @public -export interface TestProfileRunAdministrationGetTestProfileRun200Response extends HttpResponse { - // (undocumented) - body: TestProfileRunOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface TestProfileRunAdministrationGetTestProfileRunDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface TestProfileRunAdministrationGetTestProfileRunDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & TestProfileRunAdministrationGetTestProfileRunDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type TestProfileRunAdministrationGetTestProfileRunParameters = RequestParameters; - -// @public (undocumented) -export interface TestProfileRunAdministrationListTestProfileRuns { - get(options?: TestProfileRunAdministrationListTestProfileRunsParameters): StreamableMethod; -} - -// @public -export interface TestProfileRunAdministrationListTestProfileRuns200Response extends HttpResponse { - // (undocumented) - body: PagedTestProfileRunOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface TestProfileRunAdministrationListTestProfileRunsDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface TestProfileRunAdministrationListTestProfileRunsDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & TestProfileRunAdministrationListTestProfileRunsDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type TestProfileRunAdministrationListTestProfileRunsParameters = TestProfileRunAdministrationListTestProfileRunsQueryParam & RequestParameters; - -// @public (undocumented) -export interface TestProfileRunAdministrationListTestProfileRunsQueryParam { - // (undocumented) - queryParameters?: TestProfileRunAdministrationListTestProfileRunsQueryParamProperties; -} - -// @public (undocumented) -export interface TestProfileRunAdministrationListTestProfileRunsQueryParamProperties { - createdDateEndTime?: Date | string; - createdDateStartTime?: Date | string; - maxEndDateTime?: Date | string; - maxpagesize?: number; - maxStartDateTime?: Date | string; - minEndDateTime?: Date | string; - minStartDateTime?: Date | string; - statuses?: string[] | TestProfileRunAdministrationListTestProfileRunsStatusesQueryParam; - testProfileIds?: string[] | TestProfileRunAdministrationListTestProfileRunsTestProfileIdsQueryParam; - testProfileRunIds?: string[] | TestProfileRunAdministrationListTestProfileRunsTestProfileRunIdsQueryParam; -} - -// @public -export interface TestProfileRunAdministrationListTestProfileRunsStatusesQueryParam { - explode: false; - style: "form"; - value: string[]; -} - -// @public -export interface TestProfileRunAdministrationListTestProfileRunsTestProfileIdsQueryParam { - explode: false; - style: "form"; - value: string[]; -} - -// @public -export interface TestProfileRunAdministrationListTestProfileRunsTestProfileRunIdsQueryParam { - explode: false; - style: "form"; - value: string[]; -} - -// @public (undocumented) -export interface TestProfileRunAdministrationStop { - post(options?: TestProfileRunAdministrationStopParameters): StreamableMethod; -} - -// @public -export interface TestProfileRunAdministrationStop200Response extends HttpResponse { - // (undocumented) - body: TestProfileRunOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface TestProfileRunAdministrationStopDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface TestProfileRunAdministrationStopDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & TestProfileRunAdministrationStopDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type TestProfileRunAdministrationStopParameters = RequestParameters; - -// @public -export type TestProfileRunCompletionPoller = SimplePollerLike, TestProfileRunAdministrationGetTestProfileRun200Response>; - -// @public (undocumented) -export type TestProfileRunCreateOrUpdateSuccessResponse = TestProfileRunAdministrationCreateOrUpdateTestProfileRun200Response | TestProfileRunAdministrationCreateOrUpdateTestProfileRun201Response; - -// @public -export interface TestProfileRunOutput { - readonly createdBy?: string; - readonly createdDateTime?: string; - description?: string; - displayName?: string; - readonly durationInSeconds?: number; - readonly endDateTime?: string; - readonly errorDetails?: Array; - readonly lastModifiedBy?: string; - readonly lastModifiedDateTime?: string; - readonly recommendations?: Array; - readonly startDateTime?: string; - readonly status?: TestProfileRunStatusOutput; - readonly targetResourceConfigurations?: TargetResourceConfigurationsOutput; - readonly targetResourceId?: string; - testProfileId?: string; - readonly testProfileRunId: string; - readonly testRunDetails?: Record; -} - -// @public -export interface TestProfileRunRecommendation { - category: RecommendationCategory; - configurations?: string[]; -} - -// @public -export interface TestProfileRunRecommendationOutput { - category: RecommendationCategoryOutput; - configurations?: string[]; -} - -// @public -export type TestProfileRunResourceMergeAndPatch = Partial; - -// @public -export type TestProfileRunStatus = string; - -// @public -export type TestProfileRunStatusOutput = string; - -// @public -export type TestResourceMergeAndPatch = Partial; - -// @public -export interface TestRun { - autoStopCriteria?: AutoStopCriteria; - certificate?: CertificateMetadata; - createdByType?: CreatedByType; - debugLogsEnabled?: boolean; - description?: string; - displayName?: string; - environmentVariables?: Record; - passFailCriteria?: PassFailCriteria; - requestDataLevel?: RequestDataLevel; - secrets?: Record; - testId?: string; -} - -// @public -export interface TestRunAppComponents { - components: Record; -} - -// @public -export interface TestRunAppComponentsOutput { - components: Record; - readonly createdBy?: string; - readonly createdDateTime?: string; - readonly lastModifiedBy?: string; - readonly lastModifiedDateTime?: string; - readonly testRunId?: string; -} - -// @public -export type TestRunAppComponentsResourceMergeAndPatch = Partial; - -// @public -export interface TestRunArtifacts { - outputArtifacts?: TestRunOutputArtifacts; -} - -// @public -export interface TestRunArtifactsOutput { - readonly inputArtifacts?: TestRunInputArtifactsOutput; - outputArtifacts?: TestRunOutputArtifactsOutput; -} - -// @public -export type TestRunCompletionPoller = SimplePollerLike, LoadTestRunGetTestRun200Response>; - -// @public (undocumented) -export type TestRunCreateOrUpdateSuccessResponse = LoadTestRunCreateOrUpdateTestRun200Response | LoadTestRunCreateOrUpdateTestRun201Response; - -// @public -export interface TestRunDetail { - configurationId: string; - properties: Record; - status: TestRunStatus; -} - -// @public -export interface TestRunDetailOutput { - configurationId: string; - properties: Record; - status: TestRunStatusOutput; -} - -// @public -export interface TestRunEndedEventCondition { - testRunResults?: PassFailTestResult[]; - testRunStatuses?: TestRunStatus[]; -} - -// @public -export interface TestRunEndedEventConditionOutput { - testRunResults?: PassFailTestResultOutput[]; - testRunStatuses?: TestRunStatusOutput[]; -} - -// @public -export interface TestRunEndedNotificationEventFilter extends TestsNotificationEventFilterParent { - condition?: TestRunEndedEventCondition; - kind: "TestRunEnded"; -} - -// @public -export interface TestRunEndedNotificationEventFilterOutput extends TestsNotificationEventFilterOutputParent { - condition?: TestRunEndedEventConditionOutput; - kind: "TestRunEnded"; -} - -// @public -export interface TestRunFileInfo { - fileName: string; -} - -// @public -export interface TestRunFileInfoOutput { - readonly expireDateTime?: string; - fileName: string; - readonly fileType?: FileTypeOutput; - readonly url?: string; - readonly validationFailureDetails?: string; - readonly validationStatus?: FileValidationStatusOutput; -} - -// @public -export interface TestRunInputArtifacts { - configFileInfo?: TestRunFileInfo; - inputArtifactsZipFileInfo?: TestRunFileInfo; - testScriptFileInfo?: TestRunFileInfo; - urlTestConfigFileInfo?: TestRunFileInfo; - userPropFileInfo?: TestRunFileInfo; -} - -// @public -export interface TestRunInputArtifactsOutput { - readonly additionalFileInfo?: Array; - configFileInfo?: TestRunFileInfoOutput; - inputArtifactsZipFileInfo?: TestRunFileInfoOutput; - testScriptFileInfo?: TestRunFileInfoOutput; - urlTestConfigFileInfo?: TestRunFileInfoOutput; - userPropFileInfo?: TestRunFileInfoOutput; -} - -// @public -export interface TestRunOutput { - autoStopCriteria?: AutoStopCriteriaOutput; - certificate?: CertificateMetadataOutput; - readonly createdBy?: string; - createdByType?: CreatedByTypeOutput; - readonly createdDateTime?: string; - debugLogsEnabled?: boolean; - description?: string; - displayName?: string; - readonly duration?: number; - readonly endDateTime?: string; - environmentVariables?: Record; - readonly errorDetails?: Array; - readonly executedDateTime?: string; - readonly kind?: TestKindOutput; - readonly lastModifiedBy?: string; - readonly lastModifiedDateTime?: string; - readonly loadTestConfiguration?: LoadTestConfigurationOutput; - passFailCriteria?: PassFailCriteriaOutput; - readonly portalUrl?: string; - readonly publicIPDisabled?: boolean; - readonly regionalStatistics?: Record; - requestDataLevel?: RequestDataLevelOutput; - secrets?: Record; - readonly startDateTime?: string; - readonly status?: TestRunStatusOutput; - readonly subnetId?: string; - readonly testArtifacts?: TestRunArtifactsOutput; - testId?: string; - readonly testResult?: PassFailTestResultOutput; - readonly testRunId: string; - readonly testRunStatistics?: Record; - readonly virtualUserHours?: number; - readonly virtualUsers?: number; -} - -// @public -export interface TestRunOutputArtifacts { - artifactsContainerInfo?: ArtifactsContainerInfo; - logsFileInfo?: TestRunFileInfo; - reportFileInfo?: TestRunFileInfo; - resultFileInfo?: TestRunFileInfo; -} - -// @public -export interface TestRunOutputArtifactsOutput { - artifactsContainerInfo?: ArtifactsContainerInfoOutput; - logsFileInfo?: TestRunFileInfoOutput; - reportFileInfo?: TestRunFileInfoOutput; - resultFileInfo?: TestRunFileInfoOutput; -} - -// @public -export type TestRunResourceMergeAndPatch = Partial; - -// @public -export interface TestRunServerMetricsConfiguration { - metrics?: Record; -} - -// @public -export interface TestRunServerMetricsConfigurationOutput { - readonly createdBy?: string; - readonly createdDateTime?: string; - readonly lastModifiedBy?: string; - readonly lastModifiedDateTime?: string; - metrics?: Record; - readonly testRunId?: string; -} - -// @public -export type TestRunServerMetricsConfigurationResourceMergeAndPatch = Partial; - -// @public -export interface TestRunStartedNotificationEventFilter extends TestsNotificationEventFilterParent { - kind: "TestRunStarted"; -} - -// @public -export interface TestRunStartedNotificationEventFilterOutput extends TestsNotificationEventFilterOutputParent { - kind: "TestRunStarted"; -} - -// @public -export interface TestRunStatistics { -} - -// @public -export interface TestRunStatisticsOutput { - readonly errorCount?: number; - readonly errorPct?: number; - readonly maxResTime?: number; - readonly meanResTime?: number; - readonly medianResTime?: number; - readonly minResTime?: number; - readonly pct1ResTime?: number; - readonly pct2ResTime?: number; - readonly pct3ResTime?: number; - readonly pct75ResTime?: number; - readonly pct96ResTime?: number; - readonly pct97ResTime?: number; - readonly pct98ResTime?: number; - readonly pct9999ResTime?: number; - readonly pct999ResTime?: number; - readonly receivedKBytesPerSec?: number; - readonly sampleCount?: number; - readonly sentKBytesPerSec?: number; - readonly throughput?: number; - readonly transaction?: string; -} - -// @public -export type TestRunStatus = string; - -// @public -export type TestRunStatusOutput = string; - -// @public -export interface TestServerMetricsConfiguration { - metrics: Record; -} - -// @public -export interface TestServerMetricsConfigurationOutput { - readonly createdBy?: string; - readonly createdDateTime?: string; - readonly lastModifiedBy?: string; - readonly lastModifiedDateTime?: string; - metrics: Record; - readonly testId?: string; -} - -// @public -export type TestServerMetricsConfigurationResourceMergeAndPatch = Partial; - -// @public -export type TestsNotificationEventFilter = TestsNotificationEventFilterParent | TestRunEndedNotificationEventFilter | TestRunStartedNotificationEventFilter | TriggerCompletedNotificationEventFilter | TriggerDisabledNotificationEventFilter; - -// @public -export type TestsNotificationEventFilterOutput = TestsNotificationEventFilterOutputParent | TestRunEndedNotificationEventFilterOutput | TestRunStartedNotificationEventFilterOutput | TriggerCompletedNotificationEventFilterOutput | TriggerDisabledNotificationEventFilterOutput; - -// @public -export interface TestsNotificationEventFilterOutputParent { - // (undocumented) - kind: NotificationEventTypeOutput; -} - -// @public -export interface TestsNotificationEventFilterParent { - // (undocumented) - kind: NotificationEventType; -} - -// @public -export interface TestsNotificationRule extends NotificationRuleParent { - eventFilters: Record; - scope: "Tests"; - testIds?: string[]; -} - -// @public -export interface TestsNotificationRuleOutput extends NotificationRuleOutputParent { - eventFilters: Record; - scope: "Tests"; - testIds?: string[]; -} - -// @public (undocumented) -export type TestUploadFileSuccessResponse = LoadTestAdministrationUploadTestFile201Response; - -// @public -export type TimeGrain = string; - -// @public -export type TimeGrainOutput = string; - -// @public -export interface TimeSeriesElementOutput { - data?: Array; - dimensionValues?: Array; -} - -// @public -export type Trigger = TriggerParent | ScheduleTestsTrigger; - -// @public -export interface TriggerAdministrationCreateOrUpdateTrigger200Response extends HttpResponse { - // (undocumented) - body: TriggerOutput; - // (undocumented) - status: "200"; -} - -// @public -export interface TriggerAdministrationCreateOrUpdateTrigger201Response extends HttpResponse { - // (undocumented) - body: TriggerOutput; - // (undocumented) - status: "201"; -} - -// @public (undocumented) -export interface TriggerAdministrationCreateOrUpdateTriggerBodyParam { - body: TriggerResourceMergeAndPatch; -} - -// @public (undocumented) -export interface TriggerAdministrationCreateOrUpdateTriggerDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface TriggerAdministrationCreateOrUpdateTriggerDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & TriggerAdministrationCreateOrUpdateTriggerDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export interface TriggerAdministrationCreateOrUpdateTriggerMediaTypesParam { - contentType: "application/merge-patch+json"; -} - -// @public (undocumented) -export type TriggerAdministrationCreateOrUpdateTriggerParameters = TriggerAdministrationCreateOrUpdateTriggerMediaTypesParam & TriggerAdministrationCreateOrUpdateTriggerBodyParam & RequestParameters; - -// @public -export interface TriggerAdministrationDeleteTrigger204Response extends HttpResponse { - // (undocumented) - status: "204"; -} - -// @public (undocumented) -export interface TriggerAdministrationDeleteTriggerDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface TriggerAdministrationDeleteTriggerDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & TriggerAdministrationDeleteTriggerDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type TriggerAdministrationDeleteTriggerParameters = RequestParameters; - -// @public (undocumented) -export interface TriggerAdministrationGetTrigger { - delete(options?: TriggerAdministrationDeleteTriggerParameters): StreamableMethod; - get(options?: TriggerAdministrationGetTriggerParameters): StreamableMethod; - patch(options: TriggerAdministrationCreateOrUpdateTriggerParameters): StreamableMethod; -} - -// @public -export interface TriggerAdministrationGetTrigger200Response extends HttpResponse { - // (undocumented) - body: TriggerOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface TriggerAdministrationGetTriggerDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface TriggerAdministrationGetTriggerDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & TriggerAdministrationGetTriggerDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type TriggerAdministrationGetTriggerParameters = RequestParameters; - -// @public (undocumented) -export interface TriggerAdministrationListTrigger { - get(options?: TriggerAdministrationListTriggerParameters): StreamableMethod; -} - -// @public -export interface TriggerAdministrationListTrigger200Response extends HttpResponse { - // (undocumented) - body: PagedTriggerOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface TriggerAdministrationListTriggerDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface TriggerAdministrationListTriggerDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & TriggerAdministrationListTriggerDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type TriggerAdministrationListTriggerParameters = TriggerAdministrationListTriggerQueryParam & RequestParameters; - -// @public (undocumented) -export interface TriggerAdministrationListTriggerQueryParam { - // (undocumented) - queryParameters?: TriggerAdministrationListTriggerQueryParamProperties; -} - -// @public (undocumented) -export interface TriggerAdministrationListTriggerQueryParamProperties { - lastModifiedEndTime?: Date | string; - lastModifiedStartTime?: Date | string; - maxpagesize?: number; - states?: TriggerState; - testIds?: string; -} - -// @public -export interface TriggerCompletedNotificationEventFilter extends TestsNotificationEventFilterParent { - kind: "TriggerCompleted"; -} - -// @public -export interface TriggerCompletedNotificationEventFilterOutput extends TestsNotificationEventFilterOutputParent { - kind: "TriggerCompleted"; -} - -// @public -export interface TriggerDisabledNotificationEventFilter extends TestsNotificationEventFilterParent { - kind: "TriggerDisabled"; -} - -// @public -export interface TriggerDisabledNotificationEventFilterOutput extends TestsNotificationEventFilterOutputParent { - kind: "TriggerDisabled"; -} - -// @public -export type TriggerOutput = TriggerOutputParent | ScheduleTestsTriggerOutput; - -// @public -export interface TriggerOutputParent { - readonly createdBy?: string; - readonly createdDateTime?: string; - description?: string; - displayName: string; - // (undocumented) - kind: TriggerTypeOutput; - readonly lastModifiedBy?: string; - readonly lastModifiedDateTime?: string; - state?: TriggerStateOutput; - readonly stateDetails?: StateDetailsOutput; - readonly triggerId: string; -} - -// @public -export interface TriggerParent { - description?: string; - displayName: string; - // (undocumented) - kind: TriggerType; - state?: TriggerState; -} - -// @public -export type TriggerResourceMergeAndPatch = Partial; - -// @public -export type TriggerState = string; - -// @public -export type TriggerStateOutput = string; - -// @public -export type TriggerType = string; - -// @public -export type TriggerTypeOutput = string; - -// @public -export type WeekDays = string; - -// @public -export type WeekDaysOutput = string; - -// @public -export interface WeeklyRecurrence extends RecurrenceParent { - daysOfWeek?: WeekDays[]; - frequency: "Weekly"; - interval?: number; -} - -// @public -export interface WeeklyRecurrenceOutput extends RecurrenceOutputParent { - daysOfWeek?: WeekDaysOutput[]; - frequency: "Weekly"; - interval?: number; -} - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/loadtesting/load-testing-rest/sample.env b/sdk/loadtesting/load-testing-rest/sample.env deleted file mode 100644 index 03f6278c22ac..000000000000 --- a/sdk/loadtesting/load-testing-rest/sample.env +++ /dev/null @@ -1,9 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= - -LOADTESTSERVICE_ENDPOINT= -SUBSCRIPTION_ID= -RESOURCE_GROUP= -LOADTESTSERVICE_FLEXFUNCTIONSRESOURCEID= \ No newline at end of file diff --git a/sdk/loadtesting/load-testing-rest/samples-dev/addAppComponents.ts b/sdk/loadtesting/load-testing-rest/samples-dev/addAppComponents.ts deleted file mode 100644 index b9bba6d31bd8..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples-dev/addAppComponents.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to add App Components to an existing test. - * - * @summary Demonstrates how to add app components to an existing test. - */ - -import AzureLoadTesting, { isUnexpected } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testId = process.env["LOADTESTSERVICE_TESTID"] || ""; // TestId of a test already created. - - const SUBSCRIPTION_ID = process.env["SUBSCRIPTION_ID"] || ""; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - const appComponentCreationResult = await client - .path("/tests/{testId}/app-components", testId) - .patch({ - contentType: "application/merge-patch+json", - body: { - components: { - "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo": - { - resourceName: "App-Service-Sample-Demo", - resourceType: "Microsoft.Web/sites", - }, - }, - }, - }); - - if (isUnexpected(appComponentCreationResult)) { - throw appComponentCreationResult.body.error; - } -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples-dev/createOrUpdateTest.ts b/sdk/loadtesting/load-testing-rest/samples-dev/createOrUpdateTest.ts deleted file mode 100644 index 838ec3fd555f..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples-dev/createOrUpdateTest.ts +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create a load test - * - * @summary Demonstrates how to create a load test - */ - -import AzureLoadTesting /* , { isUnexpected }*/ from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; -import { randomUUID } from "node:crypto"; - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - - const testId = randomUUID(); // ID to be assigned to a test - const displayName = "Sample Load Test"; - const description = "Sample Test Description"; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Creating the Load test - await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: displayName, - description: description, - loadTestConfiguration: { - engineInstances: 1, // number of engine instances to run test - }, - }, - }); -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples-dev/createTestProfile.ts b/sdk/loadtesting/load-testing-rest/samples-dev/createTestProfile.ts deleted file mode 100644 index 97e977403509..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples-dev/createTestProfile.ts +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create a load test and then use it to create a test profile. - * - * @summary Demonstrates how to create a test profile. - */ - -import AzureLoadTesting /* , { isUnexpected }*/ from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; -import { randomUUID } from "node:crypto"; - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - const functionsResourceId = process.env["LOADTESTSERVICE_FUNCTIONSFLEXRESOURCEID"] || ""; // ResourceID of a Azure Function on Flex Consumption Plan - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - - const testId = randomUUID(); // ID to be assigned to a test - const testProfileId = randomUUID(); // ID to be assigned to the test profile - const displayName = "Sample Load Test"; - const description = "Sample Test Description"; - - const testProfileDisplayName = "Sample Test Profile"; - const testProfileDescription = "Sample Test Profile Description"; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Creating the Load test - await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: displayName, - description: description, - loadTestConfiguration: { - engineInstances: 1, // number of engine instances to run test - }, - }, - }); - - // Creating the test profile - await client.path("/test-profiles/{testProfileId}", testProfileId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: testProfileDisplayName, - description: testProfileDescription, - testId: testId, - targetResourceId: functionsResourceId, - targetResourceConfigurations: { - kind: "FunctionsFlexConsumption", - configurations: { - config1: { - instanceMemoryMB: 2048, - httpConcurrency: 20, - }, - config2: { - instanceMemoryMB: 4096, - httpConcurrency: 100, - }, - }, - }, - }, - }); -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples-dev/sample.jmx b/sdk/loadtesting/load-testing-rest/samples-dev/sample.jmx deleted file mode 100644 index 92e673147be4..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples-dev/sample.jmx +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - false - true - false - - - - - - - - continue - - false - -1 - - 25 - 2 - true - 60 - 5 - true - - - - - - - example.com - - https - - / - GET - true - false - true - false - - - - - - - - - diff --git a/sdk/loadtesting/load-testing-rest/samples-dev/startTestProfileRun.ts b/sdk/loadtesting/load-testing-rest/samples-dev/startTestProfileRun.ts deleted file mode 100644 index 93a10cad15b5..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples-dev/startTestProfileRun.ts +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to run a test profile and get recommendations from it. - * - * @summary Demonstrates how to start a test profile run. - */ - -import AzureLoadTesting, { isUnexpected, getLongRunningPoller } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; -import { randomUUID } from "node:crypto"; - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testProfileId = process.env["LOADTESTSERVICE_TESTPROFILEID"] || ""; // TestProfileId of a test profile already created. - - const testProfileRunId = randomUUID(); // Random ID for the Test Profile Run - const displayName = "Sample Test Profile Run"; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Creating the test profile run - const testProfileRunCreationResult = await client - .path("/test-profile-runs/{testProfileRunId}", testProfileRunId) - .patch({ - contentType: "application/merge-patch+json", - body: { - testProfileId: testProfileId, - displayName: displayName, - }, - }); - - if (isUnexpected(testProfileRunCreationResult)) { - throw testProfileRunCreationResult.body.error; - } - - let testProfileRunResult; - - const testProfileRunPoller = await getLongRunningPoller(client, testProfileRunCreationResult); - try { - testProfileRunResult = await testProfileRunPoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(10 * 60000), // timeout of 10 minutes - }); - } catch (ex: any) { - new Error("Error in polling for test profile run completion: " + ex.message); // Polling timed out - } - - if (testProfileRunPoller.getOperationState().status !== "succeeded") { - throw new Error( - "There is some issue in running the test profile, Error Response : " + testProfileRunResult, - ); - } - - if (testProfileRunResult) { - const recommendations = testProfileRunResult.body.recommendations; - - if (recommendations && recommendations[0]) { - const throughputOptimizedRecommendation = recommendations.filter( - (r) => r.category === "ThroughputOptimized", - )[0]; - console.log( - "Throughput optimized configuration: " + throughputOptimizedRecommendation.configurations, - ); - } - } -} -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples-dev/startTestRunAndGetMetrics.ts b/sdk/loadtesting/load-testing-rest/samples-dev/startTestRunAndGetMetrics.ts deleted file mode 100644 index 7d76ce4aa228..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples-dev/startTestRunAndGetMetrics.ts +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to run a test, poll for its status and then fetch metrics from it. - * - * @summary Demonstrates how to start a test run and get metrics. - */ - -import AzureLoadTesting, { isUnexpected, getLongRunningPoller } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; -import { randomUUID } from "node:crypto"; - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testId = process.env["LOADTESTSERVICE_TESTID"] || ""; // TestId of a test already created. - - const testRunId = randomUUID(); // Random ID for the Test Run - const displayName = "Sample Test Run"; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Creating the test run - const testRunCreationResult = await client.path("/test-runs/{testRunId}", testRunId).patch({ - contentType: "application/merge-patch+json", - body: { - testId: testId, - displayName: displayName, - }, - }); - - if (isUnexpected(testRunCreationResult)) { - throw testRunCreationResult.body.error; - } - - let testRunResult; - - const testRunPoller = await getLongRunningPoller(client, testRunCreationResult); - try { - testRunResult = await testRunPoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(90000), // timeout of 90 seconds - }); - } catch (ex: any) { - new Error("Error in polling for test run completion: " + ex.message); // Polling timed out - } - - if (testRunPoller.getOperationState().status !== "succeeded") { - throw new Error("There is some issue in running the test, Error Response : " + testRunResult); - } - - if (testRunResult) { - const testRunStartTime = testRunResult.body.startDateTime; - const testRunEndTime = testRunResult.body.endDateTime; - - // Get the list of all metric namespaces and pick the first one - const metricNamespaces = await client - .path("/test-runs/{testRunId}/metric-namespaces", testRunId) - .get(); - - if (isUnexpected(metricNamespaces)) { - throw metricNamespaces.body.error; - } - - const metricNamespace = metricNamespaces.body.value[0]; - - if (metricNamespace.name === undefined) { - throw "No Metric Namespace name is defined."; - } - - // Get the list of all metric definitions and pick the first one - const metricDefinitions = await client - .path("/test-runs/{testRunId}/metric-definitions", testRunId) - .get({ - queryParameters: { - metricNamespace: metricNamespace.name, - }, - }); - - if (isUnexpected(metricDefinitions)) { - throw metricDefinitions.body.error; - } - - const metricDefinition = metricDefinitions.body.value[0]; - - if (metricDefinition.name === undefined) { - throw "No Metric Definition name is defined."; - } - - // Fetch client metrics using metric namespace and metric definition name - const metricsResult = await client.path("/test-runs/{testRunId}/metrics", testRunId).post({ - queryParameters: { - metricname: metricDefinition.name, - metricNamespace: metricNamespace.name, - timespan: testRunStartTime + "/" + testRunEndTime, - }, - }); - - console.log(metricsResult); - console.log(testRunResult); - } -} -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples-dev/stopTestProfileRun.ts b/sdk/loadtesting/load-testing-rest/samples-dev/stopTestProfileRun.ts deleted file mode 100644 index 5840a7f1d8e4..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples-dev/stopTestProfileRun.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to stop a test profile run's execution - * - * @summary Demonstrates how to stop a running test profile run - */ - -import AzureLoadTesting, { isUnexpected } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testProfileRunId = process.env["LOADTESTSERVICE_TESTPROFILERUNID"] || ""; // TestProfileRunId of an already started test profile run - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - const stopTestProfileRunResult = await client - .path("/test-profile-runs/{testProfileRunId}:stop", testProfileRunId) - .post(); - - if (isUnexpected(stopTestProfileRunResult)) { - throw stopTestProfileRunResult.body.error; - } -} -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples-dev/stopTestRun.ts b/sdk/loadtesting/load-testing-rest/samples-dev/stopTestRun.ts deleted file mode 100644 index fd0ee8ccc8da..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples-dev/stopTestRun.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to stop a test run's execution - * - * @summary Demonstrates how to stop a running load test - */ - -import AzureLoadTesting, { isUnexpected } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testRunId = process.env["LOADTESTSERVICE_TESTRUNID"] || ""; // TestRunId of an already started test run - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - const stopTestRunResult = await client.path("/test-runs/{testRunId}:stop", testRunId).post(); - - if (isUnexpected(stopTestRunResult)) { - throw stopTestRunResult.body.error; - } -} -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples-dev/uploadTestScript.ts b/sdk/loadtesting/load-testing-rest/samples-dev/uploadTestScript.ts deleted file mode 100644 index b113a91ee247..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples-dev/uploadTestScript.ts +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to upload a JMX test script file - * - * @summary Demonstrates how to upload a test script file. - */ - -import AzureLoadTesting, { isUnexpected, getLongRunningPoller } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; -import { createReadStream } from "node:fs"; - -const readStream = createReadStream("./sample.jmx"); - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testId = process.env["LOADTESTSERVICE_TESTID"] || ""; // TestId of a test already created. - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Uploading .jmx test script file for a test - const fileUploadResult = await client - .path("/tests/{testId}/files/{fileName}", testId, "sample.jmx") - .put({ - contentType: "application/octet-stream", - body: readStream, - }); - - if (isUnexpected(fileUploadResult)) { - throw fileUploadResult.body.error; - } - - let fileValidationResult; - const fileValidationPoller = await getLongRunningPoller(client, fileUploadResult); - try { - fileValidationResult = await fileValidationPoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(120 * 1000), // Time out polling in 120 seconds - }); - } catch (ex: any) { - throw new Error("Error in polling file validation status: " + ex.message); // Validation might have timed out. - } - - if (fileValidationPoller.getOperationState().status !== "succeeded" && fileValidationResult) { - throw new Error( - "There is some issue in validation, please make sure the upload file is a valid JMX file.", - ); - } -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/README.md b/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/README.md deleted file mode 100644 index 6d67d9781cf8..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/README.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -page_type: sample -languages: - - javascript -products: - - azure - - azure-load-testing -urlFragment: load-testing-javascript-beta ---- - -# Azure Load Testing client library samples for JavaScript (Beta) - -These sample programs show how to use the JavaScript client libraries for Azure Load Testing in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------- | ----------------------------------------------------------- | -| [addAppComponents.js][addappcomponents] | Demonstrates how to add app components to an existing test. | -| [createOrUpdateTest.js][createorupdatetest] | Demonstrates how to create a load test | -| [createTestProfile.js][createtestprofile] | Demonstrates how to create a test profile. | -| [startTestProfileRun.js][starttestprofilerun] | Demonstrates how to start a test profile run. | -| [startTestRunAndGetMetrics.js][starttestrunandgetmetrics] | Demonstrates how to start a test run and get metrics. | -| [stopTestProfileRun.js][stoptestprofilerun] | Demonstrates how to stop a running test profile run | -| [stopTestRun.js][stoptestrun] | Demonstrates how to stop a running load test | -| [uploadTestScript.js][uploadtestscript] | Demonstrates how to upload a test script file. | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -You need [an Azure subscription][freesub] and the following Azure resources to run these sample programs: - -- [Azure Load Testing Resource][createinstance_azureloadtestingresource] - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -3. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node addAppComponents.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env LOADTESTSERVICE_ENDPOINT="" LOADTESTSERVICE_TESTID="" SUBSCRIPTION_ID="" node addAppComponents.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[addappcomponents]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/addAppComponents.js -[createorupdatetest]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/createOrUpdateTest.js -[createtestprofile]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/createTestProfile.js -[starttestprofilerun]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/startTestProfileRun.js -[starttestrunandgetmetrics]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/startTestRunAndGetMetrics.js -[stoptestprofilerun]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/stopTestProfileRun.js -[stoptestrun]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/stopTestRun.js -[uploadtestscript]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/uploadTestScript.js -[apiref]: https://learn.microsoft.com/javascript/api/@azure-rest/load-testing?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[createinstance_azureloadtestingresource]: https://learn.microsoft.com/azure/load-testing/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtesting/load-testing-rest/README.md diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/addAppComponents.js b/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/addAppComponents.js deleted file mode 100644 index db59cbdf6b41..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/addAppComponents.js +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to add App Components to an existing test. - * - * @summary Demonstrates how to add app components to an existing test. - */ - -const AzureLoadTesting = require("@azure-rest/load-testing").default, - { isUnexpected } = require("@azure-rest/load-testing"); -const { DefaultAzureCredential } = require("@azure/identity"); - -async function main() { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testId = process.env["LOADTESTSERVICE_TESTID"] || ""; // TestId of a test already created. - - const SUBSCRIPTION_ID = process.env["SUBSCRIPTION_ID"] || ""; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - const appComponentCreationResult = await client - .path("/tests/{testId}/app-components", testId) - .patch({ - contentType: "application/merge-patch+json", - body: { - components: { - "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo": - { - resourceName: "App-Service-Sample-Demo", - resourceType: "Microsoft.Web/sites", - }, - }, - }, - }); - - if (isUnexpected(appComponentCreationResult)) { - throw appComponentCreationResult.body.error; - } -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/createOrUpdateTest.js b/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/createOrUpdateTest.js deleted file mode 100644 index 81ed29bf1226..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/createOrUpdateTest.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create a load test - * - * @summary Demonstrates how to create a load test - */ - -const AzureLoadTesting /* , { isUnexpected }*/ = require("@azure-rest/load-testing").default; -const { DefaultAzureCredential } = require("@azure/identity"); -const { randomUUID } = require("node:crypto"); - -async function main() { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - - const testId = randomUUID(); // ID to be assigned to a test - const displayName = "Sample Load Test"; - const description = "Sample Test Description"; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Creating the Load test - await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: displayName, - description: description, - loadTestConfiguration: { - engineInstances: 1, // number of engine instances to run test - }, - }, - }); -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/createTestProfile.js b/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/createTestProfile.js deleted file mode 100644 index 8c9741593326..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/createTestProfile.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create a load test and then use it to create a test profile. - * - * @summary Demonstrates how to create a test profile. - */ - -const AzureLoadTesting /* , { isUnexpected }*/ = require("@azure-rest/load-testing").default; -const { DefaultAzureCredential } = require("@azure/identity"); -const { randomUUID } = require("node:crypto"); - -async function main() { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - const functionsResourceId = process.env["LOADTESTSERVICE_FUNCTIONSFLEXRESOURCEID"] || ""; // ResourceID of a Azure Function on Flex Consumption Plan - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - - const testId = randomUUID(); // ID to be assigned to a test - const testProfileId = randomUUID(); // ID to be assigned to the test profile - const displayName = "Sample Load Test"; - const description = "Sample Test Description"; - - const testProfileDisplayName = "Sample Test Profile"; - const testProfileDescription = "Sample Test Profile Description"; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Creating the Load test - await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: displayName, - description: description, - loadTestConfiguration: { - engineInstances: 1, // number of engine instances to run test - }, - }, - }); - - // Creating the test profile - await client.path("/test-profiles/{testProfileId}", testProfileId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: testProfileDisplayName, - description: testProfileDescription, - testId: testId, - targetResourceId: functionsResourceId, - targetResourceConfigurations: { - kind: "FunctionsFlexConsumption", - configurations: { - config1: { - instanceMemoryMB: 2048, - httpConcurrency: 20, - }, - config2: { - instanceMemoryMB: 4096, - httpConcurrency: 100, - }, - }, - }, - }, - }); -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/package.json b/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/package.json deleted file mode 100644 index 839d9672e262..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "@azure-samples/load-testing-js-beta", - "private": true, - "version": "1.0.0", - "description": "Azure Load Testing client library samples for JavaScript (Beta)", - "engines": { - "node": ">=18.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/loadtesting/load-testing-rest" - }, - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtesting/load-testing-rest", - "dependencies": { - "@azure-rest/load-testing": "next", - "dotenv": "latest", - "@azure/identity": "^4.6.0" - } -} diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/sample.env b/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/sample.env deleted file mode 100644 index 03f6278c22ac..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/sample.env +++ /dev/null @@ -1,9 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= - -LOADTESTSERVICE_ENDPOINT= -SUBSCRIPTION_ID= -RESOURCE_GROUP= -LOADTESTSERVICE_FLEXFUNCTIONSRESOURCEID= \ No newline at end of file diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/startTestProfileRun.js b/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/startTestProfileRun.js deleted file mode 100644 index 2d8635981479..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/startTestProfileRun.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to run a test profile and get recommendations from it. - * - * @summary Demonstrates how to start a test profile run. - */ - -const AzureLoadTesting = require("@azure-rest/load-testing").default, - { isUnexpected, getLongRunningPoller } = require("@azure-rest/load-testing"); -const { DefaultAzureCredential } = require("@azure/identity"); -const { randomUUID } = require("node:crypto"); - -async function main() { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testProfileId = process.env["LOADTESTSERVICE_TESTPROFILEID"] || ""; // TestProfileId of a test profile already created. - - const testProfileRunId = randomUUID(); // Random ID for the Test Profile Run - const displayName = "Sample Test Profile Run"; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Creating the test profile run - const testProfileRunCreationResult = await client - .path("/test-profile-runs/{testProfileRunId}", testProfileRunId) - .patch({ - contentType: "application/merge-patch+json", - body: { - testProfileId: testProfileId, - displayName: displayName, - }, - }); - - if (isUnexpected(testProfileRunCreationResult)) { - throw testProfileRunCreationResult.body.error; - } - - let testProfileRunResult; - - const testProfileRunPoller = await getLongRunningPoller(client, testProfileRunCreationResult); - try { - testProfileRunResult = await testProfileRunPoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(10 * 60000), // timeout of 10 minutes - }); - } catch (ex) { - new Error("Error in polling for test profile run completion: " + ex.message); // Polling timed out - } - - if (testProfileRunPoller.getOperationState().status !== "succeeded") { - throw new Error( - "There is some issue in running the test profile, Error Response : " + testProfileRunResult, - ); - } - - if (testProfileRunResult) { - const recommendations = testProfileRunResult.body.recommendations; - - if (recommendations && recommendations[0]) { - const throughputOptimizedRecommendation = recommendations.filter( - (r) => r.category === "ThroughputOptimized", - )[0]; - console.log( - "Throughput optimized configuration: " + throughputOptimizedRecommendation.configurations, - ); - } - } -} -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/startTestRunAndGetMetrics.js b/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/startTestRunAndGetMetrics.js deleted file mode 100644 index 2b780b286453..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/startTestRunAndGetMetrics.js +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to run a test, poll for its status and then fetch metrics from it. - * - * @summary Demonstrates how to start a test run and get metrics. - */ - -const AzureLoadTesting = require("@azure-rest/load-testing").default, - { isUnexpected, getLongRunningPoller } = require("@azure-rest/load-testing"); -const { DefaultAzureCredential } = require("@azure/identity"); -const { randomUUID } = require("node:crypto"); - -async function main() { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testId = process.env["LOADTESTSERVICE_TESTID"] || ""; // TestId of a test already created. - - const testRunId = randomUUID(); // Random ID for the Test Run - const displayName = "Sample Test Run"; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Creating the test run - const testRunCreationResult = await client.path("/test-runs/{testRunId}", testRunId).patch({ - contentType: "application/merge-patch+json", - body: { - testId: testId, - displayName: displayName, - }, - }); - - if (isUnexpected(testRunCreationResult)) { - throw testRunCreationResult.body.error; - } - - let testRunResult; - - const testRunPoller = await getLongRunningPoller(client, testRunCreationResult); - try { - testRunResult = await testRunPoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(90000), // timeout of 90 seconds - }); - } catch (ex) { - new Error("Error in polling for test run completion: " + ex.message); // Polling timed out - } - - if (testRunPoller.getOperationState().status !== "succeeded") { - throw new Error("There is some issue in running the test, Error Response : " + testRunResult); - } - - if (testRunResult) { - const testRunStartTime = testRunResult.body.startDateTime; - const testRunEndTime = testRunResult.body.endDateTime; - - // Get the list of all metric namespaces and pick the first one - const metricNamespaces = await client - .path("/test-runs/{testRunId}/metric-namespaces", testRunId) - .get(); - - if (isUnexpected(metricNamespaces)) { - throw metricNamespaces.body.error; - } - - const metricNamespace = metricNamespaces.body.value[0]; - - if (metricNamespace.name === undefined) { - throw "No Metric Namespace name is defined."; - } - - // Get the list of all metric definitions and pick the first one - const metricDefinitions = await client - .path("/test-runs/{testRunId}/metric-definitions", testRunId) - .get({ - queryParameters: { - metricNamespace: metricNamespace.name, - }, - }); - - if (isUnexpected(metricDefinitions)) { - throw metricDefinitions.body.error; - } - - const metricDefinition = metricDefinitions.body.value[0]; - - if (metricDefinition.name === undefined) { - throw "No Metric Definition name is defined."; - } - - // Fetch client metrics using metric namespace and metric definition name - const metricsResult = await client.path("/test-runs/{testRunId}/metrics", testRunId).post({ - queryParameters: { - metricname: metricDefinition.name, - metricNamespace: metricNamespace.name, - timespan: testRunStartTime + "/" + testRunEndTime, - }, - }); - - console.log(metricsResult); - console.log(testRunResult); - } -} -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/stopTestProfileRun.js b/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/stopTestProfileRun.js deleted file mode 100644 index d1bf786d8e35..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/stopTestProfileRun.js +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to stop a test profile run's execution - * - * @summary Demonstrates how to stop a running test profile run - */ - -const AzureLoadTesting = require("@azure-rest/load-testing").default, - { isUnexpected } = require("@azure-rest/load-testing"); -const { DefaultAzureCredential } = require("@azure/identity"); - -async function main() { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testProfileRunId = process.env["LOADTESTSERVICE_TESTPROFILERUNID"] || ""; // TestProfileRunId of an already started test profile run - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - const stopTestProfileRunResult = await client - .path("/test-profile-runs/{testProfileRunId}:stop", testProfileRunId) - .post(); - - if (isUnexpected(stopTestProfileRunResult)) { - throw stopTestProfileRunResult.body.error; - } -} -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/stopTestRun.js b/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/stopTestRun.js deleted file mode 100644 index 746653571de1..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/stopTestRun.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to stop a test run's execution - * - * @summary Demonstrates how to stop a running load test - */ - -const AzureLoadTesting = require("@azure-rest/load-testing").default, - { isUnexpected } = require("@azure-rest/load-testing"); -const { DefaultAzureCredential } = require("@azure/identity"); - -async function main() { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testRunId = process.env["LOADTESTSERVICE_TESTRUNID"] || ""; // TestRunId of an already started test run - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - const stopTestRunResult = await client.path("/test-runs/{testRunId}:stop", testRunId).post(); - - if (isUnexpected(stopTestRunResult)) { - throw stopTestRunResult.body.error; - } -} -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/uploadTestScript.js b/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/uploadTestScript.js deleted file mode 100644 index 25c9ac8c23ed..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/javascript/uploadTestScript.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to upload a JMX test script file - * - * @summary Demonstrates how to upload a test script file. - */ - -const AzureLoadTesting = require("@azure-rest/load-testing").default, - { isUnexpected, getLongRunningPoller } = require("@azure-rest/load-testing"); -const { DefaultAzureCredential } = require("@azure/identity"); -const { createReadStream } = require("node:fs"); - -const readStream = createReadStream("./sample.jmx"); - -async function main() { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testId = process.env["LOADTESTSERVICE_TESTID"] || ""; // TestId of a test already created. - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Uploading .jmx test script file for a test - const fileUploadResult = await client - .path("/tests/{testId}/files/{fileName}", testId, "sample.jmx") - .put({ - contentType: "application/octet-stream", - body: readStream, - }); - - if (isUnexpected(fileUploadResult)) { - throw fileUploadResult.body.error; - } - - let fileValidationResult; - const fileValidationPoller = await getLongRunningPoller(client, fileUploadResult); - try { - fileValidationResult = await fileValidationPoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(120 * 1000), // Time out polling in 120 seconds - }); - } catch (ex) { - throw new Error("Error in polling file validation status: " + ex.message); // Validation might have timed out. - } - - if (fileValidationPoller.getOperationState().status !== "succeeded" && fileValidationResult) { - throw new Error( - "There is some issue in validation, please make sure the upload file is a valid JMX file.", - ); - } -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/README.md b/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/README.md deleted file mode 100644 index bf3af31e7625..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/README.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -page_type: sample -languages: - - typescript -products: - - azure - - azure-load-testing -urlFragment: load-testing-typescript-beta ---- - -# Azure Load Testing client library samples for TypeScript (Beta) - -These sample programs show how to use the TypeScript client libraries for Azure Load Testing in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------- | ----------------------------------------------------------- | -| [addAppComponents.ts][addappcomponents] | Demonstrates how to add app components to an existing test. | -| [createOrUpdateTest.ts][createorupdatetest] | Demonstrates how to create a load test | -| [createTestProfile.ts][createtestprofile] | Demonstrates how to create a test profile. | -| [startTestProfileRun.ts][starttestprofilerun] | Demonstrates how to start a test profile run. | -| [startTestRunAndGetMetrics.ts][starttestrunandgetmetrics] | Demonstrates how to start a test run and get metrics. | -| [stopTestProfileRun.ts][stoptestprofilerun] | Demonstrates how to stop a running test profile run | -| [stopTestRun.ts][stoptestrun] | Demonstrates how to stop a running load test | -| [uploadTestScript.ts][uploadtestscript] | Demonstrates how to upload a test script file. | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: - -```bash -npm install -g typescript -``` - -You need [an Azure subscription][freesub] and the following Azure resources to run these sample programs: - -- [Azure Load Testing Resource][createinstance_azureloadtestingresource] - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Compile the samples: - -```bash -npm run build -``` - -3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -4. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node dist/addAppComponents.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env LOADTESTSERVICE_ENDPOINT="" LOADTESTSERVICE_TESTID="" SUBSCRIPTION_ID="" node dist/addAppComponents.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[addappcomponents]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/addAppComponents.ts -[createorupdatetest]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/createOrUpdateTest.ts -[createtestprofile]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/createTestProfile.ts -[starttestprofilerun]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/startTestProfileRun.ts -[starttestrunandgetmetrics]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/startTestRunAndGetMetrics.ts -[stoptestprofilerun]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/stopTestProfileRun.ts -[stoptestrun]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/stopTestRun.ts -[uploadtestscript]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/uploadTestScript.ts -[apiref]: https://learn.microsoft.com/javascript/api/@azure-rest/load-testing?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[createinstance_azureloadtestingresource]: https://learn.microsoft.com/azure/load-testing/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtesting/load-testing-rest/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/package.json b/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/package.json deleted file mode 100644 index 32be6c98dff4..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@azure-samples/load-testing-ts-beta", - "private": true, - "version": "1.0.0", - "description": "Azure Load Testing client library samples for TypeScript (Beta)", - "engines": { - "node": ">=18.0.0" - }, - "scripts": { - "build": "tsc", - "prebuild": "rimraf dist/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/loadtesting/load-testing-rest" - }, - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtesting/load-testing-rest", - "dependencies": { - "@azure-rest/load-testing": "next", - "dotenv": "latest", - "@azure/identity": "^4.6.0" - }, - "devDependencies": { - "@types/node": "^18.0.0", - "typescript": "~5.8.2", - "rimraf": "latest" - } -} diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/sample.env b/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/sample.env deleted file mode 100644 index 03f6278c22ac..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/sample.env +++ /dev/null @@ -1,9 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= - -LOADTESTSERVICE_ENDPOINT= -SUBSCRIPTION_ID= -RESOURCE_GROUP= -LOADTESTSERVICE_FLEXFUNCTIONSRESOURCEID= \ No newline at end of file diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/addAppComponents.ts b/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/addAppComponents.ts deleted file mode 100644 index b9bba6d31bd8..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/addAppComponents.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to add App Components to an existing test. - * - * @summary Demonstrates how to add app components to an existing test. - */ - -import AzureLoadTesting, { isUnexpected } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testId = process.env["LOADTESTSERVICE_TESTID"] || ""; // TestId of a test already created. - - const SUBSCRIPTION_ID = process.env["SUBSCRIPTION_ID"] || ""; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - const appComponentCreationResult = await client - .path("/tests/{testId}/app-components", testId) - .patch({ - contentType: "application/merge-patch+json", - body: { - components: { - "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo": - { - resourceName: "App-Service-Sample-Demo", - resourceType: "Microsoft.Web/sites", - }, - }, - }, - }); - - if (isUnexpected(appComponentCreationResult)) { - throw appComponentCreationResult.body.error; - } -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/createOrUpdateTest.ts b/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/createOrUpdateTest.ts deleted file mode 100644 index 838ec3fd555f..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/createOrUpdateTest.ts +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create a load test - * - * @summary Demonstrates how to create a load test - */ - -import AzureLoadTesting /* , { isUnexpected }*/ from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; -import { randomUUID } from "node:crypto"; - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - - const testId = randomUUID(); // ID to be assigned to a test - const displayName = "Sample Load Test"; - const description = "Sample Test Description"; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Creating the Load test - await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: displayName, - description: description, - loadTestConfiguration: { - engineInstances: 1, // number of engine instances to run test - }, - }, - }); -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/createTestProfile.ts b/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/createTestProfile.ts deleted file mode 100644 index 97e977403509..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/createTestProfile.ts +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create a load test and then use it to create a test profile. - * - * @summary Demonstrates how to create a test profile. - */ - -import AzureLoadTesting /* , { isUnexpected }*/ from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; -import { randomUUID } from "node:crypto"; - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - const functionsResourceId = process.env["LOADTESTSERVICE_FUNCTIONSFLEXRESOURCEID"] || ""; // ResourceID of a Azure Function on Flex Consumption Plan - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - - const testId = randomUUID(); // ID to be assigned to a test - const testProfileId = randomUUID(); // ID to be assigned to the test profile - const displayName = "Sample Load Test"; - const description = "Sample Test Description"; - - const testProfileDisplayName = "Sample Test Profile"; - const testProfileDescription = "Sample Test Profile Description"; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Creating the Load test - await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: displayName, - description: description, - loadTestConfiguration: { - engineInstances: 1, // number of engine instances to run test - }, - }, - }); - - // Creating the test profile - await client.path("/test-profiles/{testProfileId}", testProfileId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: testProfileDisplayName, - description: testProfileDescription, - testId: testId, - targetResourceId: functionsResourceId, - targetResourceConfigurations: { - kind: "FunctionsFlexConsumption", - configurations: { - config1: { - instanceMemoryMB: 2048, - httpConcurrency: 20, - }, - config2: { - instanceMemoryMB: 4096, - httpConcurrency: 100, - }, - }, - }, - }, - }); -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/startTestProfileRun.ts b/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/startTestProfileRun.ts deleted file mode 100644 index 93a10cad15b5..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/startTestProfileRun.ts +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to run a test profile and get recommendations from it. - * - * @summary Demonstrates how to start a test profile run. - */ - -import AzureLoadTesting, { isUnexpected, getLongRunningPoller } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; -import { randomUUID } from "node:crypto"; - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testProfileId = process.env["LOADTESTSERVICE_TESTPROFILEID"] || ""; // TestProfileId of a test profile already created. - - const testProfileRunId = randomUUID(); // Random ID for the Test Profile Run - const displayName = "Sample Test Profile Run"; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Creating the test profile run - const testProfileRunCreationResult = await client - .path("/test-profile-runs/{testProfileRunId}", testProfileRunId) - .patch({ - contentType: "application/merge-patch+json", - body: { - testProfileId: testProfileId, - displayName: displayName, - }, - }); - - if (isUnexpected(testProfileRunCreationResult)) { - throw testProfileRunCreationResult.body.error; - } - - let testProfileRunResult; - - const testProfileRunPoller = await getLongRunningPoller(client, testProfileRunCreationResult); - try { - testProfileRunResult = await testProfileRunPoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(10 * 60000), // timeout of 10 minutes - }); - } catch (ex: any) { - new Error("Error in polling for test profile run completion: " + ex.message); // Polling timed out - } - - if (testProfileRunPoller.getOperationState().status !== "succeeded") { - throw new Error( - "There is some issue in running the test profile, Error Response : " + testProfileRunResult, - ); - } - - if (testProfileRunResult) { - const recommendations = testProfileRunResult.body.recommendations; - - if (recommendations && recommendations[0]) { - const throughputOptimizedRecommendation = recommendations.filter( - (r) => r.category === "ThroughputOptimized", - )[0]; - console.log( - "Throughput optimized configuration: " + throughputOptimizedRecommendation.configurations, - ); - } - } -} -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/startTestRunAndGetMetrics.ts b/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/startTestRunAndGetMetrics.ts deleted file mode 100644 index 7d76ce4aa228..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/startTestRunAndGetMetrics.ts +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to run a test, poll for its status and then fetch metrics from it. - * - * @summary Demonstrates how to start a test run and get metrics. - */ - -import AzureLoadTesting, { isUnexpected, getLongRunningPoller } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; -import { randomUUID } from "node:crypto"; - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testId = process.env["LOADTESTSERVICE_TESTID"] || ""; // TestId of a test already created. - - const testRunId = randomUUID(); // Random ID for the Test Run - const displayName = "Sample Test Run"; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Creating the test run - const testRunCreationResult = await client.path("/test-runs/{testRunId}", testRunId).patch({ - contentType: "application/merge-patch+json", - body: { - testId: testId, - displayName: displayName, - }, - }); - - if (isUnexpected(testRunCreationResult)) { - throw testRunCreationResult.body.error; - } - - let testRunResult; - - const testRunPoller = await getLongRunningPoller(client, testRunCreationResult); - try { - testRunResult = await testRunPoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(90000), // timeout of 90 seconds - }); - } catch (ex: any) { - new Error("Error in polling for test run completion: " + ex.message); // Polling timed out - } - - if (testRunPoller.getOperationState().status !== "succeeded") { - throw new Error("There is some issue in running the test, Error Response : " + testRunResult); - } - - if (testRunResult) { - const testRunStartTime = testRunResult.body.startDateTime; - const testRunEndTime = testRunResult.body.endDateTime; - - // Get the list of all metric namespaces and pick the first one - const metricNamespaces = await client - .path("/test-runs/{testRunId}/metric-namespaces", testRunId) - .get(); - - if (isUnexpected(metricNamespaces)) { - throw metricNamespaces.body.error; - } - - const metricNamespace = metricNamespaces.body.value[0]; - - if (metricNamespace.name === undefined) { - throw "No Metric Namespace name is defined."; - } - - // Get the list of all metric definitions and pick the first one - const metricDefinitions = await client - .path("/test-runs/{testRunId}/metric-definitions", testRunId) - .get({ - queryParameters: { - metricNamespace: metricNamespace.name, - }, - }); - - if (isUnexpected(metricDefinitions)) { - throw metricDefinitions.body.error; - } - - const metricDefinition = metricDefinitions.body.value[0]; - - if (metricDefinition.name === undefined) { - throw "No Metric Definition name is defined."; - } - - // Fetch client metrics using metric namespace and metric definition name - const metricsResult = await client.path("/test-runs/{testRunId}/metrics", testRunId).post({ - queryParameters: { - metricname: metricDefinition.name, - metricNamespace: metricNamespace.name, - timespan: testRunStartTime + "/" + testRunEndTime, - }, - }); - - console.log(metricsResult); - console.log(testRunResult); - } -} -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/stopTestProfileRun.ts b/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/stopTestProfileRun.ts deleted file mode 100644 index 5840a7f1d8e4..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/stopTestProfileRun.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to stop a test profile run's execution - * - * @summary Demonstrates how to stop a running test profile run - */ - -import AzureLoadTesting, { isUnexpected } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testProfileRunId = process.env["LOADTESTSERVICE_TESTPROFILERUNID"] || ""; // TestProfileRunId of an already started test profile run - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - const stopTestProfileRunResult = await client - .path("/test-profile-runs/{testProfileRunId}:stop", testProfileRunId) - .post(); - - if (isUnexpected(stopTestProfileRunResult)) { - throw stopTestProfileRunResult.body.error; - } -} -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/stopTestRun.ts b/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/stopTestRun.ts deleted file mode 100644 index fd0ee8ccc8da..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/stopTestRun.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to stop a test run's execution - * - * @summary Demonstrates how to stop a running load test - */ - -import AzureLoadTesting, { isUnexpected } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testRunId = process.env["LOADTESTSERVICE_TESTRUNID"] || ""; // TestRunId of an already started test run - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - const stopTestRunResult = await client.path("/test-runs/{testRunId}:stop", testRunId).post(); - - if (isUnexpected(stopTestRunResult)) { - throw stopTestRunResult.body.error; - } -} -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/uploadTestScript.ts b/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/uploadTestScript.ts deleted file mode 100644 index b113a91ee247..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/src/uploadTestScript.ts +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to upload a JMX test script file - * - * @summary Demonstrates how to upload a test script file. - */ - -import AzureLoadTesting, { isUnexpected, getLongRunningPoller } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; -import { createReadStream } from "node:fs"; - -const readStream = createReadStream("./sample.jmx"); - -async function main(): Promise { - /** - * The dataplane endpoint for the Azure Load Testing resource. - * Refer to https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri to understand how to obtain the data-plane endpoint. - */ - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - - /** Microsoft Entra ID authentication */ - /** - * In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth - */ - const credential = new DefaultAzureCredential(); - const testId = process.env["LOADTESTSERVICE_TESTID"] || ""; // TestId of a test already created. - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, credential); - - // Uploading .jmx test script file for a test - const fileUploadResult = await client - .path("/tests/{testId}/files/{fileName}", testId, "sample.jmx") - .put({ - contentType: "application/octet-stream", - body: readStream, - }); - - if (isUnexpected(fileUploadResult)) { - throw fileUploadResult.body.error; - } - - let fileValidationResult; - const fileValidationPoller = await getLongRunningPoller(client, fileUploadResult); - try { - fileValidationResult = await fileValidationPoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(120 * 1000), // Time out polling in 120 seconds - }); - } catch (ex: any) { - throw new Error("Error in polling file validation status: " + ex.message); // Validation might have timed out. - } - - if (fileValidationPoller.getOperationState().status !== "succeeded" && fileValidationResult) { - throw new Error( - "There is some issue in validation, please make sure the upload file is a valid JMX file.", - ); - } -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/tsconfig.json b/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/tsconfig.json deleted file mode 100644 index 400db87cf648..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1-beta/typescript/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2023", - "module": "commonjs", - "lib": [], - "importHelpers": true, - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "moduleResolution": "node10", - "esModuleInterop": true, - "outDir": "./dist", - "resolveJsonModule": true - }, - "include": [ - "./src" - ] -} diff --git a/sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts b/sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts index 1f870f66bb18..df1eebd74e13 100644 --- a/sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts +++ b/sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts @@ -22,9 +22,13 @@ export interface AzureLoadTestingClientOptions extends ClientOptions { export default function createClient( endpointParam: string, credentials: TokenCredential, - { apiVersion = "2024-12-01-preview", ...options }: AzureLoadTestingClientOptions = {}, + { + apiVersion = "2024-12-01-preview", + ...options + }: AzureLoadTestingClientOptions = {}, ): AzureLoadTestingClient { - const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://${endpointParam}`; + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `https://${endpointParam}`; const userAgentInfo = `azsdk-js-load-testing-rest/1.0.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix @@ -39,10 +43,16 @@ export default function createClient( logger: options.loggingOptions?.logger ?? logger.info, }, credentials: { - scopes: options.credentials?.scopes ?? ["https://cnt-prod.loadtesting.azure.com/.default"], + scopes: options.credentials?.scopes ?? [ + "https://cnt-prod.loadtesting.azure.com/.default", + ], }, }; - const client = getClient(endpointUrl, credentials, options) as AzureLoadTestingClient; + const client = getClient( + endpointUrl, + credentials, + options, + ) as AzureLoadTestingClient; client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); client.pipeline.addPolicy({ diff --git a/sdk/loadtesting/load-testing-rest/src/clientDefinitions.ts b/sdk/loadtesting/load-testing-rest/src/clientDefinitions.ts index 64de2a893bb7..db894d64b8d4 100644 --- a/sdk/loadtesting/load-testing-rest/src/clientDefinitions.ts +++ b/sdk/loadtesting/load-testing-rest/src/clientDefinitions.ts @@ -159,13 +159,15 @@ export interface LoadTestAdministrationCreateOrUpdateTest { delete( options?: LoadTestAdministrationDeleteTestParameters, ): StreamableMethod< - LoadTestAdministrationDeleteTest204Response | LoadTestAdministrationDeleteTestDefaultResponse + | LoadTestAdministrationDeleteTest204Response + | LoadTestAdministrationDeleteTestDefaultResponse >; /** Get load test details by test Id */ get( options?: LoadTestAdministrationGetTestParameters, ): StreamableMethod< - LoadTestAdministrationGetTest200Response | LoadTestAdministrationGetTestDefaultResponse + | LoadTestAdministrationGetTest200Response + | LoadTestAdministrationGetTestDefaultResponse >; } @@ -177,7 +179,8 @@ export interface LoadTestAdministrationListTests { get( options?: LoadTestAdministrationListTestsParameters, ): StreamableMethod< - LoadTestAdministrationListTests200Response | LoadTestAdministrationListTestsDefaultResponse + | LoadTestAdministrationListTests200Response + | LoadTestAdministrationListTestsDefaultResponse >; } @@ -197,7 +200,8 @@ export interface LoadTestAdministrationUploadTestFile { get( options?: LoadTestAdministrationGetTestFileParameters, ): StreamableMethod< - LoadTestAdministrationGetTestFile200Response | LoadTestAdministrationGetTestFileDefaultResponse + | LoadTestAdministrationGetTestFile200Response + | LoadTestAdministrationGetTestFileDefaultResponse >; /** Delete file by the file name for a test */ delete( @@ -293,7 +297,9 @@ export interface LoadTestRunGetTestRun { /** Get test run details by test run Id. */ get( options?: LoadTestRunGetTestRunParameters, - ): StreamableMethod; + ): StreamableMethod< + LoadTestRunGetTestRun200Response | LoadTestRunGetTestRunDefaultResponse + >; /** Create and start a new test run with the given test run Id. */ patch( options: LoadTestRunCreateOrUpdateTestRunParameters, @@ -306,7 +312,8 @@ export interface LoadTestRunGetTestRun { delete( options?: LoadTestRunDeleteTestRunParameters, ): StreamableMethod< - LoadTestRunDeleteTestRun204Response | LoadTestRunDeleteTestRunDefaultResponse + | LoadTestRunDeleteTestRun204Response + | LoadTestRunDeleteTestRunDefaultResponse >; } @@ -314,7 +321,9 @@ export interface LoadTestRunListTestRuns { /** Get all test runs for the given filters. */ get( options?: LoadTestRunListTestRunsParameters, - ): StreamableMethod; + ): StreamableMethod< + LoadTestRunListTestRuns200Response | LoadTestRunListTestRunsDefaultResponse + >; } export interface LoadTestRunGetTestRunFile { @@ -322,7 +331,8 @@ export interface LoadTestRunGetTestRunFile { get( options?: LoadTestRunGetTestRunFileParameters, ): StreamableMethod< - LoadTestRunGetTestRunFile200Response | LoadTestRunGetTestRunFileDefaultResponse + | LoadTestRunGetTestRunFile200Response + | LoadTestRunGetTestRunFileDefaultResponse >; } @@ -330,7 +340,9 @@ export interface LoadTestRunStop { /** Stop test run by test run Id. */ post( options?: LoadTestRunStopParameters, - ): StreamableMethod; + ): StreamableMethod< + LoadTestRunStop200Response | LoadTestRunStopDefaultResponse + >; } export interface LoadTestRunListMetricNamespaces { @@ -338,7 +350,8 @@ export interface LoadTestRunListMetricNamespaces { get( options?: LoadTestRunListMetricNamespacesParameters, ): StreamableMethod< - LoadTestRunListMetricNamespaces200Response | LoadTestRunListMetricNamespacesDefaultResponse + | LoadTestRunListMetricNamespaces200Response + | LoadTestRunListMetricNamespacesDefaultResponse >; } @@ -347,7 +360,8 @@ export interface LoadTestRunListMetricDefinitions { get( options: LoadTestRunListMetricDefinitionsParameters, ): StreamableMethod< - LoadTestRunListMetricDefinitions200Response | LoadTestRunListMetricDefinitionsDefaultResponse + | LoadTestRunListMetricDefinitions200Response + | LoadTestRunListMetricDefinitionsDefaultResponse >; } @@ -355,7 +369,9 @@ export interface LoadTestRunListMetrics { /** List the metric values for a load test run. */ post( options: LoadTestRunListMetricsParameters, - ): StreamableMethod; + ): StreamableMethod< + LoadTestRunListMetrics200Response | LoadTestRunListMetricsDefaultResponse + >; } export interface LoadTestRunListMetricDimensionValues { @@ -384,7 +400,8 @@ export interface LoadTestRunCreateOrUpdateAppComponents { get( options?: LoadTestRunGetAppComponentsParameters, ): StreamableMethod< - LoadTestRunGetAppComponents200Response | LoadTestRunGetAppComponentsDefaultResponse + | LoadTestRunGetAppComponents200Response + | LoadTestRunGetAppComponentsDefaultResponse >; } @@ -401,7 +418,8 @@ export interface LoadTestRunCreateOrUpdateServerMetricsConfig { get( options?: LoadTestRunGetServerMetricsConfigParameters, ): StreamableMethod< - LoadTestRunGetServerMetricsConfig200Response | LoadTestRunGetServerMetricsConfigDefaultResponse + | LoadTestRunGetServerMetricsConfig200Response + | LoadTestRunGetServerMetricsConfigDefaultResponse >; } @@ -435,7 +453,8 @@ export interface TestProfileRunAdministrationStop { post( options?: TestProfileRunAdministrationStopParameters, ): StreamableMethod< - TestProfileRunAdministrationStop200Response | TestProfileRunAdministrationStopDefaultResponse + | TestProfileRunAdministrationStop200Response + | TestProfileRunAdministrationStopDefaultResponse >; } @@ -454,7 +473,8 @@ export interface TriggerAdministrationGetTrigger { get( options?: TriggerAdministrationGetTriggerParameters, ): StreamableMethod< - TriggerAdministrationGetTrigger200Response | TriggerAdministrationGetTriggerDefaultResponse + | TriggerAdministrationGetTrigger200Response + | TriggerAdministrationGetTriggerDefaultResponse >; /** Create or update operation template. */ patch( @@ -478,7 +498,8 @@ export interface TriggerAdministrationListTrigger { get( options?: TriggerAdministrationListTriggerParameters, ): StreamableMethod< - TriggerAdministrationListTrigger200Response | TriggerAdministrationListTriggerDefaultResponse + | TriggerAdministrationListTrigger200Response + | TriggerAdministrationListTriggerDefaultResponse >; } @@ -519,7 +540,10 @@ export interface NotificationRuleAdministrationListNotificationRule { export interface Routes { /** Resource for '/tests/\{testId\}' has methods for the following verbs: patch, delete, get */ - (path: "/tests/{testId}", testId: string): LoadTestAdministrationCreateOrUpdateTest; + ( + path: "/tests/{testId}", + testId: string, + ): LoadTestAdministrationCreateOrUpdateTest; /** Resource for '/tests' has methods for the following verbs: get */ (path: "/tests"): LoadTestAdministrationListTests; /** Resource for '/tests/\{testId\}/files/\{fileName\}' has methods for the following verbs: put, get, delete */ @@ -529,7 +553,10 @@ export interface Routes { fileName: string, ): LoadTestAdministrationUploadTestFile; /** Resource for '/tests/\{testId\}/files' has methods for the following verbs: get */ - (path: "/tests/{testId}/files", testId: string): LoadTestAdministrationListTestFiles; + ( + path: "/tests/{testId}/files", + testId: string, + ): LoadTestAdministrationListTestFiles; /** Resource for '/tests/\{testId\}/app-components' has methods for the following verbs: patch, get */ ( path: "/tests/{testId}/app-components", @@ -570,7 +597,10 @@ export interface Routes { testRunId: string, ): LoadTestRunListMetricDefinitions; /** Resource for '/test-runs/\{testRunId\}/metrics' has methods for the following verbs: post */ - (path: "/test-runs/{testRunId}/metrics", testRunId: string): LoadTestRunListMetrics; + ( + path: "/test-runs/{testRunId}/metrics", + testRunId: string, + ): LoadTestRunListMetrics; /** Resource for '/test-runs/\{testRunId\}/metric-dimensions/\{name\}/values' has methods for the following verbs: get */ ( path: "/test-runs/{testRunId}/metric-dimensions/{name}/values", @@ -600,7 +630,10 @@ export interface Routes { /** Resource for '/test-profile-runs' has methods for the following verbs: get */ (path: "/test-profile-runs"): TestProfileRunAdministrationListTestProfileRuns; /** Resource for '/triggers/\{triggerId\}' has methods for the following verbs: get, patch, delete */ - (path: "/triggers/{triggerId}", triggerId: string): TriggerAdministrationGetTrigger; + ( + path: "/triggers/{triggerId}", + triggerId: string, + ): TriggerAdministrationGetTrigger; /** Resource for '/triggers' has methods for the following verbs: get */ (path: "/triggers"): TriggerAdministrationListTrigger; /** Resource for '/notification-rules/\{notificationRuleId\}' has methods for the following verbs: get, patch, delete */ @@ -609,7 +642,9 @@ export interface Routes { notificationRuleId: string, ): NotificationRuleAdministrationGetNotificationRule; /** Resource for '/notification-rules' has methods for the following verbs: get */ - (path: "/notification-rules"): NotificationRuleAdministrationListNotificationRule; + ( + path: "/notification-rules", + ): NotificationRuleAdministrationListNotificationRule; } export type AzureLoadTestingClient = Client & { diff --git a/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts b/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts deleted file mode 100644 index eae67c2c8673..000000000000 --- a/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { AbortSignalLike } from "@azure/abort-controller"; -import { AbortError } from "@azure/abort-controller"; -import type { CancelOnProgress, OperationState, SimplePollerLike } from "@azure/core-lro"; -import type { FileUploadAndValidatePoller, PolledOperationOptions } from "./models.js"; -import type { AzureLoadTestingClient } from "./clientDefinitions.js"; -import type { - LoadTestAdministrationGetTestFile200Response, - LoadTestAdministrationUploadTestFile201Response, -} from "./responses.js"; -import { isUnexpected } from "./isUnexpected.js"; -import { sleep } from "./util/LROUtil.js"; - -/** - * Uploads a file and creates a poller to poll for validation. - * @param client - The Load Testing client. - * @param options - The operation options. - * @returns A poller which can be called to poll until completion of the job. - */ -export async function getFileValidationPoller( - client: AzureLoadTestingClient, - fileUploadResult: LoadTestAdministrationUploadTestFile201Response, - polledOperationOptions: PolledOperationOptions = {}, -): Promise { - // get filename and testid from initial response - const fileName = fileUploadResult.body.fileName; - const requestUrl = fileUploadResult.request.url; - const testId = requestUrl.substring( - requestUrl.indexOf("tests/") + 6, - requestUrl.lastIndexOf("/files"), - ); - type Handler = (state: OperationState) => void; - - const state: OperationState = { - status: "notStarted", - }; - - const progressCallbacks = new Map(); - const processProgressCallbacks = async (): Promise => - progressCallbacks.forEach((h) => h(state)); - let resultPromise: Promise | undefined; - let cancelJob: (() => void) | undefined; - const abortController = new AbortController(); - const currentPollIntervalInMs = polledOperationOptions.updateIntervalInMs ?? 2000; - - const poller: SimplePollerLike< - OperationState, - LoadTestAdministrationGetTestFile200Response - > = { - async poll(options?: { abortSignal?: AbortSignalLike }): Promise { - if (options?.abortSignal?.aborted) { - throw new AbortError("The polling was aborted."); - } - - if (fileName) { - const fileValidationResponse = await client - .path("/tests/{testId}/files/{fileName}", testId, fileName) - .get(); - if (isUnexpected(fileValidationResponse)) { - state.status = "failed"; - state.error = new Error(fileValidationResponse.body.error.message); - return; - } - - switch (fileValidationResponse.body.validationStatus) { - case "NOT_VALIDATED": { - state.status = "succeeded"; - break; - } - case "VALIDATION_INITIATED": { - state.status = "running"; - break; - } - case "VALIDATION_SUCCESS": - case "VALIDATION_NOT_REQUIRED": { - state.status = "succeeded"; - break; - } - case "VALIDATION_FAILURE": { - state.status = "failed"; - state.error = new Error(fileValidationResponse.body.validationFailureDetails); - break; - } - } - state.result = fileValidationResponse; - - await processProgressCallbacks(); - } - }, - - pollUntilDone(pollOptions?: { - abortSignal?: AbortSignalLike; - }): Promise { - return (resultPromise ??= (async () => { - const { abortSignal: inputAbortSignal } = pollOptions || {}; - // In the future we can use AbortSignal.any() instead - function abortListener(): void { - abortController.abort(); - } - const abortSignal = abortController.signal; - if (inputAbortSignal?.aborted) { - abortController.abort(); - } else if (!abortSignal.aborted) { - inputAbortSignal?.addEventListener("abort", abortListener, { once: true }); - } - - try { - if (!poller.isDone()) { - await poller.poll({ abortSignal }); - while (!poller.isDone()) { - const delay = sleep(currentPollIntervalInMs, abortSignal); - cancelJob = () => abortController.abort(); - await delay; - await poller.poll({ abortSignal }); - } - } - } finally { - inputAbortSignal?.removeEventListener("abort", abortListener); - } - switch (state.status) { - case "succeeded": - case "failed": - case "canceled": { - return poller.getResult() as LoadTestAdministrationGetTestFile200Response; - } - case "notStarted": - case "running": { - // Unreachable - throw new Error(`polling completed without succeeding or failing`); - } - } - })().finally(() => { - resultPromise = undefined; - })); - }, - - onProgress( - callback: (state: OperationState) => void, - ): CancelOnProgress { - const s = Symbol(); - progressCallbacks.set(s, callback); - - return () => progressCallbacks.delete(s); - }, - - isDone(): boolean { - return ["succeeded", "failed", "canceled"].includes(state.status); - }, - - stopPolling(): void { - abortController.abort(); - cancelJob?.(); - }, - - isStopped(): boolean { - return resultPromise === undefined; - }, - - getOperationState(): OperationState { - return state; - }, - - getResult(): LoadTestAdministrationGetTestFile200Response | undefined { - return state.result; - }, - - toString() { - return JSON.stringify({ state }); - }, - }; - - return poller; -} diff --git a/sdk/loadtesting/load-testing-rest/src/getTestProfileRunCompletionPoller.ts b/sdk/loadtesting/load-testing-rest/src/getTestProfileRunCompletionPoller.ts deleted file mode 100644 index f8f1d3e670eb..000000000000 --- a/sdk/loadtesting/load-testing-rest/src/getTestProfileRunCompletionPoller.ts +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { AbortSignalLike } from "@azure/abort-controller"; -import { AbortError } from "@azure/abort-controller"; -import type { CancelOnProgress, OperationState, SimplePollerLike } from "@azure/core-lro"; -import type { PolledOperationOptions, TestProfileRunCompletionPoller } from "./models.js"; -import type { AzureLoadTestingClient } from "./clientDefinitions.js"; -import type { - TestProfileRunAdministrationCreateOrUpdateTestProfileRun200Response, - TestProfileRunAdministrationCreateOrUpdateTestProfileRun201Response, - TestProfileRunAdministrationGetTestProfileRun200Response, -} from "./responses.js"; -import { isUnexpected } from "./isUnexpected.js"; -import { sleep, isTestProfileRunInProgress } from "./util/LROUtil.js"; - -/** - * Creates a poller to poll for test run status. - * @param client - The Load Testing client. - * @param options - The operation options. - * @returns A poller which can be called to poll until completion of the job. - */ -export async function getTestProfileRunCompletionPoller( - client: AzureLoadTestingClient, - createTestProfileRunResponse: - | TestProfileRunAdministrationCreateOrUpdateTestProfileRun200Response - | TestProfileRunAdministrationCreateOrUpdateTestProfileRun201Response, - polledOperationOptions: PolledOperationOptions = {}, -): Promise { - type Handler = ( - state: OperationState, - ) => void; - - const state: OperationState = { - status: "notStarted", - }; - - const progressCallbacks = new Map(); - const processProgressCallbacks = async (): Promise => - progressCallbacks.forEach((h) => h(state)); - let resultPromise: Promise | undefined; - let cancelJob: (() => void) | undefined; - const abortController = new AbortController(); - const currentPollIntervalInMs = polledOperationOptions.updateIntervalInMs ?? 10000; - const testProfileRunId = createTestProfileRunResponse.body.testProfileRunId; - - const poller: SimplePollerLike< - OperationState, - TestProfileRunAdministrationGetTestProfileRun200Response - > = { - async poll(options?: { abortSignal?: AbortSignalLike }): Promise { - if (options?.abortSignal?.aborted) { - throw new AbortError("The polling was aborted."); - } - - if (testProfileRunId) { - const getTestProfileRunResult = await client - .path("/test-profile-runs/{testProfileRunId}", testProfileRunId) - .get(); - if (isUnexpected(getTestProfileRunResult)) { - state.status = "failed"; - state.error = new Error(getTestProfileRunResult.body.error.message); - return; - } - - if (getTestProfileRunResult.body.status === "FAILED") { - state.status = "failed"; - state.error = new Error(getTestProfileRunResult.body.status); - } - - if (getTestProfileRunResult.body.status === "CANCELLED") { - state.status = "canceled"; - } - - if (getTestProfileRunResult.body.status === "DONE") { - state.status = "succeeded"; - } - - if (isTestProfileRunInProgress(getTestProfileRunResult.body)) { - state.status = "running"; - } - state.result = getTestProfileRunResult; - await processProgressCallbacks(); - } - }, - - pollUntilDone(pollOptions?: { - abortSignal?: AbortSignalLike; - }): Promise { - return (resultPromise ??= (async () => { - const { abortSignal: inputAbortSignal } = pollOptions || {}; - // In the future we can use AbortSignal.any() instead - function abortListener(): void { - abortController.abort(); - } - const abortSignal = abortController.signal; - if (inputAbortSignal?.aborted) { - abortController.abort(); - } else if (!abortSignal.aborted) { - inputAbortSignal?.addEventListener("abort", abortListener, { once: true }); - } - - try { - if (!poller.isDone()) { - await poller.poll({ abortSignal }); - while (!poller.isDone()) { - const delay = sleep(currentPollIntervalInMs, abortSignal); - cancelJob = () => abortController.abort(); - await delay; - await poller.poll({ abortSignal }); - } - } - } finally { - inputAbortSignal?.removeEventListener("abort", abortListener); - } - switch (state.status) { - case "succeeded": - case "failed": - case "canceled": { - return poller.getResult() as TestProfileRunAdministrationGetTestProfileRun200Response; - } - case "notStarted": - case "running": { - // Unreachable - throw new Error(`polling completed without succeeding or failing`); - } - } - })().finally(() => { - resultPromise = undefined; - })); - }, - - onProgress( - callback: ( - state: OperationState, - ) => void, - ): CancelOnProgress { - const s = Symbol(); - progressCallbacks.set(s, callback); - - return () => progressCallbacks.delete(s); - }, - - isDone(): boolean { - return ["succeeded", "failed", "canceled"].includes(state.status); - }, - - stopPolling(): void { - abortController.abort(); - cancelJob?.(); - }, - - isStopped(): boolean { - return resultPromise === undefined; - }, - - getOperationState(): OperationState { - return state; - }, - - getResult(): TestProfileRunAdministrationGetTestProfileRun200Response | undefined { - return state.result; - }, - - toString() { - return JSON.stringify({ state }); - }, - }; - - return poller; -} diff --git a/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts b/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts deleted file mode 100644 index acd0f348e17c..000000000000 --- a/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { AbortSignalLike } from "@azure/abort-controller"; -import { AbortError } from "@azure/abort-controller"; -import type { CancelOnProgress, OperationState, SimplePollerLike } from "@azure/core-lro"; -import type { TestRunCompletionPoller, PolledOperationOptions } from "./models.js"; -import type { AzureLoadTestingClient } from "./clientDefinitions.js"; -import type { - LoadTestRunCreateOrUpdateTestRun200Response, - LoadTestRunCreateOrUpdateTestRun201Response, - LoadTestRunGetTestRun200Response, -} from "./responses.js"; -import { isUnexpected } from "./isUnexpected.js"; -import { sleep, isTestRunInProgress } from "./util/LROUtil.js"; - -/** - * Creates a poller to poll for test run status. - * @param client - The Load Testing client. - * @param options - The operation options. - * @returns A poller which can be called to poll until completion of the job. - */ -export async function getTestRunCompletionPoller( - client: AzureLoadTestingClient, - createTestRunResponse: - | LoadTestRunCreateOrUpdateTestRun200Response - | LoadTestRunCreateOrUpdateTestRun201Response, - polledOperationOptions: PolledOperationOptions = {}, -): Promise { - type Handler = (state: OperationState) => void; - - const state: OperationState = { - status: "notStarted", - }; - - const progressCallbacks = new Map(); - const processProgressCallbacks = async (): Promise => - progressCallbacks.forEach((h) => h(state)); - let resultPromise: Promise | undefined; - let cancelJob: (() => void) | undefined; - const abortController = new AbortController(); - const currentPollIntervalInMs = polledOperationOptions.updateIntervalInMs ?? 2000; - const testRunId = createTestRunResponse.body.testRunId; - - const poller: SimplePollerLike< - OperationState, - LoadTestRunGetTestRun200Response - > = { - async poll(options?: { abortSignal?: AbortSignalLike }): Promise { - if (options?.abortSignal?.aborted) { - throw new AbortError("The polling was aborted."); - } - - if (testRunId) { - const getTestRunResult = await client.path("/test-runs/{testRunId}", testRunId).get(); - if (isUnexpected(getTestRunResult)) { - state.status = "failed"; - state.error = new Error(getTestRunResult.body.error.message); - return; - } - - if (getTestRunResult.body.status === "FAILED") { - state.status = "failed"; - state.error = new Error(getTestRunResult.body.status); - } - - if (getTestRunResult.body.status === "CANCELLED") { - state.status = "canceled"; - } - - if (getTestRunResult.body.status === "DONE") { - state.status = "succeeded"; - } - - if (isTestRunInProgress(getTestRunResult.body)) { - state.status = "running"; - } - state.result = getTestRunResult; - await processProgressCallbacks(); - } - }, - - pollUntilDone(pollOptions?: { - abortSignal?: AbortSignalLike; - }): Promise { - return (resultPromise ??= (async () => { - const { abortSignal: inputAbortSignal } = pollOptions || {}; - // In the future we can use AbortSignal.any() instead - function abortListener(): void { - abortController.abort(); - } - const abortSignal = abortController.signal; - if (inputAbortSignal?.aborted) { - abortController.abort(); - } else if (!abortSignal.aborted) { - inputAbortSignal?.addEventListener("abort", abortListener, { once: true }); - } - - try { - if (!poller.isDone()) { - await poller.poll({ abortSignal }); - while (!poller.isDone()) { - const delay = sleep(currentPollIntervalInMs, abortSignal); - cancelJob = () => abortController.abort(); - await delay; - await poller.poll({ abortSignal }); - } - } - } finally { - inputAbortSignal?.removeEventListener("abort", abortListener); - } - switch (state.status) { - case "succeeded": - case "failed": - case "canceled": { - return poller.getResult() as LoadTestRunGetTestRun200Response; - } - case "notStarted": - case "running": { - // Unreachable - throw new Error(`polling completed without succeeding or failing`); - } - } - })().finally(() => { - resultPromise = undefined; - })); - }, - - onProgress( - callback: (state: OperationState) => void, - ): CancelOnProgress { - const s = Symbol(); - progressCallbacks.set(s, callback); - - return () => progressCallbacks.delete(s); - }, - - isDone(): boolean { - return ["succeeded", "failed", "canceled"].includes(state.status); - }, - - stopPolling(): void { - abortController.abort(); - cancelJob?.(); - }, - - isStopped(): boolean { - return resultPromise === undefined; - }, - - getOperationState(): OperationState { - return state; - }, - - getResult(): LoadTestRunGetTestRun200Response | undefined { - return state.result; - }, - - toString() { - return JSON.stringify({ state }); - }, - }; - - return poller; -} diff --git a/sdk/loadtesting/load-testing-rest/src/index.ts b/sdk/loadtesting/load-testing-rest/src/index.ts index bcc15065f484..242e15696d72 100644 --- a/sdk/loadtesting/load-testing-rest/src/index.ts +++ b/sdk/loadtesting/load-testing-rest/src/index.ts @@ -11,7 +11,5 @@ export * from "./isUnexpected.js"; export * from "./models.js"; export * from "./outputModels.js"; export * from "./paginateHelper.js"; -export { getLongRunningPoller } from "./pollingHelper.js"; -// eslint-disable-next-line @azure/azure-sdk/ts-modules-only-named export default AzureLoadTesting; diff --git a/sdk/loadtesting/load-testing-rest/src/isUnexpected.ts b/sdk/loadtesting/load-testing-rest/src/isUnexpected.ts index 4017aba61aa1..fc4448fec797 100644 --- a/sdk/loadtesting/load-testing-rest/src/isUnexpected.ts +++ b/sdk/loadtesting/load-testing-rest/src/isUnexpected.ts @@ -158,7 +158,9 @@ export function isUnexpected( | LoadTestAdministrationDeleteTestDefaultResponse, ): response is LoadTestAdministrationDeleteTestDefaultResponse; export function isUnexpected( - response: LoadTestAdministrationGetTest200Response | LoadTestAdministrationGetTestDefaultResponse, + response: + | LoadTestAdministrationGetTest200Response + | LoadTestAdministrationGetTestDefaultResponse, ): response is LoadTestAdministrationGetTestDefaultResponse; export function isUnexpected( response: @@ -229,7 +231,9 @@ export function isUnexpected( | TestProfileAdministrationListTestProfilesDefaultResponse, ): response is TestProfileAdministrationListTestProfilesDefaultResponse; export function isUnexpected( - response: LoadTestRunGetTestRun200Response | LoadTestRunGetTestRunDefaultResponse, + response: + | LoadTestRunGetTestRun200Response + | LoadTestRunGetTestRunDefaultResponse, ): response is LoadTestRunGetTestRunDefaultResponse; export function isUnexpected( response: @@ -238,13 +242,19 @@ export function isUnexpected( | LoadTestRunCreateOrUpdateTestRunDefaultResponse, ): response is LoadTestRunCreateOrUpdateTestRunDefaultResponse; export function isUnexpected( - response: LoadTestRunDeleteTestRun204Response | LoadTestRunDeleteTestRunDefaultResponse, + response: + | LoadTestRunDeleteTestRun204Response + | LoadTestRunDeleteTestRunDefaultResponse, ): response is LoadTestRunDeleteTestRunDefaultResponse; export function isUnexpected( - response: LoadTestRunListTestRuns200Response | LoadTestRunListTestRunsDefaultResponse, + response: + | LoadTestRunListTestRuns200Response + | LoadTestRunListTestRunsDefaultResponse, ): response is LoadTestRunListTestRunsDefaultResponse; export function isUnexpected( - response: LoadTestRunGetTestRunFile200Response | LoadTestRunGetTestRunFileDefaultResponse, + response: + | LoadTestRunGetTestRunFile200Response + | LoadTestRunGetTestRunFileDefaultResponse, ): response is LoadTestRunGetTestRunFileDefaultResponse; export function isUnexpected( response: LoadTestRunStop200Response | LoadTestRunStopDefaultResponse, @@ -260,7 +270,9 @@ export function isUnexpected( | LoadTestRunListMetricDefinitionsDefaultResponse, ): response is LoadTestRunListMetricDefinitionsDefaultResponse; export function isUnexpected( - response: LoadTestRunListMetrics200Response | LoadTestRunListMetricsDefaultResponse, + response: + | LoadTestRunListMetrics200Response + | LoadTestRunListMetricsDefaultResponse, ): response is LoadTestRunListMetricsDefaultResponse; export function isUnexpected( response: @@ -274,7 +286,9 @@ export function isUnexpected( | LoadTestRunCreateOrUpdateAppComponentsDefaultResponse, ): response is LoadTestRunCreateOrUpdateAppComponentsDefaultResponse; export function isUnexpected( - response: LoadTestRunGetAppComponents200Response | LoadTestRunGetAppComponentsDefaultResponse, + response: + | LoadTestRunGetAppComponents200Response + | LoadTestRunGetAppComponentsDefaultResponse, ): response is LoadTestRunGetAppComponentsDefaultResponse; export function isUnexpected( response: @@ -529,17 +543,24 @@ function getParametrizedPathSuccess(method: string, path: string): string[] { // track if we have found a match to return the values found. let found = true; - for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { - if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + for ( + let i = candidateParts.length - 1, j = pathParts.length - 1; + i >= 1 && j >= 1; + i--, j-- + ) { + if ( + candidateParts[i]?.startsWith("{") && + candidateParts[i]?.indexOf("}") !== -1 + ) { const start = candidateParts[i]!.indexOf("}") + 1, end = candidateParts[i]?.length; // If the current part of the candidate is a "template" part // Try to use the suffix of pattern to match the path // {guid} ==> $ // {guid}:export ==> :export$ - const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( - pathParts[j] || "", - ); + const isMatched = new RegExp( + `${candidateParts[i]?.slice(start, end)}`, + ).test(pathParts[j] || ""); if (!isMatched) { found = false; diff --git a/sdk/loadtesting/load-testing-rest/src/models.ts b/sdk/loadtesting/load-testing-rest/src/models.ts index 818b558c1613..01409caea4d9 100644 --- a/sdk/loadtesting/load-testing-rest/src/models.ts +++ b/sdk/loadtesting/load-testing-rest/src/models.ts @@ -1,18 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { OperationState, SimplePollerLike } from "@azure/core-lro"; -import type { - LoadTestAdministrationGetTestFile200Response, - LoadTestAdministrationUploadTestFile201Response, - LoadTestRunCreateOrUpdateTestRun200Response, - LoadTestRunCreateOrUpdateTestRun201Response, - LoadTestRunGetTestRun200Response, - TestProfileRunAdministrationCreateOrUpdateTestProfileRun200Response, - TestProfileRunAdministrationCreateOrUpdateTestProfileRun201Response, - TestProfileRunAdministrationGetTestProfileRun200Response, -} from "./responses.js"; - /** Load test model. */ export interface Test { /** Pass fail criteria for a test. */ @@ -641,7 +629,8 @@ export interface TestsNotificationEventFilterParent { } /** The notification event filter when the event type is TestRunEnded and scope is Tests. */ -export interface TestRunEndedNotificationEventFilter extends TestsNotificationEventFilterParent { +export interface TestRunEndedNotificationEventFilter + extends TestsNotificationEventFilterParent { /** Event type for test run ended event. */ kind: "TestRunEnded"; /** Event filtering condition. */ @@ -657,7 +646,8 @@ export interface TestRunEndedEventCondition { } /** The notification event filter when the event type is TestRunStarted and scope is Tests. */ -export interface TestRunStartedNotificationEventFilter extends TestsNotificationEventFilterParent { +export interface TestRunStartedNotificationEventFilter + extends TestsNotificationEventFilterParent { /** Event type for test run started event. */ kind: "TestRunStarted"; } @@ -670,7 +660,8 @@ export interface TriggerCompletedNotificationEventFilter } /** The notification event filter when the event type is TriggerDisabled. */ -export interface TriggerDisabledNotificationEventFilter extends TestsNotificationEventFilterParent { +export interface TriggerDisabledNotificationEventFilter + extends TestsNotificationEventFilterParent { /** Event type for trigger disabled event. */ kind: "TriggerDisabled"; } @@ -747,46 +738,3 @@ export type WeekDays = string; export type NotificationScopeType = string; /** Alias for NotificationEventType */ export type NotificationEventType = string; - -/** Added Poller Types **/ - -/** - * Poller for File Upload and Validation - */ -export type FileUploadAndValidatePoller = SimplePollerLike< - OperationState, - LoadTestAdministrationGetTestFile200Response ->; - -/** - * Poller for Test Run Completion - */ -export type TestRunCompletionPoller = SimplePollerLike< - OperationState, - LoadTestRunGetTestRun200Response ->; - -/** - * Poller for Test Profile Run Completion - */ -export type TestProfileRunCompletionPoller = SimplePollerLike< - OperationState, - TestProfileRunAdministrationGetTestProfileRun200Response ->; - -export type TestRunCreateOrUpdateSuccessResponse = - | LoadTestRunCreateOrUpdateTestRun200Response - | LoadTestRunCreateOrUpdateTestRun201Response; - -export type TestProfileRunCreateOrUpdateSuccessResponse = - | TestProfileRunAdministrationCreateOrUpdateTestProfileRun200Response - | TestProfileRunAdministrationCreateOrUpdateTestProfileRun201Response; - -export type TestUploadFileSuccessResponse = LoadTestAdministrationUploadTestFile201Response; - -export interface PolledOperationOptions { - /** - * Time delay between poll requests, in milliseconds. - */ - updateIntervalInMs?: number; -} diff --git a/sdk/loadtesting/load-testing-rest/src/outputModels.ts b/sdk/loadtesting/load-testing-rest/src/outputModels.ts index 0498d12518f1..5da27fa80e64 100644 --- a/sdk/loadtesting/load-testing-rest/src/outputModels.ts +++ b/sdk/loadtesting/load-testing-rest/src/outputModels.ts @@ -413,7 +413,10 @@ export interface FunctionFlexConsumptionTargetResourceConfigurationsOutput */ kind: "FunctionsFlexConsumption"; /** A map of configurations for a Function app using Flex Consumption Plan. */ - configurations?: Record; + configurations?: Record< + string, + FunctionFlexConsumptionResourceConfigurationOutput + >; } /** Resource configuration instance for a Flex Consumption based Azure Function App. */ @@ -979,7 +982,8 @@ export interface HourlyRecurrenceOutput extends RecurrenceOutputParent { } /** Recurrence model when frequency is set as MonthlyByDays . */ -export interface MonthlyRecurrenceByWeekDaysOutput extends RecurrenceOutputParent { +export interface MonthlyRecurrenceByWeekDaysOutput + extends RecurrenceOutputParent { /** Frequency of the month recurrence. */ frequency: "MonthlyByDays"; /** Specific days of the week when the recurrence should repeat. */ @@ -1046,7 +1050,8 @@ export interface NotificationRuleOutputParent { } /** Tests Notification rule model. */ -export interface TestsNotificationRuleOutput extends NotificationRuleOutputParent { +export interface TestsNotificationRuleOutput + extends NotificationRuleOutputParent { /** Scope of type Tests. */ scope: "Tests"; /** The test ids to include. If not provided, notification will be sent for all testIds. */ @@ -1125,7 +1130,9 @@ export type RecurrenceOutput = | RecurrenceWithCronOutput | WeeklyRecurrenceOutput; /** Notification rule model. */ -export type NotificationRuleOutput = NotificationRuleOutputParent | TestsNotificationRuleOutput; +export type NotificationRuleOutput = + | NotificationRuleOutputParent + | TestsNotificationRuleOutput; /** The notification event filter for Tests scope. */ export type TestsNotificationEventFilterOutput = | TestsNotificationEventFilterOutputParent diff --git a/sdk/loadtesting/load-testing-rest/src/paginateHelper.ts b/sdk/loadtesting/load-testing-rest/src/paginateHelper.ts index 9ea946d9d6c5..70694e2c93c6 100644 --- a/sdk/loadtesting/load-testing-rest/src/paginateHelper.ts +++ b/sdk/loadtesting/load-testing-rest/src/paginateHelper.ts @@ -19,7 +19,9 @@ function getPagedAsyncIterator< >( pagedResult: PagedResult, ): PagedAsyncIterableIterator { - const iter = getItemAsyncIterator(pagedResult); + const iter = getItemAsyncIterator( + pagedResult, + ); return { next() { return iter.next(); @@ -34,7 +36,9 @@ function getPagedAsyncIterator< return getPageAsyncIterator(pagedResult, { pageLink: continuationToken as unknown as TLink | undefined, }); - }) as unknown as (settings?: TPageSettings) => AsyncIterableIterator), + }) as unknown as ( + settings?: TPageSettings, + ) => AsyncIterableIterator), }; } @@ -74,7 +78,9 @@ async function* getPageAsyncIterator( } = {}, ): AsyncIterableIterator { const { pageLink } = options; - let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + let response = await pagedResult.getPage( + pageLink ?? pagedResult.firstPageLink, + ); if (!response) { return; } @@ -113,7 +119,11 @@ export interface PagedAsyncIterableIterator< /** * The connection to the async iterator, part of the iteration protocol */ - [Symbol.asyncIterator](): PagedAsyncIterableIterator; + [Symbol.asyncIterator](): PagedAsyncIterableIterator< + TElement, + TPage, + TPageSettings + >; /** * Return an AsyncIterableIterator that works a page at a time */ @@ -131,7 +141,9 @@ interface PagedResult { /** * A method that returns a page of results. */ - getPage: (pageLink: TLink) => Promise<{ page: TPage; nextPageLink?: TLink } | undefined>; + getPage: ( + pageLink: TLink, + ) => Promise<{ page: TPage; nextPageLink?: TLink } | undefined>; /** * a function to implement the `byPage` method on the paged async iterator. */ @@ -203,7 +215,9 @@ export function paginate( typeof customGetPage === "function" ? customGetPage : async (pageLink: string) => { - const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get(); + const result = firstRun + ? initialResponse + : await client.pathUnchecked(pageLink).get(); firstRun = false; checkPagingRequest(result); const nextLink = getNextLink(result.body, nextLinkName); @@ -229,7 +243,9 @@ function getNextLink(body: unknown, nextLinkName?: string): string | undefined { const nextLink = (body as Record)[nextLinkName]; if (typeof nextLink !== "string" && typeof nextLink !== "undefined") { - throw new Error(`Body Property ${nextLinkName} should be a string or undefined`); + throw new Error( + `Body Property ${nextLinkName} should be a string or undefined`, + ); } return nextLink; @@ -257,7 +273,18 @@ function getElements(body: unknown, itemName: string): T[] { * Checks if a request failed */ function checkPagingRequest(response: PathUncheckedResponse): void { - const Http2xxStatusCodes = ["200", "201", "202", "203", "204", "205", "206", "207", "208", "226"]; + const Http2xxStatusCodes = [ + "200", + "201", + "202", + "203", + "204", + "205", + "206", + "207", + "208", + "226", + ]; if (!Http2xxStatusCodes.includes(response.status)) { throw createRestError( `Pagination failed with unexpected statusCode ${response.status}`, diff --git a/sdk/loadtesting/load-testing-rest/src/parameters.ts b/sdk/loadtesting/load-testing-rest/src/parameters.ts index a73089d306bf..274a065de9ea 100644 --- a/sdk/loadtesting/load-testing-rest/src/parameters.ts +++ b/sdk/loadtesting/load-testing-rest/src/parameters.ts @@ -63,8 +63,8 @@ export interface LoadTestAdministrationListTestsQueryParam { queryParameters?: LoadTestAdministrationListTestsQueryParamProperties; } -export type LoadTestAdministrationListTestsParameters = LoadTestAdministrationListTestsQueryParam & - RequestParameters; +export type LoadTestAdministrationListTestsParameters = + LoadTestAdministrationListTestsQueryParam & RequestParameters; export interface LoadTestAdministrationUploadTestFileBodyParam { /** @@ -72,7 +72,11 @@ export interface LoadTestAdministrationUploadTestFileBodyParam { * * Value may contain any sequence of octets */ - body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream; + body: + | string + | Uint8Array + | ReadableStream + | NodeJS.ReadableStream; } export interface LoadTestAdministrationUploadTestFileQueryParamProperties { @@ -118,7 +122,8 @@ export type LoadTestAdministrationCreateOrUpdateAppComponentsParameters = LoadTestAdministrationCreateOrUpdateAppComponentsMediaTypesParam & LoadTestAdministrationCreateOrUpdateAppComponentsBodyParam & RequestParameters; -export type LoadTestAdministrationGetAppComponentsParameters = RequestParameters; +export type LoadTestAdministrationGetAppComponentsParameters = + RequestParameters; /** Server metric configuration model. */ export type TestServerMetricsConfigurationResourceMergeAndPatch = Partial; @@ -137,7 +142,8 @@ export type LoadTestAdministrationCreateOrUpdateServerMetricsConfigParameters = LoadTestAdministrationCreateOrUpdateServerMetricsConfigMediaTypesParam & LoadTestAdministrationCreateOrUpdateServerMetricsConfigBodyParam & RequestParameters; -export type LoadTestAdministrationGetServerMetricsConfigParameters = RequestParameters; +export type LoadTestAdministrationGetServerMetricsConfigParameters = + RequestParameters; /** The resource instance. */ export type TestProfileResourceMergeAndPatch = Partial; @@ -155,8 +161,10 @@ export type TestProfileAdministrationCreateOrUpdateTestProfileParameters = TestProfileAdministrationCreateOrUpdateTestProfileMediaTypesParam & TestProfileAdministrationCreateOrUpdateTestProfileBodyParam & RequestParameters; -export type TestProfileAdministrationDeleteTestProfileParameters = RequestParameters; -export type TestProfileAdministrationGetTestProfileParameters = RequestParameters; +export type TestProfileAdministrationDeleteTestProfileParameters = + RequestParameters; +export type TestProfileAdministrationGetTestProfileParameters = + RequestParameters; /** This is the wrapper object for the parameter `testProfileIds` with explode set to false and style set to form. */ export interface TestProfileAdministrationListTestProfilesTestProfileIdsQueryParam { @@ -186,9 +194,13 @@ export interface TestProfileAdministrationListTestProfilesQueryParamProperties { /** End DateTime(RFC 3339 literal format) of the last updated time range to filter test profiles. */ lastModifiedEndTime?: Date | string; /** Comma separated list of IDs of the test profiles to filter. */ - testProfileIds?: string[] | TestProfileAdministrationListTestProfilesTestProfileIdsQueryParam; + testProfileIds?: + | string[] + | TestProfileAdministrationListTestProfilesTestProfileIdsQueryParam; /** Comma separated list IDs of the tests which should be associated with the test profiles to fetch. */ - testIds?: string[] | TestProfileAdministrationListTestProfilesTestIdsQueryParam; + testIds?: + | string[] + | TestProfileAdministrationListTestProfilesTestIdsQueryParam; } export interface TestProfileAdministrationListTestProfilesQueryParam { @@ -260,8 +272,8 @@ export interface LoadTestRunListTestRunsQueryParam { queryParameters?: LoadTestRunListTestRunsQueryParamProperties; } -export type LoadTestRunListTestRunsParameters = LoadTestRunListTestRunsQueryParam & - RequestParameters; +export type LoadTestRunListTestRunsParameters = + LoadTestRunListTestRunsQueryParam & RequestParameters; export type LoadTestRunGetTestRunFileParameters = RequestParameters; export type LoadTestRunStopParameters = RequestParameters; export type LoadTestRunListMetricNamespacesParameters = RequestParameters; @@ -304,9 +316,10 @@ export interface LoadTestRunListMetricsQueryParam { queryParameters: LoadTestRunListMetricsQueryParamProperties; } -export type LoadTestRunListMetricsParameters = LoadTestRunListMetricsQueryParam & - LoadTestRunListMetricsBodyParam & - RequestParameters; +export type LoadTestRunListMetricsParameters = + LoadTestRunListMetricsQueryParam & + LoadTestRunListMetricsBodyParam & + RequestParameters; export interface LoadTestRunListMetricDimensionValuesQueryParamProperties { /** Metric name */ @@ -330,7 +343,8 @@ export interface LoadTestRunListMetricDimensionValuesQueryParam { export type LoadTestRunListMetricDimensionValuesParameters = LoadTestRunListMetricDimensionValuesQueryParam & RequestParameters; /** App Component model. */ -export type TestRunAppComponentsResourceMergeAndPatch = Partial; +export type TestRunAppComponentsResourceMergeAndPatch = + Partial; export interface LoadTestRunCreateOrUpdateAppComponentsBodyParam { /** App Component model. */ @@ -366,7 +380,8 @@ export type LoadTestRunCreateOrUpdateServerMetricsConfigParameters = LoadTestRunCreateOrUpdateServerMetricsConfigBodyParam & RequestParameters; export type LoadTestRunGetServerMetricsConfigParameters = RequestParameters; -export type TestProfileRunAdministrationGetTestProfileRunParameters = RequestParameters; +export type TestProfileRunAdministrationGetTestProfileRunParameters = + RequestParameters; /** The resource instance. */ export type TestProfileRunResourceMergeAndPatch = Partial; @@ -384,7 +399,8 @@ export type TestProfileRunAdministrationCreateOrUpdateTestProfileRunParameters = TestProfileRunAdministrationCreateOrUpdateTestProfileRunMediaTypesParam & TestProfileRunAdministrationCreateOrUpdateTestProfileRunBodyParam & RequestParameters; -export type TestProfileRunAdministrationDeleteTestProfileRunParameters = RequestParameters; +export type TestProfileRunAdministrationDeleteTestProfileRunParameters = + RequestParameters; export type TestProfileRunAdministrationStopParameters = RequestParameters; /** This is the wrapper object for the parameter `testProfileRunIds` with explode set to false and style set to form. */ @@ -441,7 +457,9 @@ export interface TestProfileRunAdministrationListTestProfileRunsQueryParamProper | string[] | TestProfileRunAdministrationListTestProfileRunsTestProfileIdsQueryParam; /** Comma separated list of Statuses of the test profile runs to filter. */ - statuses?: string[] | TestProfileRunAdministrationListTestProfileRunsStatusesQueryParam; + statuses?: + | string[] + | TestProfileRunAdministrationListTestProfileRunsStatusesQueryParam; } export interface TestProfileRunAdministrationListTestProfileRunsQueryParam { @@ -493,7 +511,8 @@ export interface TriggerAdministrationListTriggerQueryParam { export type TriggerAdministrationListTriggerParameters = TriggerAdministrationListTriggerQueryParam & RequestParameters; -export type NotificationRuleAdministrationGetNotificationRuleParameters = RequestParameters; +export type NotificationRuleAdministrationGetNotificationRuleParameters = + RequestParameters; /** The resource instance. */ export type NotificationRuleResourceMergeAndPatch = Partial; @@ -511,7 +530,8 @@ export type NotificationRuleAdministrationCreateOrUpdateNotificationRuleParamete NotificationRuleAdministrationCreateOrUpdateNotificationRuleMediaTypesParam & NotificationRuleAdministrationCreateOrUpdateNotificationRuleBodyParam & RequestParameters; -export type NotificationRuleAdministrationDeleteNotificationRuleParameters = RequestParameters; +export type NotificationRuleAdministrationDeleteNotificationRuleParameters = + RequestParameters; export interface NotificationRuleAdministrationListNotificationRuleQueryParamProperties { /** Search based on notification rules associated with the provided test ids. */ @@ -531,4 +551,5 @@ export interface NotificationRuleAdministrationListNotificationRuleQueryParam { } export type NotificationRuleAdministrationListNotificationRuleParameters = - NotificationRuleAdministrationListNotificationRuleQueryParam & RequestParameters; + NotificationRuleAdministrationListNotificationRuleQueryParam & + RequestParameters; diff --git a/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts b/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts deleted file mode 100644 index 0c85d4c556e1..000000000000 --- a/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { AzureLoadTestingClient } from "./clientDefinitions.js"; -import { getFileValidationPoller } from "./getFileValidationPoller.js"; -import { getTestRunCompletionPoller } from "./getTestRunCompletionPoller.js"; -import { getTestProfileRunCompletionPoller } from "./getTestProfileRunCompletionPoller.js"; -import type { - FileUploadAndValidatePoller, - TestUploadFileSuccessResponse, - TestRunCompletionPoller, - TestRunCreateOrUpdateSuccessResponse, - TestProfileRunCreateOrUpdateSuccessResponse, - TestProfileRunCompletionPoller, -} from "./models.js"; - -export async function getLongRunningPoller( - client: AzureLoadTestingClient, - initialResponse: TestUploadFileSuccessResponse, -): Promise; -export async function getLongRunningPoller( - client: AzureLoadTestingClient, - initialResponse: TestRunCreateOrUpdateSuccessResponse, -): Promise; -export async function getLongRunningPoller( - client: AzureLoadTestingClient, - initialResponse: TestProfileRunCreateOrUpdateSuccessResponse, -): Promise; -export async function getLongRunningPoller( - client: AzureLoadTestingClient, - initialResponse: - | TestRunCreateOrUpdateSuccessResponse - | TestUploadFileSuccessResponse - | TestProfileRunCreateOrUpdateSuccessResponse, -): Promise { - if (isFileUpload(initialResponse)) { - return getFileValidationPoller(client, initialResponse); - } else if (isTestRunCreation(initialResponse)) { - return getTestRunCompletionPoller(client, initialResponse); - } else if (isTestProfileRunCreation(initialResponse)) { - return getTestProfileRunCompletionPoller(client, initialResponse); - } - - throw new Error("The Operation is not a long running operation."); -} - -function isFileUpload(response: any): response is TestUploadFileSuccessResponse { - return response.request.url.includes("/files/"); -} - -function isTestRunCreation(response: any): response is TestRunCreateOrUpdateSuccessResponse { - return response.request.url.includes("/test-runs/"); -} - -function isTestProfileRunCreation( - response: any, -): response is TestProfileRunCreateOrUpdateSuccessResponse { - return response.request.url.includes("/test-profile-runs/"); -} diff --git a/sdk/loadtesting/load-testing-rest/src/responses.ts b/sdk/loadtesting/load-testing-rest/src/responses.ts index c617f377d964..cda711d5b589 100644 --- a/sdk/loadtesting/load-testing-rest/src/responses.ts +++ b/sdk/loadtesting/load-testing-rest/src/responses.ts @@ -30,13 +30,15 @@ import type { } from "./outputModels.js"; /** The request has succeeded. */ -export interface LoadTestAdministrationCreateOrUpdateTest200Response extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateTest200Response + extends HttpResponse { status: "200"; body: TestOutput; } /** The request has succeeded and a new resource has been created as a result. */ -export interface LoadTestAdministrationCreateOrUpdateTest201Response extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateTest201Response + extends HttpResponse { status: "201"; body: TestOutput; } @@ -46,14 +48,17 @@ export interface LoadTestAdministrationCreateOrUpdateTestDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestAdministrationCreateOrUpdateTestDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateTestDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & LoadTestAdministrationCreateOrUpdateTestDefaultHeaders; + headers: RawHttpHeaders & + LoadTestAdministrationCreateOrUpdateTestDefaultHeaders; } /** There is no content to send for this request, but the headers may be useful. */ -export interface LoadTestAdministrationDeleteTest204Response extends HttpResponse { +export interface LoadTestAdministrationDeleteTest204Response + extends HttpResponse { status: "204"; } @@ -62,7 +67,8 @@ export interface LoadTestAdministrationDeleteTestDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestAdministrationDeleteTestDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationDeleteTestDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & LoadTestAdministrationDeleteTestDefaultHeaders; @@ -79,14 +85,16 @@ export interface LoadTestAdministrationGetTestDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestAdministrationGetTestDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationGetTestDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & LoadTestAdministrationGetTestDefaultHeaders; } /** The request has succeeded. */ -export interface LoadTestAdministrationListTests200Response extends HttpResponse { +export interface LoadTestAdministrationListTests200Response + extends HttpResponse { status: "200"; body: PagedTestOutput; } @@ -96,14 +104,16 @@ export interface LoadTestAdministrationListTestsDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestAdministrationListTestsDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationListTestsDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & LoadTestAdministrationListTestsDefaultHeaders; } /** The request has succeeded and a new resource has been created as a result. */ -export interface LoadTestAdministrationUploadTestFile201Response extends HttpResponse { +export interface LoadTestAdministrationUploadTestFile201Response + extends HttpResponse { status: "201"; body: TestFileInfoOutput; } @@ -113,14 +123,16 @@ export interface LoadTestAdministrationUploadTestFileDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestAdministrationUploadTestFileDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationUploadTestFileDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & LoadTestAdministrationUploadTestFileDefaultHeaders; } /** The request has succeeded. */ -export interface LoadTestAdministrationGetTestFile200Response extends HttpResponse { +export interface LoadTestAdministrationGetTestFile200Response + extends HttpResponse { status: "200"; body: TestFileInfoOutput; } @@ -130,14 +142,16 @@ export interface LoadTestAdministrationGetTestFileDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestAdministrationGetTestFileDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationGetTestFileDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & LoadTestAdministrationGetTestFileDefaultHeaders; } /** There is no content to send for this request, but the headers may be useful. */ -export interface LoadTestAdministrationDeleteTestFile204Response extends HttpResponse { +export interface LoadTestAdministrationDeleteTestFile204Response + extends HttpResponse { status: "204"; } @@ -146,14 +160,16 @@ export interface LoadTestAdministrationDeleteTestFileDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestAdministrationDeleteTestFileDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationDeleteTestFileDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & LoadTestAdministrationDeleteTestFileDefaultHeaders; } /** The request has succeeded. */ -export interface LoadTestAdministrationListTestFiles200Response extends HttpResponse { +export interface LoadTestAdministrationListTestFiles200Response + extends HttpResponse { status: "200"; body: PagedTestFileInfoOutput; } @@ -163,20 +179,23 @@ export interface LoadTestAdministrationListTestFilesDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestAdministrationListTestFilesDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationListTestFilesDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & LoadTestAdministrationListTestFilesDefaultHeaders; } /** The request has succeeded. */ -export interface LoadTestAdministrationCreateOrUpdateAppComponents200Response extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateAppComponents200Response + extends HttpResponse { status: "200"; body: TestAppComponentsOutput; } /** The request has succeeded and a new resource has been created as a result. */ -export interface LoadTestAdministrationCreateOrUpdateAppComponents201Response extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateAppComponents201Response + extends HttpResponse { status: "201"; body: TestAppComponentsOutput; } @@ -190,11 +209,13 @@ export interface LoadTestAdministrationCreateOrUpdateAppComponentsDefaultRespons extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & LoadTestAdministrationCreateOrUpdateAppComponentsDefaultHeaders; + headers: RawHttpHeaders & + LoadTestAdministrationCreateOrUpdateAppComponentsDefaultHeaders; } /** The request has succeeded. */ -export interface LoadTestAdministrationGetAppComponents200Response extends HttpResponse { +export interface LoadTestAdministrationGetAppComponents200Response + extends HttpResponse { status: "200"; body: TestAppComponentsOutput; } @@ -204,10 +225,12 @@ export interface LoadTestAdministrationGetAppComponentsDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestAdministrationGetAppComponentsDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationGetAppComponentsDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & LoadTestAdministrationGetAppComponentsDefaultHeaders; + headers: RawHttpHeaders & + LoadTestAdministrationGetAppComponentsDefaultHeaders; } /** The request has succeeded. */ @@ -233,11 +256,13 @@ export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultR extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultHeaders; + headers: RawHttpHeaders & + LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultHeaders; } /** The request has succeeded. */ -export interface LoadTestAdministrationGetServerMetricsConfig200Response extends HttpResponse { +export interface LoadTestAdministrationGetServerMetricsConfig200Response + extends HttpResponse { status: "200"; body: TestServerMetricsConfigurationOutput; } @@ -247,10 +272,12 @@ export interface LoadTestAdministrationGetServerMetricsConfigDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestAdministrationGetServerMetricsConfigDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationGetServerMetricsConfigDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & LoadTestAdministrationGetServerMetricsConfigDefaultHeaders; + headers: RawHttpHeaders & + LoadTestAdministrationGetServerMetricsConfigDefaultHeaders; } /** The request has succeeded. */ @@ -276,11 +303,13 @@ export interface TestProfileAdministrationCreateOrUpdateTestProfileDefaultRespon extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & TestProfileAdministrationCreateOrUpdateTestProfileDefaultHeaders; + headers: RawHttpHeaders & + TestProfileAdministrationCreateOrUpdateTestProfileDefaultHeaders; } /** There is no content to send for this request, but the headers may be useful. */ -export interface TestProfileAdministrationDeleteTestProfile204Response extends HttpResponse { +export interface TestProfileAdministrationDeleteTestProfile204Response + extends HttpResponse { status: "204"; } @@ -289,14 +318,17 @@ export interface TestProfileAdministrationDeleteTestProfileDefaultHeaders { "x-ms-error-code"?: string; } -export interface TestProfileAdministrationDeleteTestProfileDefaultResponse extends HttpResponse { +export interface TestProfileAdministrationDeleteTestProfileDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & TestProfileAdministrationDeleteTestProfileDefaultHeaders; + headers: RawHttpHeaders & + TestProfileAdministrationDeleteTestProfileDefaultHeaders; } /** The request has succeeded. */ -export interface TestProfileAdministrationGetTestProfile200Response extends HttpResponse { +export interface TestProfileAdministrationGetTestProfile200Response + extends HttpResponse { status: "200"; body: TestProfileOutput; } @@ -306,14 +338,17 @@ export interface TestProfileAdministrationGetTestProfileDefaultHeaders { "x-ms-error-code"?: string; } -export interface TestProfileAdministrationGetTestProfileDefaultResponse extends HttpResponse { +export interface TestProfileAdministrationGetTestProfileDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & TestProfileAdministrationGetTestProfileDefaultHeaders; + headers: RawHttpHeaders & + TestProfileAdministrationGetTestProfileDefaultHeaders; } /** The request has succeeded. */ -export interface TestProfileAdministrationListTestProfiles200Response extends HttpResponse { +export interface TestProfileAdministrationListTestProfiles200Response + extends HttpResponse { status: "200"; body: PagedTestProfileOutput; } @@ -323,10 +358,12 @@ export interface TestProfileAdministrationListTestProfilesDefaultHeaders { "x-ms-error-code"?: string; } -export interface TestProfileAdministrationListTestProfilesDefaultResponse extends HttpResponse { +export interface TestProfileAdministrationListTestProfilesDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & TestProfileAdministrationListTestProfilesDefaultHeaders; + headers: RawHttpHeaders & + TestProfileAdministrationListTestProfilesDefaultHeaders; } /** The request has succeeded. */ @@ -347,13 +384,15 @@ export interface LoadTestRunGetTestRunDefaultResponse extends HttpResponse { } /** The request has succeeded. */ -export interface LoadTestRunCreateOrUpdateTestRun200Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateTestRun200Response + extends HttpResponse { status: "200"; body: TestRunOutput; } /** The request has succeeded and a new resource has been created as a result. */ -export interface LoadTestRunCreateOrUpdateTestRun201Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateTestRun201Response + extends HttpResponse { status: "201"; body: TestRunOutput; } @@ -363,7 +402,8 @@ export interface LoadTestRunCreateOrUpdateTestRunDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestRunCreateOrUpdateTestRunDefaultResponse extends HttpResponse { +export interface LoadTestRunCreateOrUpdateTestRunDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & LoadTestRunCreateOrUpdateTestRunDefaultHeaders; @@ -437,7 +477,8 @@ export interface LoadTestRunStopDefaultResponse extends HttpResponse { } /** The request has succeeded. */ -export interface LoadTestRunListMetricNamespaces200Response extends HttpResponse { +export interface LoadTestRunListMetricNamespaces200Response + extends HttpResponse { status: "200"; body: MetricNamespaceCollectionOutput; } @@ -447,14 +488,16 @@ export interface LoadTestRunListMetricNamespacesDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestRunListMetricNamespacesDefaultResponse extends HttpResponse { +export interface LoadTestRunListMetricNamespacesDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & LoadTestRunListMetricNamespacesDefaultHeaders; } /** The request has succeeded. */ -export interface LoadTestRunListMetricDefinitions200Response extends HttpResponse { +export interface LoadTestRunListMetricDefinitions200Response + extends HttpResponse { status: "200"; body: MetricDefinitionCollectionOutput; } @@ -464,7 +507,8 @@ export interface LoadTestRunListMetricDefinitionsDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestRunListMetricDefinitionsDefaultResponse extends HttpResponse { +export interface LoadTestRunListMetricDefinitionsDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & LoadTestRunListMetricDefinitionsDefaultHeaders; @@ -488,7 +532,8 @@ export interface LoadTestRunListMetricsDefaultResponse extends HttpResponse { } /** The request has succeeded. */ -export interface LoadTestRunListMetricDimensionValues200Response extends HttpResponse { +export interface LoadTestRunListMetricDimensionValues200Response + extends HttpResponse { status: "200"; body: DimensionValueListOutput; } @@ -498,20 +543,23 @@ export interface LoadTestRunListMetricDimensionValuesDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestRunListMetricDimensionValuesDefaultResponse extends HttpResponse { +export interface LoadTestRunListMetricDimensionValuesDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & LoadTestRunListMetricDimensionValuesDefaultHeaders; } /** The request has succeeded. */ -export interface LoadTestRunCreateOrUpdateAppComponents200Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateAppComponents200Response + extends HttpResponse { status: "200"; body: TestRunAppComponentsOutput; } /** The request has succeeded and a new resource has been created as a result. */ -export interface LoadTestRunCreateOrUpdateAppComponents201Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateAppComponents201Response + extends HttpResponse { status: "201"; body: TestRunAppComponentsOutput; } @@ -521,10 +569,12 @@ export interface LoadTestRunCreateOrUpdateAppComponentsDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestRunCreateOrUpdateAppComponentsDefaultResponse extends HttpResponse { +export interface LoadTestRunCreateOrUpdateAppComponentsDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & LoadTestRunCreateOrUpdateAppComponentsDefaultHeaders; + headers: RawHttpHeaders & + LoadTestRunCreateOrUpdateAppComponentsDefaultHeaders; } /** The request has succeeded. */ @@ -538,20 +588,23 @@ export interface LoadTestRunGetAppComponentsDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestRunGetAppComponentsDefaultResponse extends HttpResponse { +export interface LoadTestRunGetAppComponentsDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & LoadTestRunGetAppComponentsDefaultHeaders; } /** The request has succeeded. */ -export interface LoadTestRunCreateOrUpdateServerMetricsConfig200Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateServerMetricsConfig200Response + extends HttpResponse { status: "200"; body: TestRunServerMetricsConfigurationOutput; } /** The request has succeeded and a new resource has been created as a result. */ -export interface LoadTestRunCreateOrUpdateServerMetricsConfig201Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateServerMetricsConfig201Response + extends HttpResponse { status: "201"; body: TestRunServerMetricsConfigurationOutput; } @@ -561,14 +614,17 @@ export interface LoadTestRunCreateOrUpdateServerMetricsConfigDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse extends HttpResponse { +export interface LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & LoadTestRunCreateOrUpdateServerMetricsConfigDefaultHeaders; + headers: RawHttpHeaders & + LoadTestRunCreateOrUpdateServerMetricsConfigDefaultHeaders; } /** The request has succeeded. */ -export interface LoadTestRunGetServerMetricsConfig200Response extends HttpResponse { +export interface LoadTestRunGetServerMetricsConfig200Response + extends HttpResponse { status: "200"; body: TestRunServerMetricsConfigurationOutput; } @@ -578,14 +634,16 @@ export interface LoadTestRunGetServerMetricsConfigDefaultHeaders { "x-ms-error-code"?: string; } -export interface LoadTestRunGetServerMetricsConfigDefaultResponse extends HttpResponse { +export interface LoadTestRunGetServerMetricsConfigDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & LoadTestRunGetServerMetricsConfigDefaultHeaders; } /** The request has succeeded. */ -export interface TestProfileRunAdministrationGetTestProfileRun200Response extends HttpResponse { +export interface TestProfileRunAdministrationGetTestProfileRun200Response + extends HttpResponse { status: "200"; body: TestProfileRunOutput; } @@ -595,10 +653,12 @@ export interface TestProfileRunAdministrationGetTestProfileRunDefaultHeaders { "x-ms-error-code"?: string; } -export interface TestProfileRunAdministrationGetTestProfileRunDefaultResponse extends HttpResponse { +export interface TestProfileRunAdministrationGetTestProfileRunDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & TestProfileRunAdministrationGetTestProfileRunDefaultHeaders; + headers: RawHttpHeaders & + TestProfileRunAdministrationGetTestProfileRunDefaultHeaders; } /** The request has succeeded. */ @@ -624,11 +684,13 @@ export interface TestProfileRunAdministrationCreateOrUpdateTestProfileRunDefault extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & TestProfileRunAdministrationCreateOrUpdateTestProfileRunDefaultHeaders; + headers: RawHttpHeaders & + TestProfileRunAdministrationCreateOrUpdateTestProfileRunDefaultHeaders; } /** There is no content to send for this request, but the headers may be useful. */ -export interface TestProfileRunAdministrationDeleteTestProfileRun204Response extends HttpResponse { +export interface TestProfileRunAdministrationDeleteTestProfileRun204Response + extends HttpResponse { status: "204"; } @@ -641,11 +703,13 @@ export interface TestProfileRunAdministrationDeleteTestProfileRunDefaultResponse extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & TestProfileRunAdministrationDeleteTestProfileRunDefaultHeaders; + headers: RawHttpHeaders & + TestProfileRunAdministrationDeleteTestProfileRunDefaultHeaders; } /** The request has succeeded. */ -export interface TestProfileRunAdministrationStop200Response extends HttpResponse { +export interface TestProfileRunAdministrationStop200Response + extends HttpResponse { status: "200"; body: TestProfileRunOutput; } @@ -655,14 +719,16 @@ export interface TestProfileRunAdministrationStopDefaultHeaders { "x-ms-error-code"?: string; } -export interface TestProfileRunAdministrationStopDefaultResponse extends HttpResponse { +export interface TestProfileRunAdministrationStopDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & TestProfileRunAdministrationStopDefaultHeaders; } /** The request has succeeded. */ -export interface TestProfileRunAdministrationListTestProfileRuns200Response extends HttpResponse { +export interface TestProfileRunAdministrationListTestProfileRuns200Response + extends HttpResponse { status: "200"; body: PagedTestProfileRunOutput; } @@ -676,11 +742,13 @@ export interface TestProfileRunAdministrationListTestProfileRunsDefaultResponse extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & TestProfileRunAdministrationListTestProfileRunsDefaultHeaders; + headers: RawHttpHeaders & + TestProfileRunAdministrationListTestProfileRunsDefaultHeaders; } /** The request has succeeded. */ -export interface TriggerAdministrationGetTrigger200Response extends HttpResponse { +export interface TriggerAdministrationGetTrigger200Response + extends HttpResponse { status: "200"; body: TriggerOutput; } @@ -690,20 +758,23 @@ export interface TriggerAdministrationGetTriggerDefaultHeaders { "x-ms-error-code"?: string; } -export interface TriggerAdministrationGetTriggerDefaultResponse extends HttpResponse { +export interface TriggerAdministrationGetTriggerDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & TriggerAdministrationGetTriggerDefaultHeaders; } /** The request has succeeded. */ -export interface TriggerAdministrationCreateOrUpdateTrigger200Response extends HttpResponse { +export interface TriggerAdministrationCreateOrUpdateTrigger200Response + extends HttpResponse { status: "200"; body: TriggerOutput; } /** The request has succeeded and a new resource has been created as a result. */ -export interface TriggerAdministrationCreateOrUpdateTrigger201Response extends HttpResponse { +export interface TriggerAdministrationCreateOrUpdateTrigger201Response + extends HttpResponse { status: "201"; body: TriggerOutput; } @@ -713,14 +784,17 @@ export interface TriggerAdministrationCreateOrUpdateTriggerDefaultHeaders { "x-ms-error-code"?: string; } -export interface TriggerAdministrationCreateOrUpdateTriggerDefaultResponse extends HttpResponse { +export interface TriggerAdministrationCreateOrUpdateTriggerDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & TriggerAdministrationCreateOrUpdateTriggerDefaultHeaders; + headers: RawHttpHeaders & + TriggerAdministrationCreateOrUpdateTriggerDefaultHeaders; } /** There is no content to send for this request, but the headers may be useful. */ -export interface TriggerAdministrationDeleteTrigger204Response extends HttpResponse { +export interface TriggerAdministrationDeleteTrigger204Response + extends HttpResponse { status: "204"; } @@ -729,14 +803,16 @@ export interface TriggerAdministrationDeleteTriggerDefaultHeaders { "x-ms-error-code"?: string; } -export interface TriggerAdministrationDeleteTriggerDefaultResponse extends HttpResponse { +export interface TriggerAdministrationDeleteTriggerDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & TriggerAdministrationDeleteTriggerDefaultHeaders; } /** The request has succeeded. */ -export interface TriggerAdministrationListTrigger200Response extends HttpResponse { +export interface TriggerAdministrationListTrigger200Response + extends HttpResponse { status: "200"; body: PagedTriggerOutput; } @@ -746,14 +822,16 @@ export interface TriggerAdministrationListTriggerDefaultHeaders { "x-ms-error-code"?: string; } -export interface TriggerAdministrationListTriggerDefaultResponse extends HttpResponse { +export interface TriggerAdministrationListTriggerDefaultResponse + extends HttpResponse { status: string; body: ErrorResponse; headers: RawHttpHeaders & TriggerAdministrationListTriggerDefaultHeaders; } /** The request has succeeded. */ -export interface NotificationRuleAdministrationGetNotificationRule200Response extends HttpResponse { +export interface NotificationRuleAdministrationGetNotificationRule200Response + extends HttpResponse { status: "200"; body: NotificationRuleOutput; } @@ -767,7 +845,8 @@ export interface NotificationRuleAdministrationGetNotificationRuleDefaultRespons extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & NotificationRuleAdministrationGetNotificationRuleDefaultHeaders; + headers: RawHttpHeaders & + NotificationRuleAdministrationGetNotificationRuleDefaultHeaders; } /** The request has succeeded. */ @@ -812,7 +891,8 @@ export interface NotificationRuleAdministrationDeleteNotificationRuleDefaultResp extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & NotificationRuleAdministrationDeleteNotificationRuleDefaultHeaders; + headers: RawHttpHeaders & + NotificationRuleAdministrationDeleteNotificationRuleDefaultHeaders; } /** The request has succeeded. */ @@ -831,5 +911,6 @@ export interface NotificationRuleAdministrationListNotificationRuleDefaultRespon extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & NotificationRuleAdministrationListNotificationRuleDefaultHeaders; + headers: RawHttpHeaders & + NotificationRuleAdministrationListNotificationRuleDefaultHeaders; } diff --git a/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts b/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts deleted file mode 100644 index 652db1c88054..000000000000 --- a/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { AbortSignalLike } from "@azure/abort-controller"; -import { AbortError } from "@azure/abort-controller"; -import type { TestRunOutput, TestProfileRunOutput } from "../outputModels.js"; - -const REJECTED_ERR = new AbortError("The polling was aborted."); - -export function sleep(ms: number, signal: AbortSignalLike): Promise { - return new Promise((resolve, reject) => { - if (signal.aborted) { - reject(REJECTED_ERR); - return; - } - - const id = setTimeout(() => { - signal.removeEventListener("abort", onAbort); - - if (signal.aborted) { - reject(REJECTED_ERR); - return; - } - - resolve(); - }, ms); - - signal.addEventListener("abort", onAbort, { once: true }); - - function onAbort(): void { - clearTimeout(id); - reject(REJECTED_ERR); - } - }); -} - -export function isTestRunInProgress(testRunOutput: TestRunOutput): boolean { - switch (testRunOutput.status) { - case "ACCEPTED": - case "NOTSTARTED": - case "PROVISIONING": - case "PROVISIONED": - case "CONFIGURING": - case "CONFIGURED": - case "EXECUTING": - case "EXECUTED": - case "DEPROVISIONING": - case "DEPROVISIONED": - case "CANCELLING": - return true; - default: - return false; - } -} - -export function isTestProfileRunInProgress(testProfileRunOutput: TestProfileRunOutput): boolean { - switch (testProfileRunOutput.status) { - case "ACCEPTED": - case "NOTSTARTED": - case "EXECUTING": - case "CANCELLING": - return true; - default: - return false; - } -} diff --git a/sdk/loadtesting/load-testing-rest/test/public/additional-data.csv b/sdk/loadtesting/load-testing-rest/test/public/additional-data.csv deleted file mode 100644 index 96dbf5b98a39..000000000000 --- a/sdk/loadtesting/load-testing-rest/test/public/additional-data.csv +++ /dev/null @@ -1,2 +0,0 @@ -a,b,c,d -1,2,3,4 diff --git a/sdk/loadtesting/load-testing-rest/test/public/browser/testAdminCrud.spec.ts b/sdk/loadtesting/load-testing-rest/test/public/browser/testAdminCrud.spec.ts deleted file mode 100644 index b255c944b26c..000000000000 --- a/sdk/loadtesting/load-testing-rest/test/public/browser/testAdminCrud.spec.ts +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { createClient, createRecorder } from "../utils/recordedClient.js"; -import type { - AppComponent, - AzureLoadTestingClient, - TestAppComponentsOutput, -} from "../../../src/index.js"; -import type { Recorder } from "@azure-tools/test-recorder"; -import { env } from "@azure-tools/test-recorder"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -// NOTE: Since file upload is not supported, this only tests the API calls that don't require file upload -describe("Test Administration Operations Browser", () => { - let recorder: Recorder; - let client: AzureLoadTestingClient; - const testId = "sample-sdk-testbr-20250318"; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = createClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("should create a load test", async () => { - const result = await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: "Sample Load Test", - description: "Sample Load Test Description", - loadTestConfiguration: { - engineInstances: 1, - splitAllCSVs: false, - }, - }, - }); - - assert.include(["200", "201"], result.status); - }); - - it("should create the app components", async () => { - const SUBSCRIPTION_ID = env["SUBSCRIPTION_ID"] || ""; - - const appCompResourceId = `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/contoso-sampleapp-rg/providers/Microsoft.Web/sites/contoso-sampleapp`; - const appComponent: AppComponent = { - resourceName: "contoso-sampleapp", - resourceType: "Microsoft.Web/sites", - }; - const appComps: Record = {}; - - appComps[appCompResourceId] = appComponent; - const result = await client.path("/tests/{testId}/app-components", testId).patch({ - contentType: "application/merge-patch+json", - body: { - components: appComps, - }, - }); - - assert.include(["200", "201"], result.status); - }); - - it("should get the test", async () => { - const result = await client.path("/tests/{testId}", testId).get(); - - assert.include(["200"], result.status); - }); - - it("should get the test app components", async () => { - const result = await client.path("/tests/{testId}/app-components", testId).get(); - - assert.include(["200"], result.status); - const output = result.body as TestAppComponentsOutput; - assert.isNotEmpty(output.components); - }); - - it("should delete the test", async () => { - const result = await client.path("/tests/{testId}", testId).delete(); - - assert.include(["204"], result.status); - }); -}); diff --git a/sdk/loadtesting/load-testing-rest/test/public/node/testAdministration.spec.ts b/sdk/loadtesting/load-testing-rest/test/public/node/testAdministration.spec.ts deleted file mode 100644 index 4c28d4564b2c..000000000000 --- a/sdk/loadtesting/load-testing-rest/test/public/node/testAdministration.spec.ts +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { createClient, createRecorder } from "../utils/recordedClient.js"; -import type { - AppComponent, - AzureLoadTestingClient, - TestAppComponentsOutput, -} from "../../../src/index.js"; -import { isUnexpected } from "../../../src/index.js"; -import type { Recorder } from "@azure-tools/test-recorder"; -import { env } from "@azure-tools/test-recorder"; -import * as fs from "node:fs"; -import { getLongRunningPoller } from "../../../src/pollingHelper.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -describe("Test Administration Operations", () => { - let recorder: Recorder; - let client: AzureLoadTestingClient; - const testId = "sample-sdk-test-20250318"; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = createClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("should create a load test", async () => { - const result = await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: "Sample Load Test", - description: "Sample Load Test Description", - loadTestConfiguration: { - engineInstances: 1, - splitAllCSVs: false, - }, - }, - }); - - assert.include(["200", "201"], result.status); - }); - - it("should upload the additional file without LRO", async () => { - const readStreamAdditionalFile: fs.ReadStream = fs.createReadStream( - "./test/public/additional-data.csv", - ); - const result = await client - .path("/tests/{testId}/files/{fileName}", testId, "additional-data.csv") - .put({ - contentType: "application/octet-stream", - body: readStreamAdditionalFile, - queryParameters: { - fileType: "ADDITIONAL_ARTIFACTS", - }, - }); - - assert.include(["201"], result.status); - }); - - it("should fail file upload due to LRO timeout", async () => { - const readStreamTestFile: fs.ReadStream = fs.createReadStream("./test/public/sample.jmx"); - const fileUploadResult = await client - .path("/tests/{testId}/files/{fileName}", testId, "sample.jmx") - .put({ - contentType: "application/octet-stream", - body: readStreamTestFile, - }); - - if (isUnexpected(fileUploadResult)) { - throw fileUploadResult.body.error; - } - - const fileValidatePoller = await getLongRunningPoller(client, fileUploadResult); - try { - await fileValidatePoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(10), // timeout of 10 milliseconds - }); - } catch (ex: any) { - assert.equal(ex.message, "The polling was aborted."); - return; - } - - assert.fail(); - }); - - it("should upload the test script file with LRO", async () => { - const readStreamTestFile: fs.ReadStream = fs.createReadStream("./test/public/sample.jmx"); - const fileUploadResult = await client - .path("/tests/{testId}/files/{fileName}", testId, "sample.jmx") - .put({ - contentType: "application/octet-stream", - body: readStreamTestFile, - }); - - if (isUnexpected(fileUploadResult)) { - throw fileUploadResult.body.error; - } - - const fileValidatePoller = await getLongRunningPoller(client, fileUploadResult); - await fileValidatePoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(60000), // timeout of 60 seconds - }); - assert.equal(fileValidatePoller.getOperationState().status, "succeeded"); - }); - - it("should create the app components", async () => { - const SUBSCRIPTION_ID = env["SUBSCRIPTION_ID"] || ""; - - const appCompResourceId = `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/contoso-sampleapp-rg/providers/Microsoft.Web/sites/contoso-sampleapp`; - const appComponent: AppComponent = { - resourceName: "contoso-sampleapp", - resourceType: "Microsoft.Web/sites", - }; - const appComps: Record = {}; - - appComps[appCompResourceId] = appComponent; - const result = await client.path("/tests/{testId}/app-components", testId).patch({ - contentType: "application/merge-patch+json", - body: { - components: appComps, - }, - }); - - assert.include(["200", "201"], result.status); - }); - - it("should get the test file", async () => { - const result = await client - .path("/tests/{testId}/files/{fileName}", testId, "sample.jmx") - .get(); - - assert.include(["200"], result.status); - }); - - it("should get the test", async () => { - const result = await client.path("/tests/{testId}", testId).get(); - - assert.include(["200"], result.status); - }); - - it("should get the test app components", async () => { - const result = await client.path("/tests/{testId}/app-components", testId).get(); - - assert.include(["200"], result.status); - const output = result.body as TestAppComponentsOutput; - assert.isNotEmpty(output.components); - }); - - it("should delete the test file", async () => { - const result = await client - .path("/tests/{testId}/files/{fileName}", testId, "sample.jmx") - .delete(); - - assert.include(["204"], result.status); - }); - - it("should delete the test", async () => { - const result = await client.path("/tests/{testId}", testId).delete(); - - assert.include(["204"], result.status); - }); -}); - -describe("Test Profile Administration Operations", () => { - let recorder: Recorder; - let client: AzureLoadTestingClient; - const testId = "sample-sdk-testpr-202503183"; - const testProfileId = "sample-sdk-testprofile-202503188"; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = createClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("should create a load test", async () => { - const result = await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: "Sample Load Test", - description: "Sample Load Test Description", - loadTestConfiguration: { - engineInstances: 1, - splitAllCSVs: false, - }, - }, - }); - - assert.include(["200", "201"], result.status); - }); - - it("should upload the test script file with LRO", async () => { - const readStreamTestFile: fs.ReadStream = fs.createReadStream("./test/public/sample.jmx"); - const fileUploadResult = await client - .path("/tests/{testId}/files/{fileName}", testId, "sample.jmx") - .put({ - contentType: "application/octet-stream", - body: readStreamTestFile, - }); - - if (isUnexpected(fileUploadResult)) { - throw fileUploadResult.body.error; - } - - const fileValidatePoller = await getLongRunningPoller(client, fileUploadResult); - await fileValidatePoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(60000), // timeout of 60 seconds - }); - assert.equal(fileValidatePoller.getOperationState().status, "succeeded"); - }); - - it("should create a test profile with the given test", async () => { - const flexFunctionsResourceId = env["LOADTESTSERVICE_FLEXFUNCTIONSRESOURCEID"] || ""; - const testProfileDisplayName = "Sample Test Profile"; - const testProfileDescription = "Sample Test Profile Description"; - - const testProfileCreationResult = await client - .path("/test-profiles/{testProfileId}", testProfileId) - .patch({ - contentType: "application/merge-patch+json", - body: { - testId: testId, - displayName: testProfileDisplayName, - description: testProfileDescription, - targetResourceId: flexFunctionsResourceId, - targetResourceConfigurations: { - kind: "FunctionsFlexConsumption", - configurations: { - config1: { - instanceMemoryMB: 2048, - httpConcurrency: 20, - }, - config2: { - instanceMemoryMB: 4096, - httpConcurrency: 40, - }, - }, - }, - }, - }); - - if (isUnexpected(testProfileCreationResult)) { - throw testProfileCreationResult.body.error; - } - - assert.include(["200", "201"], testProfileCreationResult.status); - }); - - it("should get a test profile", async () => { - const testProfileResult = await client - .path("/test-profiles/{testProfileId}", testProfileId) - .get(); - - if (isUnexpected(testProfileResult)) { - throw testProfileResult.body.error; - } - - assert.equal("200", testProfileResult.status); - assert.isNotNull(testProfileResult.body); - }); - - it("should delete a test profile", async () => { - const testProfileResult = await client - .path("/test-profiles/{testProfileId}", testProfileId) - .delete(); - - if (isUnexpected(testProfileResult)) { - throw testProfileResult.body.error; - } - - assert.equal("204", testProfileResult.status); - }); -}); diff --git a/sdk/loadtesting/load-testing-rest/test/public/node/testRun.spec.ts b/sdk/loadtesting/load-testing-rest/test/public/node/testRun.spec.ts deleted file mode 100644 index c73e4e5ac8dd..000000000000 --- a/sdk/loadtesting/load-testing-rest/test/public/node/testRun.spec.ts +++ /dev/null @@ -1,342 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder } from "@azure-tools/test-recorder"; -import { env } from "@azure-tools/test-recorder"; -import { createRecorder, createClient } from "../utils/recordedClient.js"; -import type { - AppComponent, - AzureLoadTestingClient, - TestProfileRunOutput, - TestRunAppComponentsOutput, -} from "../../../src/index.js"; -import { isUnexpected } from "../../../src/index.js"; -import * as fs from "node:fs"; -import { getLongRunningPoller } from "../../../src/pollingHelper.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -describe("Test Run Operations", () => { - let recorder: Recorder; - let client: AzureLoadTestingClient; - const testId = "sample-sdk-testtr-20250318"; // The test that will get created - const testRunId = "sample-sdk-testrun-20250318-2"; // The test run that will get created - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = createClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - // Pre-req for creating a test-run - it("should create a load test", async () => { - const result = await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: "Sample Load Test", - description: "Sample Load Test Description", - loadTestConfiguration: { - engineInstances: 1, - splitAllCSVs: false, - }, - }, - }); - - assert.include(["200", "201"], result.status); - }); - - // Pre-req for creating a test-run - it("should upload the test file with LRO", async () => { - const readStreamTestFile: fs.ReadStream = fs.createReadStream("./test/public/sample.jmx"); - const fileUploadResult = await client - .path("/tests/{testId}/files/{fileName}", testId, "sample.jmx") - .put({ - contentType: "application/octet-stream", - body: readStreamTestFile, - }); - - if (isUnexpected(fileUploadResult)) { - throw fileUploadResult.body.error; - } - - const fileValidatePoller = await getLongRunningPoller(client, fileUploadResult); - await fileValidatePoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(60000), // timeout of 60 seconds - }); - assert.equal(fileValidatePoller.getOperationState().status, "succeeded"); - }); - - it("should timeout while polling the test run", async () => { - const timeoutTestRunId = "sample-sdk-testrun-20250318-1"; - const testRunCreationResult = await client - .path("/test-runs/{testRunId}", timeoutTestRunId) - .patch({ - contentType: "application/merge-patch+json", - body: { - testId: testId, - displayName: "Time out Test Run", - }, - }); - - if (isUnexpected(testRunCreationResult)) { - throw testRunCreationResult.body.error; - } - - const testRunPoller = await getLongRunningPoller(client, testRunCreationResult); - try { - await testRunPoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(10), // timeout of 10 milliseconds - }); - } catch (ex: any) { - assert.equal(ex.name, "AbortError"); - return; - } - - assert.fail(); - }); - - it("should stop the test run", async () => { - const timeoutTestRunId = "sample-sdk-testrun-20250318-1"; - const stopResult = await client.path("/test-runs/{testRunId}:stop", timeoutTestRunId).post(); - - if (isUnexpected(stopResult)) { - throw stopResult.body.error; - } - - assert.equal("200", stopResult.status); - }); - - it("should be able to create a test run and poll", async () => { - const testRunCreationResult = await client.path("/test-runs/{testRunId}", testRunId).patch({ - contentType: "application/merge-patch+json", - body: { - testId: testId, - displayName: "Sample Test Run", - }, - }); - - if (isUnexpected(testRunCreationResult)) { - throw testRunCreationResult.body.error; - } - - const testRunPoller = await getLongRunningPoller(client, testRunCreationResult); - await testRunPoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(600000), - }); - - assert.equal(testRunPoller.getOperationState().status, "succeeded"); - }); - - it("should get a test run", async () => { - const result = await client.path("/test-runs/{testRunId}", testRunId).get(); - - assert.include(["200"], result.status); - }); - - it("should create a app component for test run", async () => { - const SUBSCRIPTION_ID = env["SUBSCRIPTION_ID"] || ""; - - const appCompResourceId = `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/contoso-sampleapp-rg/providers/Microsoft.Web/sites/contoso-sampleapp`; - const appComponent: AppComponent = { - resourceName: "contoso-sampleapp", - resourceType: "Microsoft.Web/sites", - }; - const appComps: Record = {}; - - appComps[appCompResourceId] = appComponent; - - const result = await client.path("/test-runs/{testRunId}/app-components", testRunId).patch({ - contentType: "application/merge-patch+json", - body: { - components: appComps, - }, - }); - - assert.include(["200", "201"], result.status); - }); - - it("should get a test run app components", async () => { - const result = await client.path("/test-runs/{testRunId}/app-components", testRunId).get(); - - assert.include(["200"], result.status); - - const output = result.body as TestRunAppComponentsOutput; - assert.isNotEmpty(output.components); - }); - - it("should get a test run server metrics config", async () => { - const result = await client - .path("/test-runs/{testRunId}/server-metrics-config", testRunId) - .get(); - - assert.include(["200"], result.status); - }); - - it("should delete a test run", async () => { - const result = await client.path("/test-runs/{testRunId}", testRunId).delete(); - - assert.include(["204"], result.status); - }); - - it("should delete the test", async () => { - const result = await client.path("/tests/{testId}", testId).delete(); - - assert.include(["204"], result.status); - }); -}); - -describe("Test Profile Run Operations", () => { - let recorder: Recorder; - let client: AzureLoadTestingClient; - const testId = "sample-sdk-testtpr-20250319"; - const testProfileId = "sample-sdk-testprofile-202503198"; - const testProfileRunId = "sample-sdk-testprofilerun-202503198"; - - beforeEach(async (ctx) => { - recorder = await createRecorder(ctx); - client = createClient(recorder); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - // Pre-req for creating a test profile run - it("should create a load test", async () => { - const result = await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: "Sample Load Test", - description: "Sample Load Test Description", - loadTestConfiguration: { - engineInstances: 1, - splitAllCSVs: false, - }, - }, - }); - - assert.include(["200", "201"], result.status); - }); - - // Pre-req for creating a test profile run - it("should upload the test file with LRO", async () => { - const readStreamTestFile: fs.ReadStream = fs.createReadStream("./test/public/sample.jmx"); - const fileUploadResult = await client - .path("/tests/{testId}/files/{fileName}", testId, "sample.jmx") - .put({ - contentType: "application/octet-stream", - body: readStreamTestFile, - }); - - if (isUnexpected(fileUploadResult)) { - throw fileUploadResult.body.error; - } - - const fileValidatePoller = await getLongRunningPoller(client, fileUploadResult); - await fileValidatePoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(60000), // timeout of 60 seconds - }); - assert.equal(fileValidatePoller.getOperationState().status, "succeeded"); - }); - - it("should create a test profile with the given test", async () => { - const flexFunctionsResourceId = env["LOADTESTSERVICE_FLEXFUNCTIONSRESOURCEID"] || ""; - const testProfileDisplayName = "Sample Test Profile"; - const testProfileDescription = "Sample Test Profile Description"; - - const testProfileCreationResult = await client - .path("/test-profiles/{testProfileId}", testProfileId) - .patch({ - contentType: "application/merge-patch+json", - body: { - testId: testId, - displayName: testProfileDisplayName, - description: testProfileDescription, - targetResourceId: flexFunctionsResourceId, - targetResourceConfigurations: { - kind: "FunctionsFlexConsumption", - configurations: { - config1: { - instanceMemoryMB: 2048, - httpConcurrency: 20, - }, - config2: { - instanceMemoryMB: 4096, - httpConcurrency: 40, - }, - }, - }, - }, - }); - - if (isUnexpected(testProfileCreationResult)) { - throw testProfileCreationResult.body.error; - } - - assert.include(["200", "201"], testProfileCreationResult.status); - }); - - it("should create a test profile run and poll", async () => { - const testProfileRunCreationResult = await client - .path("/test-profile-runs/{testProfileRunId}", testProfileRunId) - .patch({ - contentType: "application/merge-patch+json", - body: { - testProfileId: testProfileId, - displayName: "Sample Test Profile Run", - }, - }); - - if (isUnexpected(testProfileRunCreationResult)) { - throw testProfileRunCreationResult.body.error; - } - - const testProfileRunPoller = await getLongRunningPoller(client, testProfileRunCreationResult); - const polledResult = await testProfileRunPoller.pollUntilDone({ - abortSignal: AbortSignal.timeout(1200000), - }); - - assert.equal(testProfileRunPoller.getOperationState().status, "succeeded"); - - assert.isNotNull(polledResult.body); - }); - - it("should get a test profile run", async () => { - const result = await client - .path("/test-profile-runs/{testProfileRunId}", testProfileRunId) - .get(); - - const testProfileRun = result.body as TestProfileRunOutput; - assert.include(["200"], result.status); - assert.isNotNull(result.body); - assert.isNotEmpty(testProfileRun.recommendations); - }); - - it("should delete a test profile run", async () => { - const result = await client - .path("/test-profile-runs/{testProfileRunId}", testProfileRunId) - .delete(); - - assert.include(["204"], result.status); - }); - - it("should delete a test profile", async () => { - const testProfileResult = await client - .path("/test-profiles/{testProfileId}", testProfileId) - .delete(); - - if (isUnexpected(testProfileResult)) { - throw testProfileResult.body.error; - } - - assert.equal("204", testProfileResult.status); - }); - - it("should delete the test", async () => { - const result = await client.path("/tests/{testId}", testId).delete(); - - assert.include(["204"], result.status); - }); -}); diff --git a/sdk/loadtesting/load-testing-rest/test/public/sample.jmx b/sdk/loadtesting/load-testing-rest/test/public/sample.jmx deleted file mode 100644 index 25d4442c74d9..000000000000 --- a/sdk/loadtesting/load-testing-rest/test/public/sample.jmx +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - false - true - false - - - - - - - - continue - - false - -1 - - 25 - 2 - true - 30 - 2 - true - - - - - - - example.com - - https - - / - GET - true - false - true - false - - - - - - - - - diff --git a/sdk/loadtesting/load-testing-rest/test/public/utils/env-browser.mts b/sdk/loadtesting/load-testing-rest/test/public/utils/env-browser.mts deleted file mode 100644 index fc36ab244fad..000000000000 --- a/sdk/loadtesting/load-testing-rest/test/public/utils/env-browser.mts +++ /dev/null @@ -1,2 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. diff --git a/sdk/loadtesting/load-testing-rest/test/public/utils/env.ts b/sdk/loadtesting/load-testing-rest/test/public/utils/env.ts deleted file mode 100644 index 54ee1e71af77..000000000000 --- a/sdk/loadtesting/load-testing-rest/test/public/utils/env.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import "dotenv/config"; diff --git a/sdk/loadtesting/load-testing-rest/test/public/utils/recordedClient.ts b/sdk/loadtesting/load-testing-rest/test/public/utils/recordedClient.ts deleted file mode 100644 index e00b950bab89..000000000000 --- a/sdk/loadtesting/load-testing-rest/test/public/utils/recordedClient.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { AzureLoadTestingClient } from "../../../src/index.js"; -import AzureLoadTesting from "../../../src/index.js"; -import type { RecorderStartOptions, TestInfo } from "@azure-tools/test-recorder"; -import { Recorder, env } from "@azure-tools/test-recorder"; -import "./env.js"; -import type { ClientOptions } from "@azure-rest/core-client"; -import { createTestCredential } from "@azure-tools/test-credential"; - -const credential = createTestCredential(); - -const envSetupForPlayback: Record = { - LOADTESTSERVICE_ENDPOINT: - "00000000-0000-0000-0000-000000000000.eastus.cnt-prod.loadtesting.azure.com", - SUBSCRIPTION_ID: "azure_subscription_id", - LOADTESTSERVICE_FLEXFUNCTIONSRESOURCEID: - "/subscriptions/azure_subscription_id/resourceGroups/resource_group_name/providers/Microsoft.Web/sites/func_resource_name", -}; - -const recorderEnvSetup: RecorderStartOptions = { - envSetupForPlayback, - removeCentralSanitizers: [ - "AZSDK3493", // .name in the body is not a secret and is listed below in the beforeEach section - ], -}; - -export function createClient( - recorder: Recorder, - options: ClientOptions = {}, -): AzureLoadTestingClient { - return AzureLoadTesting( - env.LOADTESTSERVICE_ENDPOINT || "", - credential, - recorder.configureClientOptions(options), - ); -} - -/** - * creates the recorder and reads the environment variables from the `.env` file. - * Should be called first in the test suite to make sure environment variables are - * read before they are being used. - */ -export async function createRecorder(context: TestInfo): Promise { - const recorder = new Recorder(context); - await recorder.start(recorderEnvSetup); - return recorder; -} diff --git a/sdk/loadtesting/load-testing-rest/test/snippets.spec.ts b/sdk/loadtesting/load-testing-rest/test/snippets.spec.ts deleted file mode 100644 index d56110270158..000000000000 --- a/sdk/loadtesting/load-testing-rest/test/snippets.spec.ts +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import AzureLoadTesting, { getLongRunningPoller, isUnexpected } from "../src/index.js"; -import { DefaultAzureCredential, InteractiveBrowserCredential } from "@azure/identity"; -import { setLogLevel } from "@azure/logger"; -import { describe, it } from "vitest"; -import { createReadStream } from "node:fs"; - -describe("snippets", () => { - it("ReadmeSampleCreateClient_Node", async () => { - const endpoint = "https://"; - const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - }); - - it("ReadmeSampleCreateLoadTest", async () => { - const endpoint = "https://"; - const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - // @ts-preserve-whitespace - const TEST_ID = "some-test-id"; - const DISPLAY_NAME = "my-load-test"; - // @ts-preserve-whitespace - await client.path("/tests/{testId}", TEST_ID).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: DISPLAY_NAME, - description: "", - loadTestConfiguration: { - engineInstances: 1, - splitAllCSVs: false, - }, - secrets: {}, - environmentVariables: {}, - passFailCriteria: { passFailMetrics: {} }, - }, - }); - }); - - it("ReadmeSampleUploadTestScriptFile", async () => { - const endpoint = "https://"; - const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - // @ts-preserve-whitespace - const TEST_ID = "some-test-id"; - const readStream = createReadStream("./sample.jmx"); - // @ts-preserve-whitespace - const fileUploadResult = await client - .path("/tests/{testId}/files/{fileName}", TEST_ID, "sample.jmx") - .put({ - contentType: "application/octet-stream", - body: readStream, - }); - // @ts-preserve-whitespace - if (isUnexpected(fileUploadResult)) { - throw fileUploadResult.body.error; - } - // @ts-preserve-whitespace - const fileValidatePoller = await getLongRunningPoller(client, fileUploadResult); - const fileValidateResult = await fileValidatePoller.pollUntilDone(); - }); - - it("ReadmeSampleRunTest", async () => { - const endpoint = "https://"; - const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - // @ts-preserve-whitespace - const TEST_ID = "some-test-id"; - const DISPLAY_NAME = "my-load-test"; - const TEST_RUN_ID = "some-test-run-id"; - // @ts-preserve-whitespace - // Creating/Updating the test run - const testRunCreationResult = await client.path("/test-runs/{testRunId}", TEST_RUN_ID).patch({ - contentType: "application/merge-patch+json", - body: { - testId: TEST_ID, - displayName: DISPLAY_NAME, - }, - }); - // @ts-preserve-whitespace - if (isUnexpected(testRunCreationResult)) { - throw testRunCreationResult.body.error; - } - // @ts-preserve-whitespace - const testRunPoller = await getLongRunningPoller(client, testRunCreationResult); - const testRunResult = await testRunPoller.pollUntilDone(); - // @ts-preserve-whitespace - const testRunStarttime = testRunResult.body.startDateTime; - const testRunEndTime = testRunResult.body.endDateTime; - // @ts-preserve-whitespace - // get list of all metric namespaces and pick the first one - const metricNamespaces = await client - .path("/test-runs/{testRunId}/metric-namespaces", TEST_RUN_ID) - .get(); - // @ts-preserve-whitespace - if (isUnexpected(metricNamespaces)) { - throw metricNamespaces.body.error; - } - // @ts-preserve-whitespace - const metricNamespace = metricNamespaces.body.value[0]; - // @ts-preserve-whitespace - if (metricNamespace.name === undefined) { - throw "No Metric Namespace name is defined."; - } - // @ts-preserve-whitespace - // get list of all metric definitions and pick the first one - const metricDefinitions = await client - .path("/test-runs/{testRunId}/metric-definitions", TEST_RUN_ID) - .get({ - queryParameters: { - metricNamespace: metricNamespace.name, - }, - }); - // @ts-preserve-whitespace - if (isUnexpected(metricDefinitions)) { - throw metricDefinitions.body.error; - } - // @ts-preserve-whitespace - const metricDefinition = metricDefinitions.body.value[0]; - // @ts-preserve-whitespace - if (metricDefinition.name === undefined) { - throw "No Metric Namespace name is defined."; - } - // @ts-preserve-whitespace - // fetch client metrics using metric namespace and metric name - const metricsResult = await client.path("/test-runs/{testRunId}/metrics", TEST_RUN_ID).post({ - queryParameters: { - metricname: metricDefinition.name, - metricNamespace: metricNamespace.name, - timespan: testRunStarttime + "/" + testRunEndTime, - }, - }); - // @ts-preserve-whitespace - if (isUnexpected(metricsResult)) { - throw metricsResult.body.error; - } - // @ts-preserve-whitespace - for (const timeSeries of metricsResult.body.value) { - console.log(timeSeries); - } - }); - - it("SetLogLevel", async () => { - setLogLevel("info"); - }); -}); diff --git a/sdk/loadtesting/load-testing-rest/tsconfig.browser.config.json b/sdk/loadtesting/load-testing-rest/tsconfig.browser.config.json deleted file mode 100644 index 75871518e3a0..000000000000 --- a/sdk/loadtesting/load-testing-rest/tsconfig.browser.config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["./tsconfig.test.json", "../../../tsconfig.browser.base.json"] -} diff --git a/sdk/loadtesting/load-testing-rest/tsconfig.json b/sdk/loadtesting/load-testing-rest/tsconfig.json deleted file mode 100644 index 19ceb382b521..000000000000 --- a/sdk/loadtesting/load-testing-rest/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "references": [ - { - "path": "./tsconfig.src.json" - }, - { - "path": "./tsconfig.samples.json" - }, - { - "path": "./tsconfig.test.json" - } - ] -} diff --git a/sdk/loadtesting/load-testing-rest/tsconfig.samples.json b/sdk/loadtesting/load-testing-rest/tsconfig.samples.json deleted file mode 100644 index 8d1e0f43acb8..000000000000 --- a/sdk/loadtesting/load-testing-rest/tsconfig.samples.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../../tsconfig.samples.base.json", - "compilerOptions": { - "paths": { - "@azure-rest/load-testing": ["./dist/esm"] - } - } -} diff --git a/sdk/loadtesting/load-testing-rest/tsconfig.src.json b/sdk/loadtesting/load-testing-rest/tsconfig.src.json deleted file mode 100644 index bae70752dd38..000000000000 --- a/sdk/loadtesting/load-testing-rest/tsconfig.src.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../../tsconfig.lib.json" -} diff --git a/sdk/loadtesting/load-testing-rest/tsconfig.test.json b/sdk/loadtesting/load-testing-rest/tsconfig.test.json deleted file mode 100644 index 290ca214aebc..000000000000 --- a/sdk/loadtesting/load-testing-rest/tsconfig.test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] -} diff --git a/sdk/loadtesting/load-testing-rest/tsp-location.yaml b/sdk/loadtesting/load-testing-rest/tsp-location.yaml index f862b18befa1..84a2fb684fa5 100644 --- a/sdk/loadtesting/load-testing-rest/tsp-location.yaml +++ b/sdk/loadtesting/load-testing-rest/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/loadtestservice/LoadTestService -commit: 3582fd3aac7f024efda7e439acd84a83fc5ad3df -repo: Azure/azure-rest-api-specs +commit: 77367a9ab0c41a2962db46f74cc2a2299f83abe6 +repo: /mnt/vss/_work/1/s/azure-rest-api-specs additionalDirectories: diff --git a/sdk/loadtesting/load-testing-rest/vitest.browser.config.ts b/sdk/loadtesting/load-testing-rest/vitest.browser.config.ts deleted file mode 100644 index 10e70dbfa8ee..000000000000 --- a/sdk/loadtesting/load-testing-rest/vitest.browser.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { defineConfig, mergeConfig } from "vitest/config"; -import viteConfig from "../../../vitest.browser.shared.config.ts"; - -export default mergeConfig( - viteConfig, - defineConfig({ - test: { - include: ["dist-test/browser/test/**/*.spec.js"], - testTimeout: 1200000, - hookTimeout: 1200000, - }, - }), -); diff --git a/sdk/loadtesting/load-testing-rest/vitest.config.ts b/sdk/loadtesting/load-testing-rest/vitest.config.ts deleted file mode 100644 index 86a71911ccc2..000000000000 --- a/sdk/loadtesting/load-testing-rest/vitest.config.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { defineConfig, mergeConfig } from "vitest/config"; -import viteConfig from "../../../vitest.shared.config.ts"; - -export default mergeConfig( - viteConfig, - defineConfig({ - test: { - testTimeout: 1200000, - hookTimeout: 1200000, - }, - }), -); diff --git a/sdk/loadtesting/load-testing-rest/vitest.esm.config.ts b/sdk/loadtesting/load-testing-rest/vitest.esm.config.ts deleted file mode 100644 index 5e9735e9b144..000000000000 --- a/sdk/loadtesting/load-testing-rest/vitest.esm.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { mergeConfig } from "vitest/config"; -import vitestConfig from "./vitest.config.ts"; -import vitestEsmConfig from "../../../vitest.esm.shared.config.ts"; - -export default mergeConfig(vitestConfig, vitestEsmConfig);