From dc257d8fd31be86ea8f0cc1489a10d4f4b9acef5 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 19 Oct 2022 09:00:41 +0000 Subject: [PATCH] CodeGen from PR 21177 in Azure/azure-rest-api-specs Merge 6a2bca651b1259d3de2fbd0564e03a2f9f74008e into 9366804c62e024801daf8a578924099ff644ccf6 --- common/config/rush/pnpm-lock.yaml | 29 +- rush.json | 7 +- sdk/loadtestservice/ci.yml | 39 + .../loadtestservice-rest/.eslintrc.json | 11 + .../loadtestservice-rest/CHANGELOG.md | 3 + .../loadtestservice-rest/LICENSE | 21 + .../loadtestservice-rest/README.md | 59 + .../loadtestservice-rest/api-extractor.json | 31 + .../loadtestservice-rest/package.json | 94 + .../review/loadtestservice.api.md | 1695 +++++++++++++++++ .../src/clientDefinitions.ts | 360 ++++ .../loadtestservice-rest/src/index.ts | 15 + .../loadtestservice-rest/src/isUnexpected.ts | 357 ++++ .../src/loadTestingClient.ts | 42 + .../loadtestservice-rest/src/models.ts | 362 ++++ .../loadtestservice-rest/src/outputModels.ts | 550 ++++++ .../src/paginateHelper.ts | 154 ++ .../loadtestservice-rest/src/parameters.ts | 253 +++ .../loadtestservice-rest/src/responses.ts | 536 ++++++ .../loadtestservice-rest/swagger/README.md | 18 + .../loadtestservice-rest/tsconfig.json | 10 + 21 files changed, 4642 insertions(+), 4 deletions(-) create mode 100644 sdk/loadtestservice/ci.yml create mode 100644 sdk/loadtestservice/loadtestservice-rest/.eslintrc.json create mode 100644 sdk/loadtestservice/loadtestservice-rest/CHANGELOG.md create mode 100644 sdk/loadtestservice/loadtestservice-rest/LICENSE create mode 100644 sdk/loadtestservice/loadtestservice-rest/README.md create mode 100644 sdk/loadtestservice/loadtestservice-rest/api-extractor.json create mode 100644 sdk/loadtestservice/loadtestservice-rest/package.json create mode 100644 sdk/loadtestservice/loadtestservice-rest/review/loadtestservice.api.md create mode 100644 sdk/loadtestservice/loadtestservice-rest/src/clientDefinitions.ts create mode 100644 sdk/loadtestservice/loadtestservice-rest/src/index.ts create mode 100644 sdk/loadtestservice/loadtestservice-rest/src/isUnexpected.ts create mode 100644 sdk/loadtestservice/loadtestservice-rest/src/loadTestingClient.ts create mode 100644 sdk/loadtestservice/loadtestservice-rest/src/models.ts create mode 100644 sdk/loadtestservice/loadtestservice-rest/src/outputModels.ts create mode 100644 sdk/loadtestservice/loadtestservice-rest/src/paginateHelper.ts create mode 100644 sdk/loadtestservice/loadtestservice-rest/src/parameters.ts create mode 100644 sdk/loadtestservice/loadtestservice-rest/src/responses.ts create mode 100644 sdk/loadtestservice/loadtestservice-rest/swagger/README.md create mode 100644 sdk/loadtestservice/loadtestservice-rest/tsconfig.json diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index daa3149f174e..84f3aa5223fb 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -254,6 +254,7 @@ specifiers: '@rush-temp/keyvault-common': file:./projects/keyvault-common.tgz '@rush-temp/keyvault-keys': file:./projects/keyvault-keys.tgz '@rush-temp/keyvault-secrets': file:./projects/keyvault-secrets.tgz + '@rush-temp/loadtestservice': file:./projects/loadtestservice.tgz '@rush-temp/logger': file:./projects/logger.tgz '@rush-temp/maps-common': file:./projects/maps-common.tgz '@rush-temp/maps-search': file:./projects/maps-search.tgz @@ -571,6 +572,7 @@ dependencies: '@rush-temp/keyvault-common': file:projects/keyvault-common.tgz '@rush-temp/keyvault-keys': file:projects/keyvault-keys.tgz '@rush-temp/keyvault-secrets': file:projects/keyvault-secrets.tgz + '@rush-temp/loadtestservice': file:projects/loadtestservice.tgz '@rush-temp/logger': file:projects/logger.tgz '@rush-temp/maps-common': file:projects/maps-common.tgz '@rush-temp/maps-search': file:projects/maps-search.tgz @@ -3965,7 +3967,7 @@ packages: dependencies: semver: 7.3.7 shelljs: 0.8.5 - typescript: 4.9.0-dev.20221018 + typescript: 4.9.0-dev.20221019 dev: false /downlevel-dts/0.8.0: @@ -8962,8 +8964,8 @@ packages: hasBin: true dev: false - /typescript/4.9.0-dev.20221018: - resolution: {integrity: sha512-jHigCAzVp9JXy+t9J854z8ooZTtc1luK25iKKFF48w/AfRfTbypn8HkOGWDmb7x7RuAcZxo1zYcYDk4OaUFKjw==} + /typescript/4.9.0-dev.20221019: + resolution: {integrity: sha512-FgRBDKHZQAbayBvRcfFpjtmztLCobGom2k5W5nFqCXDb/XKYn0oG/8s6O9le3lGIt3+1FC7FYMmqvR5qRW50AA==} engines: {node: '>=4.2.0'} hasBin: true dev: false @@ -17553,6 +17555,27 @@ packages: - utf-8-validate dev: false + file:projects/loadtestservice.tgz: + resolution: {integrity: sha512-UZTfYmpqJpi8mK6NK87zFXeHcDDpFpFSbl4iK9LIfYtD90vquG2ND6wkwJE8OxmHp3L/cuLSd4hbUsTiU2rekQ==, tarball: file:projects/loadtestservice.tgz} + name: '@rush-temp/loadtestservice' + version: 0.0.0 + dependencies: + '@azure-rest/core-client': 1.0.0-beta.10 + '@microsoft/api-extractor': 7.32.0 + '@types/node': 14.18.32 + autorest: 3.6.2 + dotenv: 8.6.0 + eslint: 8.24.0 + mkdirp: 1.0.4 + prettier: 2.2.1 + rimraf: 3.0.2 + source-map-support: 0.5.21 + tslib: 2.4.0 + typescript: 4.6.4 + transitivePeerDependencies: + - supports-color + dev: false + file:projects/logger.tgz: resolution: {integrity: sha512-1vw4Yu9tbtUua8BPIlaP6f7Sg5RiuysrM4mtc5U52ZEXGJ8OMBAb5H5xNkwKrssvo6M4EZ/wAQA4n2fGi7b1/w==, tarball: file:projects/logger.tgz} name: '@rush-temp/logger' diff --git a/rush.json b/rush.json index f4676b09b401..d0d22b53bc70 100644 --- a/rush.json +++ b/rush.json @@ -1895,6 +1895,11 @@ "packageName": "@azure/arm-devhub", "projectFolder": "sdk/devhub/arm-devhub", "versionPolicyName": "management" + }, + { + "packageName": "@azure-rest/loadtestservice", + "projectFolder": "sdk/loadtestservice/loadtestservice-rest", + "versionPolicyName": "client" } ] -} +} \ No newline at end of file diff --git a/sdk/loadtestservice/ci.yml b/sdk/loadtestservice/ci.yml new file mode 100644 index 000000000000..4957726a1498 --- /dev/null +++ b/sdk/loadtestservice/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/loadtestservice/ + exclude: + - sdk/loadtestservice/ci.mgmt.yml + - sdk/loadtestservice/arm-loadtestservice +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/loadtestservice/ + exclude: + - sdk/loadtestservice/ci.mgmt.yml + - sdk/loadtestservice/arm-loadtestservice +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: loadtestservice + Artifacts: + - name: azure-rest-loadtestservice + safeName: azurerestloadtestservice diff --git a/sdk/loadtestservice/loadtestservice-rest/.eslintrc.json b/sdk/loadtestservice/loadtestservice-rest/.eslintrc.json new file mode 100644 index 000000000000..619797ac39b6 --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/.eslintrc.json @@ -0,0 +1,11 @@ +{ + "plugins": ["@azure/azure-sdk"], + "extends": ["plugin:@azure/azure-sdk/azure-sdk-base"], + "rules": { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-apiextractor-json-types": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "tsdoc/syntax": "warn" + } +} diff --git a/sdk/loadtestservice/loadtestservice-rest/CHANGELOG.md b/sdk/loadtestservice/loadtestservice-rest/CHANGELOG.md new file mode 100644 index 000000000000..433b40509417 --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0-beta.1 (2022-10-19) + + - Initial Release diff --git a/sdk/loadtestservice/loadtestservice-rest/LICENSE b/sdk/loadtestservice/loadtestservice-rest/LICENSE new file mode 100644 index 000000000000..5d1d36e0af80 --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +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. \ No newline at end of file diff --git a/sdk/loadtestservice/loadtestservice-rest/README.md b/sdk/loadtestservice/loadtestservice-rest/README.md new file mode 100644 index 000000000000..148c2f979bb8 --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/README.md @@ -0,0 +1,59 @@ +# Azure LoadTesting REST client library for JavaScript + +These APIs allow end users to create, view and run load tests using Azure Load Test Service. + +**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** + +Key links: + +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtestservice/loadtestservice-rest) +- [Package (NPM)](https://www.npmjs.com/package/@azure-rest/loadtestservice) +- [API reference documentation](https://docs.microsoft.com/javascript/api/@azure-rest/loadtestservice?view=azure-node-preview) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtestservice/loadtestservice-rest/samples) + +## Getting started + +### Currently supported environments + +- Node.js version 14.x.x or higher + +### Prerequisites + +- You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package. + +### Install the `@azure-rest/loadtestservice` package + +Install the Azure LoadTesting REST client REST client library for JavaScript with `npm`: + +```bash +npm install @azure-rest/loadtestservice +``` + +### Create and authenticate a `LoadTestingClient` + +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 + +## 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`: + +```javascript +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). diff --git a/sdk/loadtestservice/loadtestservice-rest/api-extractor.json b/sdk/loadtestservice/loadtestservice-rest/api-extractor.json new file mode 100644 index 000000000000..d81e173cf40d --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./types/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/loadtestservice.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/loadtestservice/loadtestservice-rest/package.json b/sdk/loadtestservice/loadtestservice-rest/package.json new file mode 100644 index 000000000000..e5aae0be8039 --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/package.json @@ -0,0 +1,94 @@ +{ + "name": "@azure-rest/loadtestservice", + "sdk-type": "client", + "author": "Microsoft Corporation", + "version": "1.0.0-beta.1", + "description": "A generated SDK for LoadTestingClient.", + "keywords": [ + "node", + "azure", + "cloud", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "dist/index.js", + "module": "./dist-esm/index.js", + "types": "./types/loadtestservice.d.ts", + "repository": "github:Azure/azure-sdk-for-js", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/", + "dist-esm/", + "types/loadtestservice.d.ts", + "README.md", + "LICENSE", + "review/*" + ], + "engines": { + "node": ">=14.0.0" + }, + "scripts": { + "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", + "build:browser": "tsc -p . && dev-tool run bundle", + "build:node": "tsc -p . && dev-tool run bundle", + "build:samples": "echo skipped.", + "build:test": "echo skipped.", + "build:debug": "tsc -p . && dev-tool run bundle && api-extractor run --local", + "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "execute:samples": "echo skipped", + "extract-api": "rimraf review && mkdirp ./review && api-extractor run --local", + "format": "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:browser": "echo skipped", + "integration-test:node": "echo skipped", + "integration-test": "echo skipped", + "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]", + "lint": "eslint package.json api-extractor.json src test --ext .ts", + "pack": "npm pack 2>&1", + "test:browser": "echo skipped", + "test:node": "echo skipped", + "test": "echo \"Error: no test specified\" && exit 1", + "unit-test": "echo skipped", + "unit-test:node": "echo skipped", + "unit-test:browser": "echo skipped", + "build": "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && api-extractor run --local" + }, + "sideEffects": false, + "autoPublish": false, + "dependencies": { + "@azure/core-auth": "^1.3.0", + "@azure-rest/core-client": "1.0.0-beta.10", + "@azure/core-rest-pipeline": "^1.8.0", + "@azure/logger": "^1.0.0", + "tslib": "^2.2.0", + "@azure/core-paging": "^1.2.0" + }, + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "autorest": "latest", + "@types/node": "^14.0.0", + "dotenv": "^8.2.0", + "eslint": "^8.0.0", + "mkdirp": "^1.0.4", + "prettier": "2.2.1", + "rimraf": "^3.0.0", + "source-map-support": "^0.5.9", + "typescript": "~4.6.0", + "@azure/dev-tool": "^1.0.0", + "@azure/eslint-plugin-azure-sdk": "^3.0.0" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtestservice/loadtestservice-rest/README.md", + "//metadata": { + "constantPaths": [ + { + "path": "swagger/README.md", + "prefix": "package-version" + } + ] + } +} \ No newline at end of file diff --git a/sdk/loadtestservice/loadtestservice-rest/review/loadtestservice.api.md b/sdk/loadtestservice/loadtestservice-rest/review/loadtestservice.api.md new file mode 100644 index 000000000000..f1981d1fd10b --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/review/loadtestservice.api.md @@ -0,0 +1,1695 @@ +## API Report File for "@azure-rest/loadtestservice" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +/// + +import { Client } from '@azure-rest/core-client'; +import { ClientOptions } from '@azure-rest/core-client'; +import { HttpResponse } from '@azure-rest/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PathUncheckedResponse } from '@azure-rest/core-client'; +import { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import { RequestParameters } from '@azure-rest/core-client'; +import { StreamableMethod } from '@azure-rest/core-client'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export interface AppComponent { + displayName?: string; + kind?: string; + resourceGroup?: string; + resourceId: string; + resourceName: string; + resourceType?: string; + subscriptionId?: string; +} + +// @public (undocumented) +export interface AppComponentCreateOrUpdate { + delete(options?: AppComponentDeleteParameters): StreamableMethod; + get(options?: AppComponentGetParameters): StreamableMethod; + patch(options: AppComponentCreateOrUpdateParameters): StreamableMethod; +} + +// @public +export interface AppComponentCreateOrUpdate200Response extends HttpResponse { + // (undocumented) + body: AppComponentsMapOutput; + // (undocumented) + status: "200"; +} + +// @public +export interface AppComponentCreateOrUpdate201Response extends HttpResponse { + // (undocumented) + body: AppComponentsMapOutput; + // (undocumented) + status: "201"; +} + +// @public (undocumented) +export interface AppComponentCreateOrUpdateBodyParam { + body: AppComponentsMap; +} + +// @public (undocumented) +export interface AppComponentCreateOrUpdateDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface AppComponentCreateOrUpdateDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & AppComponentCreateOrUpdateDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export interface AppComponentCreateOrUpdateMediaTypesParam { + contentType?: "application/merge-patch+json"; +} + +// @public (undocumented) +export type AppComponentCreateOrUpdateParameters = AppComponentCreateOrUpdateMediaTypesParam & AppComponentCreateOrUpdateBodyParam & RequestParameters; + +// @public +export interface AppComponentDelete204Response extends HttpResponse { + // (undocumented) + body: Record; + // (undocumented) + status: "204"; +} + +// @public (undocumented) +export interface AppComponentDeleteDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface AppComponentDeleteDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & AppComponentDeleteDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type AppComponentDeleteParameters = RequestParameters; + +// @public +export interface AppComponentGet200Response extends HttpResponse { + // (undocumented) + body: AppComponentsMapOutput; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface AppComponentGetByTestOrTestRun { + get(options?: AppComponentGetByTestOrTestRunParameters): StreamableMethod; +} + +// @public +export interface AppComponentGetByTestOrTestRun200Response extends HttpResponse { + // (undocumented) + body: AppComponentsMapOutput; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface AppComponentGetByTestOrTestRunDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface AppComponentGetByTestOrTestRunDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & AppComponentGetByTestOrTestRunDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type AppComponentGetByTestOrTestRunParameters = AppComponentGetByTestOrTestRunQueryParam & RequestParameters; + +// @public (undocumented) +export interface AppComponentGetByTestOrTestRunQueryParam { + // (undocumented) + queryParameters?: AppComponentGetByTestOrTestRunQueryParamProperties; +} + +// @public (undocumented) +export interface AppComponentGetByTestOrTestRunQueryParamProperties { + testRunId?: string; +} + +// @public (undocumented) +export interface AppComponentGetDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface AppComponentGetDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & AppComponentGetDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type AppComponentGetParameters = RequestParameters; + +// @public +export interface AppComponentOutput { + displayName?: string; + kind?: string; + resourceGroup?: string; + resourceId: string; + resourceName: string; + resourceType?: string; + subscriptionId?: string; +} + +// @public +export interface AppComponentsMap { + name?: string; + resourceId?: string; + testId?: string; + testRunId?: string; + value: Record; +} + +// @public +export interface AppComponentsMapOutput { + name?: string; + resourceId?: string; + testId?: string; + testRunId?: string; + value: Record; +} + +// @public (undocumented) +export interface CertificateMetadata20221101 { + name?: string; + type?: "AKV_CERT_URI"; + value?: string; +} + +// @public (undocumented) +export interface CertificateMetadata20221101Output { + name?: string; + type?: "AKV_CERT_URI"; + value?: string; +} + +// @public +function createClient(Endpoint: string, credentials: TokenCredential, options?: ClientOptions): LoadTestingClient; +export default createClient; + +// @public +export interface DefaultServerMetricsConfigListModelOutput { + defaultMetrics?: Record>; +} + +// @public +export interface DefaultServerMetricsConfigModelOutput { + aggregation?: string; + displayDescription?: string; + metricnamespace?: string; + name?: LocalizableStringOutput; + unit?: string; +} + +// @public +export interface ErrorDetails20221101 { + message?: string; +} + +// @public +export interface ErrorDetails20221101Output { + message?: string; +} + +// @public +export interface ErrorModelOutput { + code: string; + details?: Array; + message: string; + target?: string; +} + +// @public +export interface ErrorResponseBodyOutput { + error: ErrorModelOutput; +} + +// @public +export interface FileUrl20221101 { + expireTime?: Date | string; + fileId?: string; + filename?: string; + fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; + url?: string; + validationStatus?: "NOT_VALIDATED" | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE" | "VALIDATION_INITIATED"; +} + +// @public +export interface FileUrl20221101Output { + expireTime?: string; + fileId?: string; + filename?: string; + fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; + url?: string; + validationStatus?: "NOT_VALIDATED" | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE" | "VALIDATION_INITIATED"; +} + +// @public (undocumented) +export interface FileUrlListOutput { + nextLink?: string; + value: Array; +} + +// @public +export type GetArrayType = T extends Array ? TData : never; + +// @public +export type GetPage = (pageLink: string, maxPageSize?: number) => Promise<{ + page: TPage; + nextPageLink?: string; +}>; + +// @public +export interface InputTestArtifacts20221101 { + additionalUrls?: Array; + configUrl?: FileUrl20221101; + inputArtifactsZipFileurl?: FileUrl20221101; + testScriptUrl?: FileUrl20221101; + userPropUrl?: FileUrl20221101; +} + +// @public +export interface InputTestArtifacts20221101Output { + additionalUrls?: Array; + configUrl?: FileUrl20221101Output; + inputArtifactsZipFileurl?: FileUrl20221101Output; + testScriptUrl?: FileUrl20221101Output; + userPropUrl?: FileUrl20221101Output; +} + +// @public (undocumented) +export function isUnexpected(response: AppComponentCreateOrUpdate200Response | AppComponentCreateOrUpdate201Response | AppComponentCreateOrUpdateDefaultResponse): response is AppComponentCreateOrUpdateDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: AppComponentDelete204Response | AppComponentDeleteDefaultResponse): response is AppComponentDeleteDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: AppComponentGet200Response | AppComponentGetDefaultResponse): response is AppComponentGetDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: AppComponentGetByTestOrTestRun200Response | AppComponentGetByTestOrTestRunDefaultResponse): response is AppComponentGetByTestOrTestRunDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: ServerMetricsCreateOrUpdate200Response | ServerMetricsCreateOrUpdate201Response | ServerMetricsCreateOrUpdateDefaultResponse): response is ServerMetricsCreateOrUpdateDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: ServerMetricsGet200Response | ServerMetricsGetDefaultResponse): response is ServerMetricsGetDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: ServerMetricsDelete204Response | ServerMetricsDeleteDefaultResponse): response is ServerMetricsDeleteDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: ServerMetricsGetByTestOrTestRun200Response | ServerMetricsGetByTestOrTestRunDefaultResponse): response is ServerMetricsGetByTestOrTestRunDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: ServerMetricsGetDefaultMetrics200Response | ServerMetricsGetDefaultMetricsDefaultResponse): response is ServerMetricsGetDefaultMetricsDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: ServerMetricsListSupportedResourceType200Response | ServerMetricsListSupportedResourceTypeDefaultResponse): response is ServerMetricsListSupportedResourceTypeDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestCreateOrUpdate200Response | TestCreateOrUpdate201Response | TestCreateOrUpdateDefaultResponse): response is TestCreateOrUpdateDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestDelete204Response | TestDeleteDefaultResponse): response is TestDeleteDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestGet200Response | TestGetDefaultResponse): response is TestGetDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestList200Response | TestListDefaultResponse): response is TestListDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestUploadFile201Response | TestUploadFileDefaultResponse): response is TestUploadFileDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestGetFile200Response | TestGetFileDefaultResponse): response is TestGetFileDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestDeleteFile204Response | TestDeleteFileDefaultResponse): response is TestDeleteFileDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestGetAllFiles200Response | TestGetAllFilesDefaultResponse): response is TestGetAllFilesDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestRunDelete204Response | TestRunDeleteDefaultResponse): response is TestRunDeleteDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestRunCreateOrUpdate200Response | TestRunCreateOrUpdateDefaultResponse): response is TestRunCreateOrUpdateDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestRunGet200Response | TestRunGetDefaultResponse): response is TestRunGetDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestRunGetFile200Response | TestRunGetFileDefaultResponse): response is TestRunGetFileDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestRunList200Response | TestRunListDefaultResponse): response is TestRunListDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestRunStop200Response | TestRunStopDefaultResponse): response is TestRunStopDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestRunMetricNamespaces200Response | TestRunMetricNamespacesDefaultResponse): response is TestRunMetricNamespacesDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestRunMetricDefinitions200Response | TestRunMetricDefinitionsDefaultResponse): response is TestRunMetricDefinitionsDefaultResponse; + +// @public (undocumented) +export function isUnexpected(response: TestRunMetrics200Response | TestRunMetricsDefaultResponse): response is TestRunMetricsDefaultResponse; + +// @public +export interface LoadTestConfig20221101 { + engineInstances?: number; + optionalLoadTestConfig?: OptionalLoadTestConfig; + quickStartTest?: boolean; + splitAllCSVs?: boolean; +} + +// @public +export interface LoadTestConfig20221101Output { + engineInstances?: number; + optionalLoadTestConfig?: OptionalLoadTestConfigOutput; + quickStartTest?: boolean; + splitAllCSVs?: boolean; +} + +// @public (undocumented) +export type LoadTestingClient = Client & { + path: Routes; +}; + +// @public +export interface LocalizableString { + localizedValue?: string; + value?: string; +} + +// @public +export interface LocalizableStringOutput { + localizedValue?: string; + value?: string; +} + +// @public +export interface MetadataFilter { + name?: string; + values?: Array; +} + +// @public +export interface MetadataValueOutput { + name?: LocalizableStringOutput; + value?: string; +} + +// @public +export interface MetricAvailabilityOutput { + timeGrain?: "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; +} + +// @public +export interface MetricDefinitionCollectionOutput { + value?: Array; +} + +// @public +export interface MetricDefinitionOutput { + dimensions?: Array; + displayDescription?: string; + metricAvailabilities?: Array; + name?: LocalizableStringOutput; + namespace?: string; + primaryAggregationType?: "Average" | "Count" | "Minimum" | "Maximum" | "None" | "Total" | "Percentile90" | "Percentile95" | "Percentile99"; + supportedAggregationTypes?: Array; + unit?: "NotSpecified" | "Percent" | "Count" | "Seconds" | "Milliseconds" | "Bytes" | "BytesPerSecond" | "CountPerSecond"; +} + +// @public +export interface MetricNamespaceCollectionOutput { + value?: Array; +} + +// @public +export interface MetricNamespaceOutput { + metricNamespaceName?: string; + name?: string; +} + +// @public +export interface MetricOutput { + displayDescription?: string; + id?: string; + name?: LocalizableStringOutput; + timeseries?: Array; + unit?: "NotSpecified" | "Percent" | "Count" | "Seconds" | "Milliseconds" | "Bytes" | "BytesPerSecond" | "CountPerSecond"; +} + +// @public +export interface MetricRequestPayload { + // (undocumented) + filters?: Array; +} + +// @public +export interface MetricValueOutput { + average?: number; + count?: number; + maximum?: number; + minimum?: number; + percentile90?: number; + percentile95?: number; + percentile99?: number; + timeStamp?: string; + total?: number; +} + +// @public +export interface OptionalLoadTestConfig { + duration?: number; + endpointUrl?: string; + rampUpTime?: number; + vusers?: number; +} + +// @public +export interface OptionalLoadTestConfigOutput { + duration?: number; + endpointUrl?: string; + rampUpTime?: number; + vusers?: number; +} + +// @public +export interface OutputTestArtifacts20221101 { + logsUrl?: FileUrl20221101; + resultUrl?: FileUrl20221101; +} + +// @public +export interface OutputTestArtifacts20221101Output { + logsUrl?: FileUrl20221101Output; + resultUrl?: FileUrl20221101Output; +} + +// @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 interface PassFailCriteria20221101 { + passFailMetrics?: Record; +} + +// @public +export interface PassFailCriteria20221101Output { + passFailMetrics?: Record; +} + +// @public (undocumented) +export interface PassFailMetric20221101 { + action?: "stop" | "continue"; + actualValue?: number; + aggregate?: "count" | "percentage" | "avg" | "p50" | "p90" | "p95" | "p99" | "min" | "max"; + clientmetric?: "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; + condition?: string; + requestName?: string; + result?: "passed" | "undetermined" | "failed"; + value?: number; +} + +// @public (undocumented) +export interface PassFailMetric20221101Output { + action?: "stop" | "continue"; + actualValue?: number; + aggregate?: "count" | "percentage" | "avg" | "p50" | "p90" | "p95" | "p99" | "min" | "max"; + clientmetric?: "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; + condition?: string; + requestName?: string; + result?: "passed" | "undetermined" | "failed"; + value?: number; +} + +// @public +export interface ResourceMetricModel { + aggregation: string; + displayDescription?: string; + id?: string; + metricnamespace: string; + name: LocalizableString; + resourceId: string; + resourceType: string; + unit?: string; +} + +// @public +export interface ResourceMetricModelOutput { + aggregation: string; + displayDescription?: string; + id?: string; + metricnamespace: string; + name: LocalizableStringOutput; + resourceId: string; + resourceType: string; + unit?: string; +} + +// @public +export interface ResponseOutput { + interval?: string; + namespace?: string; + timespan?: string; + value?: MetricOutput; +} + +// @public (undocumented) +export interface Routes { + (path: "/app-components/{name}", name: string): AppComponentCreateOrUpdate; + (path: "/app-components"): AppComponentGetByTestOrTestRun; + (path: "/serverMetricsConfig/{name}", name: string): ServerMetricsCreateOrUpdate; + (path: "/serverMetricsConfig"): ServerMetricsGetByTestOrTestRun; + (path: "/serverMetricsConfig/default"): ServerMetricsGetDefaultMetrics; + (path: "/serverMetricsConfig/supportedResourceTypes"): ServerMetricsListSupportedResourceType; + (path: "/loadtests/{testId}", testId: string): TestCreateOrUpdate; + (path: "/loadtests/sortAndFilter"): TestList; + (path: "/loadtests/{testId}/files/{fileId}", testId: string, fileId: string): TestUploadFile; + (path: "/loadtests/{testId}/files", testId: string): TestGetAllFiles; + (path: "/testruns/{testRunId}", testRunId: string): TestRunDelete; + (path: "/testruns/{testRunId}/files/{fileId}", testRunId: string, fileId: string): TestRunGetFile; + (path: "/testruns/sortAndFilter"): TestRunList; + (path: "/testruns/{testRunId}:stop", testRunId: string): TestRunStop; + (path: "/testRuns/{testRunId}/metricNamespaces", testRunId: string): TestRunMetricNamespaces; + (path: "/testRuns/{testRunId}/metricDefinitions", testRunId: string): TestRunMetricDefinitions; + (path: "/testRuns/{testRunId}/metrics", testRunId: string): TestRunMetrics; +} + +// @public (undocumented) +export interface SecretMetadata20221101 { + type?: "AKV_SECRET_URI" | "SECRET_VALUE"; + value?: string; +} + +// @public (undocumented) +export interface SecretMetadata20221101Output { + type?: "AKV_SECRET_URI" | "SECRET_VALUE"; + value?: string; +} + +// @public (undocumented) +export interface ServerMetricsCreateOrUpdate { + delete(options?: ServerMetricsDeleteParameters): StreamableMethod; + get(options?: ServerMetricsGetParameters): StreamableMethod; + patch(options: ServerMetricsCreateOrUpdateParameters): StreamableMethod; +} + +// @public +export interface ServerMetricsCreateOrUpdate200Response extends HttpResponse { + // (undocumented) + body: ServerMetricsModelOutput; + // (undocumented) + status: "200"; +} + +// @public +export interface ServerMetricsCreateOrUpdate201Response extends HttpResponse { + // (undocumented) + body: ServerMetricsModelOutput; + // (undocumented) + status: "201"; +} + +// @public (undocumented) +export interface ServerMetricsCreateOrUpdateBodyParam { + body: ServerMetricsModel; +} + +// @public (undocumented) +export interface ServerMetricsCreateOrUpdateDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface ServerMetricsCreateOrUpdateDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & ServerMetricsCreateOrUpdateDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export interface ServerMetricsCreateOrUpdateMediaTypesParam { + contentType?: "application/merge-patch+json"; +} + +// @public (undocumented) +export type ServerMetricsCreateOrUpdateParameters = ServerMetricsCreateOrUpdateMediaTypesParam & ServerMetricsCreateOrUpdateBodyParam & RequestParameters; + +// @public +export interface ServerMetricsDelete204Response extends HttpResponse { + // (undocumented) + body: Record; + // (undocumented) + status: "204"; +} + +// @public (undocumented) +export interface ServerMetricsDeleteDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface ServerMetricsDeleteDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & ServerMetricsDeleteDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type ServerMetricsDeleteParameters = RequestParameters; + +// @public +export interface ServerMetricsGet200Response extends HttpResponse { + // (undocumented) + body: ServerMetricsModelOutput; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface ServerMetricsGetByTestOrTestRun { + get(options?: ServerMetricsGetByTestOrTestRunParameters): StreamableMethod; +} + +// @public +export interface ServerMetricsGetByTestOrTestRun200Response extends HttpResponse { + // (undocumented) + body: ServerMetricsModelOutput; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface ServerMetricsGetByTestOrTestRunDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface ServerMetricsGetByTestOrTestRunDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & ServerMetricsGetByTestOrTestRunDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type ServerMetricsGetByTestOrTestRunParameters = ServerMetricsGetByTestOrTestRunQueryParam & RequestParameters; + +// @public (undocumented) +export interface ServerMetricsGetByTestOrTestRunQueryParam { + // (undocumented) + queryParameters?: ServerMetricsGetByTestOrTestRunQueryParamProperties; +} + +// @public (undocumented) +export interface ServerMetricsGetByTestOrTestRunQueryParamProperties { + testRunId?: string; +} + +// @public (undocumented) +export interface ServerMetricsGetDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public (undocumented) +export interface ServerMetricsGetDefaultMetrics { + get(options?: ServerMetricsGetDefaultMetricsParameters): StreamableMethod; +} + +// @public +export interface ServerMetricsGetDefaultMetrics200Response extends HttpResponse { + // (undocumented) + body: DefaultServerMetricsConfigListModelOutput; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface ServerMetricsGetDefaultMetricsDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface ServerMetricsGetDefaultMetricsDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & ServerMetricsGetDefaultMetricsDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type ServerMetricsGetDefaultMetricsParameters = RequestParameters; + +// @public +export interface ServerMetricsGetDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & ServerMetricsGetDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type ServerMetricsGetParameters = RequestParameters; + +// @public (undocumented) +export interface ServerMetricsListSupportedResourceType { + get(options?: ServerMetricsListSupportedResourceTypeParameters): StreamableMethod; +} + +// @public +export interface ServerMetricsListSupportedResourceType200Response extends HttpResponse { + // (undocumented) + body: SupportedResourceTypeOutput; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface ServerMetricsListSupportedResourceTypeDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface ServerMetricsListSupportedResourceTypeDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & ServerMetricsListSupportedResourceTypeDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type ServerMetricsListSupportedResourceTypeParameters = RequestParameters; + +// @public +export interface ServerMetricsModel { + metrics?: Record; + name?: string; + testId?: string; + testRunId?: string; +} + +// @public +export interface ServerMetricsModelOutput { + metrics?: Record; + name?: string; + testId?: string; + testRunId?: string; +} + +// @public +export interface SupportedResourceTypeOutput { + // (undocumented) + value?: Array; +} + +// @public +export interface TestArtifacts20221101 { + inputArtifacts: InputTestArtifacts20221101; + outputArtifacts?: OutputTestArtifacts20221101; +} + +// @public +export interface TestArtifacts20221101Output { + inputArtifacts: InputTestArtifacts20221101Output; + outputArtifacts?: OutputTestArtifacts20221101Output; +} + +// @public (undocumented) +export interface TestCreateOrUpdate { + delete(options?: TestDeleteParameters): StreamableMethod; + get(options?: TestGetParameters): StreamableMethod; + patch(options: TestCreateOrUpdateParameters): StreamableMethod; +} + +// @public +export interface TestCreateOrUpdate200Response extends HttpResponse { + // (undocumented) + body: TestModel20221101Output; + // (undocumented) + status: "200"; +} + +// @public +export interface TestCreateOrUpdate201Response extends HttpResponse { + // (undocumented) + body: TestModel20221101Output; + // (undocumented) + status: "201"; +} + +// @public (undocumented) +export interface TestCreateOrUpdateBodyParam { + body: TestModel20221101; +} + +// @public (undocumented) +export interface TestCreateOrUpdateDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestCreateOrUpdateDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestCreateOrUpdateDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export interface TestCreateOrUpdateMediaTypesParam { + contentType?: "application/merge-patch+json"; +} + +// @public (undocumented) +export type TestCreateOrUpdateParameters = TestCreateOrUpdateMediaTypesParam & TestCreateOrUpdateBodyParam & RequestParameters; + +// @public +export interface TestDelete204Response extends HttpResponse { + // (undocumented) + body: Record; + // (undocumented) + status: "204"; +} + +// @public (undocumented) +export interface TestDeleteDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestDeleteDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestDeleteDefaultHeaders; + // (undocumented) + status: string; +} + +// @public +export interface TestDeleteFile204Response extends HttpResponse { + // (undocumented) + body: Record; + // (undocumented) + status: "204"; +} + +// @public (undocumented) +export interface TestDeleteFileDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestDeleteFileDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestDeleteFileDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type TestDeleteFileParameters = RequestParameters; + +// @public (undocumented) +export type TestDeleteParameters = RequestParameters; + +// @public +export interface TestGet200Response extends HttpResponse { + // (undocumented) + body: TestModel20221101Output; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface TestGetAllFiles { + get(options?: TestGetAllFilesParameters): StreamableMethod; +} + +// @public +export interface TestGetAllFiles200Response extends HttpResponse { + // (undocumented) + body: FileUrlListOutput; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface TestGetAllFilesDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestGetAllFilesDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestGetAllFilesDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type TestGetAllFilesParameters = TestGetAllFilesQueryParam & RequestParameters; + +// @public (undocumented) +export interface TestGetAllFilesQueryParam { + // (undocumented) + queryParameters?: TestGetAllFilesQueryParamProperties; +} + +// @public (undocumented) +export interface TestGetAllFilesQueryParamProperties { + continuationToken?: string; +} + +// @public (undocumented) +export interface TestGetDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestGetDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestGetDefaultHeaders; + // (undocumented) + status: string; +} + +// @public +export interface TestGetFile200Response extends HttpResponse { + // (undocumented) + body: FileUrl20221101Output; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface TestGetFileDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestGetFileDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestGetFileDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type TestGetFileParameters = RequestParameters; + +// @public (undocumented) +export type TestGetParameters = RequestParameters; + +// @public (undocumented) +export interface TestList { + get(options?: TestListParameters): StreamableMethod; +} + +// @public +export interface TestList200Response extends HttpResponse { + // (undocumented) + body: TestModel20221101ResourceListOutput; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface TestListDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestListDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestListDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type TestListParameters = TestListQueryParam & RequestParameters; + +// @public (undocumented) +export interface TestListQueryParam { + // (undocumented) + queryParameters?: TestListQueryParamProperties; +} + +// @public (undocumented) +export interface TestListQueryParamProperties { + continuationToken?: string; + lastUpdatedEndTime?: Date | string; + lastUpdatedStartTime?: Date | string; + maxPageSize?: number; + orderBy?: string; + search?: string; +} + +// @public +export interface TestModel20221101 { + // (undocumented) + certificate?: CertificateMetadata20221101; + createdBy?: string; + createdDateTime?: Date | string; + description?: string; + displayName?: string; + environmentVariables?: Record; + inputArtifacts?: InputTestArtifacts20221101; + keyvaultReferenceIdentityId?: string; + keyvaultReferenceIdentityType?: string; + lastModifiedBy?: string; + lastModifiedDateTime?: Date | string; + loadTestConfig?: LoadTestConfig20221101; + passFailCriteria?: PassFailCriteria20221101; + resourceId?: string; + secrets?: Record; + subnetId?: string; + testId?: string; +} + +// @public +export interface TestModel20221101Output { + // (undocumented) + certificate?: CertificateMetadata20221101Output; + createdBy?: string; + createdDateTime?: string; + description?: string; + displayName?: string; + environmentVariables?: Record; + inputArtifacts?: InputTestArtifacts20221101Output; + keyvaultReferenceIdentityId?: string; + keyvaultReferenceIdentityType?: string; + lastModifiedBy?: string; + lastModifiedDateTime?: string; + loadTestConfig?: LoadTestConfig20221101Output; + passFailCriteria?: PassFailCriteria20221101Output; + resourceId?: string; + secrets?: Record; + subnetId?: string; + testId?: string; +} + +// @public +export interface TestModel20221101ResourceListOutput { + nextLink?: string; + value: Array; +} + +// @public +export interface TestRunCreateOrUpdate200Response extends HttpResponse { + // (undocumented) + body: TestRunModel20221101Output; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface TestRunCreateOrUpdateBodyParam { + body: TestRunModel20221101; +} + +// @public (undocumented) +export interface TestRunCreateOrUpdateDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestRunCreateOrUpdateDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestRunCreateOrUpdateDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export interface TestRunCreateOrUpdateMediaTypesParam { + contentType?: "application/merge-patch+json"; +} + +// @public (undocumented) +export type TestRunCreateOrUpdateParameters = TestRunCreateOrUpdateQueryParam & TestRunCreateOrUpdateMediaTypesParam & TestRunCreateOrUpdateBodyParam & RequestParameters; + +// @public (undocumented) +export interface TestRunCreateOrUpdateQueryParam { + // (undocumented) + queryParameters?: TestRunCreateOrUpdateQueryParamProperties; +} + +// @public (undocumented) +export interface TestRunCreateOrUpdateQueryParamProperties { + oldTestRunId?: string; +} + +// @public (undocumented) +export interface TestRunDelete { + delete(options?: TestRunDeleteParameters): StreamableMethod; + get(options?: TestRunGetParameters): StreamableMethod; + patch(options: TestRunCreateOrUpdateParameters): StreamableMethod; +} + +// @public +export interface TestRunDelete204Response extends HttpResponse { + // (undocumented) + body: Record; + // (undocumented) + status: "204"; +} + +// @public (undocumented) +export interface TestRunDeleteDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestRunDeleteDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestRunDeleteDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type TestRunDeleteParameters = RequestParameters; + +// @public +export interface TestRunGet200Response extends HttpResponse { + // (undocumented) + body: TestRunModel20221101Output; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface TestRunGetDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestRunGetDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestRunGetDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export interface TestRunGetFile { + get(options?: TestRunGetFileParameters): StreamableMethod; +} + +// @public +export interface TestRunGetFile200Response extends HttpResponse { + // (undocumented) + body: FileUrl20221101Output; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface TestRunGetFileDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestRunGetFileDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestRunGetFileDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type TestRunGetFileParameters = RequestParameters; + +// @public (undocumented) +export type TestRunGetParameters = RequestParameters; + +// @public (undocumented) +export interface TestRunList { + get(options?: TestRunListParameters): StreamableMethod; +} + +// @public +export interface TestRunList200Response extends HttpResponse { + // (undocumented) + body: TestRunModel20221101ResourceListOutput; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface TestRunListDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestRunListDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestRunListDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type TestRunListParameters = TestRunListQueryParam & RequestParameters; + +// @public (undocumented) +export interface TestRunListQueryParam { + // (undocumented) + queryParameters?: TestRunListQueryParamProperties; +} + +// @public (undocumented) +export interface TestRunListQueryParamProperties { + continuationToken?: string; + executionFrom?: Date | string; + executionTo?: Date | string; + maxPageSize?: number; + orderBy?: string; + search?: string; + status?: string; +} + +// @public (undocumented) +export interface TestRunMetricDefinitions { + get(options: TestRunMetricDefinitionsParameters): StreamableMethod; +} + +// @public +export interface TestRunMetricDefinitions200Response extends HttpResponse { + // (undocumented) + body: MetricDefinitionCollectionOutput; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface TestRunMetricDefinitionsDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestRunMetricDefinitionsDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestRunMetricDefinitionsDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type TestRunMetricDefinitionsParameters = TestRunMetricDefinitionsQueryParam & RequestParameters; + +// @public (undocumented) +export interface TestRunMetricDefinitionsQueryParam { + // (undocumented) + queryParameters: TestRunMetricDefinitionsQueryParamProperties; +} + +// @public (undocumented) +export interface TestRunMetricDefinitionsQueryParamProperties { + metricnamespace: string; +} + +// @public (undocumented) +export interface TestRunMetricNamespaces { + get(options?: TestRunMetricNamespacesParameters): StreamableMethod; +} + +// @public +export interface TestRunMetricNamespaces200Response extends HttpResponse { + // (undocumented) + body: MetricNamespaceCollectionOutput; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface TestRunMetricNamespacesDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestRunMetricNamespacesDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestRunMetricNamespacesDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type TestRunMetricNamespacesParameters = RequestParameters; + +// @public (undocumented) +export interface TestRunMetrics { + post(options: TestRunMetricsParameters): StreamableMethod; +} + +// @public +export interface TestRunMetrics200Response extends HttpResponse { + // (undocumented) + body: ResponseOutput; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface TestRunMetricsBodyParam { + // (undocumented) + body?: MetricRequestPayload; +} + +// @public (undocumented) +export interface TestRunMetricsDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestRunMetricsDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestRunMetricsDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export interface TestRunMetricsMediaTypesParam { + contentType?: "application/json"; +} + +// @public (undocumented) +export type TestRunMetricsParameters = TestRunMetricsQueryParam & TestRunMetricsMediaTypesParam & TestRunMetricsBodyParam & RequestParameters; + +// @public (undocumented) +export interface TestRunMetricsQueryParam { + // (undocumented) + queryParameters: TestRunMetricsQueryParamProperties; +} + +// @public (undocumented) +export interface TestRunMetricsQueryParamProperties { + aggregation?: string; + interval?: "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; + metricname: string; + metricnamespace: string; + resultType: "Data" | "Metadata"; + timespan: string; +} + +// @public +export interface TestRunModel20221101 { + // (undocumented) + certificate?: CertificateMetadata20221101; + createdBy?: string; + createdDateTime?: Date | string; + description?: string; + displayName?: string; + duration?: number; + endDateTime?: Date | string; + environmentVariables?: Record; + errorDetails?: Array; + executedDateTime?: Date | string; + lastModifiedBy?: string; + lastModifiedDateTime?: Date | string; + loadTestConfig?: LoadTestConfig20221101; + passFailCriteria?: PassFailCriteria20221101; + portalUrl?: string; + resourceId?: string; + secrets?: Record; + startDateTime?: Date | string; + status?: "ACCEPTED" | "NOTSTARTED" | "PROVISIONING" | "PROVISIONED" | "CONFIGURING" | "CONFIGURED" | "EXECUTING" | "EXECUTED" | "DEPROVISIONING" | "DEPROVISIONED" | "DONE" | "CANCELLING" | "CANCELLED" | "FAILED" | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE"; + subnetId?: string; + testArtifacts?: TestArtifacts20221101; + testId?: string; + testResult?: "PASSED" | "NOT_APPLICABLE" | "FAILED"; + testRunId?: string; + testRunStatistics?: Record; + vusers?: number; +} + +// @public +export interface TestRunModel20221101Output { + // (undocumented) + certificate?: CertificateMetadata20221101Output; + createdBy?: string; + createdDateTime?: string; + description?: string; + displayName?: string; + duration?: number; + endDateTime?: string; + environmentVariables?: Record; + errorDetails?: Array; + executedDateTime?: string; + lastModifiedBy?: string; + lastModifiedDateTime?: string; + loadTestConfig?: LoadTestConfig20221101Output; + passFailCriteria?: PassFailCriteria20221101Output; + portalUrl?: string; + resourceId?: string; + secrets?: Record; + startDateTime?: string; + status?: "ACCEPTED" | "NOTSTARTED" | "PROVISIONING" | "PROVISIONED" | "CONFIGURING" | "CONFIGURED" | "EXECUTING" | "EXECUTED" | "DEPROVISIONING" | "DEPROVISIONED" | "DONE" | "CANCELLING" | "CANCELLED" | "FAILED" | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE"; + subnetId?: string; + testArtifacts?: TestArtifacts20221101Output; + testId?: string; + testResult?: "PASSED" | "NOT_APPLICABLE" | "FAILED"; + testRunId?: string; + testRunStatistics?: Record; + vusers?: number; +} + +// @public +export interface TestRunModel20221101ResourceListOutput { + nextLink?: string; + value: Array; +} + +// @public +export interface TestRunStatisticsModel { + errorCount?: number; + errorPct?: number; + maxResTime?: number; + meanResTime?: number; + medianResTime?: number; + minResTime?: number; + pct1ResTime?: number; + pct2ResTime?: number; + pct3ResTime?: number; + receivedKBytesPerSec?: number; + sampleCount?: number; + sentKBytesPerSec?: number; + throughput?: number; + transaction?: string; +} + +// @public +export interface TestRunStatisticsModelOutput { + errorCount?: number; + errorPct?: number; + maxResTime?: number; + meanResTime?: number; + medianResTime?: number; + minResTime?: number; + pct1ResTime?: number; + pct2ResTime?: number; + pct3ResTime?: number; + receivedKBytesPerSec?: number; + sampleCount?: number; + sentKBytesPerSec?: number; + throughput?: number; + transaction?: string; +} + +// @public (undocumented) +export interface TestRunStop { + post(options?: TestRunStopParameters): StreamableMethod; +} + +// @public +export interface TestRunStop200Response extends HttpResponse { + // (undocumented) + body: TestRunModel20221101Output; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface TestRunStopDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestRunStopDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestRunStopDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type TestRunStopParameters = RequestParameters; + +// @public (undocumented) +export interface TestUploadFile { + delete(options?: TestDeleteFileParameters): StreamableMethod; + get(options?: TestGetFileParameters): StreamableMethod; + put(options: TestUploadFileParameters): StreamableMethod; +} + +// @public +export interface TestUploadFile201Response extends HttpResponse { + // (undocumented) + body: FileUrl20221101Output; + // (undocumented) + status: "201"; +} + +// @public (undocumented) +export interface TestUploadFileBodyParam { + // (undocumented) + body: TestUploadFileFormBody; +} + +// @public (undocumented) +export interface TestUploadFileDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface TestUploadFileDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & TestUploadFileDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export interface TestUploadFileFormBody { + file: string | Uint8Array | ReadableStream | NodeJS.ReadableStream; +} + +// @public (undocumented) +export interface TestUploadFileMediaTypesParam { + contentType?: "multipart/form-data"; +} + +// @public (undocumented) +export type TestUploadFileParameters = TestUploadFileQueryParam & TestUploadFileMediaTypesParam & TestUploadFileBodyParam & RequestParameters; + +// @public (undocumented) +export interface TestUploadFileQueryParam { + // (undocumented) + queryParameters?: TestUploadFileQueryParamProperties; +} + +// @public (undocumented) +export interface TestUploadFileQueryParamProperties { + fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; +} + +// @public +export interface TimeSeriesElementOutput { + data?: Array; + metadatavalues?: Array; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/loadtestservice/loadtestservice-rest/src/clientDefinitions.ts b/sdk/loadtestservice/loadtestservice-rest/src/clientDefinitions.ts new file mode 100644 index 000000000000..4808afc08709 --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/src/clientDefinitions.ts @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + AppComponentCreateOrUpdateParameters, + AppComponentDeleteParameters, + AppComponentGetParameters, + AppComponentGetByTestOrTestRunParameters, + ServerMetricsCreateOrUpdateParameters, + ServerMetricsGetParameters, + ServerMetricsDeleteParameters, + ServerMetricsGetByTestOrTestRunParameters, + ServerMetricsGetDefaultMetricsParameters, + ServerMetricsListSupportedResourceTypeParameters, + TestCreateOrUpdateParameters, + TestDeleteParameters, + TestGetParameters, + TestListParameters, + TestUploadFileParameters, + TestGetFileParameters, + TestDeleteFileParameters, + TestGetAllFilesParameters, + TestRunDeleteParameters, + TestRunCreateOrUpdateParameters, + TestRunGetParameters, + TestRunGetFileParameters, + TestRunListParameters, + TestRunStopParameters, + TestRunMetricNamespacesParameters, + TestRunMetricDefinitionsParameters, + TestRunMetricsParameters +} from "./parameters"; +import { + AppComponentCreateOrUpdate200Response, + AppComponentCreateOrUpdate201Response, + AppComponentCreateOrUpdateDefaultResponse, + AppComponentDelete204Response, + AppComponentDeleteDefaultResponse, + AppComponentGet200Response, + AppComponentGetDefaultResponse, + AppComponentGetByTestOrTestRun200Response, + AppComponentGetByTestOrTestRunDefaultResponse, + ServerMetricsCreateOrUpdate200Response, + ServerMetricsCreateOrUpdate201Response, + ServerMetricsCreateOrUpdateDefaultResponse, + ServerMetricsGet200Response, + ServerMetricsGetDefaultResponse, + ServerMetricsDelete204Response, + ServerMetricsDeleteDefaultResponse, + ServerMetricsGetByTestOrTestRun200Response, + ServerMetricsGetByTestOrTestRunDefaultResponse, + ServerMetricsGetDefaultMetrics200Response, + ServerMetricsGetDefaultMetricsDefaultResponse, + ServerMetricsListSupportedResourceType200Response, + ServerMetricsListSupportedResourceTypeDefaultResponse, + TestCreateOrUpdate200Response, + TestCreateOrUpdate201Response, + TestCreateOrUpdateDefaultResponse, + TestDelete204Response, + TestDeleteDefaultResponse, + TestGet200Response, + TestGetDefaultResponse, + TestList200Response, + TestListDefaultResponse, + TestUploadFile201Response, + TestUploadFileDefaultResponse, + TestGetFile200Response, + TestGetFileDefaultResponse, + TestDeleteFile204Response, + TestDeleteFileDefaultResponse, + TestGetAllFiles200Response, + TestGetAllFilesDefaultResponse, + TestRunDelete204Response, + TestRunDeleteDefaultResponse, + TestRunCreateOrUpdate200Response, + TestRunCreateOrUpdateDefaultResponse, + TestRunGet200Response, + TestRunGetDefaultResponse, + TestRunGetFile200Response, + TestRunGetFileDefaultResponse, + TestRunList200Response, + TestRunListDefaultResponse, + TestRunStop200Response, + TestRunStopDefaultResponse, + TestRunMetricNamespaces200Response, + TestRunMetricNamespacesDefaultResponse, + TestRunMetricDefinitions200Response, + TestRunMetricDefinitionsDefaultResponse, + TestRunMetrics200Response, + TestRunMetricsDefaultResponse +} from "./responses"; +import { Client, StreamableMethod } from "@azure-rest/core-client"; + +export interface AppComponentCreateOrUpdate { + /** Associate an app component (Azure resource) to a test or test run. */ + patch( + options: AppComponentCreateOrUpdateParameters + ): StreamableMethod< + | AppComponentCreateOrUpdate200Response + | AppComponentCreateOrUpdate201Response + | AppComponentCreateOrUpdateDefaultResponse + >; + /** Delete an app component. */ + delete( + options?: AppComponentDeleteParameters + ): StreamableMethod< + AppComponentDelete204Response | AppComponentDeleteDefaultResponse + >; + /** Get app Component details by unique name. */ + get( + options?: AppComponentGetParameters + ): StreamableMethod< + AppComponentGet200Response | AppComponentGetDefaultResponse + >; +} + +export interface AppComponentGetByTestOrTestRun { + /** Get an app component for a test or a test run by its name. */ + get( + options?: AppComponentGetByTestOrTestRunParameters + ): StreamableMethod< + | AppComponentGetByTestOrTestRun200Response + | AppComponentGetByTestOrTestRunDefaultResponse + >; +} + +export interface ServerMetricsCreateOrUpdate { + /** Configure server metrics for a test or test run */ + patch( + options: ServerMetricsCreateOrUpdateParameters + ): StreamableMethod< + | ServerMetricsCreateOrUpdate200Response + | ServerMetricsCreateOrUpdate201Response + | ServerMetricsCreateOrUpdateDefaultResponse + >; + /** Get server metrics configuration by its name. */ + get( + options?: ServerMetricsGetParameters + ): StreamableMethod< + ServerMetricsGet200Response | ServerMetricsGetDefaultResponse + >; + /** Delete server metrics configuration by its name */ + delete( + options?: ServerMetricsDeleteParameters + ): StreamableMethod< + ServerMetricsDelete204Response | ServerMetricsDeleteDefaultResponse + >; +} + +export interface ServerMetricsGetByTestOrTestRun { + /** Get server metrics configuration for a test or test run by its name. */ + get( + options?: ServerMetricsGetByTestOrTestRunParameters + ): StreamableMethod< + | ServerMetricsGetByTestOrTestRun200Response + | ServerMetricsGetByTestOrTestRunDefaultResponse + >; +} + +export interface ServerMetricsGetDefaultMetrics { + /** Get all default server metrics configuration for supported resource types. */ + get( + options?: ServerMetricsGetDefaultMetricsParameters + ): StreamableMethod< + | ServerMetricsGetDefaultMetrics200Response + | ServerMetricsGetDefaultMetricsDefaultResponse + >; +} + +export interface ServerMetricsListSupportedResourceType { + /** Get all supported resource types for adding an app component(Azure resource types). */ + get( + options?: ServerMetricsListSupportedResourceTypeParameters + ): StreamableMethod< + | ServerMetricsListSupportedResourceType200Response + | ServerMetricsListSupportedResourceTypeDefaultResponse + >; +} + +export interface TestCreateOrUpdate { + /** Create a new test or update an existing test. */ + patch( + options: TestCreateOrUpdateParameters + ): StreamableMethod< + | TestCreateOrUpdate200Response + | TestCreateOrUpdate201Response + | TestCreateOrUpdateDefaultResponse + >; + /** Delete a test by its name. */ + delete( + options?: TestDeleteParameters + ): StreamableMethod; + /** Get load test details by test name */ + get( + options?: TestGetParameters + ): StreamableMethod; +} + +export interface TestList { + /** Get all load tests by the fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. */ + get( + options?: TestListParameters + ): StreamableMethod; +} + +export interface TestUploadFile { + /** Upload input file for a given test name. File size can't be more than 50 MB. Existing file with same name for the given test will be overwritten. File should be provided in the request body as multipart/form-data. */ + put( + options: TestUploadFileParameters + ): StreamableMethod< + TestUploadFile201Response | TestUploadFileDefaultResponse + >; + /** Get test file by the file name. */ + get( + options?: TestGetFileParameters + ): StreamableMethod; + /** Delete file by the file name for a test */ + delete( + options?: TestDeleteFileParameters + ): StreamableMethod< + TestDeleteFile204Response | TestDeleteFileDefaultResponse + >; +} + +export interface TestGetAllFiles { + /** Get all test files. */ + get( + options?: TestGetAllFilesParameters + ): StreamableMethod< + TestGetAllFiles200Response | TestGetAllFilesDefaultResponse + >; +} + +export interface TestRunDelete { + /** Delete a test run by its name. */ + delete( + options?: TestRunDeleteParameters + ): StreamableMethod; + /** Create and start a new test run with the given name. */ + patch( + options: TestRunCreateOrUpdateParameters + ): StreamableMethod< + TestRunCreateOrUpdate200Response | TestRunCreateOrUpdateDefaultResponse + >; + /** Get test run details by name. */ + get( + options?: TestRunGetParameters + ): StreamableMethod; +} + +export interface TestRunGetFile { + /** Get test run file by file name. */ + get( + options?: TestRunGetFileParameters + ): StreamableMethod< + TestRunGetFile200Response | TestRunGetFileDefaultResponse + >; +} + +export interface TestRunList { + /** Get all test runs with given filters */ + get( + options?: TestRunListParameters + ): StreamableMethod; +} + +export interface TestRunStop { + /** Stop test run by name. */ + post( + options?: TestRunStopParameters + ): StreamableMethod; +} + +export interface TestRunMetricNamespaces { + /** Lists the metric namespaces for a load test run. */ + get( + options?: TestRunMetricNamespacesParameters + ): StreamableMethod< + TestRunMetricNamespaces200Response | TestRunMetricNamespacesDefaultResponse + >; +} + +export interface TestRunMetricDefinitions { + /** Lists the metric definitions for a load test run. */ + get( + options: TestRunMetricDefinitionsParameters + ): StreamableMethod< + | TestRunMetricDefinitions200Response + | TestRunMetricDefinitionsDefaultResponse + >; +} + +export interface TestRunMetrics { + /** Lists the metric values for a load test run. */ + post( + options: TestRunMetricsParameters + ): StreamableMethod< + TestRunMetrics200Response | TestRunMetricsDefaultResponse + >; +} + +export interface Routes { + /** Resource for '/app-components/\{name\}' has methods for the following verbs: patch, delete, get */ + (path: "/app-components/{name}", name: string): AppComponentCreateOrUpdate; + /** Resource for '/app-components' has methods for the following verbs: get */ + (path: "/app-components"): AppComponentGetByTestOrTestRun; + /** Resource for '/serverMetricsConfig/\{name\}' has methods for the following verbs: patch, get, delete */ + ( + path: "/serverMetricsConfig/{name}", + name: string + ): ServerMetricsCreateOrUpdate; + /** Resource for '/serverMetricsConfig' has methods for the following verbs: get */ + (path: "/serverMetricsConfig"): ServerMetricsGetByTestOrTestRun; + /** Resource for '/serverMetricsConfig/default' has methods for the following verbs: get */ + (path: "/serverMetricsConfig/default"): ServerMetricsGetDefaultMetrics; + /** Resource for '/serverMetricsConfig/supportedResourceTypes' has methods for the following verbs: get */ + ( + path: "/serverMetricsConfig/supportedResourceTypes" + ): ServerMetricsListSupportedResourceType; + /** Resource for '/loadtests/\{testId\}' has methods for the following verbs: patch, delete, get */ + (path: "/loadtests/{testId}", testId: string): TestCreateOrUpdate; + /** Resource for '/loadtests/sortAndFilter' has methods for the following verbs: get */ + (path: "/loadtests/sortAndFilter"): TestList; + /** Resource for '/loadtests/\{testId\}/files/\{fileId\}' has methods for the following verbs: put, get, delete */ + ( + path: "/loadtests/{testId}/files/{fileId}", + testId: string, + fileId: string + ): TestUploadFile; + /** Resource for '/loadtests/\{testId\}/files' has methods for the following verbs: get */ + (path: "/loadtests/{testId}/files", testId: string): TestGetAllFiles; + /** Resource for '/testruns/\{testRunId\}' has methods for the following verbs: delete, patch, get */ + (path: "/testruns/{testRunId}", testRunId: string): TestRunDelete; + /** Resource for '/testruns/\{testRunId\}/files/\{fileId\}' has methods for the following verbs: get */ + ( + path: "/testruns/{testRunId}/files/{fileId}", + testRunId: string, + fileId: string + ): TestRunGetFile; + /** Resource for '/testruns/sortAndFilter' has methods for the following verbs: get */ + (path: "/testruns/sortAndFilter"): TestRunList; + /** Resource for '/testruns/\{testRunId\}:stop' has methods for the following verbs: post */ + (path: "/testruns/{testRunId}:stop", testRunId: string): TestRunStop; + /** Resource for '/testRuns/\{testRunId\}/metricNamespaces' has methods for the following verbs: get */ + ( + path: "/testRuns/{testRunId}/metricNamespaces", + testRunId: string + ): TestRunMetricNamespaces; + /** Resource for '/testRuns/\{testRunId\}/metricDefinitions' has methods for the following verbs: get */ + ( + path: "/testRuns/{testRunId}/metricDefinitions", + testRunId: string + ): TestRunMetricDefinitions; + /** Resource for '/testRuns/\{testRunId\}/metrics' has methods for the following verbs: post */ + (path: "/testRuns/{testRunId}/metrics", testRunId: string): TestRunMetrics; +} + +export type LoadTestingClient = Client & { + path: Routes; +}; diff --git a/sdk/loadtestservice/loadtestservice-rest/src/index.ts b/sdk/loadtestservice/loadtestservice-rest/src/index.ts new file mode 100644 index 000000000000..ffbeebe630e1 --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/src/index.ts @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import LoadTestingClient from "./loadTestingClient"; + +export * from "./loadTestingClient"; +export * from "./parameters"; +export * from "./responses"; +export * from "./clientDefinitions"; +export * from "./isUnexpected"; +export * from "./models"; +export * from "./outputModels"; +export * from "./paginateHelper"; + +export default LoadTestingClient; diff --git a/sdk/loadtestservice/loadtestservice-rest/src/isUnexpected.ts b/sdk/loadtestservice/loadtestservice-rest/src/isUnexpected.ts new file mode 100644 index 000000000000..cab5922280a8 --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/src/isUnexpected.ts @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + AppComponentCreateOrUpdate200Response, + AppComponentCreateOrUpdate201Response, + AppComponentCreateOrUpdateDefaultResponse, + AppComponentDelete204Response, + AppComponentDeleteDefaultResponse, + AppComponentGet200Response, + AppComponentGetDefaultResponse, + AppComponentGetByTestOrTestRun200Response, + AppComponentGetByTestOrTestRunDefaultResponse, + ServerMetricsCreateOrUpdate200Response, + ServerMetricsCreateOrUpdate201Response, + ServerMetricsCreateOrUpdateDefaultResponse, + ServerMetricsGet200Response, + ServerMetricsGetDefaultResponse, + ServerMetricsDelete204Response, + ServerMetricsDeleteDefaultResponse, + ServerMetricsGetByTestOrTestRun200Response, + ServerMetricsGetByTestOrTestRunDefaultResponse, + ServerMetricsGetDefaultMetrics200Response, + ServerMetricsGetDefaultMetricsDefaultResponse, + ServerMetricsListSupportedResourceType200Response, + ServerMetricsListSupportedResourceTypeDefaultResponse, + TestCreateOrUpdate200Response, + TestCreateOrUpdate201Response, + TestCreateOrUpdateDefaultResponse, + TestDelete204Response, + TestDeleteDefaultResponse, + TestGet200Response, + TestGetDefaultResponse, + TestList200Response, + TestListDefaultResponse, + TestUploadFile201Response, + TestUploadFileDefaultResponse, + TestGetFile200Response, + TestGetFileDefaultResponse, + TestDeleteFile204Response, + TestDeleteFileDefaultResponse, + TestGetAllFiles200Response, + TestGetAllFilesDefaultResponse, + TestRunDelete204Response, + TestRunDeleteDefaultResponse, + TestRunCreateOrUpdate200Response, + TestRunCreateOrUpdateDefaultResponse, + TestRunGet200Response, + TestRunGetDefaultResponse, + TestRunGetFile200Response, + TestRunGetFileDefaultResponse, + TestRunList200Response, + TestRunListDefaultResponse, + TestRunStop200Response, + TestRunStopDefaultResponse, + TestRunMetricNamespaces200Response, + TestRunMetricNamespacesDefaultResponse, + TestRunMetricDefinitions200Response, + TestRunMetricDefinitionsDefaultResponse, + TestRunMetrics200Response, + TestRunMetricsDefaultResponse +} from "./responses"; + +const responseMap: Record = { + "PATCH /app-components/{name}": ["200", "201"], + "DELETE /app-components/{name}": ["204"], + "GET /app-components/{name}": ["200"], + "GET /app-components": ["200"], + "PATCH /serverMetricsConfig/{name}": ["200", "201"], + "GET /serverMetricsConfig/{name}": ["200"], + "DELETE /serverMetricsConfig/{name}": ["204"], + "GET /serverMetricsConfig": ["200"], + "GET /serverMetricsConfig/default": ["200"], + "GET /serverMetricsConfig/supportedResourceTypes": ["200"], + "PATCH /loadtests/{testId}": ["200", "201"], + "DELETE /loadtests/{testId}": ["204"], + "GET /loadtests/{testId}": ["200"], + "GET /loadtests/sortAndFilter": ["200"], + "PUT /loadtests/{testId}/files/{fileId}": ["201"], + "GET /loadtests/{testId}/files/{fileId}": ["200"], + "DELETE /loadtests/{testId}/files/{fileId}": ["204"], + "GET /loadtests/{testId}/files": ["200"], + "DELETE /testruns/{testRunId}": ["204"], + "PATCH /testruns/{testRunId}": ["200"], + "GET /testruns/{testRunId}": ["200"], + "GET /testruns/{testRunId}/files/{fileId}": ["200"], + "GET /testruns/sortAndFilter": ["200"], + "POST /testruns/{testRunId}:stop": ["200"], + "GET /testRuns/{testRunId}/metricNamespaces": ["200"], + "GET /testRuns/{testRunId}/metricDefinitions": ["200"], + "POST /testRuns/{testRunId}/metrics": ["200"] +}; + +export function isUnexpected( + response: + | AppComponentCreateOrUpdate200Response + | AppComponentCreateOrUpdate201Response + | AppComponentCreateOrUpdateDefaultResponse +): response is AppComponentCreateOrUpdateDefaultResponse; +export function isUnexpected( + response: AppComponentDelete204Response | AppComponentDeleteDefaultResponse +): response is AppComponentDeleteDefaultResponse; +export function isUnexpected( + response: AppComponentGet200Response | AppComponentGetDefaultResponse +): response is AppComponentGetDefaultResponse; +export function isUnexpected( + response: + | AppComponentGetByTestOrTestRun200Response + | AppComponentGetByTestOrTestRunDefaultResponse +): response is AppComponentGetByTestOrTestRunDefaultResponse; +export function isUnexpected( + response: + | ServerMetricsCreateOrUpdate200Response + | ServerMetricsCreateOrUpdate201Response + | ServerMetricsCreateOrUpdateDefaultResponse +): response is ServerMetricsCreateOrUpdateDefaultResponse; +export function isUnexpected( + response: ServerMetricsGet200Response | ServerMetricsGetDefaultResponse +): response is ServerMetricsGetDefaultResponse; +export function isUnexpected( + response: ServerMetricsDelete204Response | ServerMetricsDeleteDefaultResponse +): response is ServerMetricsDeleteDefaultResponse; +export function isUnexpected( + response: + | ServerMetricsGetByTestOrTestRun200Response + | ServerMetricsGetByTestOrTestRunDefaultResponse +): response is ServerMetricsGetByTestOrTestRunDefaultResponse; +export function isUnexpected( + response: + | ServerMetricsGetDefaultMetrics200Response + | ServerMetricsGetDefaultMetricsDefaultResponse +): response is ServerMetricsGetDefaultMetricsDefaultResponse; +export function isUnexpected( + response: + | ServerMetricsListSupportedResourceType200Response + | ServerMetricsListSupportedResourceTypeDefaultResponse +): response is ServerMetricsListSupportedResourceTypeDefaultResponse; +export function isUnexpected( + response: + | TestCreateOrUpdate200Response + | TestCreateOrUpdate201Response + | TestCreateOrUpdateDefaultResponse +): response is TestCreateOrUpdateDefaultResponse; +export function isUnexpected( + response: TestDelete204Response | TestDeleteDefaultResponse +): response is TestDeleteDefaultResponse; +export function isUnexpected( + response: TestGet200Response | TestGetDefaultResponse +): response is TestGetDefaultResponse; +export function isUnexpected( + response: TestList200Response | TestListDefaultResponse +): response is TestListDefaultResponse; +export function isUnexpected( + response: TestUploadFile201Response | TestUploadFileDefaultResponse +): response is TestUploadFileDefaultResponse; +export function isUnexpected( + response: TestGetFile200Response | TestGetFileDefaultResponse +): response is TestGetFileDefaultResponse; +export function isUnexpected( + response: TestDeleteFile204Response | TestDeleteFileDefaultResponse +): response is TestDeleteFileDefaultResponse; +export function isUnexpected( + response: TestGetAllFiles200Response | TestGetAllFilesDefaultResponse +): response is TestGetAllFilesDefaultResponse; +export function isUnexpected( + response: TestRunDelete204Response | TestRunDeleteDefaultResponse +): response is TestRunDeleteDefaultResponse; +export function isUnexpected( + response: + | TestRunCreateOrUpdate200Response + | TestRunCreateOrUpdateDefaultResponse +): response is TestRunCreateOrUpdateDefaultResponse; +export function isUnexpected( + response: TestRunGet200Response | TestRunGetDefaultResponse +): response is TestRunGetDefaultResponse; +export function isUnexpected( + response: TestRunGetFile200Response | TestRunGetFileDefaultResponse +): response is TestRunGetFileDefaultResponse; +export function isUnexpected( + response: TestRunList200Response | TestRunListDefaultResponse +): response is TestRunListDefaultResponse; +export function isUnexpected( + response: TestRunStop200Response | TestRunStopDefaultResponse +): response is TestRunStopDefaultResponse; +export function isUnexpected( + response: + | TestRunMetricNamespaces200Response + | TestRunMetricNamespacesDefaultResponse +): response is TestRunMetricNamespacesDefaultResponse; +export function isUnexpected( + response: + | TestRunMetricDefinitions200Response + | TestRunMetricDefinitionsDefaultResponse +): response is TestRunMetricDefinitionsDefaultResponse; +export function isUnexpected( + response: TestRunMetrics200Response | TestRunMetricsDefaultResponse +): response is TestRunMetricsDefaultResponse; +export function isUnexpected( + response: + | AppComponentCreateOrUpdate200Response + | AppComponentCreateOrUpdate201Response + | AppComponentCreateOrUpdateDefaultResponse + | AppComponentDelete204Response + | AppComponentDeleteDefaultResponse + | AppComponentGet200Response + | AppComponentGetDefaultResponse + | AppComponentGetByTestOrTestRun200Response + | AppComponentGetByTestOrTestRunDefaultResponse + | ServerMetricsCreateOrUpdate200Response + | ServerMetricsCreateOrUpdate201Response + | ServerMetricsCreateOrUpdateDefaultResponse + | ServerMetricsGet200Response + | ServerMetricsGetDefaultResponse + | ServerMetricsDelete204Response + | ServerMetricsDeleteDefaultResponse + | ServerMetricsGetByTestOrTestRun200Response + | ServerMetricsGetByTestOrTestRunDefaultResponse + | ServerMetricsGetDefaultMetrics200Response + | ServerMetricsGetDefaultMetricsDefaultResponse + | ServerMetricsListSupportedResourceType200Response + | ServerMetricsListSupportedResourceTypeDefaultResponse + | TestCreateOrUpdate200Response + | TestCreateOrUpdate201Response + | TestCreateOrUpdateDefaultResponse + | TestDelete204Response + | TestDeleteDefaultResponse + | TestGet200Response + | TestGetDefaultResponse + | TestList200Response + | TestListDefaultResponse + | TestUploadFile201Response + | TestUploadFileDefaultResponse + | TestGetFile200Response + | TestGetFileDefaultResponse + | TestDeleteFile204Response + | TestDeleteFileDefaultResponse + | TestGetAllFiles200Response + | TestGetAllFilesDefaultResponse + | TestRunDelete204Response + | TestRunDeleteDefaultResponse + | TestRunCreateOrUpdate200Response + | TestRunCreateOrUpdateDefaultResponse + | TestRunGet200Response + | TestRunGetDefaultResponse + | TestRunGetFile200Response + | TestRunGetFileDefaultResponse + | TestRunList200Response + | TestRunListDefaultResponse + | TestRunStop200Response + | TestRunStopDefaultResponse + | TestRunMetricNamespaces200Response + | TestRunMetricNamespacesDefaultResponse + | TestRunMetricDefinitions200Response + | TestRunMetricDefinitionsDefaultResponse + | TestRunMetrics200Response + | TestRunMetricsDefaultResponse +): response is + | AppComponentCreateOrUpdateDefaultResponse + | AppComponentDeleteDefaultResponse + | AppComponentGetDefaultResponse + | AppComponentGetByTestOrTestRunDefaultResponse + | ServerMetricsCreateOrUpdateDefaultResponse + | ServerMetricsGetDefaultResponse + | ServerMetricsDeleteDefaultResponse + | ServerMetricsGetByTestOrTestRunDefaultResponse + | ServerMetricsGetDefaultMetricsDefaultResponse + | ServerMetricsListSupportedResourceTypeDefaultResponse + | TestCreateOrUpdateDefaultResponse + | TestDeleteDefaultResponse + | TestGetDefaultResponse + | TestListDefaultResponse + | TestUploadFileDefaultResponse + | TestGetFileDefaultResponse + | TestDeleteFileDefaultResponse + | TestGetAllFilesDefaultResponse + | TestRunDeleteDefaultResponse + | TestRunCreateOrUpdateDefaultResponse + | TestRunGetDefaultResponse + | TestRunGetFileDefaultResponse + | TestRunListDefaultResponse + | TestRunStopDefaultResponse + | TestRunMetricNamespacesDefaultResponse + | TestRunMetricDefinitionsDefaultResponse + | TestRunMetricsDefaultResponse { + const lroOriginal = response.headers["x-ms-original-url"]; + const url = new URL(lroOriginal ?? response.request.url); + const method = response.request.method; + let pathDetails = responseMap[`${method} ${url.pathname}`]; + if (!pathDetails) { + pathDetails = geParametrizedPathSuccess(method, url.pathname); + } + return !pathDetails.includes(response.status); +} + +function geParametrizedPathSuccess(method: string, path: string): string[] { + const pathParts = path.split("/"); + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(responseMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // If the candidate and actual paths don't match in size + // we move on to the next candidate path + if ( + candidateParts.length === pathParts.length && + hasParametrizedPath(key) + ) { + // track if we have found a match to return the values found. + let found = true; + for (let i = 0; i < candidateParts.length; i++) { + if ( + candidateParts[i]?.startsWith("{") && + candidateParts[i]?.endsWith("}") + ) { + // If the current part of the candidate is a "template" part + // it is a match with the actual path part on hand + // skip as the parameterized part can match anything + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[i]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // if all parts matched we return the success values form + // the path mapping. + if (found) { + return value; + } + } + } + + // No match was found, return an empty array. + return []; +} + +function hasParametrizedPath(path: string): boolean { + return path.includes("/{"); +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/sdk/loadtestservice/loadtestservice-rest/src/loadTestingClient.ts b/sdk/loadtestservice/loadtestservice-rest/src/loadTestingClient.ts new file mode 100644 index 000000000000..9358b3a1dfe7 --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/src/loadTestingClient.ts @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { TokenCredential } from "@azure/core-auth"; +import { LoadTestingClient } from "./clientDefinitions"; + +/** + * Initialize a new instance of the class LoadTestingClient class. + * @param Endpoint type: string URL to perform data plane API operations on the resource. + * @param credentials type: TokenCredential + */ +export default function createClient( + Endpoint: string, + credentials: TokenCredential, + options: ClientOptions = {} +): LoadTestingClient { + const baseUrl = options.baseUrl ?? `https://${Endpoint}`; + options.apiVersion = options.apiVersion ?? "2022-11-01"; + options = { + ...options, + credentials: { + scopes: ["https://loadtest.azure-dev.com/.default"] + } + }; + + const userAgentInfo = `azsdk-js-loadtestservice-rest/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix + } + }; + + const client = getClient(baseUrl, credentials, options) as LoadTestingClient; + + return client; +} diff --git a/sdk/loadtestservice/loadtestservice-rest/src/models.ts b/sdk/loadtestservice/loadtestservice-rest/src/models.ts new file mode 100644 index 000000000000..c327fbc2b316 --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/src/models.ts @@ -0,0 +1,362 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** App Components model */ +export interface AppComponentsMap { + /** Azure Load Testing resource Id */ + resourceId?: string; + /** [Required, if testRunId is not given] Load test unique name */ + testId?: string; + /** [Required if testId is not given] Load test run unique name */ + testRunId?: string; + /** AppComponent name */ + name?: string; + /** AppComponents collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object } */ + value: Record; +} + +/** An Azure resource object (Refer azure generic resource model : https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id#genericresource) */ +export interface AppComponent { + /** fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName} */ + resourceId: string; + /** Azure resource name, required while creating the app component. */ + resourceName: string; + /** Azure resource type, required while creating the app component. */ + resourceType?: string; + /** Azure resource display name */ + displayName?: string; + /** Resource group name of the Azure resource */ + resourceGroup?: string; + /** Subscription Id of the Azure resource */ + subscriptionId?: string; + /** Kind of Azure resource type */ + kind?: string; +} + +/** Server metrics configuration model */ +export interface ServerMetricsModel { + /** Server metrics configuration model. */ + name?: string; + /** [Required, if test run Id is not given] Load test unique name. */ + testId?: string; + /** [Required, if test Id is not given] Load test run unique name. */ + testRunId?: string; + /** Metrics collection {metric id : metrics object} (Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition for metric id). */ + metrics?: Record; +} + +/** Associated metric definition for particular metrics of the azure resource ( Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition). */ +export interface ResourceMetricModel { + /** Unique name for metric. */ + id?: string; + /** Azure resource id. */ + resourceId: string; + /** Metric name space. */ + metricnamespace: string; + /** Metric description. */ + displayDescription?: string; + /** The localizable string class. */ + name: LocalizableString; + /** Metric aggregation. */ + aggregation: string; + /** Metric unit. */ + unit?: string; + /** Azure resource type. */ + resourceType: string; +} + +/** The localizable string class. */ +export interface LocalizableString { + /** The locale specific value. */ + localizedValue?: string; + /** The invariant value. */ + value?: string; +} + +/** Load test model */ +export interface TestModel20221101 { + /** Pass fail criteria for a test. */ + passFailCriteria?: PassFailCriteria20221101; + /** Secrets can be stored in an Azure Key Vault or any other secret store. If the secret is stored in an Azure Key Vault, the value should be the secret identifier and the type should be AKV_SECRET_URI. If the secret is stored elsewhere, the secret value should be provided directly and the type should be SECRET_VALUE. */ + secrets?: Record; + certificate?: CertificateMetadata20221101; + /** Environment variables which are defined as a set of pairs. */ + environmentVariables?: Record; + /** The load test configuration. */ + loadTestConfig?: LoadTestConfig20221101; + /** The input artifacts for the test. */ + inputArtifacts?: InputTestArtifacts20221101; + /** Unique test name as identifier. */ + testId?: string; + /** The test description. */ + description?: string; + /** Display name of a test. */ + displayName?: string; + /** Subnet ID on which the load test instances should run. */ + subnetId?: string; + /** Type of the managed identity referencing the Key vault. */ + keyvaultReferenceIdentityType?: string; + /** Resource Id of the managed identity referencing the Key vault. */ + keyvaultReferenceIdentityId?: string; + /** Fully qualified resource Id e.g /subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. */ + resourceId?: string; + /** The created DateTime(ISO 8601 literal format) of the test model. */ + createdDateTime?: Date | string; + /** The user that created the test model. */ + createdBy?: string; + /** The last Modified DateTime(ISO 8601 literal format) of the test model. */ + lastModifiedDateTime?: Date | string; + /** The user that last modified the test model. */ + lastModifiedBy?: string; +} + +/** Pass fail criteria for a test. */ +export interface PassFailCriteria20221101 { + /** Map of id and pass fail metrics { id : pass fail metrics }. */ + passFailMetrics?: Record; +} + +export interface PassFailMetric20221101 { + /** The client metric on which the criteria should be applied. */ + clientmetric?: + | "response_time_ms" + | "latency" + | "error" + | "requests" + | "requests_per_sec"; + /** The aggregation function to be applied on the client metric. Allowed functions - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, ‘count’ - for requests */ + aggregate?: + | "count" + | "percentage" + | "avg" + | "p50" + | "p90" + | "p95" + | "p99" + | "min" + | "max"; + /** The comparison operator. Supported types ‘>’, ‘<’ */ + condition?: string; + /** Request name for which the Pass fail criteria has to be applied */ + requestName?: string; + /** The value to compare with the client metric. Allowed values - ‘error : [0.0 , 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. */ + value?: number; + /** Action taken after the threshold is met. Default is ‘continue’. */ + action?: "stop" | "continue"; + /** The actual value of the client metric for the test run. */ + actualValue?: number; + /** Outcome of the test run. */ + result?: "passed" | "undetermined" | "failed"; +} + +export interface SecretMetadata20221101 { + /** The value of the secret for the respective type */ + value?: string; + /** Type of secret */ + type?: "AKV_SECRET_URI" | "SECRET_VALUE"; +} + +export interface CertificateMetadata20221101 { + /** The value of the certificate for respective type */ + value?: string; + /** Type of certificate */ + type?: "AKV_CERT_URI"; + /** Name of the certificate. */ + name?: string; +} + +/** The load test configuration. */ +export interface LoadTestConfig20221101 { + /** The number of engine instances to execute load test. Supported values are in range of 1-45. Required for creating a new test. */ + engineInstances?: number; + /** Whether all the input CSV files should be split evenly across all engines. */ + splitAllCSVs?: boolean; + /** If true, optionalLoadTestConfig is required and JMX script for the load test is not required to upload. */ + quickStartTest?: boolean; + /** Quick start load test config */ + optionalLoadTestConfig?: OptionalLoadTestConfig; +} + +/** Quick start load test config */ +export interface OptionalLoadTestConfig { + /** Endpoint url */ + endpointUrl?: string; + /** No of virtual users */ + vusers?: number; + /** ramp up time */ + rampUpTime?: number; + /** duration */ + duration?: number; +} + +/** The input artifacts for the test. */ +export interface InputTestArtifacts20221101 { + /** FileUrl Model. */ + configUrl?: FileUrl20221101; + /** FileUrl Model. */ + testScriptUrl?: FileUrl20221101; + /** FileUrl Model. */ + userPropUrl?: FileUrl20221101; + /** FileUrl Model. */ + inputArtifactsZipFileurl?: FileUrl20221101; + /** Additional supported files for the test run */ + additionalUrls?: Array; +} + +/** FileUrl Model. */ +export interface FileUrl20221101 { + /** File URL. */ + url?: string; + /** File unique identifier. */ + fileId?: string; + /** Name of the file. */ + filename?: string; + /** File type */ + fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; + /** Expiry time of the file */ + expireTime?: Date | string; + /** Validation status of the file */ + validationStatus?: + | "NOT_VALIDATED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE" + | "VALIDATION_INITIATED"; +} + +/** Load test run model */ +export interface TestRunModel20221101 { + /** Pass fail criteria for a test. */ + passFailCriteria?: PassFailCriteria20221101; + /** Secrets can be stored in an Azure Key Vault or any other secret store. If the secret is stored in an Azure Key Vault, the value should be the secret identifier and the type should be AKV_SECRET_URI. If the secret is stored elsewhere, the secret value should be provided directly and the type should be SECRET_VALUE. */ + secrets?: Record; + certificate?: CertificateMetadata20221101; + /** Environment variables which are defined as a set of pairs. */ + environmentVariables?: Record; + /** Error details if there is any failure in load test run */ + errorDetails?: Array; + /** Test run statistics. */ + testRunStatistics?: Record; + /** The load test configuration. */ + loadTestConfig?: LoadTestConfig20221101; + /** test artifact 20221101 */ + testArtifacts?: TestArtifacts20221101; + /** Test result for pass/Fail criteria used during the test run. */ + testResult?: "PASSED" | "NOT_APPLICABLE" | "FAILED"; + /** Unique test run name as identifier */ + testRunId?: string; + /** Display name of a testRun. */ + displayName?: string; + /** Associated test Id. */ + testId?: string; + /** The test run description. */ + description?: string; + /** The test run status. */ + status?: + | "ACCEPTED" + | "NOTSTARTED" + | "PROVISIONING" + | "PROVISIONED" + | "CONFIGURING" + | "CONFIGURED" + | "EXECUTING" + | "EXECUTED" + | "DEPROVISIONING" + | "DEPROVISIONED" + | "DONE" + | "CANCELLING" + | "CANCELLED" + | "FAILED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE"; + /** The test run start DateTime(ISO 8601 literal format). */ + startDateTime?: Date | string; + /** The test run end DateTime(ISO 8601 literal format). */ + endDateTime?: Date | string; + /** Test run initiated time. */ + executedDateTime?: Date | string; + /** Number of virtual users, for which test has been run. */ + vusers?: number; + /** Portal url. */ + portalUrl?: string; + /** Test run duration in milliseconds. */ + duration?: number; + /** Subnet ID on which the load test instances should run. */ + subnetId?: string; + /** Fully qualified resource Id e.g /subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. */ + resourceId?: string; + /** The created DateTime(ISO 8601 literal format) of the test model. */ + createdDateTime?: Date | string; + /** The user that created the test model. */ + createdBy?: string; + /** The last Modified DateTime(ISO 8601 literal format) of the test model. */ + lastModifiedDateTime?: Date | string; + /** The user that last modified the test model. */ + lastModifiedBy?: string; +} + +/** Error details if there is any failure in load test run */ +export interface ErrorDetails20221101 { + /** Error details in case test run was not successfully run. */ + message?: string; +} + +/** Test run statistics. */ +export interface TestRunStatisticsModel { + /** Transaction name. */ + transaction?: string; + /** Sampler count. */ + sampleCount?: number; + /** Error count. */ + errorCount?: number; + /** Error percentage. */ + errorPct?: number; + /** Mean response time. */ + meanResTime?: number; + /** Median response time. */ + medianResTime?: number; + /** Max response time. */ + maxResTime?: number; + /** Minimum response time. */ + minResTime?: number; + /** 90 percentile response time. */ + pct1ResTime?: number; + /** 95 percentile response time. */ + pct2ResTime?: number; + /** 99 percentile response time. */ + pct3ResTime?: number; + /** Throughput. */ + throughput?: number; + /** Received network bytes. */ + receivedKBytesPerSec?: number; + /** Send network bytes. */ + sentKBytesPerSec?: number; +} + +/** test artifact 20221101 */ +export interface TestArtifacts20221101 { + /** The input artifacts for the test. */ + inputArtifacts: InputTestArtifacts20221101; + /** The output artifacts for the test run. */ + outputArtifacts?: OutputTestArtifacts20221101; +} + +/** The output artifacts for the test run. */ +export interface OutputTestArtifacts20221101 { + /** FileUrl Model. */ + resultUrl?: FileUrl20221101; + /** FileUrl Model. */ + logsUrl?: FileUrl20221101; +} + +/** Metric metadata filter to fetch the set of metric */ +export interface MetricRequestPayload { + filters?: Array; +} + +/** The MetadataFilter is used to reduce the set of metric data returned. Example: Metric contains metadata A, B and C. - Return all time series of where C is equals to c1 or c2, the MetadataFilter value will be {C, [c1,c2]} */ +export interface MetadataFilter { + /** The invariant metadata name */ + name?: string; + /** The metadata values. Maximum values can be 20. */ + values?: Array; +} diff --git a/sdk/loadtestservice/loadtestservice-rest/src/outputModels.ts b/sdk/loadtestservice/loadtestservice-rest/src/outputModels.ts new file mode 100644 index 000000000000..c12e2b3a4a51 --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/src/outputModels.ts @@ -0,0 +1,550 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** App Components model */ +export interface AppComponentsMapOutput { + /** Azure Load Testing resource Id */ + resourceId?: string; + /** [Required, if testRunId is not given] Load test unique name */ + testId?: string; + /** [Required if testId is not given] Load test run unique name */ + testRunId?: string; + /** AppComponent name */ + name?: string; + /** AppComponents collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object } */ + value: Record; +} + +/** An Azure resource object (Refer azure generic resource model : https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id#genericresource) */ +export interface AppComponentOutput { + /** fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName} */ + resourceId: string; + /** Azure resource name, required while creating the app component. */ + resourceName: string; + /** Azure resource type, required while creating the app component. */ + resourceType?: string; + /** Azure resource display name */ + displayName?: string; + /** Resource group name of the Azure resource */ + resourceGroup?: string; + /** Subscription Id of the Azure resource */ + subscriptionId?: string; + /** Kind of Azure resource type */ + kind?: string; +} + +/** The definition of an error object. */ +export interface ErrorResponseBodyOutput { + /** Error from a REST request. */ + error: ErrorModelOutput; +} + +/** Error from a REST request. */ +export interface ErrorModelOutput { + /** The error code. */ + code: string; + /** The error message. */ + message: string; + /** The error target. */ + target?: string; + /** Additional details and inner errors. */ + details?: Array; +} + +/** Server metrics configuration model */ +export interface ServerMetricsModelOutput { + /** Server metrics configuration model. */ + name?: string; + /** [Required, if test run Id is not given] Load test unique name. */ + testId?: string; + /** [Required, if test Id is not given] Load test run unique name. */ + testRunId?: string; + /** Metrics collection {metric id : metrics object} (Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition for metric id). */ + metrics?: Record; +} + +/** Associated metric definition for particular metrics of the azure resource ( Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition). */ +export interface ResourceMetricModelOutput { + /** Unique name for metric. */ + id?: string; + /** Azure resource id. */ + resourceId: string; + /** Metric name space. */ + metricnamespace: string; + /** Metric description. */ + displayDescription?: string; + /** The localizable string class. */ + name: LocalizableStringOutput; + /** Metric aggregation. */ + aggregation: string; + /** Metric unit. */ + unit?: string; + /** Azure resource type. */ + resourceType: string; +} + +/** The localizable string class. */ +export interface LocalizableStringOutput { + /** The locale specific value. */ + localizedValue?: string; + /** The invariant value. */ + value?: string; +} + +/** Default server metrics config */ +export interface DefaultServerMetricsConfigListModelOutput { + /** Default metrics collection {resourceType : list of metrics config} (Refer for metrics structure: https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition) */ + defaultMetrics?: Record>; +} + +/** Metrics config model */ +export interface DefaultServerMetricsConfigModelOutput { + /** Metric namespace */ + metricnamespace?: string; + /** Metric aggregation */ + aggregation?: string; + /** The localizable string class. */ + name?: LocalizableStringOutput; + /** Metric unit */ + unit?: string; + /** Metric display description */ + displayDescription?: string; +} + +/** Supported azure resource types for App Component like Microsoft.LoadTestService/loadtests, Microsoft.ClassicCompute, Microsoft.ClassicStorage etc. (Refer for full list of available resource types in azure : https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/resource-providers-and-types, some of them we are supporting for server side metrics configuration). */ +export interface SupportedResourceTypeOutput { + value?: Array; +} + +/** Load test model */ +export interface TestModel20221101Output { + /** Pass fail criteria for a test. */ + passFailCriteria?: PassFailCriteria20221101Output; + /** Secrets can be stored in an Azure Key Vault or any other secret store. If the secret is stored in an Azure Key Vault, the value should be the secret identifier and the type should be AKV_SECRET_URI. If the secret is stored elsewhere, the secret value should be provided directly and the type should be SECRET_VALUE. */ + secrets?: Record; + certificate?: CertificateMetadata20221101Output; + /** Environment variables which are defined as a set of pairs. */ + environmentVariables?: Record; + /** The load test configuration. */ + loadTestConfig?: LoadTestConfig20221101Output; + /** The input artifacts for the test. */ + inputArtifacts?: InputTestArtifacts20221101Output; + /** Unique test name as identifier. */ + testId?: string; + /** The test description. */ + description?: string; + /** Display name of a test. */ + displayName?: string; + /** Subnet ID on which the load test instances should run. */ + subnetId?: string; + /** Type of the managed identity referencing the Key vault. */ + keyvaultReferenceIdentityType?: string; + /** Resource Id of the managed identity referencing the Key vault. */ + keyvaultReferenceIdentityId?: string; + /** Fully qualified resource Id e.g /subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. */ + resourceId?: string; + /** The created DateTime(ISO 8601 literal format) of the test model. */ + createdDateTime?: string; + /** The user that created the test model. */ + createdBy?: string; + /** The last Modified DateTime(ISO 8601 literal format) of the test model. */ + lastModifiedDateTime?: string; + /** The user that last modified the test model. */ + lastModifiedBy?: string; +} + +/** Pass fail criteria for a test. */ +export interface PassFailCriteria20221101Output { + /** Map of id and pass fail metrics { id : pass fail metrics }. */ + passFailMetrics?: Record; +} + +export interface PassFailMetric20221101Output { + /** The client metric on which the criteria should be applied. */ + clientmetric?: + | "response_time_ms" + | "latency" + | "error" + | "requests" + | "requests_per_sec"; + /** The aggregation function to be applied on the client metric. Allowed functions - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, ‘count’ - for requests */ + aggregate?: + | "count" + | "percentage" + | "avg" + | "p50" + | "p90" + | "p95" + | "p99" + | "min" + | "max"; + /** The comparison operator. Supported types ‘>’, ‘<’ */ + condition?: string; + /** Request name for which the Pass fail criteria has to be applied */ + requestName?: string; + /** The value to compare with the client metric. Allowed values - ‘error : [0.0 , 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. */ + value?: number; + /** Action taken after the threshold is met. Default is ‘continue’. */ + action?: "stop" | "continue"; + /** The actual value of the client metric for the test run. */ + actualValue?: number; + /** Outcome of the test run. */ + result?: "passed" | "undetermined" | "failed"; +} + +export interface SecretMetadata20221101Output { + /** The value of the secret for the respective type */ + value?: string; + /** Type of secret */ + type?: "AKV_SECRET_URI" | "SECRET_VALUE"; +} + +export interface CertificateMetadata20221101Output { + /** The value of the certificate for respective type */ + value?: string; + /** Type of certificate */ + type?: "AKV_CERT_URI"; + /** Name of the certificate. */ + name?: string; +} + +/** The load test configuration. */ +export interface LoadTestConfig20221101Output { + /** The number of engine instances to execute load test. Supported values are in range of 1-45. Required for creating a new test. */ + engineInstances?: number; + /** Whether all the input CSV files should be split evenly across all engines. */ + splitAllCSVs?: boolean; + /** If true, optionalLoadTestConfig is required and JMX script for the load test is not required to upload. */ + quickStartTest?: boolean; + /** Quick start load test config */ + optionalLoadTestConfig?: OptionalLoadTestConfigOutput; +} + +/** Quick start load test config */ +export interface OptionalLoadTestConfigOutput { + /** Endpoint url */ + endpointUrl?: string; + /** No of virtual users */ + vusers?: number; + /** ramp up time */ + rampUpTime?: number; + /** duration */ + duration?: number; +} + +/** The input artifacts for the test. */ +export interface InputTestArtifacts20221101Output { + /** FileUrl Model. */ + configUrl?: FileUrl20221101Output; + /** FileUrl Model. */ + testScriptUrl?: FileUrl20221101Output; + /** FileUrl Model. */ + userPropUrl?: FileUrl20221101Output; + /** FileUrl Model. */ + inputArtifactsZipFileurl?: FileUrl20221101Output; + /** Additional supported files for the test run */ + additionalUrls?: Array; +} + +/** FileUrl Model. */ +export interface FileUrl20221101Output { + /** File URL. */ + url?: string; + /** File unique identifier. */ + fileId?: string; + /** Name of the file. */ + filename?: string; + /** File type */ + fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; + /** Expiry time of the file */ + expireTime?: string; + /** Validation status of the file */ + validationStatus?: + | "NOT_VALIDATED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE" + | "VALIDATION_INITIATED"; +} + +/** List of Resources */ +export interface TestModel20221101ResourceListOutput { + /** List of Resources */ + value: Array; + /** Link for the next list of resources in case of paginated results, if applicable */ + nextLink?: string; +} + +export interface FileUrlListOutput { + /** List of file URLs. */ + value: Array; + /** Link for the next list of file URLs, if applicable */ + nextLink?: string; +} + +/** Load test run model */ +export interface TestRunModel20221101Output { + /** Pass fail criteria for a test. */ + passFailCriteria?: PassFailCriteria20221101Output; + /** Secrets can be stored in an Azure Key Vault or any other secret store. If the secret is stored in an Azure Key Vault, the value should be the secret identifier and the type should be AKV_SECRET_URI. If the secret is stored elsewhere, the secret value should be provided directly and the type should be SECRET_VALUE. */ + secrets?: Record; + certificate?: CertificateMetadata20221101Output; + /** Environment variables which are defined as a set of pairs. */ + environmentVariables?: Record; + /** Error details if there is any failure in load test run */ + errorDetails?: Array; + /** Test run statistics. */ + testRunStatistics?: Record; + /** The load test configuration. */ + loadTestConfig?: LoadTestConfig20221101Output; + /** test artifact 20221101 */ + testArtifacts?: TestArtifacts20221101Output; + /** Test result for pass/Fail criteria used during the test run. */ + testResult?: "PASSED" | "NOT_APPLICABLE" | "FAILED"; + /** Unique test run name as identifier */ + testRunId?: string; + /** Display name of a testRun. */ + displayName?: string; + /** Associated test Id. */ + testId?: string; + /** The test run description. */ + description?: string; + /** The test run status. */ + status?: + | "ACCEPTED" + | "NOTSTARTED" + | "PROVISIONING" + | "PROVISIONED" + | "CONFIGURING" + | "CONFIGURED" + | "EXECUTING" + | "EXECUTED" + | "DEPROVISIONING" + | "DEPROVISIONED" + | "DONE" + | "CANCELLING" + | "CANCELLED" + | "FAILED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE"; + /** The test run start DateTime(ISO 8601 literal format). */ + startDateTime?: string; + /** The test run end DateTime(ISO 8601 literal format). */ + endDateTime?: string; + /** Test run initiated time. */ + executedDateTime?: string; + /** Number of virtual users, for which test has been run. */ + vusers?: number; + /** Portal url. */ + portalUrl?: string; + /** Test run duration in milliseconds. */ + duration?: number; + /** Subnet ID on which the load test instances should run. */ + subnetId?: string; + /** Fully qualified resource Id e.g /subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. */ + resourceId?: string; + /** The created DateTime(ISO 8601 literal format) of the test model. */ + createdDateTime?: string; + /** The user that created the test model. */ + createdBy?: string; + /** The last Modified DateTime(ISO 8601 literal format) of the test model. */ + lastModifiedDateTime?: string; + /** The user that last modified the test model. */ + lastModifiedBy?: string; +} + +/** Error details if there is any failure in load test run */ +export interface ErrorDetails20221101Output { + /** Error details in case test run was not successfully run. */ + message?: string; +} + +/** Test run statistics. */ +export interface TestRunStatisticsModelOutput { + /** Transaction name. */ + transaction?: string; + /** Sampler count. */ + sampleCount?: number; + /** Error count. */ + errorCount?: number; + /** Error percentage. */ + errorPct?: number; + /** Mean response time. */ + meanResTime?: number; + /** Median response time. */ + medianResTime?: number; + /** Max response time. */ + maxResTime?: number; + /** Minimum response time. */ + minResTime?: number; + /** 90 percentile response time. */ + pct1ResTime?: number; + /** 95 percentile response time. */ + pct2ResTime?: number; + /** 99 percentile response time. */ + pct3ResTime?: number; + /** Throughput. */ + throughput?: number; + /** Received network bytes. */ + receivedKBytesPerSec?: number; + /** Send network bytes. */ + sentKBytesPerSec?: number; +} + +/** test artifact 20221101 */ +export interface TestArtifacts20221101Output { + /** The input artifacts for the test. */ + inputArtifacts: InputTestArtifacts20221101Output; + /** The output artifacts for the test run. */ + outputArtifacts?: OutputTestArtifacts20221101Output; +} + +/** The output artifacts for the test run. */ +export interface OutputTestArtifacts20221101Output { + /** FileUrl Model. */ + resultUrl?: FileUrl20221101Output; + /** FileUrl Model. */ + logsUrl?: FileUrl20221101Output; +} + +/** List of Resources */ +export interface TestRunModel20221101ResourceListOutput { + /** List of Resources */ + value: Array; + /** Link for the next list of resources in case of paginated results, if applicable */ + nextLink?: string; +} + +/** Represents collection of metric namespaces. */ +export interface MetricNamespaceCollectionOutput { + /** The values for the metric namespaces. */ + value?: Array; +} + +/** Metric namespace class specifies the metadata for a metric namespace. */ +export interface MetricNamespaceOutput { + /** The escaped name of the namespace. */ + name?: string; + /** The fully qualified metric namespace name. */ + metricNamespaceName?: string; +} + +/** Represents collection of metric definitions. */ +export interface MetricDefinitionCollectionOutput { + /** the values for the metric definitions. */ + value?: Array; +} + +/** Metric definition class specifies the metadata for a metric. */ +export interface MetricDefinitionOutput { + /** The name and the display name of the dimension, i.e. it is a localizable string. */ + dimensions?: Array; + /** Detailed description of this metric. */ + displayDescription?: string; + /** The localizable string class. */ + name?: LocalizableStringOutput; + /** The namespace the metric belongs to. */ + namespace?: string; + /** the primary aggregation type value defining how to use the values for display. */ + primaryAggregationType?: + | "Average" + | "Count" + | "Minimum" + | "Maximum" + | "None" + | "Total" + | "Percentile90" + | "Percentile95" + | "Percentile99"; + /** the collection of what aggregation types are supported. */ + supportedAggregationTypes?: Array; + /** The unit of the metric. */ + unit?: + | "NotSpecified" + | "Percent" + | "Count" + | "Seconds" + | "Milliseconds" + | "Bytes" + | "BytesPerSecond" + | "CountPerSecond"; + /** Metric availability specifies the time grain (aggregation interval or frequency) and the retention period for that time grain. */ + metricAvailabilities?: Array; +} + +/** Metric availability specifies the time grain (aggregation interval or frequency) */ +export interface MetricAvailabilityOutput { + /** The time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'PT1H', etc. */ + timeGrain?: "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; +} + +/** The response to a metrics query. */ +export interface ResponseOutput { + /** The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. */ + interval?: string; + /** The namespace of the metrics being queried. */ + namespace?: string; + /** The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. */ + timespan?: string; + /** The result data of a query. */ + value?: MetricOutput; +} + +/** The result data of a query. */ +export interface MetricOutput { + /** Detailed description of this metric. */ + displayDescription?: string; + /** The Metric Id. */ + id?: string; + /** The localizable string class. */ + name?: LocalizableStringOutput; + /** The time series returned when a data query is performed. */ + timeseries?: Array; + /** The unit of the metric. */ + unit?: + | "NotSpecified" + | "Percent" + | "Count" + | "Seconds" + | "Milliseconds" + | "Bytes" + | "BytesPerSecond" + | "CountPerSecond"; +} + +/** The time series returned when a data query is performed. */ +export interface TimeSeriesElementOutput { + /** An array of data points representing the metric values. This is only returned if a result type of data is specified. */ + data?: Array; + /** The metadata values */ + metadatavalues?: Array; +} + +/** Represents a metric value. */ +export interface MetricValueOutput { + /** The average value in the time range. */ + average?: number; + /** The number of samples in the time range. Can be used to determine the number of values that contributed to the average value. */ + count?: number; + /** The greatest value in the time range. */ + maximum?: number; + /** The least value in the time range. */ + minimum?: number; + /** The timestamp for the metric value in ISO 8601 format. */ + timeStamp?: string; + /** The sum of all of the values in the time range. */ + total?: number; + /** 90th percentile value in the time range. */ + percentile90?: number; + /** 95th percentile value in the time range. */ + percentile95?: number; + /** 99th percentile value in the time range. */ + percentile99?: number; +} + +/** Represents a metric metadata value. */ +export interface MetadataValueOutput { + /** The localizable string class. */ + name?: LocalizableStringOutput; + /** The value of the metadata. */ + value?: string; +} diff --git a/sdk/loadtestservice/loadtestservice-rest/src/paginateHelper.ts b/sdk/loadtestservice/loadtestservice-rest/src/paginateHelper.ts new file mode 100644 index 000000000000..17be16382f32 --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/src/paginateHelper.ts @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + getPagedAsyncIterator, + PagedAsyncIterableIterator, + PagedResult +} from "@azure/core-paging"; +import { + Client, + createRestError, + PathUncheckedResponse +} from "@azure-rest/core-client"; + +/** + * Helper type to extract the type of an array + */ +export type GetArrayType = T extends Array ? TData : never; + +/** + * The type of a custom function that defines how to get a page and a link to the next one if any. + */ +export type GetPage = ( + pageLink: string, + maxPageSize?: number +) => Promise<{ + page: TPage; + nextPageLink?: string; +}>; + +/** + * Options for the paging helper + */ +export interface PagingOptions { + /** + * Custom function to extract pagination details for crating the PagedAsyncIterableIterator + */ + customGetPage?: GetPage[]>; +} + +/** + * Helper type to infer the Type of the paged elements from the response type + * This type is generated based on the swagger information for x-ms-pageable + * specifically on the itemName property which indicates the property of the response + * where the page items are found. The default value is `value`. + * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter + */ +export type PaginateReturn = TResult extends { + body: { value?: infer TPage }; +} + ? GetArrayType + : Array; + +/** + * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension + * @param client - Client to use for sending the next page requests + * @param initialResponse - Initial response containing the nextLink and current page of elements + * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results + * @returns - PagedAsyncIterableIterator to iterate the elements + */ +export function paginate( + client: Client, + initialResponse: TResponse, + options: PagingOptions = {} +): PagedAsyncIterableIterator> { + // Extract element type from initial response + type TElement = PaginateReturn; + let firstRun = true; + const itemName = "value"; + const nextLinkName = "nextLink"; + const { customGetPage } = options; + const pagedResult: PagedResult = { + firstPageLink: "", + getPage: + typeof customGetPage === "function" + ? customGetPage + : async (pageLink: string) => { + const result = firstRun + ? initialResponse + : await client.pathUnchecked(pageLink).get(); + firstRun = false; + checkPagingRequest(result); + const nextLink = getNextLink(result.body, nextLinkName); + const values = getElements(result.body, itemName); + return { + page: values, + nextPageLink: nextLink + }; + } + }; + + return getPagedAsyncIterator(pagedResult); +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return 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` + ); + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + + // value has to be an array according to the x-ms-pageable extension. + // The fact that this must be an array is used above to calculate the + // type of elements in the page in PaginateReturn + if (!Array.isArray(value)) { + throw new Error( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}` + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse): void { + 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}`, + response + ); + } +} diff --git a/sdk/loadtestservice/loadtestservice-rest/src/parameters.ts b/sdk/loadtestservice/loadtestservice-rest/src/parameters.ts new file mode 100644 index 000000000000..0926ec50420e --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/src/parameters.ts @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { RequestParameters } from "@azure-rest/core-client"; +import { + AppComponentsMap, + ServerMetricsModel, + TestModel20221101, + TestRunModel20221101, + MetricRequestPayload +} from "./models"; + +export interface AppComponentCreateOrUpdateBodyParam { + /** App Component model. */ + body: AppComponentsMap; +} + +export interface AppComponentCreateOrUpdateMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type AppComponentCreateOrUpdateParameters = AppComponentCreateOrUpdateMediaTypesParam & + AppComponentCreateOrUpdateBodyParam & + RequestParameters; +export type AppComponentDeleteParameters = RequestParameters; +export type AppComponentGetParameters = RequestParameters; + +export interface AppComponentGetByTestOrTestRunQueryParamProperties { + /** Required testRunId, if testId field is not provided */ + testRunId?: string; +} + +export interface AppComponentGetByTestOrTestRunQueryParam { + queryParameters?: AppComponentGetByTestOrTestRunQueryParamProperties; +} + +export type AppComponentGetByTestOrTestRunParameters = AppComponentGetByTestOrTestRunQueryParam & + RequestParameters; + +export interface ServerMetricsCreateOrUpdateBodyParam { + /** Server metrics configuration model. */ + body: ServerMetricsModel; +} + +export interface ServerMetricsCreateOrUpdateMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type ServerMetricsCreateOrUpdateParameters = ServerMetricsCreateOrUpdateMediaTypesParam & + ServerMetricsCreateOrUpdateBodyParam & + RequestParameters; +export type ServerMetricsGetParameters = RequestParameters; +export type ServerMetricsDeleteParameters = RequestParameters; + +export interface ServerMetricsGetByTestOrTestRunQueryParamProperties { + /** Required testRunId, if testId field is not provided */ + testRunId?: string; +} + +export interface ServerMetricsGetByTestOrTestRunQueryParam { + queryParameters?: ServerMetricsGetByTestOrTestRunQueryParamProperties; +} + +export type ServerMetricsGetByTestOrTestRunParameters = ServerMetricsGetByTestOrTestRunQueryParam & + RequestParameters; +export type ServerMetricsGetDefaultMetricsParameters = RequestParameters; +export type ServerMetricsListSupportedResourceTypeParameters = RequestParameters; + +export interface TestCreateOrUpdateBodyParam { + /** Load test model */ + body: TestModel20221101; +} + +export interface TestCreateOrUpdateMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type TestCreateOrUpdateParameters = TestCreateOrUpdateMediaTypesParam & + TestCreateOrUpdateBodyParam & + RequestParameters; +export type TestDeleteParameters = RequestParameters; +export type TestGetParameters = RequestParameters; + +export interface TestListQueryParamProperties { + /** Sort on one of the field - lastModifiedDateTime, displayName, createdBy in (field asc/desc) format. eg: displayName asc. */ + orderBy?: string; + /** Filter search based on searchable fields - testId, createdBy. */ + search?: string; + /** Start DateTime(ISO 8601 literal format) of the last updated time range to filter tests. */ + lastUpdatedStartTime?: Date | string; + /** End DateTime(ISO 8601 literal format) of the last updated time range to filter tests. */ + lastUpdatedEndTime?: Date | string; + /** Continuation token to get the next page of response */ + continuationToken?: string; + /** Number of results in response. */ + maxPageSize?: number; +} + +export interface TestListQueryParam { + queryParameters?: TestListQueryParamProperties; +} + +export type TestListParameters = TestListQueryParam & RequestParameters; + +export interface TestUploadFileBodyParam { + body: TestUploadFileFormBody; +} + +export interface TestUploadFileFormBody { + /** + * file. + * + * Value may contain any sequence of octets + */ + file: + | string + | Uint8Array + | ReadableStream + | NodeJS.ReadableStream; +} + +export interface TestUploadFileQueryParamProperties { + /** fileType. */ + fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; +} + +export interface TestUploadFileQueryParam { + queryParameters?: TestUploadFileQueryParamProperties; +} + +export interface TestUploadFileMediaTypesParam { + /** Request content type */ + contentType?: "multipart/form-data"; +} + +export type TestUploadFileParameters = TestUploadFileQueryParam & + TestUploadFileMediaTypesParam & + TestUploadFileBodyParam & + RequestParameters; +export type TestGetFileParameters = RequestParameters; +export type TestDeleteFileParameters = RequestParameters; + +export interface TestGetAllFilesQueryParamProperties { + /** Continuation token to get the next page of response */ + continuationToken?: string; +} + +export interface TestGetAllFilesQueryParam { + queryParameters?: TestGetAllFilesQueryParamProperties; +} + +export type TestGetAllFilesParameters = TestGetAllFilesQueryParam & + RequestParameters; +export type TestRunDeleteParameters = RequestParameters; + +export interface TestRunCreateOrUpdateBodyParam { + /** Load test run model */ + body: TestRunModel20221101; +} + +export interface TestRunCreateOrUpdateQueryParamProperties { + /** Existing test run Id that should be rerun. */ + oldTestRunId?: string; +} + +export interface TestRunCreateOrUpdateQueryParam { + queryParameters?: TestRunCreateOrUpdateQueryParamProperties; +} + +export interface TestRunCreateOrUpdateMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type TestRunCreateOrUpdateParameters = TestRunCreateOrUpdateQueryParam & + TestRunCreateOrUpdateMediaTypesParam & + TestRunCreateOrUpdateBodyParam & + RequestParameters; +export type TestRunGetParameters = RequestParameters; +export type TestRunGetFileParameters = RequestParameters; + +export interface TestRunListQueryParamProperties { + /** Sort on one of the field - status, displayName, executedDateTime in (field asc/desc) format. eg: displayName asc. */ + orderBy?: string; + /** Continuation token to get the next page of response */ + continuationToken?: string; + /** Filter search based on searchable fields - description, executedUser. */ + search?: string; + /** End DateTime(ISO 8601 literal format) of test-run execution time filter range. */ + executionFrom?: Date | string; + /** Start DateTime(ISO 8601 literal format) of test-run execution time filter range. */ + executionTo?: Date | string; + /** Comma separated list of test run status. */ + status?: string; + /** Number of results in response. */ + maxPageSize?: number; +} + +export interface TestRunListQueryParam { + queryParameters?: TestRunListQueryParamProperties; +} + +export type TestRunListParameters = TestRunListQueryParam & RequestParameters; +export type TestRunStopParameters = RequestParameters; +export type TestRunMetricNamespacesParameters = RequestParameters; + +export interface TestRunMetricDefinitionsQueryParamProperties { + /** Metric namespace to query metric definitions for. */ + metricnamespace: string; +} + +export interface TestRunMetricDefinitionsQueryParam { + queryParameters: TestRunMetricDefinitionsQueryParamProperties; +} + +export type TestRunMetricDefinitionsParameters = TestRunMetricDefinitionsQueryParam & + RequestParameters; + +export interface TestRunMetricsBodyParam { + body?: MetricRequestPayload; +} + +export interface TestRunMetricsQueryParamProperties { + /** The list of aggregation types (comma separated) to retrieve. */ + aggregation?: string; + /** The interval (i.e. timegrain) of the query. */ + interval?: "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; + /** Metric name */ + metricname: string; + /** Metric namespace to query metric definitions for. */ + metricnamespace: string; + /** Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. */ + resultType: "Data" | "Metadata"; + /** The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. */ + timespan: string; +} + +export interface TestRunMetricsQueryParam { + queryParameters: TestRunMetricsQueryParamProperties; +} + +export interface TestRunMetricsMediaTypesParam { + /** Request content type */ + contentType?: "application/json"; +} + +export type TestRunMetricsParameters = TestRunMetricsQueryParam & + TestRunMetricsMediaTypesParam & + TestRunMetricsBodyParam & + RequestParameters; diff --git a/sdk/loadtestservice/loadtestservice-rest/src/responses.ts b/sdk/loadtestservice/loadtestservice-rest/src/responses.ts new file mode 100644 index 000000000000..611c8bdb0ae6 --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/src/responses.ts @@ -0,0 +1,536 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { RawHttpHeaders } from "@azure/core-rest-pipeline"; +import { HttpResponse } from "@azure-rest/core-client"; +import { + AppComponentsMapOutput, + ErrorResponseBodyOutput, + ServerMetricsModelOutput, + DefaultServerMetricsConfigListModelOutput, + SupportedResourceTypeOutput, + TestModel20221101Output, + TestModel20221101ResourceListOutput, + FileUrl20221101Output, + FileUrlListOutput, + TestRunModel20221101Output, + TestRunModel20221101ResourceListOutput, + MetricNamespaceCollectionOutput, + MetricDefinitionCollectionOutput, + ResponseOutput +} from "./outputModels"; + +/** Associate an app component (Azure resource) to a test or test run. */ +export interface AppComponentCreateOrUpdate200Response extends HttpResponse { + status: "200"; + body: AppComponentsMapOutput; +} + +/** Associate an app component (Azure resource) to a test or test run. */ +export interface AppComponentCreateOrUpdate201Response extends HttpResponse { + status: "201"; + body: AppComponentsMapOutput; +} + +export interface AppComponentCreateOrUpdateDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Associate an app component (Azure resource) to a test or test run. */ +export interface AppComponentCreateOrUpdateDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & AppComponentCreateOrUpdateDefaultHeaders; +} + +/** Delete an app component. */ +export interface AppComponentDelete204Response extends HttpResponse { + status: "204"; + body: Record; +} + +export interface AppComponentDeleteDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Delete an app component. */ +export interface AppComponentDeleteDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & AppComponentDeleteDefaultHeaders; +} + +/** Get app Component details by unique name. */ +export interface AppComponentGet200Response extends HttpResponse { + status: "200"; + body: AppComponentsMapOutput; +} + +export interface AppComponentGetDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get app Component details by unique name. */ +export interface AppComponentGetDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & AppComponentGetDefaultHeaders; +} + +/** Get an app component for a test or a test run by its name. */ +export interface AppComponentGetByTestOrTestRun200Response + extends HttpResponse { + status: "200"; + body: AppComponentsMapOutput; +} + +export interface AppComponentGetByTestOrTestRunDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get an app component for a test or a test run by its name. */ +export interface AppComponentGetByTestOrTestRunDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & AppComponentGetByTestOrTestRunDefaultHeaders; +} + +/** Configure server metrics for a test or test run */ +export interface ServerMetricsCreateOrUpdate200Response extends HttpResponse { + status: "200"; + body: ServerMetricsModelOutput; +} + +/** Configure server metrics for a test or test run */ +export interface ServerMetricsCreateOrUpdate201Response extends HttpResponse { + status: "201"; + body: ServerMetricsModelOutput; +} + +export interface ServerMetricsCreateOrUpdateDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Configure server metrics for a test or test run */ +export interface ServerMetricsCreateOrUpdateDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & ServerMetricsCreateOrUpdateDefaultHeaders; +} + +/** Get server metrics configuration by its name. */ +export interface ServerMetricsGet200Response extends HttpResponse { + status: "200"; + body: ServerMetricsModelOutput; +} + +export interface ServerMetricsGetDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get server metrics configuration by its name. */ +export interface ServerMetricsGetDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & ServerMetricsGetDefaultHeaders; +} + +/** Delete server metrics configuration by its name */ +export interface ServerMetricsDelete204Response extends HttpResponse { + status: "204"; + body: Record; +} + +export interface ServerMetricsDeleteDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Delete server metrics configuration by its name */ +export interface ServerMetricsDeleteDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & ServerMetricsDeleteDefaultHeaders; +} + +/** Get server metrics configuration for a test or test run by its name. */ +export interface ServerMetricsGetByTestOrTestRun200Response + extends HttpResponse { + status: "200"; + body: ServerMetricsModelOutput; +} + +export interface ServerMetricsGetByTestOrTestRunDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get server metrics configuration for a test or test run by its name. */ +export interface ServerMetricsGetByTestOrTestRunDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & ServerMetricsGetByTestOrTestRunDefaultHeaders; +} + +/** Get all default server metrics configuration for supported resource types. */ +export interface ServerMetricsGetDefaultMetrics200Response + extends HttpResponse { + status: "200"; + body: DefaultServerMetricsConfigListModelOutput; +} + +export interface ServerMetricsGetDefaultMetricsDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get all default server metrics configuration for supported resource types. */ +export interface ServerMetricsGetDefaultMetricsDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & ServerMetricsGetDefaultMetricsDefaultHeaders; +} + +/** Get all supported resource types for adding an app component(Azure resource types). */ +export interface ServerMetricsListSupportedResourceType200Response + extends HttpResponse { + status: "200"; + body: SupportedResourceTypeOutput; +} + +export interface ServerMetricsListSupportedResourceTypeDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get all supported resource types for adding an app component(Azure resource types). */ +export interface ServerMetricsListSupportedResourceTypeDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & + ServerMetricsListSupportedResourceTypeDefaultHeaders; +} + +/** Create a new test or update an existing test. */ +export interface TestCreateOrUpdate200Response extends HttpResponse { + status: "200"; + body: TestModel20221101Output; +} + +/** Create a new test or update an existing test. */ +export interface TestCreateOrUpdate201Response extends HttpResponse { + status: "201"; + body: TestModel20221101Output; +} + +export interface TestCreateOrUpdateDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Create a new test or update an existing test. */ +export interface TestCreateOrUpdateDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestCreateOrUpdateDefaultHeaders; +} + +/** Delete a test by its name. */ +export interface TestDelete204Response extends HttpResponse { + status: "204"; + body: Record; +} + +export interface TestDeleteDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Delete a test by its name. */ +export interface TestDeleteDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestDeleteDefaultHeaders; +} + +/** Get load test details by test name */ +export interface TestGet200Response extends HttpResponse { + status: "200"; + body: TestModel20221101Output; +} + +export interface TestGetDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get load test details by test name */ +export interface TestGetDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestGetDefaultHeaders; +} + +/** Get all load tests by the fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. */ +export interface TestList200Response extends HttpResponse { + status: "200"; + body: TestModel20221101ResourceListOutput; +} + +export interface TestListDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get all load tests by the fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. */ +export interface TestListDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestListDefaultHeaders; +} + +/** Upload input file for a given test name. File size can't be more than 50 MB. Existing file with same name for the given test will be overwritten. File should be provided in the request body as multipart/form-data. */ +export interface TestUploadFile201Response extends HttpResponse { + status: "201"; + body: FileUrl20221101Output; +} + +export interface TestUploadFileDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Upload input file for a given test name. File size can't be more than 50 MB. Existing file with same name for the given test will be overwritten. File should be provided in the request body as multipart/form-data. */ +export interface TestUploadFileDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestUploadFileDefaultHeaders; +} + +/** Get test file by the file name. */ +export interface TestGetFile200Response extends HttpResponse { + status: "200"; + body: FileUrl20221101Output; +} + +export interface TestGetFileDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get test file by the file name. */ +export interface TestGetFileDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestGetFileDefaultHeaders; +} + +/** Delete file by the file name for a test */ +export interface TestDeleteFile204Response extends HttpResponse { + status: "204"; + body: Record; +} + +export interface TestDeleteFileDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Delete file by the file name for a test */ +export interface TestDeleteFileDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestDeleteFileDefaultHeaders; +} + +/** Get all test files. */ +export interface TestGetAllFiles200Response extends HttpResponse { + status: "200"; + body: FileUrlListOutput; +} + +export interface TestGetAllFilesDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get all test files. */ +export interface TestGetAllFilesDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestGetAllFilesDefaultHeaders; +} + +/** Delete a test run by its name. */ +export interface TestRunDelete204Response extends HttpResponse { + status: "204"; + body: Record; +} + +export interface TestRunDeleteDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Delete a test run by its name. */ +export interface TestRunDeleteDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestRunDeleteDefaultHeaders; +} + +/** Create and start a new test run with the given name. */ +export interface TestRunCreateOrUpdate200Response extends HttpResponse { + status: "200"; + body: TestRunModel20221101Output; +} + +export interface TestRunCreateOrUpdateDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Create and start a new test run with the given name. */ +export interface TestRunCreateOrUpdateDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestRunCreateOrUpdateDefaultHeaders; +} + +/** Get test run details by name. */ +export interface TestRunGet200Response extends HttpResponse { + status: "200"; + body: TestRunModel20221101Output; +} + +export interface TestRunGetDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get test run details by name. */ +export interface TestRunGetDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestRunGetDefaultHeaders; +} + +/** Get test run file by file name. */ +export interface TestRunGetFile200Response extends HttpResponse { + status: "200"; + body: FileUrl20221101Output; +} + +export interface TestRunGetFileDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get test run file by file name. */ +export interface TestRunGetFileDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestRunGetFileDefaultHeaders; +} + +/** Get all test runs with given filters */ +export interface TestRunList200Response extends HttpResponse { + status: "200"; + body: TestRunModel20221101ResourceListOutput; +} + +export interface TestRunListDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get all test runs with given filters */ +export interface TestRunListDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestRunListDefaultHeaders; +} + +/** Stop test run by name. */ +export interface TestRunStop200Response extends HttpResponse { + status: "200"; + body: TestRunModel20221101Output; +} + +export interface TestRunStopDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Stop test run by name. */ +export interface TestRunStopDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestRunStopDefaultHeaders; +} + +/** Lists the metric namespaces for a load test run. */ +export interface TestRunMetricNamespaces200Response extends HttpResponse { + status: "200"; + body: MetricNamespaceCollectionOutput; +} + +export interface TestRunMetricNamespacesDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Lists the metric namespaces for a load test run. */ +export interface TestRunMetricNamespacesDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestRunMetricNamespacesDefaultHeaders; +} + +/** Lists the metric definitions for a load test run. */ +export interface TestRunMetricDefinitions200Response extends HttpResponse { + status: "200"; + body: MetricDefinitionCollectionOutput; +} + +export interface TestRunMetricDefinitionsDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Lists the metric definitions for a load test run. */ +export interface TestRunMetricDefinitionsDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestRunMetricDefinitionsDefaultHeaders; +} + +/** Lists the metric values for a load test run. */ +export interface TestRunMetrics200Response extends HttpResponse { + status: "200"; + body: ResponseOutput; +} + +export interface TestRunMetricsDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Lists the metric values for a load test run. */ +export interface TestRunMetricsDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & TestRunMetricsDefaultHeaders; +} diff --git a/sdk/loadtestservice/loadtestservice-rest/swagger/README.md b/sdk/loadtestservice/loadtestservice-rest/swagger/README.md new file mode 100644 index 000000000000..fd267dc5c75f --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/swagger/README.md @@ -0,0 +1,18 @@ +# JavaScript + +> see https://aka.ms/autorest + +## Configuration + +```yaml +package-name: '@azure-rest/loadtestservice' +generate-metadata: true +license-header: MICROSOFT_MIT_NO_VERSION +output-folder: ../ +source-code-folder-path: ./src +require: + - /mnt/vss/_work/1/s/azure-rest-api-specs/specification/loadtestservice/data-plane/readme.md +rest-level-client: true +use-extension: + '@autorest/typescript': 6.0.0-beta.14 +``` diff --git a/sdk/loadtestservice/loadtestservice-rest/tsconfig.json b/sdk/loadtestservice/loadtestservice-rest/tsconfig.json new file mode 100644 index 000000000000..631b7f3292ea --- /dev/null +++ b/sdk/loadtestservice/loadtestservice-rest/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig.package", + "compilerOptions": { + "outDir": "./dist-esm", + "declarationDir": "./types" + }, + "include": [ + "src/**/*.ts" + ] +} \ No newline at end of file