From 690457ef17b12e685516be363a9403bb349b0890 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 9 Sep 2024 13:59:29 +0800 Subject: [PATCH 01/15] refresh load-testing-rest sdk --- .../generated/azureLoadTesting.ts | 71 + .../generated/clientDefinitions.ts | 408 +++++ .../load-testing-rest/generated/index.ts | 15 + .../generated/isUnexpected.ts | 398 +++++ .../load-testing-rest/generated/logger.ts | 5 + .../load-testing-rest/generated/models.ts | 257 +++ .../{src => generated}/outputModels.ts | 156 +- .../{src => generated}/paginateHelper.ts | 33 +- .../load-testing-rest/generated/parameters.ts | 285 +++ .../{src => generated}/responses.ts | 300 ++-- .../load-testing-rest/karma.conf.js | 6 +- .../load-testing-rest/package.json | 2 +- .../review/load-testing.api.md | 1577 ++++++++--------- .../load-testing-rest/samples-dev/sample.ts | 6 - .../load-testing-rest/samples-dev/stopTest.ts | 1 - .../samples/v1/javascript/README.md | 22 +- .../v1/javascript/createAppComponent.js | 67 - .../v1/javascript/createOrUpdateTest.js | 35 - .../samples/v1/javascript/fileUpload.js | 59 - .../samples/v1/javascript/package.json | 2 +- .../samples/v1/javascript/sample.env | 6 +- .../samples/v1/javascript/sample.js | 190 ++ ...ateTestRunAndGetMetrics.js => stopTest.js} | 53 +- .../samples/v1/typescript/README.md | 22 +- .../samples/v1/typescript/package.json | 2 +- .../samples/v1/typescript/sample.env | 6 +- .../v1/typescript/src/createAppComponent.ts | 65 - .../v1/typescript/src/createOrUpdateTest.ts | 35 - .../samples/v1/typescript/src/fileUpload.ts | 58 - .../samples/v1/typescript/src/sample.ts | 189 ++ ...ateTestRunAndGetMetrics.ts => stopTest.ts} | 53 +- .../samples/v1/typescript/tsconfig.json | 2 +- .../load-testing-rest/src/azureLoadTesting.ts | 42 - .../src/clientDefinitions.ts | 340 ---- .../src/getFileValidationPoller.ts | 32 +- .../src/getTestRunCompletionPoller.ts | 41 +- .../load-testing-rest/src/index.ts | 17 +- .../load-testing-rest/src/isUnexpected.ts | 347 ---- .../load-testing-rest/src/models.ts | 419 +---- .../load-testing-rest/src/parameters.ts | 271 --- .../load-testing-rest/src/pollingHelper.ts | 2 +- .../load-testing-rest/src/util/LROUtil.ts | 2 +- .../load-testing-rest/swagger/README.md | 8 +- .../test/public/testAdministration.spec.ts | 9 +- .../test/public/testRun.spec.ts | 12 +- .../load-testing-rest/tsconfig.json | 16 +- 46 files changed, 3046 insertions(+), 2898 deletions(-) create mode 100644 sdk/loadtesting/load-testing-rest/generated/azureLoadTesting.ts create mode 100644 sdk/loadtesting/load-testing-rest/generated/clientDefinitions.ts create mode 100644 sdk/loadtesting/load-testing-rest/generated/index.ts create mode 100644 sdk/loadtesting/load-testing-rest/generated/isUnexpected.ts create mode 100644 sdk/loadtesting/load-testing-rest/generated/logger.ts create mode 100644 sdk/loadtesting/load-testing-rest/generated/models.ts rename sdk/loadtesting/load-testing-rest/{src => generated}/outputModels.ts (85%) rename sdk/loadtesting/load-testing-rest/{src => generated}/paginateHelper.ts (87%) create mode 100644 sdk/loadtesting/load-testing-rest/generated/parameters.ts rename sdk/loadtesting/load-testing-rest/{src => generated}/responses.ts (52%) delete mode 100644 sdk/loadtesting/load-testing-rest/samples/v1/javascript/createAppComponent.js delete mode 100644 sdk/loadtesting/load-testing-rest/samples/v1/javascript/createOrUpdateTest.js delete mode 100644 sdk/loadtesting/load-testing-rest/samples/v1/javascript/fileUpload.js create mode 100644 sdk/loadtesting/load-testing-rest/samples/v1/javascript/sample.js rename sdk/loadtesting/load-testing-rest/samples/v1/javascript/{createTestRunAndGetMetrics.js => stopTest.js} (54%) delete mode 100644 sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/createAppComponent.ts delete mode 100644 sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/createOrUpdateTest.ts delete mode 100644 sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/fileUpload.ts create mode 100644 sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/sample.ts rename sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/{createTestRunAndGetMetrics.ts => stopTest.ts} (53%) delete mode 100644 sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts delete mode 100644 sdk/loadtesting/load-testing-rest/src/clientDefinitions.ts delete mode 100644 sdk/loadtesting/load-testing-rest/src/isUnexpected.ts delete mode 100644 sdk/loadtesting/load-testing-rest/src/parameters.ts diff --git a/sdk/loadtesting/load-testing-rest/generated/azureLoadTesting.ts b/sdk/loadtesting/load-testing-rest/generated/azureLoadTesting.ts new file mode 100644 index 000000000000..d77c72f053ad --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/generated/azureLoadTesting.ts @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { logger } from "./logger"; +import { TokenCredential } from "@azure/core-auth"; +import { AzureLoadTestingClient } from "./clientDefinitions"; + +/** The optional parameters for the client */ +export interface AzureLoadTestingClientOptions extends ClientOptions { + /** The api version option of the client */ + apiVersion?: string; +} + +/** + * Initialize a new instance of `AzureLoadTestingClient` + * @param endpoint - URL to perform data plane API operations on the resource. + * @param credentials - uniquely identify client credential + * @param options - the parameter for all optional parameters + */ +export default function createClient( + endpoint: string, + credentials: TokenCredential, + { apiVersion = "2022-11-01", ...options }: AzureLoadTestingClientOptions = {}, +): AzureLoadTestingClient { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `https://${endpoint}`; + const userAgentInfo = `azsdk-js-load-testing-rest/1.0.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + credentials: { + scopes: options.credentials?.scopes ?? [ + "https://cnt-prod.loadtesting.azure.com/.default", + ], + }, + }; + const client = getClient( + endpointUrl, + credentials, + options, + ) as AzureLoadTestingClient; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + client.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version") && apiVersion) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + + return client; +} diff --git a/sdk/loadtesting/load-testing-rest/generated/clientDefinitions.ts b/sdk/loadtesting/load-testing-rest/generated/clientDefinitions.ts new file mode 100644 index 000000000000..a4882259c363 --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/generated/clientDefinitions.ts @@ -0,0 +1,408 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + LoadTestAdministrationCreateOrUpdateTestParameters, + LoadTestAdministrationDeleteTestParameters, + LoadTestAdministrationGetTestParameters, + LoadTestAdministrationListTestsParameters, + LoadTestAdministrationUploadTestFileParameters, + LoadTestAdministrationGetTestFileParameters, + LoadTestAdministrationDeleteTestFileParameters, + LoadTestAdministrationListTestFilesParameters, + LoadTestAdministrationCreateOrUpdateAppComponentsParameters, + LoadTestAdministrationGetAppComponentsParameters, + LoadTestAdministrationCreateOrUpdateServerMetricsConfigParameters, + LoadTestAdministrationGetServerMetricsConfigParameters, + LoadTestRunCreateOrUpdateTestRunParameters, + LoadTestRunGetTestRunParameters, + LoadTestRunDeleteTestRunParameters, + LoadTestRunGetTestRunFileParameters, + LoadTestRunListTestRunsParameters, + LoadTestRunStopTestRunParameters, + LoadTestRunListMetricNamespacesParameters, + LoadTestRunListMetricDefinitionsParameters, + LoadTestRunListMetricsParameters, + LoadTestRunListMetricDimensionValuesParameters, + LoadTestRunCreateOrUpdateAppComponentsParameters, + LoadTestRunGetAppComponentsParameters, + LoadTestRunCreateOrUpdateServerMetricsConfigParameters, + LoadTestRunGetServerMetricsConfigParameters, +} from "./parameters"; +import { + LoadTestAdministrationCreateOrUpdateTest200Response, + LoadTestAdministrationCreateOrUpdateTest201Response, + LoadTestAdministrationCreateOrUpdateTestDefaultResponse, + LoadTestAdministrationDeleteTest204Response, + LoadTestAdministrationDeleteTestDefaultResponse, + LoadTestAdministrationGetTest200Response, + LoadTestAdministrationGetTestDefaultResponse, + LoadTestAdministrationListTests200Response, + LoadTestAdministrationListTestsDefaultResponse, + LoadTestAdministrationUploadTestFile201Response, + LoadTestAdministrationUploadTestFileDefaultResponse, + LoadTestAdministrationGetTestFile200Response, + LoadTestAdministrationGetTestFileDefaultResponse, + LoadTestAdministrationDeleteTestFile204Response, + LoadTestAdministrationDeleteTestFileDefaultResponse, + LoadTestAdministrationListTestFiles200Response, + LoadTestAdministrationListTestFilesDefaultResponse, + LoadTestAdministrationCreateOrUpdateAppComponents200Response, + LoadTestAdministrationCreateOrUpdateAppComponents201Response, + LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse, + LoadTestAdministrationGetAppComponents200Response, + LoadTestAdministrationGetAppComponentsDefaultResponse, + LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response, + LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response, + LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse, + LoadTestAdministrationGetServerMetricsConfig200Response, + LoadTestAdministrationGetServerMetricsConfigDefaultResponse, + LoadTestRunCreateOrUpdateTestRun200Response, + LoadTestRunCreateOrUpdateTestRun201Response, + LoadTestRunCreateOrUpdateTestRunDefaultResponse, + LoadTestRunGetTestRun200Response, + LoadTestRunGetTestRunDefaultResponse, + LoadTestRunDeleteTestRun204Response, + LoadTestRunDeleteTestRunDefaultResponse, + LoadTestRunGetTestRunFile200Response, + LoadTestRunGetTestRunFileDefaultResponse, + LoadTestRunListTestRuns200Response, + LoadTestRunListTestRunsDefaultResponse, + LoadTestRunStopTestRun200Response, + LoadTestRunStopTestRunDefaultResponse, + LoadTestRunListMetricNamespaces200Response, + LoadTestRunListMetricNamespacesDefaultResponse, + LoadTestRunListMetricDefinitions200Response, + LoadTestRunListMetricDefinitionsDefaultResponse, + LoadTestRunListMetrics200Response, + LoadTestRunListMetricsDefaultResponse, + LoadTestRunListMetricDimensionValues200Response, + LoadTestRunListMetricDimensionValuesDefaultResponse, + LoadTestRunCreateOrUpdateAppComponents200Response, + LoadTestRunCreateOrUpdateAppComponents201Response, + LoadTestRunCreateOrUpdateAppComponentsDefaultResponse, + LoadTestRunGetAppComponents200Response, + LoadTestRunGetAppComponentsDefaultResponse, + LoadTestRunCreateOrUpdateServerMetricsConfig200Response, + LoadTestRunCreateOrUpdateServerMetricsConfig201Response, + LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse, + LoadTestRunGetServerMetricsConfig200Response, + LoadTestRunGetServerMetricsConfigDefaultResponse, +} from "./responses"; +import { Client, StreamableMethod } from "@azure-rest/core-client"; + +export interface LoadTestAdministrationCreateOrUpdateTest { + /** Create a new test or update an existing test. */ + patch( + options: LoadTestAdministrationCreateOrUpdateTestParameters, + ): StreamableMethod< + | LoadTestAdministrationCreateOrUpdateTest200Response + | LoadTestAdministrationCreateOrUpdateTest201Response + | LoadTestAdministrationCreateOrUpdateTestDefaultResponse + >; + /** Delete a test by its name. */ + delete( + options?: LoadTestAdministrationDeleteTestParameters, + ): StreamableMethod< + | LoadTestAdministrationDeleteTest204Response + | LoadTestAdministrationDeleteTestDefaultResponse + >; + /** Get load test details by test name */ + get( + options?: LoadTestAdministrationGetTestParameters, + ): StreamableMethod< + | LoadTestAdministrationGetTest200Response + | LoadTestAdministrationGetTestDefaultResponse + >; +} + +export interface LoadTestAdministrationListTests { + /** Get all load tests by the fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. */ + get( + options?: LoadTestAdministrationListTestsParameters, + ): StreamableMethod< + | LoadTestAdministrationListTests200Response + | LoadTestAdministrationListTestsDefaultResponse + >; +} + +export interface LoadTestAdministrationUploadTestFile { + /** Upload input file for a given test name. File size can't be more than 50 MB. Existing file with same name for the given test will be overwritten. File should be provided in the request body as application/octet-stream. */ + put( + options: LoadTestAdministrationUploadTestFileParameters, + ): StreamableMethod< + | LoadTestAdministrationUploadTestFile201Response + | LoadTestAdministrationUploadTestFileDefaultResponse + >; + /** Get test file by the file name. */ + get( + options?: LoadTestAdministrationGetTestFileParameters, + ): StreamableMethod< + | LoadTestAdministrationGetTestFile200Response + | LoadTestAdministrationGetTestFileDefaultResponse + >; + /** Delete file by the file name for a test */ + delete( + options?: LoadTestAdministrationDeleteTestFileParameters, + ): StreamableMethod< + | LoadTestAdministrationDeleteTestFile204Response + | LoadTestAdministrationDeleteTestFileDefaultResponse + >; +} + +export interface LoadTestAdministrationListTestFiles { + /** Get all test files. */ + get( + options?: LoadTestAdministrationListTestFilesParameters, + ): StreamableMethod< + | LoadTestAdministrationListTestFiles200Response + | LoadTestAdministrationListTestFilesDefaultResponse + >; +} + +export interface LoadTestAdministrationCreateOrUpdateAppComponents { + /** Associate an app component (collection of azure resources) to a test */ + patch( + options: LoadTestAdministrationCreateOrUpdateAppComponentsParameters, + ): StreamableMethod< + | LoadTestAdministrationCreateOrUpdateAppComponents200Response + | LoadTestAdministrationCreateOrUpdateAppComponents201Response + | LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse + >; + /** Get associated app component (collection of azure resources) for the given test. */ + get( + options?: LoadTestAdministrationGetAppComponentsParameters, + ): StreamableMethod< + | LoadTestAdministrationGetAppComponents200Response + | LoadTestAdministrationGetAppComponentsDefaultResponse + >; +} + +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfig { + /** Configure server metrics for a test */ + patch( + options: LoadTestAdministrationCreateOrUpdateServerMetricsConfigParameters, + ): StreamableMethod< + | LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response + | LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response + | LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse + >; + /** List server metrics configuration for the given test. */ + get( + options?: LoadTestAdministrationGetServerMetricsConfigParameters, + ): StreamableMethod< + | LoadTestAdministrationGetServerMetricsConfig200Response + | LoadTestAdministrationGetServerMetricsConfigDefaultResponse + >; +} + +export interface LoadTestRunCreateOrUpdateTestRun { + /** Create and start a new test run with the given name. */ + patch( + options: LoadTestRunCreateOrUpdateTestRunParameters, + ): StreamableMethod< + | LoadTestRunCreateOrUpdateTestRun200Response + | LoadTestRunCreateOrUpdateTestRun201Response + | LoadTestRunCreateOrUpdateTestRunDefaultResponse + >; + /** Get test run details by name. */ + get( + options?: LoadTestRunGetTestRunParameters, + ): StreamableMethod< + LoadTestRunGetTestRun200Response | LoadTestRunGetTestRunDefaultResponse + >; + /** Delete a test run by its name. */ + delete( + options?: LoadTestRunDeleteTestRunParameters, + ): StreamableMethod< + | LoadTestRunDeleteTestRun204Response + | LoadTestRunDeleteTestRunDefaultResponse + >; +} + +export interface LoadTestRunGetTestRunFile { + /** Get test run file by file name. */ + get( + options?: LoadTestRunGetTestRunFileParameters, + ): StreamableMethod< + | LoadTestRunGetTestRunFile200Response + | LoadTestRunGetTestRunFileDefaultResponse + >; +} + +export interface LoadTestRunListTestRuns { + /** Get all test runs with given filters */ + get( + options?: LoadTestRunListTestRunsParameters, + ): StreamableMethod< + LoadTestRunListTestRuns200Response | LoadTestRunListTestRunsDefaultResponse + >; +} + +export interface LoadTestRunStopTestRun { + /** Stop test run by name. */ + post( + options?: LoadTestRunStopTestRunParameters, + ): StreamableMethod< + LoadTestRunStopTestRun200Response | LoadTestRunStopTestRunDefaultResponse + >; +} + +export interface LoadTestRunListMetricNamespaces { + /** List the metric namespaces for a load test run. */ + get( + options?: LoadTestRunListMetricNamespacesParameters, + ): StreamableMethod< + | LoadTestRunListMetricNamespaces200Response + | LoadTestRunListMetricNamespacesDefaultResponse + >; +} + +export interface LoadTestRunListMetricDefinitions { + /** List the metric definitions for a load test run. */ + get( + options: LoadTestRunListMetricDefinitionsParameters, + ): StreamableMethod< + | LoadTestRunListMetricDefinitions200Response + | LoadTestRunListMetricDefinitionsDefaultResponse + >; +} + +export interface LoadTestRunListMetrics { + /** List the metric values for a load test run. */ + post( + options: LoadTestRunListMetricsParameters, + ): StreamableMethod< + LoadTestRunListMetrics200Response | LoadTestRunListMetricsDefaultResponse + >; +} + +export interface LoadTestRunListMetricDimensionValues { + /** List the dimension values for the given metric dimension name. */ + get( + options: LoadTestRunListMetricDimensionValuesParameters, + ): StreamableMethod< + | LoadTestRunListMetricDimensionValues200Response + | LoadTestRunListMetricDimensionValuesDefaultResponse + >; +} + +export interface LoadTestRunCreateOrUpdateAppComponents { + /** Associate an app component (collection of azure resources) to a test run */ + patch( + options: LoadTestRunCreateOrUpdateAppComponentsParameters, + ): StreamableMethod< + | LoadTestRunCreateOrUpdateAppComponents200Response + | LoadTestRunCreateOrUpdateAppComponents201Response + | LoadTestRunCreateOrUpdateAppComponentsDefaultResponse + >; + /** Get associated app component (collection of azure resources) for the given test run. */ + get( + options?: LoadTestRunGetAppComponentsParameters, + ): StreamableMethod< + | LoadTestRunGetAppComponents200Response + | LoadTestRunGetAppComponentsDefaultResponse + >; +} + +export interface LoadTestRunCreateOrUpdateServerMetricsConfig { + /** Configure server metrics for a test run */ + patch( + options: LoadTestRunCreateOrUpdateServerMetricsConfigParameters, + ): StreamableMethod< + | LoadTestRunCreateOrUpdateServerMetricsConfig200Response + | LoadTestRunCreateOrUpdateServerMetricsConfig201Response + | LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse + >; + /** List server metrics configuration for the given test run. */ + get( + options?: LoadTestRunGetServerMetricsConfigParameters, + ): StreamableMethod< + | LoadTestRunGetServerMetricsConfig200Response + | LoadTestRunGetServerMetricsConfigDefaultResponse + >; +} + +export interface Routes { + /** Resource for '/tests/\{testId\}' has methods for the following verbs: patch, delete, get */ + ( + path: "/tests/{testId}", + testId: string, + ): LoadTestAdministrationCreateOrUpdateTest; + /** Resource for '/tests' has methods for the following verbs: get */ + (path: "/tests"): LoadTestAdministrationListTests; + /** Resource for '/tests/\{testId\}/files/\{fileName\}' has methods for the following verbs: put, get, delete */ + ( + path: "/tests/{testId}/files/{fileName}", + testId: string, + fileName: string, + ): LoadTestAdministrationUploadTestFile; + /** Resource for '/tests/\{testId\}/files' has methods for the following verbs: get */ + ( + path: "/tests/{testId}/files", + testId: string, + ): LoadTestAdministrationListTestFiles; + /** Resource for '/tests/\{testId\}/app-components' has methods for the following verbs: patch, get */ + ( + path: "/tests/{testId}/app-components", + testId: string, + ): LoadTestAdministrationCreateOrUpdateAppComponents; + /** Resource for '/tests/\{testId\}/server-metrics-config' has methods for the following verbs: patch, get */ + ( + path: "/tests/{testId}/server-metrics-config", + testId: string, + ): LoadTestAdministrationCreateOrUpdateServerMetricsConfig; + /** Resource for '/test-runs/\{testRunId\}' has methods for the following verbs: patch, get, delete */ + ( + path: "/test-runs/{testRunId}", + testRunId: string, + ): LoadTestRunCreateOrUpdateTestRun; + /** Resource for '/test-runs/\{testRunId\}/files/\{fileName\}' has methods for the following verbs: get */ + ( + path: "/test-runs/{testRunId}/files/{fileName}", + testRunId: string, + fileName: string, + ): LoadTestRunGetTestRunFile; + /** Resource for '/test-runs' has methods for the following verbs: get */ + (path: "/test-runs"): LoadTestRunListTestRuns; + /** Resource for '/test-runs/\{testRunId\}:stop' has methods for the following verbs: post */ + ( + path: "/test-runs/{testRunId}:stop", + testRunId: string, + ): LoadTestRunStopTestRun; + /** Resource for '/test-runs/\{testRunId\}/metric-namespaces' has methods for the following verbs: get */ + ( + path: "/test-runs/{testRunId}/metric-namespaces", + testRunId: string, + ): LoadTestRunListMetricNamespaces; + /** Resource for '/test-runs/\{testRunId\}/metric-definitions' has methods for the following verbs: get */ + ( + path: "/test-runs/{testRunId}/metric-definitions", + testRunId: string, + ): LoadTestRunListMetricDefinitions; + /** Resource for '/test-runs/\{testRunId\}/metrics' has methods for the following verbs: post */ + ( + path: "/test-runs/{testRunId}/metrics", + testRunId: string, + ): LoadTestRunListMetrics; + /** Resource for '/test-runs/\{testRunId\}/metric-dimensions/\{name\}/values' has methods for the following verbs: get */ + ( + path: "/test-runs/{testRunId}/metric-dimensions/{name}/values", + testRunId: string, + name: string, + ): LoadTestRunListMetricDimensionValues; + /** Resource for '/test-runs/\{testRunId\}/app-components' has methods for the following verbs: patch, get */ + ( + path: "/test-runs/{testRunId}/app-components", + testRunId: string, + ): LoadTestRunCreateOrUpdateAppComponents; + /** Resource for '/test-runs/\{testRunId\}/server-metrics-config' has methods for the following verbs: patch, get */ + ( + path: "/test-runs/{testRunId}/server-metrics-config", + testRunId: string, + ): LoadTestRunCreateOrUpdateServerMetricsConfig; +} + +export type AzureLoadTestingClient = Client & { + path: Routes; +}; diff --git a/sdk/loadtesting/load-testing-rest/generated/index.ts b/sdk/loadtesting/load-testing-rest/generated/index.ts new file mode 100644 index 000000000000..74816446f6d6 --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/generated/index.ts @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import AzureLoadTesting from "./azureLoadTesting"; + +export * from "./azureLoadTesting"; +export * from "./parameters"; +export * from "./responses"; +export * from "./clientDefinitions"; +export * from "./isUnexpected"; +export * from "./models"; +export * from "./outputModels"; +export * from "./paginateHelper"; + +export default AzureLoadTesting; diff --git a/sdk/loadtesting/load-testing-rest/generated/isUnexpected.ts b/sdk/loadtesting/load-testing-rest/generated/isUnexpected.ts new file mode 100644 index 000000000000..2d1e0f0ec7e3 --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/generated/isUnexpected.ts @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + LoadTestAdministrationCreateOrUpdateTest200Response, + LoadTestAdministrationCreateOrUpdateTest201Response, + LoadTestAdministrationCreateOrUpdateTestDefaultResponse, + LoadTestAdministrationDeleteTest204Response, + LoadTestAdministrationDeleteTestDefaultResponse, + LoadTestAdministrationGetTest200Response, + LoadTestAdministrationGetTestDefaultResponse, + LoadTestAdministrationListTests200Response, + LoadTestAdministrationListTestsDefaultResponse, + LoadTestAdministrationUploadTestFile201Response, + LoadTestAdministrationUploadTestFileDefaultResponse, + LoadTestAdministrationGetTestFile200Response, + LoadTestAdministrationGetTestFileDefaultResponse, + LoadTestAdministrationDeleteTestFile204Response, + LoadTestAdministrationDeleteTestFileDefaultResponse, + LoadTestAdministrationListTestFiles200Response, + LoadTestAdministrationListTestFilesDefaultResponse, + LoadTestAdministrationCreateOrUpdateAppComponents200Response, + LoadTestAdministrationCreateOrUpdateAppComponents201Response, + LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse, + LoadTestAdministrationGetAppComponents200Response, + LoadTestAdministrationGetAppComponentsDefaultResponse, + LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response, + LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response, + LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse, + LoadTestAdministrationGetServerMetricsConfig200Response, + LoadTestAdministrationGetServerMetricsConfigDefaultResponse, + LoadTestRunCreateOrUpdateTestRun200Response, + LoadTestRunCreateOrUpdateTestRun201Response, + LoadTestRunCreateOrUpdateTestRunDefaultResponse, + LoadTestRunGetTestRun200Response, + LoadTestRunGetTestRunDefaultResponse, + LoadTestRunDeleteTestRun204Response, + LoadTestRunDeleteTestRunDefaultResponse, + LoadTestRunGetTestRunFile200Response, + LoadTestRunGetTestRunFileDefaultResponse, + LoadTestRunListTestRuns200Response, + LoadTestRunListTestRunsDefaultResponse, + LoadTestRunStopTestRun200Response, + LoadTestRunStopTestRunDefaultResponse, + LoadTestRunListMetricNamespaces200Response, + LoadTestRunListMetricNamespacesDefaultResponse, + LoadTestRunListMetricDefinitions200Response, + LoadTestRunListMetricDefinitionsDefaultResponse, + LoadTestRunListMetrics200Response, + LoadTestRunListMetricsDefaultResponse, + LoadTestRunListMetricDimensionValues200Response, + LoadTestRunListMetricDimensionValuesDefaultResponse, + LoadTestRunCreateOrUpdateAppComponents200Response, + LoadTestRunCreateOrUpdateAppComponents201Response, + LoadTestRunCreateOrUpdateAppComponentsDefaultResponse, + LoadTestRunGetAppComponents200Response, + LoadTestRunGetAppComponentsDefaultResponse, + LoadTestRunCreateOrUpdateServerMetricsConfig200Response, + LoadTestRunCreateOrUpdateServerMetricsConfig201Response, + LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse, + LoadTestRunGetServerMetricsConfig200Response, + LoadTestRunGetServerMetricsConfigDefaultResponse, +} from "./responses"; + +const responseMap: Record = { + "PATCH /tests/{testId}": ["200", "201"], + "DELETE /tests/{testId}": ["204"], + "GET /tests/{testId}": ["200"], + "GET /tests": ["200"], + "PUT /tests/{testId}/files/{fileName}": ["201"], + "GET /tests/{testId}/files/{fileName}": ["200"], + "DELETE /tests/{testId}/files/{fileName}": ["204"], + "GET /tests/{testId}/files": ["200"], + "PATCH /tests/{testId}/app-components": ["200", "201"], + "GET /tests/{testId}/app-components": ["200"], + "PATCH /tests/{testId}/server-metrics-config": ["200", "201"], + "GET /tests/{testId}/server-metrics-config": ["200"], + "PATCH /test-runs/{testRunId}": ["200", "201"], + "GET /test-runs/{testRunId}": ["200"], + "DELETE /test-runs/{testRunId}": ["204"], + "GET /test-runs/{testRunId}/files/{fileName}": ["200"], + "GET /test-runs": ["200"], + "POST /test-runs/{testRunId}:stop": ["200"], + "GET /test-runs/{testRunId}/metric-namespaces": ["200"], + "GET /test-runs/{testRunId}/metric-definitions": ["200"], + "POST /test-runs/{testRunId}/metrics": ["200"], + "GET /test-runs/{testRunId}/metric-dimensions/{name}/values": ["200"], + "PATCH /test-runs/{testRunId}/app-components": ["200", "201"], + "GET /test-runs/{testRunId}/app-components": ["200"], + "PATCH /test-runs/{testRunId}/server-metrics-config": ["200", "201"], + "GET /test-runs/{testRunId}/server-metrics-config": ["200"], +}; + +export function isUnexpected( + response: + | LoadTestAdministrationCreateOrUpdateTest200Response + | LoadTestAdministrationCreateOrUpdateTest201Response + | LoadTestAdministrationCreateOrUpdateTestDefaultResponse, +): response is LoadTestAdministrationCreateOrUpdateTestDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationDeleteTest204Response + | LoadTestAdministrationDeleteTestDefaultResponse, +): response is LoadTestAdministrationDeleteTestDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationGetTest200Response + | LoadTestAdministrationGetTestDefaultResponse, +): response is LoadTestAdministrationGetTestDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationListTests200Response + | LoadTestAdministrationListTestsDefaultResponse, +): response is LoadTestAdministrationListTestsDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationUploadTestFile201Response + | LoadTestAdministrationUploadTestFileDefaultResponse, +): response is LoadTestAdministrationUploadTestFileDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationGetTestFile200Response + | LoadTestAdministrationGetTestFileDefaultResponse, +): response is LoadTestAdministrationGetTestFileDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationDeleteTestFile204Response + | LoadTestAdministrationDeleteTestFileDefaultResponse, +): response is LoadTestAdministrationDeleteTestFileDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationListTestFiles200Response + | LoadTestAdministrationListTestFilesDefaultResponse, +): response is LoadTestAdministrationListTestFilesDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationCreateOrUpdateAppComponents200Response + | LoadTestAdministrationCreateOrUpdateAppComponents201Response + | LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse, +): response is LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationGetAppComponents200Response + | LoadTestAdministrationGetAppComponentsDefaultResponse, +): response is LoadTestAdministrationGetAppComponentsDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response + | LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response + | LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse, +): response is LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationGetServerMetricsConfig200Response + | LoadTestAdministrationGetServerMetricsConfigDefaultResponse, +): response is LoadTestAdministrationGetServerMetricsConfigDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunCreateOrUpdateTestRun200Response + | LoadTestRunCreateOrUpdateTestRun201Response + | LoadTestRunCreateOrUpdateTestRunDefaultResponse, +): response is LoadTestRunCreateOrUpdateTestRunDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunGetTestRun200Response + | LoadTestRunGetTestRunDefaultResponse, +): response is LoadTestRunGetTestRunDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunDeleteTestRun204Response + | LoadTestRunDeleteTestRunDefaultResponse, +): response is LoadTestRunDeleteTestRunDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunGetTestRunFile200Response + | LoadTestRunGetTestRunFileDefaultResponse, +): response is LoadTestRunGetTestRunFileDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunListTestRuns200Response + | LoadTestRunListTestRunsDefaultResponse, +): response is LoadTestRunListTestRunsDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunStopTestRun200Response + | LoadTestRunStopTestRunDefaultResponse, +): response is LoadTestRunStopTestRunDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunListMetricNamespaces200Response + | LoadTestRunListMetricNamespacesDefaultResponse, +): response is LoadTestRunListMetricNamespacesDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunListMetricDefinitions200Response + | LoadTestRunListMetricDefinitionsDefaultResponse, +): response is LoadTestRunListMetricDefinitionsDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunListMetrics200Response + | LoadTestRunListMetricsDefaultResponse, +): response is LoadTestRunListMetricsDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunListMetricDimensionValues200Response + | LoadTestRunListMetricDimensionValuesDefaultResponse, +): response is LoadTestRunListMetricDimensionValuesDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunCreateOrUpdateAppComponents200Response + | LoadTestRunCreateOrUpdateAppComponents201Response + | LoadTestRunCreateOrUpdateAppComponentsDefaultResponse, +): response is LoadTestRunCreateOrUpdateAppComponentsDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunGetAppComponents200Response + | LoadTestRunGetAppComponentsDefaultResponse, +): response is LoadTestRunGetAppComponentsDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunCreateOrUpdateServerMetricsConfig200Response + | LoadTestRunCreateOrUpdateServerMetricsConfig201Response + | LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse, +): response is LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunGetServerMetricsConfig200Response + | LoadTestRunGetServerMetricsConfigDefaultResponse, +): response is LoadTestRunGetServerMetricsConfigDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationCreateOrUpdateTest200Response + | LoadTestAdministrationCreateOrUpdateTest201Response + | LoadTestAdministrationCreateOrUpdateTestDefaultResponse + | LoadTestAdministrationDeleteTest204Response + | LoadTestAdministrationDeleteTestDefaultResponse + | LoadTestAdministrationGetTest200Response + | LoadTestAdministrationGetTestDefaultResponse + | LoadTestAdministrationListTests200Response + | LoadTestAdministrationListTestsDefaultResponse + | LoadTestAdministrationUploadTestFile201Response + | LoadTestAdministrationUploadTestFileDefaultResponse + | LoadTestAdministrationGetTestFile200Response + | LoadTestAdministrationGetTestFileDefaultResponse + | LoadTestAdministrationDeleteTestFile204Response + | LoadTestAdministrationDeleteTestFileDefaultResponse + | LoadTestAdministrationListTestFiles200Response + | LoadTestAdministrationListTestFilesDefaultResponse + | LoadTestAdministrationCreateOrUpdateAppComponents200Response + | LoadTestAdministrationCreateOrUpdateAppComponents201Response + | LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse + | LoadTestAdministrationGetAppComponents200Response + | LoadTestAdministrationGetAppComponentsDefaultResponse + | LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response + | LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response + | LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse + | LoadTestAdministrationGetServerMetricsConfig200Response + | LoadTestAdministrationGetServerMetricsConfigDefaultResponse + | LoadTestRunCreateOrUpdateTestRun200Response + | LoadTestRunCreateOrUpdateTestRun201Response + | LoadTestRunCreateOrUpdateTestRunDefaultResponse + | LoadTestRunGetTestRun200Response + | LoadTestRunGetTestRunDefaultResponse + | LoadTestRunDeleteTestRun204Response + | LoadTestRunDeleteTestRunDefaultResponse + | LoadTestRunGetTestRunFile200Response + | LoadTestRunGetTestRunFileDefaultResponse + | LoadTestRunListTestRuns200Response + | LoadTestRunListTestRunsDefaultResponse + | LoadTestRunStopTestRun200Response + | LoadTestRunStopTestRunDefaultResponse + | LoadTestRunListMetricNamespaces200Response + | LoadTestRunListMetricNamespacesDefaultResponse + | LoadTestRunListMetricDefinitions200Response + | LoadTestRunListMetricDefinitionsDefaultResponse + | LoadTestRunListMetrics200Response + | LoadTestRunListMetricsDefaultResponse + | LoadTestRunListMetricDimensionValues200Response + | LoadTestRunListMetricDimensionValuesDefaultResponse + | LoadTestRunCreateOrUpdateAppComponents200Response + | LoadTestRunCreateOrUpdateAppComponents201Response + | LoadTestRunCreateOrUpdateAppComponentsDefaultResponse + | LoadTestRunGetAppComponents200Response + | LoadTestRunGetAppComponentsDefaultResponse + | LoadTestRunCreateOrUpdateServerMetricsConfig200Response + | LoadTestRunCreateOrUpdateServerMetricsConfig201Response + | LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse + | LoadTestRunGetServerMetricsConfig200Response + | LoadTestRunGetServerMetricsConfigDefaultResponse, +): response is + | LoadTestAdministrationCreateOrUpdateTestDefaultResponse + | LoadTestAdministrationDeleteTestDefaultResponse + | LoadTestAdministrationGetTestDefaultResponse + | LoadTestAdministrationListTestsDefaultResponse + | LoadTestAdministrationUploadTestFileDefaultResponse + | LoadTestAdministrationGetTestFileDefaultResponse + | LoadTestAdministrationDeleteTestFileDefaultResponse + | LoadTestAdministrationListTestFilesDefaultResponse + | LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse + | LoadTestAdministrationGetAppComponentsDefaultResponse + | LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse + | LoadTestAdministrationGetServerMetricsConfigDefaultResponse + | LoadTestRunCreateOrUpdateTestRunDefaultResponse + | LoadTestRunGetTestRunDefaultResponse + | LoadTestRunDeleteTestRunDefaultResponse + | LoadTestRunGetTestRunFileDefaultResponse + | LoadTestRunListTestRunsDefaultResponse + | LoadTestRunStopTestRunDefaultResponse + | LoadTestRunListMetricNamespacesDefaultResponse + | LoadTestRunListMetricDefinitionsDefaultResponse + | LoadTestRunListMetricsDefaultResponse + | LoadTestRunListMetricDimensionValuesDefaultResponse + | LoadTestRunCreateOrUpdateAppComponentsDefaultResponse + | LoadTestRunGetAppComponentsDefaultResponse + | LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse + | LoadTestRunGetServerMetricsConfigDefaultResponse { + 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 = getParametrizedPathSuccess(method, url.pathname); + } + return !pathDetails.includes(response.status); +} + +function getParametrizedPathSuccess(method: string, path: string): string[] { + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: string[] = []; + + // 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("/"); + + // track if we have found a match to return the values found. + let found = true; + for ( + let i = candidateParts.length - 1, j = pathParts.length - 1; + i >= 1 && j >= 1; + i--, j-- + ) { + if ( + candidateParts[i]?.startsWith("{") && + candidateParts[i]?.indexOf("}") !== -1 + ) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp( + `${candidateParts[i]?.slice(start, end)}`, + ).test(pathParts[j] || ""); + + if (!isMatched) { + found = false; + break; + } + 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[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/sdk/loadtesting/load-testing-rest/generated/logger.ts b/sdk/loadtesting/load-testing-rest/generated/logger.ts new file mode 100644 index 000000000000..31a2389c94d0 --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/generated/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("load-testing"); diff --git a/sdk/loadtesting/load-testing-rest/generated/models.ts b/sdk/loadtesting/load-testing-rest/generated/models.ts new file mode 100644 index 000000000000..0cf8fee62428 --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/generated/models.ts @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** Load test model */ +export interface Test { + /** Pass fail criteria for a test. */ + passFailCriteria?: PassFailCriteria; + /** 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; + /** Certificates metadata */ + certificate?: CertificateMetadata; + /** Environment variables which are defined as a set of pairs. */ + environmentVariables?: Record; + /** The load test configuration. */ + loadTestConfiguration?: LoadTestConfiguration; + /** 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; +} + +/** Pass fail criteria for a test. */ +export interface PassFailCriteria { + /** Map of id and pass fail metrics { id : pass fail metrics }. */ + passFailMetrics?: Record; +} + +/** Pass fail metric */ +export interface PassFailMetric { + /** 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?: "continue" | "stop"; +} + +/** Secret */ +export interface Secret { + /** The value of the secret for the respective type */ + value?: string; + /** Type of secret */ + type?: "AKV_SECRET_URI" | "SECRET_VALUE"; +} + +/** Certificates metadata */ +export interface CertificateMetadata { + /** 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 LoadTestConfiguration { + /** 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; + /** If false, Azure Load Testing copies and processes your input files unmodified across all test engine instances. If true, Azure Load Testing splits the CSV input data evenly across all engine instances. If you provide multiple CSV files, each file will be split evenly. */ + splitAllCSVs?: boolean; + /** If true, optionalLoadTestConfig is required and JMX script for the load test is not required to upload. */ + quickStartTest?: boolean; + /** Optional load test config */ + optionalLoadTestConfig?: OptionalLoadTestConfig; +} + +/** Optional load test config */ +export interface OptionalLoadTestConfig { + /** Test URL. Provide the complete HTTP URL. For example, http://contoso-app.azurewebsites.net/login */ + endpointUrl?: string; + /** No of concurrent virtual users */ + virtualUsers?: number; + /** Ramp up time */ + rampUpTime?: number; + /** Test run duration */ + duration?: number; +} + +/** The input artifacts for the test. */ +export interface TestInputArtifacts { + /** File info */ + configFileInfo?: FileInfo; + /** File info */ + testScriptFileInfo?: FileInfo; + /** File info */ + userPropFileInfo?: FileInfo; + /** File info */ + inputArtifactsZipFileInfo?: FileInfo; +} + +/** File info */ +export interface FileInfo { + /** File URL. */ + url?: string; + /** Name of the file. */ + fileName?: string; + /** File type */ + fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; + /** Expiry time of the file (ISO 8601 literal format) */ + expireDateTime?: Date | string; + /** Validation status of the file */ + validationStatus?: + | "NOT_VALIDATED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE" + | "VALIDATION_INITIATED" + | "VALIDATION_NOT_REQUIRED"; + /** Validation failure error details */ + validationFailureDetails?: string; +} + +/** Test app component */ +export interface TestAppComponents { + /** Azure resource collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object } */ + components: 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 { + /** 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; + /** Kind of Azure resource type */ + kind?: string; +} + +/** Test server metrics configuration */ +export interface TestServerMetricConfig { + /** Azure resource metrics collection {metric id : metrics object} (Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition for metric id). */ + 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 ResourceMetric { + /** Azure resource id. */ + resourceId: string; + /** Metric name space. */ + metricNamespace: string; + /** Metric description. */ + displayDescription?: string; + /** The invariant value of metric name */ + name: string; + /** Metric aggregation. */ + aggregation: string; + /** Metric unit. */ + unit?: string; + /** Azure resource type. */ + resourceType: string; +} + +/** Load test run model */ +export interface TestRun { + /** Pass fail criteria for a test. */ + passFailCriteria?: PassFailCriteria; + /** 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; + /** Certificates metadata */ + certificate?: CertificateMetadata; + /** Environment variables which are defined as a set of pairs. */ + environmentVariables?: Record; + /** The load test configuration. */ + loadTestConfiguration?: LoadTestConfiguration; + /** Display name of a testRun. */ + displayName?: string; + /** Associated test Id. */ + testId?: string; + /** The test run description. */ + description?: string; +} + +/** Error details if there is any failure in load test run */ +export interface ErrorDetails {} + +/** Test run statistics. */ +export interface TestRunStatistics {} + +/** Collection of test run artifacts */ +export interface TestRunArtifacts { + /** The output artifacts for the test run. */ + outputArtifacts?: TestRunOutputArtifacts; +} + +/** The input artifacts for the test run. */ +export interface TestRunInputArtifacts { + /** File info */ + configFileInfo?: FileInfo; + /** File info */ + testScriptFileInfo?: FileInfo; + /** File info */ + userPropFileInfo?: FileInfo; + /** File info */ + inputArtifactsZipFileInfo?: FileInfo; +} + +/** The output artifacts for the test run. */ +export interface TestRunOutputArtifacts { + /** File info */ + resultFileInfo?: FileInfo; + /** File info */ + logsFileInfo?: FileInfo; +} + +/** Filters to fetch the set of metric */ +export interface MetricRequestPayload { + /** Get metrics for specific dimension values. Example: Metric contains dimension like SamplerName, Error. To retrieve all the time series data where SamplerName is equals to HTTPRequest1 or HTTPRequest2, the DimensionFilter value will be {"SamplerName", ["HTTPRequest1", "HTTPRequest2"} */ + filters?: Array; +} + +/** Dimension name and values to filter */ +export interface DimensionFilter { + /** The dimension name */ + name?: string; + /** The dimension values. Maximum values can be 20. */ + values?: Array; +} + +/** Test run app component */ +export interface TestRunAppComponents { + /** Azure resource collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object } */ + components: Record; +} + +/** Test run server metrics configuration */ +export interface TestRunServerMetricConfig { + /** Azure resource metrics collection {metric id : metrics object} (Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition for metric id). */ + metrics?: Record; +} diff --git a/sdk/loadtesting/load-testing-rest/src/outputModels.ts b/sdk/loadtesting/load-testing-rest/generated/outputModels.ts similarity index 85% rename from sdk/loadtesting/load-testing-rest/src/outputModels.ts rename to sdk/loadtesting/load-testing-rest/generated/outputModels.ts index 3dbe80add481..77c0f7de0544 100644 --- a/sdk/loadtesting/load-testing-rest/src/outputModels.ts +++ b/sdk/loadtesting/load-testing-rest/generated/outputModels.ts @@ -14,9 +14,9 @@ export interface TestOutput { /** The load test configuration. */ loadTestConfiguration?: LoadTestConfigurationOutput; /** The input artifacts for the test. */ - inputArtifacts?: TestInputArtifactsOutput; + readonly inputArtifacts?: TestInputArtifactsOutput; /** Unique test name as identifier. */ - testId?: string; + readonly testId?: string; /** The test description. */ description?: string; /** Display name of a test. */ @@ -28,13 +28,13 @@ export interface TestOutput { /** Resource Id of the managed identity referencing the Key vault. */ keyvaultReferenceIdentityId?: string; /** The creation datetime(ISO 8601 literal format). */ - createdDateTime?: string; + readonly createdDateTime?: string; /** The user that created. */ - createdBy?: string; + readonly createdBy?: string; /** The last Modified datetime(ISO 8601 literal format). */ - lastModifiedDateTime?: string; + readonly lastModifiedDateTime?: string; /** The user that last modified. */ - lastModifiedBy?: string; + readonly lastModifiedBy?: string; } /** Pass fail criteria for a test. */ @@ -46,9 +46,23 @@ export interface PassFailCriteriaOutput { /** Pass fail metric */ export interface PassFailMetricOutput { /** The client metric on which the criteria should be applied. */ - clientMetric?: "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; + 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"; + 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 */ @@ -56,11 +70,11 @@ export interface PassFailMetricOutput { /** 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"; + action?: "continue" | "stop"; /** The actual value of the client metric for the test run. */ - actualValue?: number; + readonly actualValue?: number; /** Outcome of the test run. */ - result?: "passed" | "undetermined" | "failed"; + readonly result?: "passed" | "undetermined" | "failed"; } /** Secret */ @@ -116,7 +130,7 @@ export interface TestInputArtifactsOutput { /** File info */ inputArtifactsZipFileInfo?: FileInfoOutput; /** Additional supported files for the test run */ - additionalFileInfo?: Array; + readonly additionalFileInfo?: Array; } /** File info */ @@ -179,21 +193,21 @@ export interface TestAppComponentsOutput { /** Azure resource collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object } */ components: Record; /** Test identifier */ - testId?: string; + readonly testId?: string; /** The creation datetime(ISO 8601 literal format). */ - createdDateTime?: string; + readonly createdDateTime?: string; /** The user that created. */ - createdBy?: string; + readonly createdBy?: string; /** The last Modified datetime(ISO 8601 literal format). */ - lastModifiedDateTime?: string; + readonly lastModifiedDateTime?: string; /** The user that last modified. */ - lastModifiedBy?: string; + readonly lastModifiedBy?: string; } /** 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; + readonly resourceId?: string; /** Azure resource name, required while creating the app component. */ resourceName?: string; /** Azure resource type, required while creating the app component. */ @@ -201,9 +215,9 @@ export interface AppComponentOutput { /** Azure resource display name */ displayName?: string; /** Resource group name of the Azure resource */ - resourceGroup?: string; + readonly resourceGroup?: string; /** Subscription Id of the Azure resource */ - subscriptionId?: string; + readonly subscriptionId?: string; /** Kind of Azure resource type */ kind?: string; } @@ -211,23 +225,23 @@ export interface AppComponentOutput { /** Test server metrics configuration */ export interface TestServerMetricConfigOutput { /** Test identifier */ - testId?: string; + readonly testId?: string; /** Azure resource metrics collection {metric id : metrics object} (Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition for metric id). */ metrics?: Record; /** The creation datetime(ISO 8601 literal format). */ - createdDateTime?: string; + readonly createdDateTime?: string; /** The user that created. */ - createdBy?: string; + readonly createdBy?: string; /** The last Modified datetime(ISO 8601 literal format). */ - lastModifiedDateTime?: string; + readonly lastModifiedDateTime?: string; /** The user that last modified. */ - lastModifiedBy?: string; + readonly lastModifiedBy?: string; } /** 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 ResourceMetricOutput { /** Unique name for metric. */ - id?: string; + readonly id?: string; /** Azure resource id. */ resourceId: string; /** Metric name space. */ @@ -255,19 +269,19 @@ export interface TestRunOutput { /** 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; + readonly errorDetails?: Array; /** Test run statistics. */ - testRunStatistics?: Record; + readonly testRunStatistics?: Record; /** The load test configuration. */ loadTestConfiguration?: LoadTestConfigurationOutput; /** Collection of test run artifacts */ - testArtifacts?: TestRunArtifactsOutput; + readonly testArtifacts?: TestRunArtifactsOutput; /** Test result for pass/Fail criteria used during the test run. */ - testResult?: "PASSED" | "NOT_APPLICABLE" | "FAILED"; + readonly testResult?: "PASSED" | "NOT_APPLICABLE" | "FAILED"; /** Number of virtual users, for which test has been run. */ - virtualUsers?: number; + readonly virtualUsers?: number; /** Unique test run name as identifier */ - testRunId?: string; + readonly testRunId?: string; /** Display name of a testRun. */ displayName?: string; /** Associated test Id. */ @@ -275,7 +289,7 @@ export interface TestRunOutput { /** The test run description. */ description?: string; /** The test run status. */ - status?: + readonly status?: | "ACCEPTED" | "NOTSTARTED" | "PROVISIONING" @@ -293,69 +307,69 @@ export interface TestRunOutput { | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE"; /** The test run start DateTime(ISO 8601 literal format). */ - startDateTime?: string; + readonly startDateTime?: string; /** The test run end DateTime(ISO 8601 literal format). */ - endDateTime?: string; + readonly endDateTime?: string; /** Test run initiated time. */ - executedDateTime?: string; + readonly executedDateTime?: string; /** Portal url. */ - portalUrl?: string; + readonly portalUrl?: string; /** Test run duration in milliseconds. */ - duration?: number; + readonly duration?: number; /** Subnet ID on which the load test instances should run. */ - subnetId?: string; + readonly subnetId?: string; /** The creation datetime(ISO 8601 literal format). */ - createdDateTime?: string; + readonly createdDateTime?: string; /** The user that created. */ - createdBy?: string; + readonly createdBy?: string; /** The last Modified datetime(ISO 8601 literal format). */ - lastModifiedDateTime?: string; + readonly lastModifiedDateTime?: string; /** The user that last modified. */ - lastModifiedBy?: string; + readonly lastModifiedBy?: string; } /** Error details if there is any failure in load test run */ export interface ErrorDetailsOutput { /** Error details in case test run was not successfully run. */ - message?: string; + readonly message?: string; } /** Test run statistics. */ export interface TestRunStatisticsOutput { /** Transaction name. */ - transaction?: string; + readonly transaction?: string; /** Sampler count. */ - sampleCount?: number; + readonly sampleCount?: number; /** Error count. */ - errorCount?: number; + readonly errorCount?: number; /** Error percentage. */ - errorPct?: number; + readonly errorPct?: number; /** Mean response time. */ - meanResTime?: number; + readonly meanResTime?: number; /** Median response time. */ - medianResTime?: number; + readonly medianResTime?: number; /** Max response time. */ - maxResTime?: number; + readonly maxResTime?: number; /** Minimum response time. */ - minResTime?: number; + readonly minResTime?: number; /** 90 percentile response time. */ - pct1ResTime?: number; + readonly pct1ResTime?: number; /** 95 percentile response time. */ - pct2ResTime?: number; + readonly pct2ResTime?: number; /** 99 percentile response time. */ - pct3ResTime?: number; + readonly pct3ResTime?: number; /** Throughput. */ - throughput?: number; + readonly throughput?: number; /** Received network bytes. */ - receivedKBytesPerSec?: number; + readonly receivedKBytesPerSec?: number; /** Send network bytes. */ - sentKBytesPerSec?: number; + readonly sentKBytesPerSec?: number; } /** Collection of test run artifacts */ export interface TestRunArtifactsOutput { /** The input artifacts for the test run. */ - inputArtifacts?: TestRunInputArtifactsOutput; + readonly inputArtifacts?: TestRunInputArtifactsOutput; /** The output artifacts for the test run. */ outputArtifacts?: TestRunOutputArtifactsOutput; } @@ -371,7 +385,7 @@ export interface TestRunInputArtifactsOutput { /** File info */ inputArtifactsZipFileInfo?: FileInfoOutput; /** Additional supported files for the test run */ - additionalFileInfo?: Array; + readonly additionalFileInfo?: Array; } /** The output artifacts for the test run. */ @@ -462,7 +476,7 @@ export interface MetricAvailabilityOutput { /** The response to a metrics query. */ export interface MetricsOutput { /** Timeseries data for metric query. */ - timeseries?: Array; + value?: Array; /** Link for the next set of timeseries in case of paginated results, if applicable */ nextLink?: string; } @@ -504,29 +518,29 @@ export interface TestRunAppComponentsOutput { /** Azure resource collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object } */ components: Record; /** Test run identifier */ - testRunId?: string; + readonly testRunId?: string; /** The creation datetime(ISO 8601 literal format). */ - createdDateTime?: string; + readonly createdDateTime?: string; /** The user that created. */ - createdBy?: string; + readonly createdBy?: string; /** The last Modified datetime(ISO 8601 literal format). */ - lastModifiedDateTime?: string; + readonly lastModifiedDateTime?: string; /** The user that last modified. */ - lastModifiedBy?: string; + readonly lastModifiedBy?: string; } /** Test run server metrics configuration */ export interface TestRunServerMetricConfigOutput { /** Test run identifier */ - testRunId?: string; + readonly testRunId?: string; /** Azure resource metrics collection {metric id : metrics object} (Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition for metric id). */ metrics?: Record; /** The creation datetime(ISO 8601 literal format). */ - createdDateTime?: string; + readonly createdDateTime?: string; /** The user that created. */ - createdBy?: string; + readonly createdBy?: string; /** The last Modified datetime(ISO 8601 literal format). */ - lastModifiedDateTime?: string; + readonly lastModifiedDateTime?: string; /** The user that last modified. */ - lastModifiedBy?: string; + readonly lastModifiedBy?: string; } diff --git a/sdk/loadtesting/load-testing-rest/src/paginateHelper.ts b/sdk/loadtesting/load-testing-rest/generated/paginateHelper.ts similarity index 87% rename from sdk/loadtesting/load-testing-rest/src/paginateHelper.ts rename to sdk/loadtesting/load-testing-rest/generated/paginateHelper.ts index e27846d32a90..94d5220235d9 100644 --- a/sdk/loadtesting/load-testing-rest/src/paginateHelper.ts +++ b/sdk/loadtesting/load-testing-rest/generated/paginateHelper.ts @@ -1,8 +1,16 @@ // 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"; +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 @@ -67,7 +75,9 @@ export function paginate( typeof customGetPage === "function" ? customGetPage : async (pageLink: string) => { - const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get(); + const result = firstRun + ? initialResponse + : await client.pathUnchecked(pageLink).get(); firstRun = false; checkPagingRequest(result); const nextLink = getNextLink(result.body, nextLinkName); @@ -93,7 +103,9 @@ function getNextLink(body: unknown, nextLinkName?: string): string | undefined { const nextLink = (body as Record)[nextLinkName]; if (typeof nextLink !== "string" && typeof nextLink !== "undefined") { - throw new Error(`Body Property ${nextLinkName} should be a string or undefined`); + throw new Error( + `Body Property ${nextLinkName} should be a string or undefined`, + ); } return nextLink; @@ -121,7 +133,18 @@ function getElements(body: unknown, itemName: string): T[] { * Checks if a request failed */ function checkPagingRequest(response: PathUncheckedResponse): void { - const Http2xxStatusCodes = ["200", "201", "202", "203", "204", "205", "206", "207", "208", "226"]; + const Http2xxStatusCodes = [ + "200", + "201", + "202", + "203", + "204", + "205", + "206", + "207", + "208", + "226", + ]; if (!Http2xxStatusCodes.includes(response.status)) { throw createRestError( `Pagination failed with unexpected statusCode ${response.status}`, diff --git a/sdk/loadtesting/load-testing-rest/generated/parameters.ts b/sdk/loadtesting/load-testing-rest/generated/parameters.ts new file mode 100644 index 000000000000..d34454af3ad6 --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/generated/parameters.ts @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { RequestParameters } from "@azure-rest/core-client"; +import { + Test, + TestAppComponents, + TestServerMetricConfig, + TestRun, + MetricRequestPayload, + TestRunAppComponents, + TestRunServerMetricConfig, +} from "./models"; + +/** Load test model */ +export type TestResourceMergeAndPatch = Partial; + +export interface LoadTestAdministrationCreateOrUpdateTestBodyParam { + /** Load test model */ + body: TestResourceMergeAndPatch; +} + +export interface LoadTestAdministrationCreateOrUpdateTestMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type LoadTestAdministrationCreateOrUpdateTestParameters = + LoadTestAdministrationCreateOrUpdateTestMediaTypesParam & + LoadTestAdministrationCreateOrUpdateTestBodyParam & + RequestParameters; +export type LoadTestAdministrationDeleteTestParameters = RequestParameters; +export type LoadTestAdministrationGetTestParameters = RequestParameters; + +export interface LoadTestAdministrationListTestsQueryParamProperties { + /** Sort on the supported fields in (field asc/desc) format. eg: lastModifiedDateTime asc. Supported fields - lastModifiedDateTime */ + orderby?: string; + /** Prefix based, case sensitive search on searchable fields - displayName, createdBy. For example, to search for a test, with display name is Login Test, the search parameter can be Login. */ + search?: string; + /** Start DateTime(ISO 8601 literal format) of the last updated time range to filter tests. */ + lastModifiedStartTime?: Date | string; + /** End DateTime(ISO 8601 literal format) of the last updated time range to filter tests. */ + lastModifiedEndTime?: Date | string; + /** Number of results in response. */ + maxpagesize?: number; +} + +export interface LoadTestAdministrationListTestsQueryParam { + queryParameters?: LoadTestAdministrationListTestsQueryParamProperties; +} + +export type LoadTestAdministrationListTestsParameters = + LoadTestAdministrationListTestsQueryParam & RequestParameters; + +export interface LoadTestAdministrationUploadTestFileBodyParam { + /** + * The file content as application/octet-stream. + * + * Value may contain any sequence of octets + */ + body: + | string + | Uint8Array + | ReadableStream + | NodeJS.ReadableStream; +} + +export interface LoadTestAdministrationUploadTestFileQueryParamProperties { + /** File type */ + fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; +} + +export interface LoadTestAdministrationUploadTestFileQueryParam { + queryParameters?: LoadTestAdministrationUploadTestFileQueryParamProperties; +} + +export interface LoadTestAdministrationUploadTestFileMediaTypesParam { + /** Request content type */ + contentType?: "application/octet-stream"; +} + +export type LoadTestAdministrationUploadTestFileParameters = + LoadTestAdministrationUploadTestFileQueryParam & + LoadTestAdministrationUploadTestFileMediaTypesParam & + LoadTestAdministrationUploadTestFileBodyParam & + RequestParameters; +export type LoadTestAdministrationGetTestFileParameters = RequestParameters; +export type LoadTestAdministrationDeleteTestFileParameters = RequestParameters; +export type LoadTestAdministrationListTestFilesParameters = RequestParameters; +/** App Component model. */ +export type TestAppComponentsResourceMergeAndPatch = Partial; + +export interface LoadTestAdministrationCreateOrUpdateAppComponentsBodyParam { + /** App Component model. */ + body: TestAppComponentsResourceMergeAndPatch; +} + +export interface LoadTestAdministrationCreateOrUpdateAppComponentsMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type LoadTestAdministrationCreateOrUpdateAppComponentsParameters = + LoadTestAdministrationCreateOrUpdateAppComponentsMediaTypesParam & + LoadTestAdministrationCreateOrUpdateAppComponentsBodyParam & + RequestParameters; +export type LoadTestAdministrationGetAppComponentsParameters = + RequestParameters; +/** Server metric configuration model. */ +export type TestServerMetricConfigResourceMergeAndPatch = + Partial; + +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigBodyParam { + /** Server metric configuration model. */ + body: TestServerMetricConfigResourceMergeAndPatch; +} + +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type LoadTestAdministrationCreateOrUpdateServerMetricsConfigParameters = + LoadTestAdministrationCreateOrUpdateServerMetricsConfigMediaTypesParam & + LoadTestAdministrationCreateOrUpdateServerMetricsConfigBodyParam & + RequestParameters; +export type LoadTestAdministrationGetServerMetricsConfigParameters = + RequestParameters; +/** Load test run model */ +export type TestRunResourceMergeAndPatch = Partial; + +export interface LoadTestRunCreateOrUpdateTestRunBodyParam { + /** Load test run model */ + body: TestRunResourceMergeAndPatch; +} + +export interface LoadTestRunCreateOrUpdateTestRunQueryParamProperties { + /** Existing test run identifier that should be rerun, if this is provided, the test will run with the JMX file, configuration and app components from the existing test run. You can override the configuration values for new test run in the request body. */ + oldTestRunId?: string; +} + +export interface LoadTestRunCreateOrUpdateTestRunQueryParam { + queryParameters?: LoadTestRunCreateOrUpdateTestRunQueryParamProperties; +} + +export interface LoadTestRunCreateOrUpdateTestRunMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type LoadTestRunCreateOrUpdateTestRunParameters = + LoadTestRunCreateOrUpdateTestRunQueryParam & + LoadTestRunCreateOrUpdateTestRunMediaTypesParam & + LoadTestRunCreateOrUpdateTestRunBodyParam & + RequestParameters; +export type LoadTestRunGetTestRunParameters = RequestParameters; +export type LoadTestRunDeleteTestRunParameters = RequestParameters; +export type LoadTestRunGetTestRunFileParameters = RequestParameters; + +export interface LoadTestRunListTestRunsQueryParamProperties { + /** Sort on the supported fields in (field asc/desc) format. eg: executedDateTime asc. Supported fields - executedDateTime */ + orderby?: string; + /** Prefix based, case sensitive search on searchable fields - description, executedUser. For example, to search for a test run, with description 500 VUs, the search parameter can be 500. */ + search?: string; + /** Unique name of an existing load test. */ + testId?: string; + /** Start DateTime(ISO 8601 literal format) of test-run execution time filter range. */ + executionFrom?: Date | string; + /** End 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 LoadTestRunListTestRunsQueryParam { + queryParameters?: LoadTestRunListTestRunsQueryParamProperties; +} + +export type LoadTestRunListTestRunsParameters = + LoadTestRunListTestRunsQueryParam & RequestParameters; +export type LoadTestRunStopTestRunParameters = RequestParameters; +export type LoadTestRunListMetricNamespacesParameters = RequestParameters; + +export interface LoadTestRunListMetricDefinitionsQueryParamProperties { + /** Metric namespace to query metric definitions for. */ + metricNamespace: string; +} + +export interface LoadTestRunListMetricDefinitionsQueryParam { + queryParameters: LoadTestRunListMetricDefinitionsQueryParamProperties; +} + +export type LoadTestRunListMetricDefinitionsParameters = + LoadTestRunListMetricDefinitionsQueryParam & RequestParameters; + +export interface LoadTestRunListMetricsBodyParam { + /** Metric dimension filter */ + body?: MetricRequestPayload; +} + +export interface LoadTestRunListMetricsQueryParamProperties { + /** The aggregation */ + 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; + /** The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. */ + timespan: string; +} + +export interface LoadTestRunListMetricsQueryParam { + queryParameters: LoadTestRunListMetricsQueryParamProperties; +} + +export interface LoadTestRunListMetricsMediaTypesParam { + /** Request content type */ + contentType?: "application/json"; +} + +export type LoadTestRunListMetricsParameters = + LoadTestRunListMetricsQueryParam & + LoadTestRunListMetricsMediaTypesParam & + LoadTestRunListMetricsBodyParam & + RequestParameters; + +export interface LoadTestRunListMetricDimensionValuesQueryParamProperties { + /** 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; + /** The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. */ + timespan: string; +} + +export interface LoadTestRunListMetricDimensionValuesQueryParam { + queryParameters: LoadTestRunListMetricDimensionValuesQueryParamProperties; +} + +export type LoadTestRunListMetricDimensionValuesParameters = + LoadTestRunListMetricDimensionValuesQueryParam & RequestParameters; +/** App Component model. */ +export type TestRunAppComponentsResourceMergeAndPatch = + Partial; + +export interface LoadTestRunCreateOrUpdateAppComponentsBodyParam { + /** App Component model. */ + body: TestRunAppComponentsResourceMergeAndPatch; +} + +export interface LoadTestRunCreateOrUpdateAppComponentsMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type LoadTestRunCreateOrUpdateAppComponentsParameters = + LoadTestRunCreateOrUpdateAppComponentsMediaTypesParam & + LoadTestRunCreateOrUpdateAppComponentsBodyParam & + RequestParameters; +export type LoadTestRunGetAppComponentsParameters = RequestParameters; +/** Server metric configuration model. */ +export type TestRunServerMetricConfigResourceMergeAndPatch = + Partial; + +export interface LoadTestRunCreateOrUpdateServerMetricsConfigBodyParam { + /** Server metric configuration model. */ + body: TestRunServerMetricConfigResourceMergeAndPatch; +} + +export interface LoadTestRunCreateOrUpdateServerMetricsConfigMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type LoadTestRunCreateOrUpdateServerMetricsConfigParameters = + LoadTestRunCreateOrUpdateServerMetricsConfigMediaTypesParam & + LoadTestRunCreateOrUpdateServerMetricsConfigBodyParam & + RequestParameters; +export type LoadTestRunGetServerMetricsConfigParameters = RequestParameters; diff --git a/sdk/loadtesting/load-testing-rest/src/responses.ts b/sdk/loadtesting/load-testing-rest/generated/responses.ts similarity index 52% rename from sdk/loadtesting/load-testing-rest/src/responses.ts rename to sdk/loadtesting/load-testing-rest/generated/responses.ts index d76ff1ceb9b0..85eaed1fa2d0 100644 --- a/sdk/loadtesting/load-testing-rest/src/responses.ts +++ b/sdk/loadtesting/load-testing-rest/generated/responses.ts @@ -22,505 +22,553 @@ import { } from "./outputModels"; /** Create a new test or update an existing test. */ -export interface TestCreateOrUpdate200Response extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateTest200Response + extends HttpResponse { status: "200"; body: TestOutput; } /** Create a new test or update an existing test. */ -export interface TestCreateOrUpdate201Response extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateTest201Response + extends HttpResponse { status: "201"; body: TestOutput; } -export interface TestCreateOrUpdateDefaultHeaders { +export interface LoadTestAdministrationCreateOrUpdateTestDefaultHeaders { /** 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 { +export interface LoadTestAdministrationCreateOrUpdateTestDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestCreateOrUpdateDefaultHeaders; + headers: RawHttpHeaders & + LoadTestAdministrationCreateOrUpdateTestDefaultHeaders; } /** Delete a test by its name. */ -export interface TestDelete204Response extends HttpResponse { +export interface LoadTestAdministrationDeleteTest204Response + extends HttpResponse { status: "204"; - body: Record; } -export interface TestDeleteDefaultHeaders { +export interface LoadTestAdministrationDeleteTestDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** Delete a test by its name. */ -export interface TestDeleteDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationDeleteTestDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestDeleteDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationDeleteTestDefaultHeaders; } /** Get load test details by test name */ -export interface TestGet200Response extends HttpResponse { +export interface LoadTestAdministrationGetTest200Response extends HttpResponse { status: "200"; body: TestOutput; } -export interface TestGetDefaultHeaders { +export interface LoadTestAdministrationGetTestDefaultHeaders { /** 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 { +export interface LoadTestAdministrationGetTestDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestGetDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationGetTestDefaultHeaders; } /** 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 { +export interface LoadTestAdministrationListTests200Response + extends HttpResponse { status: "200"; body: TestsListOutput; } -export interface TestListDefaultHeaders { +export interface LoadTestAdministrationListTestsDefaultHeaders { /** 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 { +export interface LoadTestAdministrationListTestsDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestListDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationListTestsDefaultHeaders; } /** Upload input file for a given test name. File size can't be more than 50 MB. Existing file with same name for the given test will be overwritten. File should be provided in the request body as application/octet-stream. */ -export interface TestUploadFile201Response extends HttpResponse { +export interface LoadTestAdministrationUploadTestFile201Response + extends HttpResponse { status: "201"; body: FileInfoOutput; } -export interface TestUploadFileDefaultHeaders { +export interface LoadTestAdministrationUploadTestFileDefaultHeaders { /** 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 application/octet-stream. */ -export interface TestUploadFileDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationUploadTestFileDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestUploadFileDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationUploadTestFileDefaultHeaders; } /** Get test file by the file name. */ -export interface TestGetFile200Response extends HttpResponse { +export interface LoadTestAdministrationGetTestFile200Response + extends HttpResponse { status: "200"; body: FileInfoOutput; } -export interface TestGetFileDefaultHeaders { +export interface LoadTestAdministrationGetTestFileDefaultHeaders { /** 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 { +export interface LoadTestAdministrationGetTestFileDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestGetFileDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationGetTestFileDefaultHeaders; } /** Delete file by the file name for a test */ -export interface TestDeleteFile204Response extends HttpResponse { +export interface LoadTestAdministrationDeleteTestFile204Response + extends HttpResponse { status: "204"; - body: Record; } -export interface TestDeleteFileDefaultHeaders { +export interface LoadTestAdministrationDeleteTestFileDefaultHeaders { /** 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 { +export interface LoadTestAdministrationDeleteTestFileDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestDeleteFileDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationDeleteTestFileDefaultHeaders; } /** Get all test files. */ -export interface TestListFiles200Response extends HttpResponse { +export interface LoadTestAdministrationListTestFiles200Response + extends HttpResponse { status: "200"; body: FileInfoListOutput; } -export interface TestListFilesDefaultHeaders { +export interface LoadTestAdministrationListTestFilesDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** Get all test files. */ -export interface TestListFilesDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationListTestFilesDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestListFilesDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationListTestFilesDefaultHeaders; } /** Associate an app component (collection of azure resources) to a test */ -export interface TestCreateOrUpdateAppComponents200Response extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateAppComponents200Response + extends HttpResponse { status: "200"; body: TestAppComponentsOutput; } /** Associate an app component (collection of azure resources) to a test */ -export interface TestCreateOrUpdateAppComponents201Response extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateAppComponents201Response + extends HttpResponse { status: "201"; body: TestAppComponentsOutput; } -export interface TestCreateOrUpdateAppComponentsDefaultHeaders { +export interface LoadTestAdministrationCreateOrUpdateAppComponentsDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** Associate an app component (collection of azure resources) to a test */ -export interface TestCreateOrUpdateAppComponentsDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestCreateOrUpdateAppComponentsDefaultHeaders; + headers: RawHttpHeaders & + LoadTestAdministrationCreateOrUpdateAppComponentsDefaultHeaders; } /** Get associated app component (collection of azure resources) for the given test. */ -export interface TestListAppComponents200Response extends HttpResponse { +export interface LoadTestAdministrationGetAppComponents200Response + extends HttpResponse { status: "200"; body: TestAppComponentsOutput; } -export interface TestListAppComponentsDefaultHeaders { +export interface LoadTestAdministrationGetAppComponentsDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** Get associated app component (collection of azure resources) for the given test. */ -export interface TestListAppComponentsDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationGetAppComponentsDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestListAppComponentsDefaultHeaders; + headers: RawHttpHeaders & + LoadTestAdministrationGetAppComponentsDefaultHeaders; } /** Configure server metrics for a test */ -export interface TestCreateOrUpdateServerMetricsConfig200Response extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response + extends HttpResponse { status: "200"; body: TestServerMetricConfigOutput; } /** Configure server metrics for a test */ -export interface TestCreateOrUpdateServerMetricsConfig201Response extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response + extends HttpResponse { status: "201"; body: TestServerMetricConfigOutput; } -export interface TestCreateOrUpdateServerMetricsConfigDefaultHeaders { +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** Configure server metrics for a test */ -export interface TestCreateOrUpdateServerMetricsConfigDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestCreateOrUpdateServerMetricsConfigDefaultHeaders; + headers: RawHttpHeaders & + LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultHeaders; } /** List server metrics configuration for the given test. */ -export interface TestListServerMetricsConfig200Response extends HttpResponse { +export interface LoadTestAdministrationGetServerMetricsConfig200Response + extends HttpResponse { status: "200"; body: TestServerMetricConfigOutput; } -export interface TestListServerMetricsConfigDefaultHeaders { +export interface LoadTestAdministrationGetServerMetricsConfigDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** List server metrics configuration for the given test. */ -export interface TestListServerMetricsConfigDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationGetServerMetricsConfigDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestListServerMetricsConfigDefaultHeaders; -} - -/** 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; + headers: RawHttpHeaders & + LoadTestAdministrationGetServerMetricsConfigDefaultHeaders; } /** Create and start a new test run with the given name. */ -export interface TestRunCreateOrUpdate200Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateTestRun200Response + extends HttpResponse { status: "200"; body: TestRunOutput; } /** Create and start a new test run with the given name. */ -export interface TestRunCreateOrUpdate201Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateTestRun201Response + extends HttpResponse { status: "201"; body: TestRunOutput; } -export interface TestRunCreateOrUpdateDefaultHeaders { +export interface LoadTestRunCreateOrUpdateTestRunDefaultHeaders { /** 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 { +export interface LoadTestRunCreateOrUpdateTestRunDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestRunCreateOrUpdateDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunCreateOrUpdateTestRunDefaultHeaders; } /** Get test run details by name. */ -export interface TestRunGet200Response extends HttpResponse { +export interface LoadTestRunGetTestRun200Response extends HttpResponse { status: "200"; body: TestRunOutput; } -export interface TestRunGetDefaultHeaders { +export interface LoadTestRunGetTestRunDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** Get test run details by name. */ -export interface TestRunGetDefaultResponse extends HttpResponse { +export interface LoadTestRunGetTestRunDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunGetTestRunDefaultHeaders; +} + +/** Delete a test run by its name. */ +export interface LoadTestRunDeleteTestRun204Response extends HttpResponse { + status: "204"; +} + +export interface LoadTestRunDeleteTestRunDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Delete a test run by its name. */ +export interface LoadTestRunDeleteTestRunDefaultResponse extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestRunGetDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunDeleteTestRunDefaultHeaders; } /** Get test run file by file name. */ -export interface TestRunGetFile200Response extends HttpResponse { +export interface LoadTestRunGetTestRunFile200Response extends HttpResponse { status: "200"; body: FileInfoOutput; } -export interface TestRunGetFileDefaultHeaders { +export interface LoadTestRunGetTestRunFileDefaultHeaders { /** 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 { +export interface LoadTestRunGetTestRunFileDefaultResponse extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestRunGetFileDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunGetTestRunFileDefaultHeaders; } /** Get all test runs with given filters */ -export interface TestRunList200Response extends HttpResponse { +export interface LoadTestRunListTestRuns200Response extends HttpResponse { status: "200"; body: TestRunsListOutput; } -export interface TestRunListDefaultHeaders { +export interface LoadTestRunListTestRunsDefaultHeaders { /** 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 { +export interface LoadTestRunListTestRunsDefaultResponse extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestRunListDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunListTestRunsDefaultHeaders; } /** Stop test run by name. */ -export interface TestRunStop200Response extends HttpResponse { +export interface LoadTestRunStopTestRun200Response extends HttpResponse { status: "200"; body: TestRunOutput; } -export interface TestRunStopDefaultHeaders { +export interface LoadTestRunStopTestRunDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** Stop test run by name. */ -export interface TestRunStopDefaultResponse extends HttpResponse { +export interface LoadTestRunStopTestRunDefaultResponse extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestRunStopDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunStopTestRunDefaultHeaders; } /** List the metric namespaces for a load test run. */ -export interface TestRunListMetricNamespaces200Response extends HttpResponse { +export interface LoadTestRunListMetricNamespaces200Response + extends HttpResponse { status: "200"; body: MetricNamespaceCollectionOutput; } -export interface TestRunListMetricNamespacesDefaultHeaders { +export interface LoadTestRunListMetricNamespacesDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** List the metric namespaces for a load test run. */ -export interface TestRunListMetricNamespacesDefaultResponse extends HttpResponse { +export interface LoadTestRunListMetricNamespacesDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestRunListMetricNamespacesDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunListMetricNamespacesDefaultHeaders; } /** List the metric definitions for a load test run. */ -export interface TestRunListMetricDefinitions200Response extends HttpResponse { +export interface LoadTestRunListMetricDefinitions200Response + extends HttpResponse { status: "200"; body: MetricDefinitionCollectionOutput; } -export interface TestRunListMetricDefinitionsDefaultHeaders { +export interface LoadTestRunListMetricDefinitionsDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** List the metric definitions for a load test run. */ -export interface TestRunListMetricDefinitionsDefaultResponse extends HttpResponse { +export interface LoadTestRunListMetricDefinitionsDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestRunListMetricDefinitionsDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunListMetricDefinitionsDefaultHeaders; } /** List the metric values for a load test run. */ -export interface TestRunListMetrics200Response extends HttpResponse { +export interface LoadTestRunListMetrics200Response extends HttpResponse { status: "200"; body: MetricsOutput; } -export interface TestRunListMetricsDefaultHeaders { +export interface LoadTestRunListMetricsDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** List the metric values for a load test run. */ -export interface TestRunListMetricsDefaultResponse extends HttpResponse { +export interface LoadTestRunListMetricsDefaultResponse extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestRunListMetricsDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunListMetricsDefaultHeaders; } /** List the dimension values for the given metric dimension name. */ -export interface TestRunListMetricDimensionValues200Response extends HttpResponse { +export interface LoadTestRunListMetricDimensionValues200Response + extends HttpResponse { status: "200"; body: DimensionValueListOutput; } -export interface TestRunListMetricDimensionValuesDefaultHeaders { +export interface LoadTestRunListMetricDimensionValuesDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** List the dimension values for the given metric dimension name. */ -export interface TestRunListMetricDimensionValuesDefaultResponse extends HttpResponse { +export interface LoadTestRunListMetricDimensionValuesDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestRunListMetricDimensionValuesDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunListMetricDimensionValuesDefaultHeaders; } /** Associate an app component (collection of azure resources) to a test run */ -export interface TestRunCreateOrUpdateAppComponents200Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateAppComponents200Response + extends HttpResponse { status: "200"; body: TestRunAppComponentsOutput; } /** Associate an app component (collection of azure resources) to a test run */ -export interface TestRunCreateOrUpdateAppComponents201Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateAppComponents201Response + extends HttpResponse { status: "201"; body: TestRunAppComponentsOutput; } -export interface TestRunCreateOrUpdateAppComponentsDefaultHeaders { +export interface LoadTestRunCreateOrUpdateAppComponentsDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** Associate an app component (collection of azure resources) to a test run */ -export interface TestRunCreateOrUpdateAppComponentsDefaultResponse extends HttpResponse { +export interface LoadTestRunCreateOrUpdateAppComponentsDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestRunCreateOrUpdateAppComponentsDefaultHeaders; + headers: RawHttpHeaders & + LoadTestRunCreateOrUpdateAppComponentsDefaultHeaders; } /** Get associated app component (collection of azure resources) for the given test run. */ -export interface TestRunListAppComponents200Response extends HttpResponse { +export interface LoadTestRunGetAppComponents200Response extends HttpResponse { status: "200"; body: TestRunAppComponentsOutput; } -export interface TestRunListAppComponentsDefaultHeaders { +export interface LoadTestRunGetAppComponentsDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** Get associated app component (collection of azure resources) for the given test run. */ -export interface TestRunListAppComponentsDefaultResponse extends HttpResponse { +export interface LoadTestRunGetAppComponentsDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestRunListAppComponentsDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunGetAppComponentsDefaultHeaders; } /** Configure server metrics for a test run */ -export interface TestRunCreateOrUpdateServerMetricsConfig200Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateServerMetricsConfig200Response + extends HttpResponse { status: "200"; body: TestRunServerMetricConfigOutput; } /** Configure server metrics for a test run */ -export interface TestRunCreateOrUpdateServerMetricsConfig201Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateServerMetricsConfig201Response + extends HttpResponse { status: "201"; body: TestRunServerMetricConfigOutput; } -export interface TestRunCreateOrUpdateServerMetricsConfigDefaultHeaders { +export interface LoadTestRunCreateOrUpdateServerMetricsConfigDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** Configure server metrics for a test run */ -export interface TestRunCreateOrUpdateServerMetricsConfigDefaultResponse extends HttpResponse { +export interface LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestRunCreateOrUpdateServerMetricsConfigDefaultHeaders; + headers: RawHttpHeaders & + LoadTestRunCreateOrUpdateServerMetricsConfigDefaultHeaders; } /** List server metrics configuration for the given test run. */ -export interface TestRunListServerMetricsConfig200Response extends HttpResponse { +export interface LoadTestRunGetServerMetricsConfig200Response + extends HttpResponse { status: "200"; body: TestRunServerMetricConfigOutput; } -export interface TestRunListServerMetricsConfigDefaultHeaders { +export interface LoadTestRunGetServerMetricsConfigDefaultHeaders { /** The error code for specific error that occurred. */ "x-ms-error-code"?: string; } /** List server metrics configuration for the given test run. */ -export interface TestRunListServerMetricsConfigDefaultResponse extends HttpResponse { +export interface LoadTestRunGetServerMetricsConfigDefaultResponse + extends HttpResponse { status: string; body: ErrorResponseBodyOutput; - headers: RawHttpHeaders & TestRunListServerMetricsConfigDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunGetServerMetricsConfigDefaultHeaders; } diff --git a/sdk/loadtesting/load-testing-rest/karma.conf.js b/sdk/loadtesting/load-testing-rest/karma.conf.js index 5f468354314d..4fdf26c79ac0 100644 --- a/sdk/loadtesting/load-testing-rest/karma.conf.js +++ b/sdk/loadtesting/load-testing-rest/karma.conf.js @@ -16,8 +16,6 @@ module.exports = function (config) { // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ["source-map-support", "mocha"], - failOnEmptyTestSuite: false, - plugins: [ "karma-mocha", "karma-mocha-reporter", @@ -55,7 +53,7 @@ module.exports = function (config) { envPreprocessor: [ "TEST_MODE", - "LOADTESTSERVICE_ENDPOINT", + "ENDPOINT", "AZURE_CLIENT_SECRET", "AZURE_CLIENT_ID", "AZURE_TENANT_ID", @@ -108,7 +106,7 @@ module.exports = function (config) { customLaunchers: { ChromeHeadlessNoSandbox: { base: "ChromeHeadless", - flags: ["--no-sandbox", "--disable-web-security", "--lang=en-US"], + flags: ["--no-sandbox", "--disable-web-security"], }, }, diff --git a/sdk/loadtesting/load-testing-rest/package.json b/sdk/loadtesting/load-testing-rest/package.json index 31a274940451..80e9fa926762 100644 --- a/sdk/loadtesting/load-testing-rest/package.json +++ b/sdk/loadtesting/load-testing-rest/package.json @@ -72,7 +72,7 @@ "dependencies": { "@azure-rest/core-client": "^1.0.0", "@azure/core-auth": "^1.3.0", - "@azure/core-paging": "^1.2.0", + "@azure/core-paging": "^1.5.0", "@azure/core-rest-pipeline": "^1.8.0", "@azure/logger": "^1.0.0", "tslib": "^2.2.0", diff --git a/sdk/loadtesting/load-testing-rest/review/load-testing.api.md b/sdk/loadtesting/load-testing-rest/review/load-testing.api.md index 00269c36727b..8ecb90227b69 100644 --- a/sdk/loadtesting/load-testing-rest/review/load-testing.api.md +++ b/sdk/loadtesting/load-testing-rest/review/load-testing.api.md @@ -20,22 +20,19 @@ import { TokenCredential } from '@azure/core-auth'; export interface AppComponent { displayName?: string; kind?: string; - resourceGroup?: string; - resourceId?: string; resourceName?: string; resourceType?: string; - subscriptionId?: string; } // @public export interface AppComponentOutput { displayName?: string; kind?: string; - resourceGroup?: string; - resourceId?: string; + readonly resourceGroup?: string; + readonly resourceId?: string; resourceName?: string; resourceType?: string; - subscriptionId?: string; + readonly subscriptionId?: string; } // @public (undocumented) @@ -43,6 +40,11 @@ export type AzureLoadTestingClient = Client & { path: Routes; }; +// @public +export interface AzureLoadTestingClientOptions extends ClientOptions { + apiVersion?: string; +} + // @public export interface CertificateMetadata { name?: string; @@ -58,7 +60,7 @@ export interface CertificateMetadataOutput { } // @public -function createClient(Endpoint: string, credentials: TokenCredential, options?: ClientOptions): AzureLoadTestingClient; +function createClient(endpoint: string, credentials: TokenCredential, { apiVersion, ...options }?: AzureLoadTestingClientOptions): AzureLoadTestingClient; export default createClient; // @public @@ -81,12 +83,11 @@ export interface DimensionValueOutput { // @public export interface ErrorDetails { - message?: string; } // @public export interface ErrorDetailsOutput { - message?: string; + readonly message?: string; } // @public @@ -129,7 +130,7 @@ export interface FileInfoOutput { } // @public -export type FileUploadAndValidatePoller = SimplePollerLike, TestGetFile200Response>; +export type FileUploadAndValidatePoller = SimplePollerLike, LoadTestAdministrationGetTestFile200Response>; // @public export type GetArrayType = T extends Array ? TData : never; @@ -147,352 +148,91 @@ export type GetPage = (pageLink: string, maxPageSize?: number) => Promise }>; // @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; +export function isUnexpected(response: LoadTestAdministrationCreateOrUpdateTest200Response | LoadTestAdministrationCreateOrUpdateTest201Response | LoadTestAdministrationCreateOrUpdateTestDefaultResponse): response is LoadTestAdministrationCreateOrUpdateTestDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestUploadFile201Response | TestUploadFileDefaultResponse): response is TestUploadFileDefaultResponse; +export function isUnexpected(response: LoadTestAdministrationDeleteTest204Response | LoadTestAdministrationDeleteTestDefaultResponse): response is LoadTestAdministrationDeleteTestDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestGetFile200Response | TestGetFileDefaultResponse): response is TestGetFileDefaultResponse; +export function isUnexpected(response: LoadTestAdministrationGetTest200Response | LoadTestAdministrationGetTestDefaultResponse): response is LoadTestAdministrationGetTestDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestDeleteFile204Response | TestDeleteFileDefaultResponse): response is TestDeleteFileDefaultResponse; +export function isUnexpected(response: LoadTestAdministrationListTests200Response | LoadTestAdministrationListTestsDefaultResponse): response is LoadTestAdministrationListTestsDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestListFiles200Response | TestListFilesDefaultResponse): response is TestListFilesDefaultResponse; +export function isUnexpected(response: LoadTestAdministrationUploadTestFile201Response | LoadTestAdministrationUploadTestFileDefaultResponse): response is LoadTestAdministrationUploadTestFileDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestCreateOrUpdateAppComponents200Response | TestCreateOrUpdateAppComponents201Response | TestCreateOrUpdateAppComponentsDefaultResponse): response is TestCreateOrUpdateAppComponentsDefaultResponse; +export function isUnexpected(response: LoadTestAdministrationGetTestFile200Response | LoadTestAdministrationGetTestFileDefaultResponse): response is LoadTestAdministrationGetTestFileDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestListAppComponents200Response | TestListAppComponentsDefaultResponse): response is TestListAppComponentsDefaultResponse; +export function isUnexpected(response: LoadTestAdministrationDeleteTestFile204Response | LoadTestAdministrationDeleteTestFileDefaultResponse): response is LoadTestAdministrationDeleteTestFileDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestCreateOrUpdateServerMetricsConfig200Response | TestCreateOrUpdateServerMetricsConfig201Response | TestCreateOrUpdateServerMetricsConfigDefaultResponse): response is TestCreateOrUpdateServerMetricsConfigDefaultResponse; +export function isUnexpected(response: LoadTestAdministrationListTestFiles200Response | LoadTestAdministrationListTestFilesDefaultResponse): response is LoadTestAdministrationListTestFilesDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestListServerMetricsConfig200Response | TestListServerMetricsConfigDefaultResponse): response is TestListServerMetricsConfigDefaultResponse; +export function isUnexpected(response: LoadTestAdministrationCreateOrUpdateAppComponents200Response | LoadTestAdministrationCreateOrUpdateAppComponents201Response | LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse): response is LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestRunDelete204Response | TestRunDeleteDefaultResponse): response is TestRunDeleteDefaultResponse; +export function isUnexpected(response: LoadTestAdministrationGetAppComponents200Response | LoadTestAdministrationGetAppComponentsDefaultResponse): response is LoadTestAdministrationGetAppComponentsDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestRunCreateOrUpdate200Response | TestRunCreateOrUpdate201Response | TestRunCreateOrUpdateDefaultResponse): response is TestRunCreateOrUpdateDefaultResponse; +export function isUnexpected(response: LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response | LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response | LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse): response is LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestRunGet200Response | TestRunGetDefaultResponse): response is TestRunGetDefaultResponse; +export function isUnexpected(response: LoadTestAdministrationGetServerMetricsConfig200Response | LoadTestAdministrationGetServerMetricsConfigDefaultResponse): response is LoadTestAdministrationGetServerMetricsConfigDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestRunGetFile200Response | TestRunGetFileDefaultResponse): response is TestRunGetFileDefaultResponse; +export function isUnexpected(response: LoadTestRunCreateOrUpdateTestRun200Response | LoadTestRunCreateOrUpdateTestRun201Response | LoadTestRunCreateOrUpdateTestRunDefaultResponse): response is LoadTestRunCreateOrUpdateTestRunDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestRunList200Response | TestRunListDefaultResponse): response is TestRunListDefaultResponse; +export function isUnexpected(response: LoadTestRunGetTestRun200Response | LoadTestRunGetTestRunDefaultResponse): response is LoadTestRunGetTestRunDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestRunStop200Response | TestRunStopDefaultResponse): response is TestRunStopDefaultResponse; +export function isUnexpected(response: LoadTestRunDeleteTestRun204Response | LoadTestRunDeleteTestRunDefaultResponse): response is LoadTestRunDeleteTestRunDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestRunListMetricNamespaces200Response | TestRunListMetricNamespacesDefaultResponse): response is TestRunListMetricNamespacesDefaultResponse; +export function isUnexpected(response: LoadTestRunGetTestRunFile200Response | LoadTestRunGetTestRunFileDefaultResponse): response is LoadTestRunGetTestRunFileDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestRunListMetricDefinitions200Response | TestRunListMetricDefinitionsDefaultResponse): response is TestRunListMetricDefinitionsDefaultResponse; +export function isUnexpected(response: LoadTestRunListTestRuns200Response | LoadTestRunListTestRunsDefaultResponse): response is LoadTestRunListTestRunsDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestRunListMetrics200Response | TestRunListMetricsDefaultResponse): response is TestRunListMetricsDefaultResponse; +export function isUnexpected(response: LoadTestRunStopTestRun200Response | LoadTestRunStopTestRunDefaultResponse): response is LoadTestRunStopTestRunDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestRunListMetricDimensionValues200Response | TestRunListMetricDimensionValuesDefaultResponse): response is TestRunListMetricDimensionValuesDefaultResponse; +export function isUnexpected(response: LoadTestRunListMetricNamespaces200Response | LoadTestRunListMetricNamespacesDefaultResponse): response is LoadTestRunListMetricNamespacesDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestRunCreateOrUpdateAppComponents200Response | TestRunCreateOrUpdateAppComponents201Response | TestRunCreateOrUpdateAppComponentsDefaultResponse): response is TestRunCreateOrUpdateAppComponentsDefaultResponse; +export function isUnexpected(response: LoadTestRunListMetricDefinitions200Response | LoadTestRunListMetricDefinitionsDefaultResponse): response is LoadTestRunListMetricDefinitionsDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestRunListAppComponents200Response | TestRunListAppComponentsDefaultResponse): response is TestRunListAppComponentsDefaultResponse; +export function isUnexpected(response: LoadTestRunListMetrics200Response | LoadTestRunListMetricsDefaultResponse): response is LoadTestRunListMetricsDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestRunCreateOrUpdateServerMetricsConfig200Response | TestRunCreateOrUpdateServerMetricsConfig201Response | TestRunCreateOrUpdateServerMetricsConfigDefaultResponse): response is TestRunCreateOrUpdateServerMetricsConfigDefaultResponse; +export function isUnexpected(response: LoadTestRunListMetricDimensionValues200Response | LoadTestRunListMetricDimensionValuesDefaultResponse): response is LoadTestRunListMetricDimensionValuesDefaultResponse; // @public (undocumented) -export function isUnexpected(response: TestRunListServerMetricsConfig200Response | TestRunListServerMetricsConfigDefaultResponse): response is TestRunListServerMetricsConfigDefaultResponse; - -// @public -export interface LoadTestConfiguration { - engineInstances?: number; - optionalLoadTestConfig?: OptionalLoadTestConfig; - quickStartTest?: boolean; - splitAllCSVs?: boolean; -} - -// @public -export interface LoadTestConfigurationOutput { - engineInstances?: number; - optionalLoadTestConfig?: OptionalLoadTestConfigOutput; - quickStartTest?: boolean; - splitAllCSVs?: boolean; -} - -// @public -export interface MetricAvailabilityOutput { - timeGrain?: "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; -} - -// @public -export interface MetricDefinitionCollectionOutput { - value: Array; -} - -// @public -export interface MetricDefinitionOutput { - description?: string; - dimensions?: Array; - metricAvailabilities?: Array; - name?: string; - namespace?: string; - primaryAggregationType?: "Average" | "Count" | "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 { - description?: string; - name?: string; -} - -// @public -export interface MetricRequestPayload { - filters?: Array; -} - -// @public -export interface MetricsOutput { - nextLink?: string; - timeseries?: Array; -} - -// @public -export interface MetricValueOutput { - timestamp?: string; - value?: number; -} - -// @public -export interface NameAndDescOutput { - description?: string; - name?: string; -} - -// @public -export interface OptionalLoadTestConfig { - duration?: number; - endpointUrl?: string; - rampUpTime?: number; - virtualUsers?: number; -} - -// @public -export interface OptionalLoadTestConfigOutput { - duration?: number; - endpointUrl?: string; - rampUpTime?: number; - virtualUsers?: number; -} - -// @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 PassFailCriteria { - passFailMetrics?: Record; -} - -// @public -export interface PassFailCriteriaOutput { - passFailMetrics?: Record; -} - -// @public -export interface PassFailMetric { - 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 PassFailMetricOutput { - 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; -} +export function isUnexpected(response: LoadTestRunCreateOrUpdateAppComponents200Response | LoadTestRunCreateOrUpdateAppComponents201Response | LoadTestRunCreateOrUpdateAppComponentsDefaultResponse): response is LoadTestRunCreateOrUpdateAppComponentsDefaultResponse; // @public (undocumented) -export interface PolledOperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface ResourceMetric { - aggregation: string; - displayDescription?: string; - id?: string; - metricNamespace: string; - name: string; - resourceId: string; - resourceType: string; - unit?: string; -} - -// @public -export interface ResourceMetricOutput { - aggregation: string; - displayDescription?: string; - id?: string; - metricNamespace: string; - name: string; - resourceId: string; - resourceType: string; - unit?: string; -} +export function isUnexpected(response: LoadTestRunGetAppComponents200Response | LoadTestRunGetAppComponentsDefaultResponse): response is LoadTestRunGetAppComponentsDefaultResponse; // @public (undocumented) -export interface Routes { - (path: "/tests/{testId}", testId: string): TestCreateOrUpdate; - (path: "/tests"): TestList; - (path: "/tests/{testId}/files/{fileName}", testId: string, fileName: string): TestUploadFile; - (path: "/tests/{testId}/files", testId: string): TestListFiles; - (path: "/tests/{testId}/app-components", testId: string): TestCreateOrUpdateAppComponents; - (path: "/tests/{testId}/server-metrics-config", testId: string): TestCreateOrUpdateServerMetricsConfig; - (path: "/test-runs/{testRunId}", testRunId: string): TestRunDelete; - (path: "/test-runs/{testRunId}/files/{fileName}", testRunId: string, fileName: string): TestRunGetFile; - (path: "/test-runs"): TestRunList; - (path: "/test-runs/{testRunId}:stop", testRunId: string): TestRunStop; - (path: "/test-runs/{testRunId}/metric-namespaces", testRunId: string): TestRunListMetricNamespaces; - (path: "/test-runs/{testRunId}/metric-definitions", testRunId: string): TestRunListMetricDefinitions; - (path: "/test-runs/{testRunId}/metrics", testRunId: string): TestRunListMetrics; - (path: "/test-runs/{testRunId}/metric-dimensions/{name}/values", testRunId: string, name: string): TestRunListMetricDimensionValues; - (path: "/test-runs/{testRunId}/app-components", testRunId: string): TestRunCreateOrUpdateAppComponents; - (path: "/test-runs/{testRunId}/server-metrics-config", testRunId: string): TestRunCreateOrUpdateServerMetricsConfig; -} - -// @public -export interface Secret { - type?: "AKV_SECRET_URI" | "SECRET_VALUE"; - value?: string; -} - -// @public -export interface SecretOutput { - type?: "AKV_SECRET_URI" | "SECRET_VALUE"; - value?: string; -} - -// @public -export interface Test { - certificate?: CertificateMetadata; - createdBy?: string; - createdDateTime?: Date | string; - description?: string; - displayName?: string; - environmentVariables?: Record; - inputArtifacts?: TestInputArtifacts; - keyvaultReferenceIdentityId?: string; - keyvaultReferenceIdentityType?: string; - lastModifiedBy?: string; - lastModifiedDateTime?: Date | string; - loadTestConfiguration?: LoadTestConfiguration; - passFailCriteria?: PassFailCriteria; - secrets?: Record; - subnetId?: string; - testId?: string; -} - -// @public -export interface TestAppComponents { - components: Record; - createdBy?: string; - createdDateTime?: Date | string; - lastModifiedBy?: string; - lastModifiedDateTime?: Date | string; - testId?: string; -} - -// @public -export interface TestAppComponentsOutput { - components: Record; - createdBy?: string; - createdDateTime?: string; - lastModifiedBy?: string; - lastModifiedDateTime?: string; - testId?: string; -} +export function isUnexpected(response: LoadTestRunCreateOrUpdateServerMetricsConfig200Response | LoadTestRunCreateOrUpdateServerMetricsConfig201Response | LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse): response is LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse; // @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: TestOutput; - // (undocumented) - status: "200"; -} - -// @public -export interface TestCreateOrUpdate201Response extends HttpResponse { - // (undocumented) - body: TestOutput; - // (undocumented) - status: "201"; -} +export function isUnexpected(response: LoadTestRunGetServerMetricsConfig200Response | LoadTestRunGetServerMetricsConfigDefaultResponse): response is LoadTestRunGetServerMetricsConfigDefaultResponse; // @public (undocumented) -export interface TestCreateOrUpdateAppComponents { - get(options?: TestListAppComponentsParameters): StreamableMethod; - patch(options: TestCreateOrUpdateAppComponentsParameters): StreamableMethod; +export interface LoadTestAdministrationCreateOrUpdateAppComponents { + get(options?: LoadTestAdministrationGetAppComponentsParameters): StreamableMethod; + patch(options: LoadTestAdministrationCreateOrUpdateAppComponentsParameters): StreamableMethod; } // @public -export interface TestCreateOrUpdateAppComponents200Response extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateAppComponents200Response extends HttpResponse { // (undocumented) body: TestAppComponentsOutput; // (undocumented) @@ -500,7 +240,7 @@ export interface TestCreateOrUpdateAppComponents200Response extends HttpResponse } // @public -export interface TestCreateOrUpdateAppComponents201Response extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateAppComponents201Response extends HttpResponse { // (undocumented) body: TestAppComponentsOutput; // (undocumented) @@ -508,294 +248,293 @@ export interface TestCreateOrUpdateAppComponents201Response extends HttpResponse } // @public (undocumented) -export interface TestCreateOrUpdateAppComponentsBodyParam { - body: TestAppComponents; +export interface LoadTestAdministrationCreateOrUpdateAppComponentsBodyParam { + body: TestAppComponentsResourceMergeAndPatch; } // @public (undocumented) -export interface TestCreateOrUpdateAppComponentsDefaultHeaders { +export interface LoadTestAdministrationCreateOrUpdateAppComponentsDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestCreateOrUpdateAppComponentsDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestCreateOrUpdateAppComponentsDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationCreateOrUpdateAppComponentsDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export interface TestCreateOrUpdateAppComponentsMediaTypesParam { +export interface LoadTestAdministrationCreateOrUpdateAppComponentsMediaTypesParam { contentType?: "application/merge-patch+json"; } // @public (undocumented) -export type TestCreateOrUpdateAppComponentsParameters = TestCreateOrUpdateAppComponentsMediaTypesParam & TestCreateOrUpdateAppComponentsBodyParam & RequestParameters; +export type LoadTestAdministrationCreateOrUpdateAppComponentsParameters = LoadTestAdministrationCreateOrUpdateAppComponentsMediaTypesParam & LoadTestAdministrationCreateOrUpdateAppComponentsBodyParam & RequestParameters; + +// @public (undocumented) +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfig { + get(options?: LoadTestAdministrationGetServerMetricsConfigParameters): StreamableMethod; + patch(options: LoadTestAdministrationCreateOrUpdateServerMetricsConfigParameters): StreamableMethod; +} + +// @public +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response extends HttpResponse { + // (undocumented) + body: TestServerMetricConfigOutput; + // (undocumented) + status: "200"; +} + +// @public +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response extends HttpResponse { + // (undocumented) + body: TestServerMetricConfigOutput; + // (undocumented) + status: "201"; +} // @public (undocumented) -export interface TestCreateOrUpdateBodyParam { - body: Test; +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigBodyParam { + body: TestServerMetricConfigResourceMergeAndPatch; } // @public (undocumented) -export interface TestCreateOrUpdateDefaultHeaders { +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestCreateOrUpdateDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestCreateOrUpdateDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export interface TestCreateOrUpdateMediaTypesParam { +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigMediaTypesParam { contentType?: "application/merge-patch+json"; } // @public (undocumented) -export type TestCreateOrUpdateParameters = TestCreateOrUpdateMediaTypesParam & TestCreateOrUpdateBodyParam & RequestParameters; +export type LoadTestAdministrationCreateOrUpdateServerMetricsConfigParameters = LoadTestAdministrationCreateOrUpdateServerMetricsConfigMediaTypesParam & LoadTestAdministrationCreateOrUpdateServerMetricsConfigBodyParam & RequestParameters; // @public (undocumented) -export interface TestCreateOrUpdateServerMetricsConfig { - get(options?: TestListServerMetricsConfigParameters): StreamableMethod; - patch(options: TestCreateOrUpdateServerMetricsConfigParameters): StreamableMethod; +export interface LoadTestAdministrationCreateOrUpdateTest { + delete(options?: LoadTestAdministrationDeleteTestParameters): StreamableMethod; + get(options?: LoadTestAdministrationGetTestParameters): StreamableMethod; + patch(options: LoadTestAdministrationCreateOrUpdateTestParameters): StreamableMethod; } // @public -export interface TestCreateOrUpdateServerMetricsConfig200Response extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateTest200Response extends HttpResponse { // (undocumented) - body: TestServerMetricConfigOutput; + body: TestOutput; // (undocumented) status: "200"; } // @public -export interface TestCreateOrUpdateServerMetricsConfig201Response extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateTest201Response extends HttpResponse { // (undocumented) - body: TestServerMetricConfigOutput; + body: TestOutput; // (undocumented) status: "201"; } // @public (undocumented) -export interface TestCreateOrUpdateServerMetricsConfigBodyParam { - body: TestServerMetricConfig; +export interface LoadTestAdministrationCreateOrUpdateTestBodyParam { + body: TestResourceMergeAndPatch; } // @public (undocumented) -export interface TestCreateOrUpdateServerMetricsConfigDefaultHeaders { +export interface LoadTestAdministrationCreateOrUpdateTestDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestCreateOrUpdateServerMetricsConfigDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationCreateOrUpdateTestDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestCreateOrUpdateServerMetricsConfigDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationCreateOrUpdateTestDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export interface TestCreateOrUpdateServerMetricsConfigMediaTypesParam { +export interface LoadTestAdministrationCreateOrUpdateTestMediaTypesParam { contentType?: "application/merge-patch+json"; } // @public (undocumented) -export type TestCreateOrUpdateServerMetricsConfigParameters = TestCreateOrUpdateServerMetricsConfigMediaTypesParam & TestCreateOrUpdateServerMetricsConfigBodyParam & RequestParameters; +export type LoadTestAdministrationCreateOrUpdateTestParameters = LoadTestAdministrationCreateOrUpdateTestMediaTypesParam & LoadTestAdministrationCreateOrUpdateTestBodyParam & RequestParameters; // @public -export interface TestDelete204Response extends HttpResponse { - // (undocumented) - body: Record; +export interface LoadTestAdministrationDeleteTest204Response extends HttpResponse { // (undocumented) status: "204"; } // @public (undocumented) -export interface TestDeleteDefaultHeaders { +export interface LoadTestAdministrationDeleteTestDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestDeleteDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationDeleteTestDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestDeleteDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationDeleteTestDefaultHeaders; // (undocumented) status: string; } // @public -export interface TestDeleteFile204Response extends HttpResponse { - // (undocumented) - body: Record; +export interface LoadTestAdministrationDeleteTestFile204Response extends HttpResponse { // (undocumented) status: "204"; } // @public (undocumented) -export interface TestDeleteFileDefaultHeaders { +export interface LoadTestAdministrationDeleteTestFileDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestDeleteFileDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationDeleteTestFileDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestDeleteFileDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationDeleteTestFileDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export type TestDeleteFileParameters = RequestParameters; +export type LoadTestAdministrationDeleteTestFileParameters = RequestParameters; // @public (undocumented) -export type TestDeleteParameters = RequestParameters; +export type LoadTestAdministrationDeleteTestParameters = RequestParameters; // @public -export interface TestGet200Response extends HttpResponse { +export interface LoadTestAdministrationGetAppComponents200Response extends HttpResponse { // (undocumented) - body: TestOutput; + body: TestAppComponentsOutput; // (undocumented) status: "200"; } // @public (undocumented) -export interface TestGetDefaultHeaders { +export interface LoadTestAdministrationGetAppComponentsDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestGetDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationGetAppComponentsDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestGetDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationGetAppComponentsDefaultHeaders; // (undocumented) status: string; } +// @public (undocumented) +export type LoadTestAdministrationGetAppComponentsParameters = RequestParameters; + // @public -export interface TestGetFile200Response extends HttpResponse { +export interface LoadTestAdministrationGetServerMetricsConfig200Response extends HttpResponse { // (undocumented) - body: FileInfoOutput; + body: TestServerMetricConfigOutput; // (undocumented) status: "200"; } // @public (undocumented) -export interface TestGetFileDefaultHeaders { +export interface LoadTestAdministrationGetServerMetricsConfigDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestGetFileDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationGetServerMetricsConfigDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestGetFileDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationGetServerMetricsConfigDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export type TestGetFileParameters = RequestParameters; - -// @public (undocumented) -export type TestGetParameters = RequestParameters; +export type LoadTestAdministrationGetServerMetricsConfigParameters = RequestParameters; // @public -export interface TestInputArtifacts { - additionalFileInfo?: Array; - configFileInfo?: FileInfo; - inputArtifactsZipFileInfo?: FileInfo; - testScriptFileInfo?: FileInfo; - userPropFileInfo?: FileInfo; -} - -// @public -export interface TestInputArtifactsOutput { - additionalFileInfo?: Array; - configFileInfo?: FileInfoOutput; - inputArtifactsZipFileInfo?: FileInfoOutput; - testScriptFileInfo?: FileInfoOutput; - userPropFileInfo?: FileInfoOutput; +export interface LoadTestAdministrationGetTest200Response extends HttpResponse { + // (undocumented) + body: TestOutput; + // (undocumented) + status: "200"; } // @public (undocumented) -export interface TestList { - get(options?: TestListParameters): StreamableMethod; +export interface LoadTestAdministrationGetTestDefaultHeaders { + "x-ms-error-code"?: string; } // @public -export interface TestList200Response extends HttpResponse { +export interface LoadTestAdministrationGetTestDefaultResponse extends HttpResponse { // (undocumented) - body: TestsListOutput; + body: ErrorResponseBodyOutput; // (undocumented) - status: "200"; + headers: RawHttpHeaders & LoadTestAdministrationGetTestDefaultHeaders; + // (undocumented) + status: string; } // @public -export interface TestListAppComponents200Response extends HttpResponse { +export interface LoadTestAdministrationGetTestFile200Response extends HttpResponse { // (undocumented) - body: TestAppComponentsOutput; + body: FileInfoOutput; // (undocumented) status: "200"; } // @public (undocumented) -export interface TestListAppComponentsDefaultHeaders { +export interface LoadTestAdministrationGetTestFileDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestListAppComponentsDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationGetTestFileDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestListAppComponentsDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationGetTestFileDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export type TestListAppComponentsParameters = RequestParameters; +export type LoadTestAdministrationGetTestFileParameters = RequestParameters; // @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; -} +export type LoadTestAdministrationGetTestParameters = RequestParameters; // @public (undocumented) -export interface TestListFiles { - get(options?: TestListFilesParameters): StreamableMethod; +export interface LoadTestAdministrationListTestFiles { + get(options?: LoadTestAdministrationListTestFilesParameters): StreamableMethod; } // @public -export interface TestListFiles200Response extends HttpResponse { +export interface LoadTestAdministrationListTestFiles200Response extends HttpResponse { // (undocumented) body: FileInfoListOutput; // (undocumented) @@ -803,46 +542,62 @@ export interface TestListFiles200Response extends HttpResponse { } // @public (undocumented) -export interface TestListFilesDefaultHeaders { +export interface LoadTestAdministrationListTestFilesDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestListFilesDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationListTestFilesDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestListFilesDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationListTestFilesDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export type TestListFilesParameters = TestListFilesQueryParam & RequestParameters; +export type LoadTestAdministrationListTestFilesParameters = RequestParameters; // @public (undocumented) -export interface TestListFilesQueryParam { +export interface LoadTestAdministrationListTests { + get(options?: LoadTestAdministrationListTestsParameters): StreamableMethod; +} + +// @public +export interface LoadTestAdministrationListTests200Response extends HttpResponse { + // (undocumented) + body: TestsListOutput; // (undocumented) - queryParameters?: TestListFilesQueryParamProperties; + status: "200"; } // @public (undocumented) -export interface TestListFilesQueryParamProperties { - continuationToken?: string; +export interface LoadTestAdministrationListTestsDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface LoadTestAdministrationListTestsDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & LoadTestAdministrationListTestsDefaultHeaders; + // (undocumented) + status: string; } // @public (undocumented) -export type TestListParameters = TestListQueryParam & RequestParameters; +export type LoadTestAdministrationListTestsParameters = LoadTestAdministrationListTestsQueryParam & RequestParameters; // @public (undocumented) -export interface TestListQueryParam { +export interface LoadTestAdministrationListTestsQueryParam { // (undocumented) - queryParameters?: TestListQueryParamProperties; + queryParameters?: LoadTestAdministrationListTestsQueryParamProperties; } // @public (undocumented) -export interface TestListQueryParamProperties { - continuationToken?: string; +export interface LoadTestAdministrationListTestsQueryParamProperties { lastModifiedEndTime?: Date | string; lastModifiedStartTime?: Date | string; maxpagesize?: number; @@ -850,140 +605,84 @@ export interface TestListQueryParamProperties { search?: string; } +// @public (undocumented) +export interface LoadTestAdministrationUploadTestFile { + delete(options?: LoadTestAdministrationDeleteTestFileParameters): StreamableMethod; + get(options?: LoadTestAdministrationGetTestFileParameters): StreamableMethod; + put(options: LoadTestAdministrationUploadTestFileParameters): StreamableMethod; +} + // @public -export interface TestListServerMetricsConfig200Response extends HttpResponse { +export interface LoadTestAdministrationUploadTestFile201Response extends HttpResponse { // (undocumented) - body: TestServerMetricConfigOutput; + body: FileInfoOutput; // (undocumented) - status: "200"; + status: "201"; +} + +// @public (undocumented) +export interface LoadTestAdministrationUploadTestFileBodyParam { + body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream; } // @public (undocumented) -export interface TestListServerMetricsConfigDefaultHeaders { +export interface LoadTestAdministrationUploadTestFileDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestListServerMetricsConfigDefaultResponse extends HttpResponse { +export interface LoadTestAdministrationUploadTestFileDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestListServerMetricsConfigDefaultHeaders; + headers: RawHttpHeaders & LoadTestAdministrationUploadTestFileDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export type TestListServerMetricsConfigParameters = RequestParameters; - -// @public -export interface TestOutput { - certificate?: CertificateMetadataOutput; - createdBy?: string; - createdDateTime?: string; - description?: string; - displayName?: string; - environmentVariables?: Record; - inputArtifacts?: TestInputArtifactsOutput; - keyvaultReferenceIdentityId?: string; - keyvaultReferenceIdentityType?: string; - lastModifiedBy?: string; - lastModifiedDateTime?: string; - loadTestConfiguration?: LoadTestConfigurationOutput; - passFailCriteria?: PassFailCriteriaOutput; - secrets?: Record; - subnetId?: string; - testId?: string; -} - -// @public -export interface TestRun { - certificate?: CertificateMetadata; - 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; - loadTestConfiguration?: LoadTestConfiguration; - passFailCriteria?: PassFailCriteria; - portalUrl?: 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?: TestRunArtifacts; - testId?: string; - testResult?: "PASSED" | "NOT_APPLICABLE" | "FAILED"; - testRunId?: string; - testRunStatistics?: Record; - virtualUsers?: number; -} - -// @public -export interface TestRunAppComponents { - components: Record; - createdBy?: string; - createdDateTime?: Date | string; - lastModifiedBy?: string; - lastModifiedDateTime?: Date | string; - testRunId?: string; -} - -// @public -export interface TestRunAppComponentsOutput { - components: Record; - createdBy?: string; - createdDateTime?: string; - lastModifiedBy?: string; - lastModifiedDateTime?: string; - testRunId?: string; +export interface LoadTestAdministrationUploadTestFileMediaTypesParam { + contentType?: "application/octet-stream"; } -// @public -export interface TestRunArtifacts { - inputArtifacts?: TestRunInputArtifacts; - outputArtifacts?: TestRunOutputArtifacts; -} +// @public (undocumented) +export type LoadTestAdministrationUploadTestFileParameters = LoadTestAdministrationUploadTestFileQueryParam & LoadTestAdministrationUploadTestFileMediaTypesParam & LoadTestAdministrationUploadTestFileBodyParam & RequestParameters; -// @public -export interface TestRunArtifactsOutput { - inputArtifacts?: TestRunInputArtifactsOutput; - outputArtifacts?: TestRunOutputArtifactsOutput; +// @public (undocumented) +export interface LoadTestAdministrationUploadTestFileQueryParam { + // (undocumented) + queryParameters?: LoadTestAdministrationUploadTestFileQueryParamProperties; } // @public (undocumented) -export type TestRunCompletionPoller = SimplePollerLike, TestRunGet200Response>; +export interface LoadTestAdministrationUploadTestFileQueryParamProperties { + fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; +} // @public -export interface TestRunCreateOrUpdate200Response extends HttpResponse { - // (undocumented) - body: TestRunOutput; - // (undocumented) - status: "200"; +export interface LoadTestConfiguration { + engineInstances?: number; + optionalLoadTestConfig?: OptionalLoadTestConfig; + quickStartTest?: boolean; + splitAllCSVs?: boolean; } // @public -export interface TestRunCreateOrUpdate201Response extends HttpResponse { - // (undocumented) - body: TestRunOutput; - // (undocumented) - status: "201"; +export interface LoadTestConfigurationOutput { + engineInstances?: number; + optionalLoadTestConfig?: OptionalLoadTestConfigOutput; + quickStartTest?: boolean; + splitAllCSVs?: boolean; } // @public (undocumented) -export interface TestRunCreateOrUpdateAppComponents { - get(options?: TestRunListAppComponentsParameters): StreamableMethod; - patch(options: TestRunCreateOrUpdateAppComponentsParameters): StreamableMethod; +export interface LoadTestRunCreateOrUpdateAppComponents { + get(options?: LoadTestRunGetAppComponentsParameters): StreamableMethod; + patch(options: LoadTestRunCreateOrUpdateAppComponentsParameters): StreamableMethod; } // @public -export interface TestRunCreateOrUpdateAppComponents200Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateAppComponents200Response extends HttpResponse { // (undocumented) body: TestRunAppComponentsOutput; // (undocumented) @@ -991,7 +690,7 @@ export interface TestRunCreateOrUpdateAppComponents200Response extends HttpRespo } // @public -export interface TestRunCreateOrUpdateAppComponents201Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateAppComponents201Response extends HttpResponse { // (undocumented) body: TestRunAppComponentsOutput; // (undocumented) @@ -999,294 +698,285 @@ export interface TestRunCreateOrUpdateAppComponents201Response extends HttpRespo } // @public (undocumented) -export interface TestRunCreateOrUpdateAppComponentsBodyParam { - body: TestRunAppComponents; +export interface LoadTestRunCreateOrUpdateAppComponentsBodyParam { + body: TestRunAppComponentsResourceMergeAndPatch; } // @public (undocumented) -export interface TestRunCreateOrUpdateAppComponentsDefaultHeaders { +export interface LoadTestRunCreateOrUpdateAppComponentsDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestRunCreateOrUpdateAppComponentsDefaultResponse extends HttpResponse { +export interface LoadTestRunCreateOrUpdateAppComponentsDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestRunCreateOrUpdateAppComponentsDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunCreateOrUpdateAppComponentsDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export interface TestRunCreateOrUpdateAppComponentsMediaTypesParam { +export interface LoadTestRunCreateOrUpdateAppComponentsMediaTypesParam { contentType?: "application/merge-patch+json"; } // @public (undocumented) -export type TestRunCreateOrUpdateAppComponentsParameters = TestRunCreateOrUpdateAppComponentsMediaTypesParam & TestRunCreateOrUpdateAppComponentsBodyParam & RequestParameters; +export type LoadTestRunCreateOrUpdateAppComponentsParameters = LoadTestRunCreateOrUpdateAppComponentsMediaTypesParam & LoadTestRunCreateOrUpdateAppComponentsBodyParam & RequestParameters; // @public (undocumented) -export interface TestRunCreateOrUpdateBodyParam { - body: TestRun; +export interface LoadTestRunCreateOrUpdateServerMetricsConfig { + get(options?: LoadTestRunGetServerMetricsConfigParameters): StreamableMethod; + patch(options: LoadTestRunCreateOrUpdateServerMetricsConfigParameters): StreamableMethod; } -// @public (undocumented) -export interface TestRunCreateOrUpdateDefaultHeaders { - "x-ms-error-code"?: string; +// @public +export interface LoadTestRunCreateOrUpdateServerMetricsConfig200Response extends HttpResponse { + // (undocumented) + body: TestRunServerMetricConfigOutput; + // (undocumented) + status: "200"; } // @public -export interface TestRunCreateOrUpdateDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponseBodyOutput; +export interface LoadTestRunCreateOrUpdateServerMetricsConfig201Response extends HttpResponse { // (undocumented) - headers: RawHttpHeaders & TestRunCreateOrUpdateDefaultHeaders; + body: TestRunServerMetricConfigOutput; // (undocumented) - status: string; + status: "201"; } // @public (undocumented) -export interface TestRunCreateOrUpdateMediaTypesParam { - contentType?: "application/merge-patch+json"; +export interface LoadTestRunCreateOrUpdateServerMetricsConfigBodyParam { + body: TestRunServerMetricConfigResourceMergeAndPatch; } // @public (undocumented) -export type TestRunCreateOrUpdateParameters = TestRunCreateOrUpdateQueryParam & TestRunCreateOrUpdateMediaTypesParam & TestRunCreateOrUpdateBodyParam & RequestParameters; +export interface LoadTestRunCreateOrUpdateServerMetricsConfigDefaultHeaders { + "x-ms-error-code"?: string; +} -// @public (undocumented) -export interface TestRunCreateOrUpdateQueryParam { +// @public +export interface LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & LoadTestRunCreateOrUpdateServerMetricsConfigDefaultHeaders; // (undocumented) - queryParameters?: TestRunCreateOrUpdateQueryParamProperties; + status: string; } // @public (undocumented) -export interface TestRunCreateOrUpdateQueryParamProperties { - oldTestRunId?: string; +export interface LoadTestRunCreateOrUpdateServerMetricsConfigMediaTypesParam { + contentType?: "application/merge-patch+json"; } // @public (undocumented) -export interface TestRunCreateOrUpdateServerMetricsConfig { - get(options?: TestRunListServerMetricsConfigParameters): StreamableMethod; - patch(options: TestRunCreateOrUpdateServerMetricsConfigParameters): StreamableMethod; +export type LoadTestRunCreateOrUpdateServerMetricsConfigParameters = LoadTestRunCreateOrUpdateServerMetricsConfigMediaTypesParam & LoadTestRunCreateOrUpdateServerMetricsConfigBodyParam & RequestParameters; + +// @public (undocumented) +export interface LoadTestRunCreateOrUpdateTestRun { + delete(options?: LoadTestRunDeleteTestRunParameters): StreamableMethod; + get(options?: LoadTestRunGetTestRunParameters): StreamableMethod; + patch(options: LoadTestRunCreateOrUpdateTestRunParameters): StreamableMethod; } // @public -export interface TestRunCreateOrUpdateServerMetricsConfig200Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateTestRun200Response extends HttpResponse { // (undocumented) - body: TestRunServerMetricConfigOutput; + body: TestRunOutput; // (undocumented) status: "200"; } // @public -export interface TestRunCreateOrUpdateServerMetricsConfig201Response extends HttpResponse { +export interface LoadTestRunCreateOrUpdateTestRun201Response extends HttpResponse { // (undocumented) - body: TestRunServerMetricConfigOutput; + body: TestRunOutput; // (undocumented) status: "201"; } // @public (undocumented) -export interface TestRunCreateOrUpdateServerMetricsConfigBodyParam { - body: TestRunServerMetricConfig; +export interface LoadTestRunCreateOrUpdateTestRunBodyParam { + body: TestRunResourceMergeAndPatch; } // @public (undocumented) -export interface TestRunCreateOrUpdateServerMetricsConfigDefaultHeaders { +export interface LoadTestRunCreateOrUpdateTestRunDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestRunCreateOrUpdateServerMetricsConfigDefaultResponse extends HttpResponse { +export interface LoadTestRunCreateOrUpdateTestRunDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestRunCreateOrUpdateServerMetricsConfigDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunCreateOrUpdateTestRunDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export interface TestRunCreateOrUpdateServerMetricsConfigMediaTypesParam { +export interface LoadTestRunCreateOrUpdateTestRunMediaTypesParam { contentType?: "application/merge-patch+json"; } // @public (undocumented) -export type TestRunCreateOrUpdateServerMetricsConfigParameters = TestRunCreateOrUpdateServerMetricsConfigMediaTypesParam & TestRunCreateOrUpdateServerMetricsConfigBodyParam & RequestParameters; +export type LoadTestRunCreateOrUpdateTestRunParameters = LoadTestRunCreateOrUpdateTestRunQueryParam & LoadTestRunCreateOrUpdateTestRunMediaTypesParam & LoadTestRunCreateOrUpdateTestRunBodyParam & RequestParameters; // @public (undocumented) -export type TestRunCreateOrUpdateSuccessResponse = TestRunCreateOrUpdate200Response | TestRunCreateOrUpdate201Response; +export interface LoadTestRunCreateOrUpdateTestRunQueryParam { + // (undocumented) + queryParameters?: LoadTestRunCreateOrUpdateTestRunQueryParamProperties; +} // @public (undocumented) -export interface TestRunDelete { - delete(options?: TestRunDeleteParameters): StreamableMethod; - get(options?: TestRunGetParameters): StreamableMethod; - patch(options: TestRunCreateOrUpdateParameters): StreamableMethod; +export interface LoadTestRunCreateOrUpdateTestRunQueryParamProperties { + oldTestRunId?: string; } // @public -export interface TestRunDelete204Response extends HttpResponse { - // (undocumented) - body: Record; +export interface LoadTestRunDeleteTestRun204Response extends HttpResponse { // (undocumented) status: "204"; } // @public (undocumented) -export interface TestRunDeleteDefaultHeaders { +export interface LoadTestRunDeleteTestRunDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestRunDeleteDefaultResponse extends HttpResponse { +export interface LoadTestRunDeleteTestRunDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestRunDeleteDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunDeleteTestRunDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export type TestRunDeleteParameters = RequestParameters; +export type LoadTestRunDeleteTestRunParameters = RequestParameters; // @public -export interface TestRunGet200Response extends HttpResponse { +export interface LoadTestRunGetAppComponents200Response extends HttpResponse { // (undocumented) - body: TestRunOutput; + body: TestRunAppComponentsOutput; // (undocumented) status: "200"; } // @public (undocumented) -export interface TestRunGetDefaultHeaders { +export interface LoadTestRunGetAppComponentsDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestRunGetDefaultResponse extends HttpResponse { +export interface LoadTestRunGetAppComponentsDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestRunGetDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunGetAppComponentsDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export interface TestRunGetFile { - get(options?: TestRunGetFileParameters): StreamableMethod; -} +export type LoadTestRunGetAppComponentsParameters = RequestParameters; // @public -export interface TestRunGetFile200Response extends HttpResponse { +export interface LoadTestRunGetServerMetricsConfig200Response extends HttpResponse { // (undocumented) - body: FileInfoOutput; + body: TestRunServerMetricConfigOutput; // (undocumented) status: "200"; } // @public (undocumented) -export interface TestRunGetFileDefaultHeaders { +export interface LoadTestRunGetServerMetricsConfigDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestRunGetFileDefaultResponse extends HttpResponse { +export interface LoadTestRunGetServerMetricsConfigDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestRunGetFileDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunGetServerMetricsConfigDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export type TestRunGetFileParameters = RequestParameters; - -// @public (undocumented) -export type TestRunGetParameters = RequestParameters; - -// @public -export interface TestRunInputArtifacts { - additionalFileInfo?: Array; - configFileInfo?: FileInfo; - inputArtifactsZipFileInfo?: FileInfo; - testScriptFileInfo?: FileInfo; - userPropFileInfo?: FileInfo; -} +export type LoadTestRunGetServerMetricsConfigParameters = RequestParameters; // @public -export interface TestRunInputArtifactsOutput { - additionalFileInfo?: Array; - configFileInfo?: FileInfoOutput; - inputArtifactsZipFileInfo?: FileInfoOutput; - testScriptFileInfo?: FileInfoOutput; - userPropFileInfo?: FileInfoOutput; +export interface LoadTestRunGetTestRun200Response extends HttpResponse { + // (undocumented) + body: TestRunOutput; + // (undocumented) + status: "200"; } // @public (undocumented) -export interface TestRunList { - get(options?: TestRunListParameters): StreamableMethod; +export interface LoadTestRunGetTestRunDefaultHeaders { + "x-ms-error-code"?: string; } // @public -export interface TestRunList200Response extends HttpResponse { +export interface LoadTestRunGetTestRunDefaultResponse extends HttpResponse { // (undocumented) - body: TestRunsListOutput; + body: ErrorResponseBodyOutput; // (undocumented) - status: "200"; + headers: RawHttpHeaders & LoadTestRunGetTestRunDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export interface LoadTestRunGetTestRunFile { + get(options?: LoadTestRunGetTestRunFileParameters): StreamableMethod; } // @public -export interface TestRunListAppComponents200Response extends HttpResponse { +export interface LoadTestRunGetTestRunFile200Response extends HttpResponse { // (undocumented) - body: TestRunAppComponentsOutput; + body: FileInfoOutput; // (undocumented) status: "200"; } // @public (undocumented) -export interface TestRunListAppComponentsDefaultHeaders { +export interface LoadTestRunGetTestRunFileDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestRunListAppComponentsDefaultResponse extends HttpResponse { +export interface LoadTestRunGetTestRunFileDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestRunListAppComponentsDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunGetTestRunFileDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export type TestRunListAppComponentsParameters = RequestParameters; +export type LoadTestRunGetTestRunFileParameters = RequestParameters; // @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; -} +export type LoadTestRunGetTestRunParameters = RequestParameters; // @public (undocumented) -export interface TestRunListMetricDefinitions { - get(options: TestRunListMetricDefinitionsParameters): StreamableMethod; +export interface LoadTestRunListMetricDefinitions { + get(options: LoadTestRunListMetricDefinitionsParameters): StreamableMethod; } // @public -export interface TestRunListMetricDefinitions200Response extends HttpResponse { +export interface LoadTestRunListMetricDefinitions200Response extends HttpResponse { // (undocumented) body: MetricDefinitionCollectionOutput; // (undocumented) @@ -1294,41 +984,41 @@ export interface TestRunListMetricDefinitions200Response extends HttpResponse { } // @public (undocumented) -export interface TestRunListMetricDefinitionsDefaultHeaders { +export interface LoadTestRunListMetricDefinitionsDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestRunListMetricDefinitionsDefaultResponse extends HttpResponse { +export interface LoadTestRunListMetricDefinitionsDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestRunListMetricDefinitionsDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunListMetricDefinitionsDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export type TestRunListMetricDefinitionsParameters = TestRunListMetricDefinitionsQueryParam & RequestParameters; +export type LoadTestRunListMetricDefinitionsParameters = LoadTestRunListMetricDefinitionsQueryParam & RequestParameters; // @public (undocumented) -export interface TestRunListMetricDefinitionsQueryParam { +export interface LoadTestRunListMetricDefinitionsQueryParam { // (undocumented) - queryParameters: TestRunListMetricDefinitionsQueryParamProperties; + queryParameters: LoadTestRunListMetricDefinitionsQueryParamProperties; } // @public (undocumented) -export interface TestRunListMetricDefinitionsQueryParamProperties { +export interface LoadTestRunListMetricDefinitionsQueryParamProperties { metricNamespace: string; } // @public (undocumented) -export interface TestRunListMetricDimensionValues { - get(options: TestRunListMetricDimensionValuesParameters): StreamableMethod; +export interface LoadTestRunListMetricDimensionValues { + get(options: LoadTestRunListMetricDimensionValuesParameters): StreamableMethod; } // @public -export interface TestRunListMetricDimensionValues200Response extends HttpResponse { +export interface LoadTestRunListMetricDimensionValues200Response extends HttpResponse { // (undocumented) body: DimensionValueListOutput; // (undocumented) @@ -1336,31 +1026,31 @@ export interface TestRunListMetricDimensionValues200Response extends HttpRespons } // @public (undocumented) -export interface TestRunListMetricDimensionValuesDefaultHeaders { +export interface LoadTestRunListMetricDimensionValuesDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestRunListMetricDimensionValuesDefaultResponse extends HttpResponse { +export interface LoadTestRunListMetricDimensionValuesDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestRunListMetricDimensionValuesDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunListMetricDimensionValuesDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export type TestRunListMetricDimensionValuesParameters = TestRunListMetricDimensionValuesQueryParam & RequestParameters; +export type LoadTestRunListMetricDimensionValuesParameters = LoadTestRunListMetricDimensionValuesQueryParam & RequestParameters; // @public (undocumented) -export interface TestRunListMetricDimensionValuesQueryParam { +export interface LoadTestRunListMetricDimensionValuesQueryParam { // (undocumented) - queryParameters: TestRunListMetricDimensionValuesQueryParamProperties; + queryParameters: LoadTestRunListMetricDimensionValuesQueryParamProperties; } // @public (undocumented) -export interface TestRunListMetricDimensionValuesQueryParamProperties { +export interface LoadTestRunListMetricDimensionValuesQueryParamProperties { interval?: "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; metricname: string; metricNamespace: string; @@ -1368,12 +1058,12 @@ export interface TestRunListMetricDimensionValuesQueryParamProperties { } // @public (undocumented) -export interface TestRunListMetricNamespaces { - get(options?: TestRunListMetricNamespacesParameters): StreamableMethod; +export interface LoadTestRunListMetricNamespaces { + get(options?: LoadTestRunListMetricNamespacesParameters): StreamableMethod; } // @public -export interface TestRunListMetricNamespaces200Response extends HttpResponse { +export interface LoadTestRunListMetricNamespaces200Response extends HttpResponse { // (undocumented) body: MetricNamespaceCollectionOutput; // (undocumented) @@ -1381,30 +1071,30 @@ export interface TestRunListMetricNamespaces200Response extends HttpResponse { } // @public (undocumented) -export interface TestRunListMetricNamespacesDefaultHeaders { +export interface LoadTestRunListMetricNamespacesDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestRunListMetricNamespacesDefaultResponse extends HttpResponse { +export interface LoadTestRunListMetricNamespacesDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestRunListMetricNamespacesDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunListMetricNamespacesDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export type TestRunListMetricNamespacesParameters = RequestParameters; +export type LoadTestRunListMetricNamespacesParameters = RequestParameters; // @public (undocumented) -export interface TestRunListMetrics { - post(options: TestRunListMetricsParameters): StreamableMethod; +export interface LoadTestRunListMetrics { + post(options: LoadTestRunListMetricsParameters): StreamableMethod; } // @public -export interface TestRunListMetrics200Response extends HttpResponse { +export interface LoadTestRunListMetrics200Response extends HttpResponse { // (undocumented) body: MetricsOutput; // (undocumented) @@ -1412,41 +1102,41 @@ export interface TestRunListMetrics200Response extends HttpResponse { } // @public (undocumented) -export interface TestRunListMetricsBodyParam { +export interface LoadTestRunListMetricsBodyParam { body?: MetricRequestPayload; } // @public (undocumented) -export interface TestRunListMetricsDefaultHeaders { +export interface LoadTestRunListMetricsDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestRunListMetricsDefaultResponse extends HttpResponse { +export interface LoadTestRunListMetricsDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestRunListMetricsDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunListMetricsDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export interface TestRunListMetricsMediaTypesParam { +export interface LoadTestRunListMetricsMediaTypesParam { contentType?: "application/json"; } // @public (undocumented) -export type TestRunListMetricsParameters = TestRunListMetricsQueryParam & TestRunListMetricsMediaTypesParam & TestRunListMetricsBodyParam & RequestParameters; +export type LoadTestRunListMetricsParameters = LoadTestRunListMetricsQueryParam & LoadTestRunListMetricsMediaTypesParam & LoadTestRunListMetricsBodyParam & RequestParameters; // @public (undocumented) -export interface TestRunListMetricsQueryParam { +export interface LoadTestRunListMetricsQueryParam { // (undocumented) - queryParameters: TestRunListMetricsQueryParamProperties; + queryParameters: LoadTestRunListMetricsQueryParamProperties; } // @public (undocumented) -export interface TestRunListMetricsQueryParamProperties { +export interface LoadTestRunListMetricsQueryParamProperties { aggregation?: string; interval?: "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; metricname: string; @@ -1455,17 +1145,44 @@ export interface TestRunListMetricsQueryParamProperties { } // @public (undocumented) -export type TestRunListParameters = TestRunListQueryParam & RequestParameters; +export interface LoadTestRunListTestRuns { + get(options?: LoadTestRunListTestRunsParameters): StreamableMethod; +} + +// @public +export interface LoadTestRunListTestRuns200Response extends HttpResponse { + // (undocumented) + body: TestRunsListOutput; + // (undocumented) + status: "200"; +} + +// @public (undocumented) +export interface LoadTestRunListTestRunsDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public +export interface LoadTestRunListTestRunsDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponseBodyOutput; + // (undocumented) + headers: RawHttpHeaders & LoadTestRunListTestRunsDefaultHeaders; + // (undocumented) + status: string; +} + +// @public (undocumented) +export type LoadTestRunListTestRunsParameters = LoadTestRunListTestRunsQueryParam & RequestParameters; // @public (undocumented) -export interface TestRunListQueryParam { +export interface LoadTestRunListTestRunsQueryParam { // (undocumented) - queryParameters?: TestRunListQueryParamProperties; + queryParameters?: LoadTestRunListTestRunsQueryParamProperties; } // @public (undocumented) -export interface TestRunListQueryParamProperties { - continuationToken?: string; +export interface LoadTestRunListTestRunsQueryParamProperties { executionFrom?: Date | string; executionTo?: Date | string; maxpagesize?: number; @@ -1475,248 +1192,468 @@ export interface TestRunListQueryParamProperties { testId?: string; } +// @public (undocumented) +export interface LoadTestRunStopTestRun { + post(options?: LoadTestRunStopTestRunParameters): StreamableMethod; +} + // @public -export interface TestRunListServerMetricsConfig200Response extends HttpResponse { +export interface LoadTestRunStopTestRun200Response extends HttpResponse { // (undocumented) - body: TestRunServerMetricConfigOutput; + body: TestRunOutput; // (undocumented) status: "200"; } // @public (undocumented) -export interface TestRunListServerMetricsConfigDefaultHeaders { +export interface LoadTestRunStopTestRunDefaultHeaders { "x-ms-error-code"?: string; } // @public -export interface TestRunListServerMetricsConfigDefaultResponse extends HttpResponse { +export interface LoadTestRunStopTestRunDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseBodyOutput; // (undocumented) - headers: RawHttpHeaders & TestRunListServerMetricsConfigDefaultHeaders; + headers: RawHttpHeaders & LoadTestRunStopTestRunDefaultHeaders; // (undocumented) status: string; } // @public (undocumented) -export type TestRunListServerMetricsConfigParameters = RequestParameters; - -// @public -export interface TestRunOutput { - certificate?: CertificateMetadataOutput; - createdBy?: string; - createdDateTime?: string; - description?: string; - displayName?: string; - duration?: number; - endDateTime?: string; - environmentVariables?: Record; - errorDetails?: Array; - executedDateTime?: string; - lastModifiedBy?: string; - lastModifiedDateTime?: string; - loadTestConfiguration?: LoadTestConfigurationOutput; - passFailCriteria?: PassFailCriteriaOutput; - portalUrl?: 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?: TestRunArtifactsOutput; - testId?: string; - testResult?: "PASSED" | "NOT_APPLICABLE" | "FAILED"; - testRunId?: string; - testRunStatistics?: Record; - virtualUsers?: number; -} +export type LoadTestRunStopTestRunParameters = RequestParameters; // @public -export interface TestRunOutputArtifacts { - logsFileInfo?: FileInfo; - resultFileInfo?: FileInfo; +export interface MetricAvailabilityOutput { + timeGrain?: "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; } // @public -export interface TestRunOutputArtifactsOutput { - logsFileInfo?: FileInfoOutput; - resultFileInfo?: FileInfoOutput; +export interface MetricDefinitionCollectionOutput { + value: Array; } // @public -export interface TestRunServerMetricConfig { - createdBy?: string; - createdDateTime?: Date | string; - lastModifiedBy?: string; - lastModifiedDateTime?: Date | string; - metrics?: Record; - testRunId?: string; +export interface MetricDefinitionOutput { + description?: string; + dimensions?: Array; + metricAvailabilities?: Array; + name?: string; + namespace?: string; + primaryAggregationType?: "Average" | "Count" | "None" | "Total" | "Percentile90" | "Percentile95" | "Percentile99"; + supportedAggregationTypes?: Array; + unit?: "NotSpecified" | "Percent" | "Count" | "Seconds" | "Milliseconds" | "Bytes" | "BytesPerSecond" | "CountPerSecond"; } // @public -export interface TestRunServerMetricConfigOutput { - createdBy?: string; - createdDateTime?: string; - lastModifiedBy?: string; - lastModifiedDateTime?: string; - metrics?: Record; - testRunId?: string; +export interface MetricNamespaceCollectionOutput { + value: Array; } // @public -export interface TestRunsListOutput { +export interface MetricNamespaceOutput { + description?: string; + name?: string; +} + +// @public +export interface MetricRequestPayload { + filters?: Array; +} + +// @public +export interface MetricsOutput { nextLink?: string; - value: Array; + value?: Array; } // @public -export interface TestRunStatistics { - 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; +export interface MetricValueOutput { + timestamp?: string; + value?: number; } // @public -export interface TestRunStatisticsOutput { - 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; +export interface NameAndDescOutput { + description?: string; + name?: string; } -// @public (undocumented) -export interface TestRunStop { - post(options?: TestRunStopParameters): StreamableMethod; +// @public +export interface OptionalLoadTestConfig { + duration?: number; + endpointUrl?: string; + rampUpTime?: number; + virtualUsers?: number; } // @public -export interface TestRunStop200Response extends HttpResponse { - // (undocumented) - body: TestRunOutput; - // (undocumented) - status: "200"; +export interface OptionalLoadTestConfigOutput { + duration?: number; + endpointUrl?: string; + rampUpTime?: number; + virtualUsers?: number; +} + +// @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 PassFailCriteria { + passFailMetrics?: Record; +} + +// @public +export interface PassFailCriteriaOutput { + passFailMetrics?: Record; +} + +// @public +export interface PassFailMetric { + action?: "continue" | "stop"; + aggregate?: "count" | "percentage" | "avg" | "p50" | "p90" | "p95" | "p99" | "min" | "max"; + clientMetric?: "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; + condition?: string; + requestName?: string; + value?: number; +} + +// @public +export interface PassFailMetricOutput { + action?: "continue" | "stop"; + readonly 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; + readonly result?: "passed" | "undetermined" | "failed"; + value?: number; } // @public (undocumented) -export interface TestRunStopDefaultHeaders { - "x-ms-error-code"?: string; +export interface PolledOperationOptions { + updateIntervalInMs?: number; } // @public -export interface TestRunStopDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponseBodyOutput; - // (undocumented) - headers: RawHttpHeaders & TestRunStopDefaultHeaders; - // (undocumented) - status: string; +export interface ResourceMetric { + aggregation: string; + displayDescription?: string; + metricNamespace: string; + name: string; + resourceId: string; + resourceType: string; + unit?: string; +} + +// @public +export interface ResourceMetricOutput { + aggregation: string; + displayDescription?: string; + readonly id?: string; + metricNamespace: string; + name: string; + resourceId: string; + resourceType: string; + unit?: string; } // @public (undocumented) -export type TestRunStopParameters = RequestParameters; +export interface Routes { + (path: "/tests/{testId}", testId: string): LoadTestAdministrationCreateOrUpdateTest; + (path: "/tests"): LoadTestAdministrationListTests; + (path: "/tests/{testId}/files/{fileName}", testId: string, fileName: string): LoadTestAdministrationUploadTestFile; + (path: "/tests/{testId}/files", testId: string): LoadTestAdministrationListTestFiles; + (path: "/tests/{testId}/app-components", testId: string): LoadTestAdministrationCreateOrUpdateAppComponents; + (path: "/tests/{testId}/server-metrics-config", testId: string): LoadTestAdministrationCreateOrUpdateServerMetricsConfig; + (path: "/test-runs/{testRunId}", testRunId: string): LoadTestRunCreateOrUpdateTestRun; + (path: "/test-runs/{testRunId}/files/{fileName}", testRunId: string, fileName: string): LoadTestRunGetTestRunFile; + (path: "/test-runs"): LoadTestRunListTestRuns; + (path: "/test-runs/{testRunId}:stop", testRunId: string): LoadTestRunStopTestRun; + (path: "/test-runs/{testRunId}/metric-namespaces", testRunId: string): LoadTestRunListMetricNamespaces; + (path: "/test-runs/{testRunId}/metric-definitions", testRunId: string): LoadTestRunListMetricDefinitions; + (path: "/test-runs/{testRunId}/metrics", testRunId: string): LoadTestRunListMetrics; + (path: "/test-runs/{testRunId}/metric-dimensions/{name}/values", testRunId: string, name: string): LoadTestRunListMetricDimensionValues; + (path: "/test-runs/{testRunId}/app-components", testRunId: string): LoadTestRunCreateOrUpdateAppComponents; + (path: "/test-runs/{testRunId}/server-metrics-config", testRunId: string): LoadTestRunCreateOrUpdateServerMetricsConfig; +} // @public -export interface TestServerMetricConfig { - createdBy?: string; - createdDateTime?: Date | string; - lastModifiedBy?: string; - lastModifiedDateTime?: Date | string; - metrics?: Record; - testId?: string; +export interface Secret { + type?: "AKV_SECRET_URI" | "SECRET_VALUE"; + value?: string; } // @public -export interface TestServerMetricConfigOutput { - createdBy?: string; - createdDateTime?: string; - lastModifiedBy?: string; - lastModifiedDateTime?: string; - metrics?: Record; - testId?: string; +export interface SecretOutput { + type?: "AKV_SECRET_URI" | "SECRET_VALUE"; + value?: string; } // @public -export interface TestsListOutput { - nextLink?: string; - value: Array; +export interface Test { + certificate?: CertificateMetadata; + description?: string; + displayName?: string; + environmentVariables?: Record; + keyvaultReferenceIdentityId?: string; + keyvaultReferenceIdentityType?: string; + loadTestConfiguration?: LoadTestConfiguration; + passFailCriteria?: PassFailCriteria; + secrets?: Record; + subnetId?: string; } -// @public (undocumented) -export interface TestUploadFile { - delete(options?: TestDeleteFileParameters): StreamableMethod; - get(options?: TestGetFileParameters): StreamableMethod; - put(options: TestUploadFileParameters): StreamableMethod; +// @public +export interface TestAppComponents { + components: Record; } // @public -export interface TestUploadFile201Response extends HttpResponse { - // (undocumented) - body: FileInfoOutput; - // (undocumented) - status: "201"; +export interface TestAppComponentsOutput { + components: Record; + readonly createdBy?: string; + readonly createdDateTime?: string; + readonly lastModifiedBy?: string; + readonly lastModifiedDateTime?: string; + readonly testId?: string; } -// @public (undocumented) -export interface TestUploadFileBodyParam { - body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream; +// @public +export type TestAppComponentsResourceMergeAndPatch = Partial; + +// @public +export interface TestInputArtifacts { + configFileInfo?: FileInfo; + inputArtifactsZipFileInfo?: FileInfo; + testScriptFileInfo?: FileInfo; + userPropFileInfo?: FileInfo; } -// @public (undocumented) -export interface TestUploadFileDefaultHeaders { - "x-ms-error-code"?: string; +// @public +export interface TestInputArtifactsOutput { + readonly additionalFileInfo?: Array; + configFileInfo?: FileInfoOutput; + inputArtifactsZipFileInfo?: FileInfoOutput; + testScriptFileInfo?: FileInfoOutput; + userPropFileInfo?: FileInfoOutput; } // @public -export interface TestUploadFileDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponseBodyOutput; - // (undocumented) - headers: RawHttpHeaders & TestUploadFileDefaultHeaders; - // (undocumented) - status: string; +export interface TestOutput { + certificate?: CertificateMetadataOutput; + readonly createdBy?: string; + readonly createdDateTime?: string; + description?: string; + displayName?: string; + environmentVariables?: Record; + readonly inputArtifacts?: TestInputArtifactsOutput; + keyvaultReferenceIdentityId?: string; + keyvaultReferenceIdentityType?: string; + readonly lastModifiedBy?: string; + readonly lastModifiedDateTime?: string; + loadTestConfiguration?: LoadTestConfigurationOutput; + passFailCriteria?: PassFailCriteriaOutput; + secrets?: Record; + subnetId?: string; + readonly testId?: string; } -// @public (undocumented) -export interface TestUploadFileMediaTypesParam { - contentType?: "application/octet-stream"; +// @public +export type TestResourceMergeAndPatch = Partial; + +// @public +export interface TestRun { + certificate?: CertificateMetadata; + description?: string; + displayName?: string; + environmentVariables?: Record; + loadTestConfiguration?: LoadTestConfiguration; + passFailCriteria?: PassFailCriteria; + secrets?: Record; + testId?: string; +} + +// @public +export interface TestRunAppComponents { + components: Record; +} + +// @public +export interface TestRunAppComponentsOutput { + components: Record; + readonly createdBy?: string; + readonly createdDateTime?: string; + readonly lastModifiedBy?: string; + readonly lastModifiedDateTime?: string; + readonly testRunId?: string; +} + +// @public +export type TestRunAppComponentsResourceMergeAndPatch = Partial; + +// @public +export interface TestRunArtifacts { + outputArtifacts?: TestRunOutputArtifacts; +} + +// @public +export interface TestRunArtifactsOutput { + readonly inputArtifacts?: TestRunInputArtifactsOutput; + outputArtifacts?: TestRunOutputArtifactsOutput; } // @public (undocumented) -export type TestUploadFileParameters = TestUploadFileQueryParam & TestUploadFileMediaTypesParam & TestUploadFileBodyParam & RequestParameters; +export type TestRunCompletionPoller = SimplePollerLike, LoadTestRunGetTestRun200Response>; // @public (undocumented) -export interface TestUploadFileQueryParam { - // (undocumented) - queryParameters?: TestUploadFileQueryParamProperties; +export type TestRunCreateOrUpdateSuccessResponse = LoadTestRunCreateOrUpdateTestRun200Response | LoadTestRunCreateOrUpdateTestRun201Response; + +// @public +export interface TestRunInputArtifacts { + configFileInfo?: FileInfo; + inputArtifactsZipFileInfo?: FileInfo; + testScriptFileInfo?: FileInfo; + userPropFileInfo?: FileInfo; } -// @public (undocumented) -export interface TestUploadFileQueryParamProperties { - fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; +// @public +export interface TestRunInputArtifactsOutput { + readonly additionalFileInfo?: Array; + configFileInfo?: FileInfoOutput; + inputArtifactsZipFileInfo?: FileInfoOutput; + testScriptFileInfo?: FileInfoOutput; + userPropFileInfo?: FileInfoOutput; +} + +// @public +export interface TestRunOutput { + certificate?: CertificateMetadataOutput; + readonly createdBy?: string; + readonly createdDateTime?: string; + description?: string; + displayName?: string; + readonly duration?: number; + readonly endDateTime?: string; + environmentVariables?: Record; + readonly errorDetails?: Array; + readonly executedDateTime?: string; + readonly lastModifiedBy?: string; + readonly lastModifiedDateTime?: string; + loadTestConfiguration?: LoadTestConfigurationOutput; + passFailCriteria?: PassFailCriteriaOutput; + readonly portalUrl?: string; + secrets?: Record; + readonly startDateTime?: string; + readonly status?: "ACCEPTED" | "NOTSTARTED" | "PROVISIONING" | "PROVISIONED" | "CONFIGURING" | "CONFIGURED" | "EXECUTING" | "EXECUTED" | "DEPROVISIONING" | "DEPROVISIONED" | "DONE" | "CANCELLING" | "CANCELLED" | "FAILED" | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE"; + readonly subnetId?: string; + readonly testArtifacts?: TestRunArtifactsOutput; + testId?: string; + readonly testResult?: "PASSED" | "NOT_APPLICABLE" | "FAILED"; + readonly testRunId?: string; + readonly testRunStatistics?: Record; + readonly virtualUsers?: number; +} + +// @public +export interface TestRunOutputArtifacts { + logsFileInfo?: FileInfo; + resultFileInfo?: FileInfo; +} + +// @public +export interface TestRunOutputArtifactsOutput { + logsFileInfo?: FileInfoOutput; + resultFileInfo?: FileInfoOutput; +} + +// @public +export type TestRunResourceMergeAndPatch = Partial; + +// @public +export interface TestRunServerMetricConfig { + metrics?: Record; +} + +// @public +export interface TestRunServerMetricConfigOutput { + readonly createdBy?: string; + readonly createdDateTime?: string; + readonly lastModifiedBy?: string; + readonly lastModifiedDateTime?: string; + metrics?: Record; + readonly testRunId?: string; +} + +// @public +export type TestRunServerMetricConfigResourceMergeAndPatch = Partial; + +// @public +export interface TestRunsListOutput { + nextLink?: string; + value: Array; +} + +// @public +export interface TestRunStatistics { +} + +// @public +export interface TestRunStatisticsOutput { + readonly errorCount?: number; + readonly errorPct?: number; + readonly maxResTime?: number; + readonly meanResTime?: number; + readonly medianResTime?: number; + readonly minResTime?: number; + readonly pct1ResTime?: number; + readonly pct2ResTime?: number; + readonly pct3ResTime?: number; + readonly receivedKBytesPerSec?: number; + readonly sampleCount?: number; + readonly sentKBytesPerSec?: number; + readonly throughput?: number; + readonly transaction?: string; +} + +// @public +export interface TestServerMetricConfig { + metrics?: Record; +} + +// @public +export interface TestServerMetricConfigOutput { + readonly createdBy?: string; + readonly createdDateTime?: string; + readonly lastModifiedBy?: string; + readonly lastModifiedDateTime?: string; + metrics?: Record; + readonly testId?: string; +} + +// @public +export type TestServerMetricConfigResourceMergeAndPatch = Partial; + +// @public +export interface TestsListOutput { + nextLink?: string; + value: Array; } // @public (undocumented) -export type TestUploadFileSuccessResponse = TestUploadFile201Response; +export type TestUploadFileSuccessResponse = LoadTestAdministrationUploadTestFile201Response; // @public export interface TimeSeriesElementOutput { diff --git a/sdk/loadtesting/load-testing-rest/samples-dev/sample.ts b/sdk/loadtesting/load-testing-rest/samples-dev/sample.ts index 4467375d0718..3214fa789250 100644 --- a/sdk/loadtesting/load-testing-rest/samples-dev/sample.ts +++ b/sdk/loadtesting/load-testing-rest/samples-dev/sample.ts @@ -18,7 +18,6 @@ const readStream = createReadStream("./sample.jmx"); async function main() { const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; const displayName = "some-load-test"; - const SUBSCRIPTION_ID = process.env["SUBSCRIPTION_ID"] || ""; const testId = uuidv4(); // ID to be assigned to a test const testRunId = uuidv4(); // ID to be assigned to a testRun @@ -78,15 +77,11 @@ async function main() { .patch({ contentType: "application/merge-patch+json", body: { - testId: testCreationResult.body.testId, components: { "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo": { - resourceId: - "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo", resourceName: "App-Service-Sample-Demo", resourceType: "Microsoft.Web/sites", - subscriptionId: SUBSCRIPTION_ID, }, }, }, @@ -102,7 +97,6 @@ async function main() { body: { testId: testId, displayName: displayName, - virtualUsers: 10, }, }); diff --git a/sdk/loadtesting/load-testing-rest/samples-dev/stopTest.ts b/sdk/loadtesting/load-testing-rest/samples-dev/stopTest.ts index daa145545c5b..99a0c4bc1b9d 100644 --- a/sdk/loadtesting/load-testing-rest/samples-dev/stopTest.ts +++ b/sdk/loadtesting/load-testing-rest/samples-dev/stopTest.ts @@ -43,7 +43,6 @@ async function main() { body: { testId: testId, displayName: displayName, - virtualUsers: 10, }, }); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/README.md b/sdk/loadtesting/load-testing-rest/samples/v1/javascript/README.md index e318e04f9e32..ee5f997fdcbf 100644 --- a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/README.md +++ b/sdk/loadtesting/load-testing-rest/samples/v1/javascript/README.md @@ -11,12 +11,10 @@ urlFragment: load-testing-javascript These sample programs show how to use the JavaScript client libraries for Azure Load Testing rest in some common scenarios. -| **File Name** | **Description** | -| ----------------------------------------------------------- | -------------------------- | -| [createAppComponent.js][createappcomponent] | creates and run a loadtest | -| [createOrUpdateTest.js][createorupdatetest] | creates and run a loadtest | -| [createTestRunAndGetMetrics.js][createtestrunandgetmetrics] | creates and run a loadtest | -| [fileUpload.js][fileupload] | creates and run a loadtest | +| **File Name** | **Description** | +| ----------------------- | -------------------------------- | +| [sample.js][sample] | creates and run a loadtest | +| [stopTest.js][stoptest] | creates, run and stop a loadtest | ## Prerequisites @@ -45,24 +43,22 @@ npm install 3. Run whichever samples you like (note that some samples may require additional setup, see the table above): ```bash -node createAppComponent.js +node sample.js ``` Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): ```bash -npx cross-env LOADTESTSERVICE_ENDPOINT="" SUBSCRIPTION_ID="" node createAppComponent.js +npx cross-env LOADTESTSERVICE_ENDPOINT="" node sample.js ``` ## Next Steps Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. -[createappcomponent]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1/javascript/createAppComponent.js -[createorupdatetest]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1/javascript/createOrUpdateTest.js -[createtestrunandgetmetrics]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1/javascript/createTestRunAndGetMetrics.js -[fileupload]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1/javascript/fileUpload.js -[apiref]: https://docs.microsoft.com/javascript/api/@azure-rest/load-testing +[sample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1/javascript/sample.js +[stoptest]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1/javascript/stopTest.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/load-testing [freesub]: https://azure.microsoft.com/free/ [createinstance_azureloadtestingserviceinstance]: https://learn.microsoft.com/azure/load-testing/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtesting/load-testing-rest/README.md diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/createAppComponent.js b/sdk/loadtesting/load-testing-rest/samples/v1/javascript/createAppComponent.js deleted file mode 100644 index 2467377d9210..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/createAppComponent.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to a) create a loadtest, b) upload a jmx file, c) create appcomponent, d) run test and e) get test status - * - * @summary creates and run a loadtest - */ - -const AzureLoadTesting = require("@azure-rest/load-testing").default, - { isUnexpected } = require("@azure-rest/load-testing"); -const { DefaultAzureCredential } = require("@azure/identity"); -const { v4: uuidv4 } = require("uuid"); - -async function main() { - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - const displayName = "some-load-test"; - const testId = uuidv4(); // ID to be assigned to a test - const SUBSCRIPTION_ID = process.env["SUBSCRIPTION_ID"] || ""; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - - // Creating a load test - const testCreationResult = await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: displayName, - description: "", - loadTestConfiguration: { - engineInstances: 1, // number of engine instances to run test - }, - }, - }); - // Checking for error response - if (isUnexpected(testCreationResult)) { - throw testCreationResult.body.error; - } - - if (testCreationResult.body.testId === undefined) - throw new Error("Test ID returned as undefined."); - - const appComponentCreationResult = await client - .path("/tests/{testId}/app-components", testId) - .patch({ - contentType: "application/merge-patch+json", - body: { - testId: testCreationResult.body.testId, - components: { - "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo": - { - resourceId: - "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo", - resourceName: "App-Service-Sample-Demo", - resourceType: "Microsoft.Web/sites", - subscriptionId: SUBSCRIPTION_ID, - }, - }, - }, - }); - - if (isUnexpected(appComponentCreationResult)) { - throw appComponentCreationResult.body.error; - } -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/createOrUpdateTest.js b/sdk/loadtesting/load-testing-rest/samples/v1/javascript/createOrUpdateTest.js deleted file mode 100644 index db99089bffa0..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/createOrUpdateTest.js +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to a) create a loadtest, b) upload a jmx file, c) create appcomponent, d) run test and e) get test status - * - * @summary creates and run a loadtest - */ - -const AzureLoadTesting /*, { isUnexpected }*/ = require("@azure-rest/load-testing").default; -const { DefaultAzureCredential } = require("@azure/identity"); -const { v4: uuidv4 } = require("uuid"); - -async function main() { - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - const displayName = "some-load-test"; - const testId = uuidv4(); // ID to be assigned to a test - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - - // Creating the Load test - await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: displayName, - description: "", - loadTestConfiguration: { - engineInstances: 1, // number of engine instances to run test - }, - }, - }); -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/fileUpload.js b/sdk/loadtesting/load-testing-rest/samples/v1/javascript/fileUpload.js deleted file mode 100644 index b7b61697beb6..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/fileUpload.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to a) create a loadtest, b) upload a jmx file, c) create appcomponent, d) run test and e) get test status - * - * @summary creates and run a loadtest - */ - -const AzureLoadTesting = require("@azure-rest/load-testing").default, - { isUnexpected } = require("@azure-rest/load-testing"); -const { DefaultAzureCredential } = require("@azure/identity"); -const { createReadStream } = require("fs"); -const { v4: uuidv4 } = require("uuid"); - -const readStream = createReadStream("./sample.jmx"); - -async function main() { - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - const displayName = "some-load-test"; - const testId = uuidv4(); // ID to be assigned to a test - const fileId = uuidv4(); // ID to be assigned to the file being uploaded - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - - // Creating a load test - const testCreationResult = await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: displayName, - description: "", - loadTestConfiguration: { - engineInstances: 1, // number of engine instances to run test - }, - }, - }); - // Checking for error response - if (isUnexpected(testCreationResult)) { - throw testCreationResult.body.error; - } - - if (testCreationResult.body.testId === undefined) - throw new Error("Test ID returned as undefined."); - - // Uploading .jmx file to a test - const fileUploadResult = await client - .path("/tests/{testId}/files/{fileName}", testCreationResult.body.testId, fileId) - .put({ - contentType: "application/octet-stream", - body: readStream, - }); - - if (isUnexpected(fileUploadResult)) { - throw fileUploadResult.body.error; - } -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/package.json b/sdk/loadtesting/load-testing-rest/samples/v1/javascript/package.json index cd7a01bd653a..2845ed9e120e 100644 --- a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/package.json +++ b/sdk/loadtesting/load-testing-rest/samples/v1/javascript/package.json @@ -28,7 +28,7 @@ "dependencies": { "@azure-rest/load-testing": "latest", "dotenv": "latest", - "@azure/identity": "^4.2.1", + "@azure/identity": "^4.0.1", "uuid": "^9.0.0" } } diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/sample.env b/sdk/loadtesting/load-testing-rest/samples/v1/javascript/sample.env index 672847a3fea0..d01f16f14dd8 100644 --- a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/sample.env +++ b/sdk/loadtesting/load-testing-rest/samples/v1/javascript/sample.env @@ -1,4 +1,8 @@ # App registration secret for AAD authentication AZURE_CLIENT_SECRET= AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +AZURE_TENANT_ID= + +LOADTESTSERVICE_ENDPOINT= +SUBSCRIPTION_ID= +RESOURCE_GROUP= diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/sample.js b/sdk/loadtesting/load-testing-rest/samples/v1/javascript/sample.js new file mode 100644 index 000000000000..def48c2d58d1 --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/samples/v1/javascript/sample.js @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * This sample demonstrates how to a) create a loadtest, b) upload a jmx file, c) create appcomponent, d) run test and e) get test status, and f) get test metrics + * + * @summary creates and run a loadtest + */ + +const AzureLoadTesting = require("@azure-rest/load-testing").default, + { isUnexpected, getLongRunningPoller } = require("@azure-rest/load-testing"); +const { DefaultAzureCredential } = require("@azure/identity"); +const { createReadStream } = require("fs"); +const { v4: uuidv4 } = require("uuid"); + +const readStream = createReadStream("./sample.jmx"); + +async function main() { + const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; + const displayName = "some-load-test"; + const testId = uuidv4(); // ID to be assigned to a test + const testRunId = uuidv4(); // ID to be assigned to a testRun + + // Build a client through AAD + const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); + + // Creating/Updating a load test + const testCreationResult = await client.path("/tests/{testId}", testId).patch({ + contentType: "application/merge-patch+json", + body: { + displayName: displayName, + description: "", + loadTestConfiguration: { + engineInstances: 1, // number of engine instances to run test + }, + }, + }); + // Checking for error response + if (isUnexpected(testCreationResult)) { + throw testCreationResult.body.error; + } + + if (testCreationResult.body.testId === undefined) + throw new Error("Test ID returned as undefined."); + + // Uploading .jmx file to a test + const fileUploadResult = await client + .path("/tests/{testId}/files/{fileName}", testId, "sample.jmx") + .put({ + contentType: "application/octet-stream", + body: readStream, + }); + + if (isUnexpected(fileUploadResult)) { + throw fileUploadResult.body.error; + } + + let fileValidateResult; + const fileValidatePoller = await getLongRunningPoller(client, fileUploadResult); + try { + fileValidateResult = await fileValidatePoller.pollUntilDone({ + abortSignal: AbortSignal.timeout(120 * 1000), // timeout of 120 seconds + }); + } catch (ex) { + new Error("Error in polling file Validation" + ex.message); //polling timed out + } + + if (fileValidatePoller.getOperationState().status != "succeeded" && fileValidateResult) + throw new Error( + "There is some issue in validation, please make sure uploaded file is a valid JMX." + + fileValidateResult.body.validationFailureDetails, + ); + + // Creating/Updating app component + const appComponentCreationResult = await client + .path("/tests/{testId}/app-components", testId) + .patch({ + contentType: "application/merge-patch+json", + body: { + components: { + "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo": + { + resourceName: "App-Service-Sample-Demo", + resourceType: "Microsoft.Web/sites", + }, + }, + }, + }); + + if (isUnexpected(appComponentCreationResult)) { + throw appComponentCreationResult.body.error; + } + + // Creating/Updating the test run + const testRunCreationResult = await client.path("/test-runs/{testRunId}", testRunId).patch({ + contentType: "application/merge-patch+json", + body: { + testId: testId, + displayName: displayName, + }, + }); + + if (isUnexpected(testRunCreationResult)) { + throw testRunCreationResult.body.error; + } + + if (testRunCreationResult.body.testRunId === undefined) + throw new Error("Test Run ID returned as undefined."); + + let testRunResult; + const testRunPoller = await getLongRunningPoller(client, testRunCreationResult); + + try { + testRunResult = await testRunPoller.pollUntilDone({ + abortSignal: AbortSignal.timeout(300 * 1000), // timeout of 5 minutes + }); + } catch (ex) { + new Error("Error in polling test run completion" + ex.message); //polling timed out + } + + if (testRunPoller.getOperationState().status != "succeeded") + throw new Error("There is some issue in running the test, Error Response : " + testRunResult); + + if (testRunResult) { + let testRunStarttime = testRunResult.body.startDateTime; + let testRunEndTime = testRunResult.body.endDateTime; + + // get list of all metric namespaces and pick the first one + const metricNamespaces = await client + .path("/test-runs/{testRunId}/metric-namespaces", testRunId) + .get(); + + if (isUnexpected(metricNamespaces)) { + throw metricNamespaces.body.error; + } + + const metricNamespace = metricNamespaces.body.value[0]; + + if (metricNamespace.name === undefined) { + throw "No Metric Namespace name is defined."; + } + + // get list of all metric definitions and pick the first one + const metricDefinitions = await client + .path("/test-runs/{testRunId}/metric-definitions", testRunId) + .get({ + queryParameters: { + metricNamespace: metricNamespace.name, + }, + }); + + if (isUnexpected(metricDefinitions)) { + throw metricDefinitions.body.error; + } + + const metricDefinition = metricDefinitions.body.value[0]; + + if (metricDefinition.name === undefined) { + throw "No Metric Namespace name is defined."; + } + + // fetch client metrics using metric namespace and metric name + const metricsResult = await client.path("/test-runs/{testRunId}/metrics", testRunId).post({ + queryParameters: { + metricname: metricDefinition.name, + metricNamespace: metricNamespace.name, + timespan: testRunStarttime + "/" + testRunEndTime, + }, + }); + + console.log(metricsResult); + console.log(testRunResult); + + // Deleting test run + const deleteTestRunResult = await client.path("/test-runs/{testRunId}", testRunId).delete(); + + if (isUnexpected(deleteTestRunResult)) { + throw deleteTestRunResult.body.error; + } + + // Deleting test + const deleteTestResult = await client.path("/tests/{testId}", testId).delete(); + + if (isUnexpected(deleteTestResult)) { + throw deleteTestResult.body.error; + } + } +} + +main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/createTestRunAndGetMetrics.js b/sdk/loadtesting/load-testing-rest/samples/v1/javascript/stopTest.js similarity index 54% rename from sdk/loadtesting/load-testing-rest/samples/v1/javascript/createTestRunAndGetMetrics.js rename to sdk/loadtesting/load-testing-rest/samples/v1/javascript/stopTest.js index 1539a1481460..ab6dc530a9a8 100644 --- a/sdk/loadtesting/load-testing-rest/samples/v1/javascript/createTestRunAndGetMetrics.js +++ b/sdk/loadtesting/load-testing-rest/samples/v1/javascript/stopTest.js @@ -1,7 +1,7 @@ /** - * This sample demonstrates how to run a test and get test status + * This sample demonstrates how to run a test and stop execution * - * @summary creates and run a loadtest + * @summary creates, run and stop a loadtest */ const AzureLoadTesting = require("@azure-rest/load-testing").default, @@ -18,13 +18,31 @@ async function main() { // Build a client through AAD const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - // Creating the test run + // Patching a load test + const testCreationResult = await client.path("/tests/{testId}", testId).patch({ + contentType: "application/merge-patch+json", + body: { + displayName: displayName, + description: "", + loadTestConfiguration: { + engineInstances: 1, // number of engine instances to run test + }, + }, + }); + // Checking for error response + if (isUnexpected(testCreationResult)) { + throw testCreationResult.body.error; + } + + if (testCreationResult.body.testId === undefined) + throw new Error("Test ID returned as undefined."); + + // Patching the test run const testRunCreationResult = await client.path("/test-runs/{testRunId}", testRunId).patch({ contentType: "application/merge-patch+json", body: { testId: testId, displayName: displayName, - virtualUsers: 10, }, }); @@ -35,28 +53,15 @@ async function main() { if (testRunCreationResult.body.testRunId === undefined) throw new Error("Test Run ID returned as undefined."); - // Checking the test run status and printing metrics - var testStatus = null; - var getTestRunResult = null; + // Checking the test run status const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); - //wait for terminal state - while ( - testStatus == null || - (testStatus != "DONE" && testStatus != "CANCELLED" && testStatus != "FAILED") - ) { - getTestRunResult = await client - .path("/test-runs/{testRunId}", testRunCreationResult.body.testRunId) - .get(); - if (isUnexpected(getTestRunResult)) { - throw getTestRunResult.body.error; - } - testStatus = getTestRunResult.body.status; - - //Check test status after every 5 seconds - sleep(5000); - } + sleep(30000); - console.log(getTestRunResult); + let stopTestRunResult = await client.path("/test-runs/{testRunId}:stop", testRunId).post(); + + if (isUnexpected(stopTestRunResult)) { + throw stopTestRunResult.body.error; + } } main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/README.md b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/README.md index 0c7fb723950f..5f1393cf786d 100644 --- a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/README.md +++ b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/README.md @@ -11,12 +11,10 @@ urlFragment: load-testing-typescript These sample programs show how to use the TypeScript client libraries for Azure Load Testing rest in some common scenarios. -| **File Name** | **Description** | -| ----------------------------------------------------------- | -------------------------- | -| [createAppComponent.ts][createappcomponent] | creates and run a loadtest | -| [createOrUpdateTest.ts][createorupdatetest] | creates and run a loadtest | -| [createTestRunAndGetMetrics.ts][createtestrunandgetmetrics] | creates and run a loadtest | -| [fileUpload.ts][fileupload] | creates and run a loadtest | +| **File Name** | **Description** | +| ----------------------- | -------------------------------- | +| [sample.ts][sample] | creates and run a loadtest | +| [stopTest.ts][stoptest] | creates, run and stop a loadtest | ## Prerequisites @@ -57,24 +55,22 @@ npm run build 4. Run whichever samples you like (note that some samples may require additional setup, see the table above): ```bash -node dist/createAppComponent.js +node dist/sample.js ``` Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): ```bash -npx cross-env LOADTESTSERVICE_ENDPOINT="" SUBSCRIPTION_ID="" node dist/createAppComponent.js +npx cross-env LOADTESTSERVICE_ENDPOINT="" node dist/sample.js ``` ## Next Steps Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. -[createappcomponent]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/createAppComponent.ts -[createorupdatetest]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/createOrUpdateTest.ts -[createtestrunandgetmetrics]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/createTestRunAndGetMetrics.ts -[fileupload]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/fileUpload.ts -[apiref]: https://docs.microsoft.com/javascript/api/@azure-rest/load-testing +[sample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/sample.ts +[stoptest]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/stopTest.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/load-testing [freesub]: https://azure.microsoft.com/free/ [createinstance_azureloadtestingserviceinstance]: https://learn.microsoft.com/azure/load-testing/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtesting/load-testing-rest/README.md diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/package.json b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/package.json index d6904d751524..fd14c189b2a6 100644 --- a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/package.json +++ b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/package.json @@ -32,7 +32,7 @@ "dependencies": { "@azure-rest/load-testing": "latest", "dotenv": "latest", - "@azure/identity": "^4.2.1", + "@azure/identity": "^4.0.1", "uuid": "^9.0.0" }, "devDependencies": { diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/sample.env b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/sample.env index 672847a3fea0..d01f16f14dd8 100644 --- a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/sample.env +++ b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/sample.env @@ -1,4 +1,8 @@ # App registration secret for AAD authentication AZURE_CLIENT_SECRET= AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +AZURE_TENANT_ID= + +LOADTESTSERVICE_ENDPOINT= +SUBSCRIPTION_ID= +RESOURCE_GROUP= diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/createAppComponent.ts b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/createAppComponent.ts deleted file mode 100644 index 6cea36d3d224..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/createAppComponent.ts +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to a) create a loadtest, b) upload a jmx file, c) create appcomponent, d) run test and e) get test status - * - * @summary creates and run a loadtest - */ - -import AzureLoadTesting, { isUnexpected } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; -import { v4 as uuidv4 } from "uuid"; - -async function main() { - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - const displayName = "some-load-test"; - const testId = uuidv4(); // ID to be assigned to a test - const SUBSCRIPTION_ID = process.env["SUBSCRIPTION_ID"] || ""; - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - - // Creating a load test - const testCreationResult = await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: displayName, - description: "", - loadTestConfiguration: { - engineInstances: 1, // number of engine instances to run test - }, - }, - }); - // Checking for error response - if (isUnexpected(testCreationResult)) { - throw testCreationResult.body.error; - } - - if (testCreationResult.body.testId === undefined) - throw new Error("Test ID returned as undefined."); - - const appComponentCreationResult = await client - .path("/tests/{testId}/app-components", testId) - .patch({ - contentType: "application/merge-patch+json", - body: { - testId: testCreationResult.body.testId, - components: { - "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo": { - resourceId: - "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo", - resourceName: "App-Service-Sample-Demo", - resourceType: "Microsoft.Web/sites", - subscriptionId: SUBSCRIPTION_ID, - }, - }, - }, - }); - - if (isUnexpected(appComponentCreationResult)) { - throw appComponentCreationResult.body.error; - } -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/createOrUpdateTest.ts b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/createOrUpdateTest.ts deleted file mode 100644 index 62f47df27e77..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/createOrUpdateTest.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to a) create a loadtest, b) upload a jmx file, c) create appcomponent, d) run test and e) get test status - * - * @summary creates and run a loadtest - */ - -import AzureLoadTesting /*, { isUnexpected }*/ from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; -import { v4 as uuidv4 } from "uuid"; - -async function main() { - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - const displayName = "some-load-test"; - const testId = uuidv4(); // ID to be assigned to a test - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - - // Creating the Load test - await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: displayName, - description: "", - loadTestConfiguration: { - engineInstances: 1, // number of engine instances to run test - }, - }, - }); -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/fileUpload.ts b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/fileUpload.ts deleted file mode 100644 index dafe8f132612..000000000000 --- a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/fileUpload.ts +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to a) create a loadtest, b) upload a jmx file, c) create appcomponent, d) run test and e) get test status - * - * @summary creates and run a loadtest - */ - -import AzureLoadTesting, { isUnexpected } from "@azure-rest/load-testing"; -import { DefaultAzureCredential } from "@azure/identity"; -import { createReadStream } from "fs"; -import { v4 as uuidv4 } from "uuid"; - -const readStream = createReadStream("./sample.jmx"); - -async function main() { - const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; - const displayName = "some-load-test"; - const testId = uuidv4(); // ID to be assigned to a test - const fileId = uuidv4(); // ID to be assigned to the file being uploaded - - // Build a client through AAD - const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - - // Creating a load test - const testCreationResult = await client.path("/tests/{testId}", testId).patch({ - contentType: "application/merge-patch+json", - body: { - displayName: displayName, - description: "", - loadTestConfiguration: { - engineInstances: 1, // number of engine instances to run test - }, - }, - }); - // Checking for error response - if (isUnexpected(testCreationResult)) { - throw testCreationResult.body.error; - } - - if (testCreationResult.body.testId === undefined) - throw new Error("Test ID returned as undefined."); - - // Uploading .jmx file to a test - const fileUploadResult = await client - .path("/tests/{testId}/files/{fileName}", testCreationResult.body.testId, fileId) - .put({ - contentType: "application/octet-stream", - body: readStream, - }); - - if (isUnexpected(fileUploadResult)) { - throw fileUploadResult.body.error; - } -} - -main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/sample.ts b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/sample.ts new file mode 100644 index 000000000000..328658f51a04 --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/sample.ts @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * This sample demonstrates how to a) create a loadtest, b) upload a jmx file, c) create appcomponent, d) run test and e) get test status, and f) get test metrics + * + * @summary creates and run a loadtest + */ + +import AzureLoadTesting, { isUnexpected, getLongRunningPoller } from "@azure-rest/load-testing"; +import { DefaultAzureCredential } from "@azure/identity"; +import { createReadStream } from "fs"; +import { v4 as uuidv4 } from "uuid"; + +const readStream = createReadStream("./sample.jmx"); + +async function main() { + const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || ""; + const displayName = "some-load-test"; + const testId = uuidv4(); // ID to be assigned to a test + const testRunId = uuidv4(); // ID to be assigned to a testRun + + // Build a client through AAD + const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); + + // Creating/Updating a load test + const testCreationResult = await client.path("/tests/{testId}", testId).patch({ + contentType: "application/merge-patch+json", + body: { + displayName: displayName, + description: "", + loadTestConfiguration: { + engineInstances: 1, // number of engine instances to run test + }, + }, + }); + // Checking for error response + if (isUnexpected(testCreationResult)) { + throw testCreationResult.body.error; + } + + if (testCreationResult.body.testId === undefined) + throw new Error("Test ID returned as undefined."); + + // Uploading .jmx file to a test + const fileUploadResult = await client + .path("/tests/{testId}/files/{fileName}", testId, "sample.jmx") + .put({ + contentType: "application/octet-stream", + body: readStream, + }); + + if (isUnexpected(fileUploadResult)) { + throw fileUploadResult.body.error; + } + + let fileValidateResult; + const fileValidatePoller = await getLongRunningPoller(client, fileUploadResult); + try { + fileValidateResult = await fileValidatePoller.pollUntilDone({ + abortSignal: AbortSignal.timeout(120 * 1000), // timeout of 120 seconds + }); + } catch (ex: any) { + new Error("Error in polling file Validation" + ex.message); //polling timed out + } + + if (fileValidatePoller.getOperationState().status != "succeeded" && fileValidateResult) + throw new Error( + "There is some issue in validation, please make sure uploaded file is a valid JMX." + + fileValidateResult.body.validationFailureDetails, + ); + + // Creating/Updating app component + const appComponentCreationResult = await client + .path("/tests/{testId}/app-components", testId) + .patch({ + contentType: "application/merge-patch+json", + body: { + components: { + "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo": + { + resourceName: "App-Service-Sample-Demo", + resourceType: "Microsoft.Web/sites", + }, + }, + }, + }); + + if (isUnexpected(appComponentCreationResult)) { + throw appComponentCreationResult.body.error; + } + + // Creating/Updating the test run + const testRunCreationResult = await client.path("/test-runs/{testRunId}", testRunId).patch({ + contentType: "application/merge-patch+json", + body: { + testId: testId, + displayName: displayName, + }, + }); + + if (isUnexpected(testRunCreationResult)) { + throw testRunCreationResult.body.error; + } + + if (testRunCreationResult.body.testRunId === undefined) + throw new Error("Test Run ID returned as undefined."); + + let testRunResult; + const testRunPoller = await getLongRunningPoller(client, testRunCreationResult); + + try { + testRunResult = await testRunPoller.pollUntilDone({ + abortSignal: AbortSignal.timeout(300 * 1000), // timeout of 5 minutes + }); + } catch (ex: any) { + new Error("Error in polling test run completion" + ex.message); //polling timed out + } + + if (testRunPoller.getOperationState().status != "succeeded") + throw new Error("There is some issue in running the test, Error Response : " + testRunResult); + + if (testRunResult) { + let testRunStarttime = testRunResult.body.startDateTime; + let testRunEndTime = testRunResult.body.endDateTime; + + // get list of all metric namespaces and pick the first one + const metricNamespaces = await client + .path("/test-runs/{testRunId}/metric-namespaces", testRunId) + .get(); + + if (isUnexpected(metricNamespaces)) { + throw metricNamespaces.body.error; + } + + const metricNamespace = metricNamespaces.body.value[0]; + + if (metricNamespace.name === undefined) { + throw "No Metric Namespace name is defined."; + } + + // get list of all metric definitions and pick the first one + const metricDefinitions = await client + .path("/test-runs/{testRunId}/metric-definitions", testRunId) + .get({ + queryParameters: { + metricNamespace: metricNamespace.name, + }, + }); + + if (isUnexpected(metricDefinitions)) { + throw metricDefinitions.body.error; + } + + const metricDefinition = metricDefinitions.body.value[0]; + + if (metricDefinition.name === undefined) { + throw "No Metric Namespace name is defined."; + } + + // fetch client metrics using metric namespace and metric name + const metricsResult = await client.path("/test-runs/{testRunId}/metrics", testRunId).post({ + queryParameters: { + metricname: metricDefinition.name, + metricNamespace: metricNamespace.name, + timespan: testRunStarttime + "/" + testRunEndTime, + }, + }); + + console.log(metricsResult); + console.log(testRunResult); + + // Deleting test run + const deleteTestRunResult = await client.path("/test-runs/{testRunId}", testRunId).delete(); + + if (isUnexpected(deleteTestRunResult)) { + throw deleteTestRunResult.body.error; + } + + // Deleting test + const deleteTestResult = await client.path("/tests/{testId}", testId).delete(); + + if (isUnexpected(deleteTestResult)) { + throw deleteTestResult.body.error; + } + } +} + +main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/createTestRunAndGetMetrics.ts b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/stopTest.ts similarity index 53% rename from sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/createTestRunAndGetMetrics.ts rename to sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/stopTest.ts index 23592802ebb5..c47f327fb9bb 100644 --- a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/createTestRunAndGetMetrics.ts +++ b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/src/stopTest.ts @@ -1,7 +1,7 @@ /** - * This sample demonstrates how to run a test and get test status + * This sample demonstrates how to run a test and stop execution * - * @summary creates and run a loadtest + * @summary creates, run and stop a loadtest */ import AzureLoadTesting, { isUnexpected } from "@azure-rest/load-testing"; @@ -17,13 +17,31 @@ async function main() { // Build a client through AAD const client = AzureLoadTesting(endpoint, new DefaultAzureCredential()); - // Creating the test run + // Patching a load test + const testCreationResult = await client.path("/tests/{testId}", testId).patch({ + contentType: "application/merge-patch+json", + body: { + displayName: displayName, + description: "", + loadTestConfiguration: { + engineInstances: 1, // number of engine instances to run test + }, + }, + }); + // Checking for error response + if (isUnexpected(testCreationResult)) { + throw testCreationResult.body.error; + } + + if (testCreationResult.body.testId === undefined) + throw new Error("Test ID returned as undefined."); + + // Patching the test run const testRunCreationResult = await client.path("/test-runs/{testRunId}", testRunId).patch({ contentType: "application/merge-patch+json", body: { testId: testId, displayName: displayName, - virtualUsers: 10, }, }); @@ -34,28 +52,15 @@ async function main() { if (testRunCreationResult.body.testRunId === undefined) throw new Error("Test Run ID returned as undefined."); - // Checking the test run status and printing metrics - var testStatus = null; - var getTestRunResult = null; + // Checking the test run status const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)); - //wait for terminal state - while ( - testStatus == null || - (testStatus != "DONE" && testStatus != "CANCELLED" && testStatus != "FAILED") - ) { - getTestRunResult = await client - .path("/test-runs/{testRunId}", testRunCreationResult.body.testRunId) - .get(); - if (isUnexpected(getTestRunResult)) { - throw getTestRunResult.body.error; - } - testStatus = getTestRunResult.body.status; - - //Check test status after every 5 seconds - sleep(5000); - } + sleep(30000); - console.log(getTestRunResult); + let stopTestRunResult = await client.path("/test-runs/{testRunId}:stop", testRunId).post(); + + if (isUnexpected(stopTestRunResult)) { + throw stopTestRunResult.body.error; + } } main().catch(console.error); diff --git a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/tsconfig.json b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/tsconfig.json index ad5ff9a19d36..984eed535aa8 100644 --- a/sdk/loadtesting/load-testing-rest/samples/v1/typescript/tsconfig.json +++ b/sdk/loadtesting/load-testing-rest/samples/v1/typescript/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "ES2018", + "target": "ES2020", "module": "commonjs", "moduleResolution": "node", "resolveJsonModule": true, diff --git a/sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts b/sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts deleted file mode 100644 index 7fddb3e997fe..000000000000 --- a/sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { getClient, ClientOptions } from "@azure-rest/core-client"; -import { TokenCredential } from "@azure/core-auth"; -import { AzureLoadTestingClient } from "./clientDefinitions"; - -/** - * Initialize a new instance of the class AzureLoadTestingClient 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 = {}, -): AzureLoadTestingClient { - const baseUrl = options.baseUrl ?? `https://${Endpoint}`; - options.apiVersion = options.apiVersion ?? "2022-11-01"; - options = { - ...options, - credentials: { - scopes: ["https://cnt-prod.loadtesting.azure.com/.default"], - }, - }; - - const userAgentInfo = `azsdk-js-load-testing-rest/1.0.1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` - : `${userAgentInfo}`; - options = { - ...options, - userAgentOptions: { - userAgentPrefix, - }, - }; - - const client = getClient(baseUrl, credentials, options) as AzureLoadTestingClient; - - return client; -} diff --git a/sdk/loadtesting/load-testing-rest/src/clientDefinitions.ts b/sdk/loadtesting/load-testing-rest/src/clientDefinitions.ts deleted file mode 100644 index 512e9b092b49..000000000000 --- a/sdk/loadtesting/load-testing-rest/src/clientDefinitions.ts +++ /dev/null @@ -1,340 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - TestCreateOrUpdateParameters, - TestDeleteParameters, - TestGetParameters, - TestListParameters, - TestUploadFileParameters, - TestGetFileParameters, - TestDeleteFileParameters, - TestListFilesParameters, - TestCreateOrUpdateAppComponentsParameters, - TestListAppComponentsParameters, - TestCreateOrUpdateServerMetricsConfigParameters, - TestListServerMetricsConfigParameters, - TestRunDeleteParameters, - TestRunCreateOrUpdateParameters, - TestRunGetParameters, - TestRunGetFileParameters, - TestRunListParameters, - TestRunStopParameters, - TestRunListMetricNamespacesParameters, - TestRunListMetricDefinitionsParameters, - TestRunListMetricsParameters, - TestRunListMetricDimensionValuesParameters, - TestRunCreateOrUpdateAppComponentsParameters, - TestRunListAppComponentsParameters, - TestRunCreateOrUpdateServerMetricsConfigParameters, - TestRunListServerMetricsConfigParameters, -} from "./parameters"; -import { - TestCreateOrUpdate200Response, - TestCreateOrUpdate201Response, - TestCreateOrUpdateDefaultResponse, - TestDelete204Response, - TestDeleteDefaultResponse, - TestGet200Response, - TestGetDefaultResponse, - TestList200Response, - TestListDefaultResponse, - TestUploadFile201Response, - TestUploadFileDefaultResponse, - TestGetFile200Response, - TestGetFileDefaultResponse, - TestDeleteFile204Response, - TestDeleteFileDefaultResponse, - TestListFiles200Response, - TestListFilesDefaultResponse, - TestCreateOrUpdateAppComponents200Response, - TestCreateOrUpdateAppComponents201Response, - TestCreateOrUpdateAppComponentsDefaultResponse, - TestListAppComponents200Response, - TestListAppComponentsDefaultResponse, - TestCreateOrUpdateServerMetricsConfig200Response, - TestCreateOrUpdateServerMetricsConfig201Response, - TestCreateOrUpdateServerMetricsConfigDefaultResponse, - TestListServerMetricsConfig200Response, - TestListServerMetricsConfigDefaultResponse, - TestRunDelete204Response, - TestRunDeleteDefaultResponse, - TestRunCreateOrUpdate200Response, - TestRunCreateOrUpdate201Response, - TestRunCreateOrUpdateDefaultResponse, - TestRunGet200Response, - TestRunGetDefaultResponse, - TestRunGetFile200Response, - TestRunGetFileDefaultResponse, - TestRunList200Response, - TestRunListDefaultResponse, - TestRunStop200Response, - TestRunStopDefaultResponse, - TestRunListMetricNamespaces200Response, - TestRunListMetricNamespacesDefaultResponse, - TestRunListMetricDefinitions200Response, - TestRunListMetricDefinitionsDefaultResponse, - TestRunListMetrics200Response, - TestRunListMetricsDefaultResponse, - TestRunListMetricDimensionValues200Response, - TestRunListMetricDimensionValuesDefaultResponse, - TestRunCreateOrUpdateAppComponents200Response, - TestRunCreateOrUpdateAppComponents201Response, - TestRunCreateOrUpdateAppComponentsDefaultResponse, - TestRunListAppComponents200Response, - TestRunListAppComponentsDefaultResponse, - TestRunCreateOrUpdateServerMetricsConfig200Response, - TestRunCreateOrUpdateServerMetricsConfig201Response, - TestRunCreateOrUpdateServerMetricsConfigDefaultResponse, - TestRunListServerMetricsConfig200Response, - TestRunListServerMetricsConfigDefaultResponse, -} from "./responses"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; - -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 application/octet-stream. */ - put( - options: TestUploadFileParameters, - ): StreamableMethod; - /** Get test file by the file name. */ - get( - options?: TestGetFileParameters, - ): StreamableMethod; - /** Delete file by the file name for a test */ - delete( - options?: TestDeleteFileParameters, - ): StreamableMethod; -} - -export interface TestListFiles { - /** Get all test files. */ - get( - options?: TestListFilesParameters, - ): StreamableMethod; -} - -export interface TestCreateOrUpdateAppComponents { - /** Associate an app component (collection of azure resources) to a test */ - patch( - options: TestCreateOrUpdateAppComponentsParameters, - ): StreamableMethod< - | TestCreateOrUpdateAppComponents200Response - | TestCreateOrUpdateAppComponents201Response - | TestCreateOrUpdateAppComponentsDefaultResponse - >; - /** Get associated app component (collection of azure resources) for the given test. */ - get( - options?: TestListAppComponentsParameters, - ): StreamableMethod; -} - -export interface TestCreateOrUpdateServerMetricsConfig { - /** Configure server metrics for a test */ - patch( - options: TestCreateOrUpdateServerMetricsConfigParameters, - ): StreamableMethod< - | TestCreateOrUpdateServerMetricsConfig200Response - | TestCreateOrUpdateServerMetricsConfig201Response - | TestCreateOrUpdateServerMetricsConfigDefaultResponse - >; - /** List server metrics configuration for the given test. */ - get( - options?: TestListServerMetricsConfigParameters, - ): StreamableMethod< - TestListServerMetricsConfig200Response | TestListServerMetricsConfigDefaultResponse - >; -} - -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 - | TestRunCreateOrUpdate201Response - | 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; -} - -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 TestRunListMetricNamespaces { - /** List the metric namespaces for a load test run. */ - get( - options?: TestRunListMetricNamespacesParameters, - ): StreamableMethod< - TestRunListMetricNamespaces200Response | TestRunListMetricNamespacesDefaultResponse - >; -} - -export interface TestRunListMetricDefinitions { - /** List the metric definitions for a load test run. */ - get( - options: TestRunListMetricDefinitionsParameters, - ): StreamableMethod< - TestRunListMetricDefinitions200Response | TestRunListMetricDefinitionsDefaultResponse - >; -} - -export interface TestRunListMetrics { - /** List the metric values for a load test run. */ - post( - options: TestRunListMetricsParameters, - ): StreamableMethod; -} - -export interface TestRunListMetricDimensionValues { - /** List the dimension values for the given metric dimension name. */ - get( - options: TestRunListMetricDimensionValuesParameters, - ): StreamableMethod< - TestRunListMetricDimensionValues200Response | TestRunListMetricDimensionValuesDefaultResponse - >; -} - -export interface TestRunCreateOrUpdateAppComponents { - /** Associate an app component (collection of azure resources) to a test run */ - patch( - options: TestRunCreateOrUpdateAppComponentsParameters, - ): StreamableMethod< - | TestRunCreateOrUpdateAppComponents200Response - | TestRunCreateOrUpdateAppComponents201Response - | TestRunCreateOrUpdateAppComponentsDefaultResponse - >; - /** Get associated app component (collection of azure resources) for the given test run. */ - get( - options?: TestRunListAppComponentsParameters, - ): StreamableMethod< - TestRunListAppComponents200Response | TestRunListAppComponentsDefaultResponse - >; -} - -export interface TestRunCreateOrUpdateServerMetricsConfig { - /** Configure server metrics for a test run */ - patch( - options: TestRunCreateOrUpdateServerMetricsConfigParameters, - ): StreamableMethod< - | TestRunCreateOrUpdateServerMetricsConfig200Response - | TestRunCreateOrUpdateServerMetricsConfig201Response - | TestRunCreateOrUpdateServerMetricsConfigDefaultResponse - >; - /** List server metrics configuration for the given test run. */ - get( - options?: TestRunListServerMetricsConfigParameters, - ): StreamableMethod< - TestRunListServerMetricsConfig200Response | TestRunListServerMetricsConfigDefaultResponse - >; -} - -export interface Routes { - /** Resource for '/tests/\{testId\}' has methods for the following verbs: patch, delete, get */ - (path: "/tests/{testId}", testId: string): TestCreateOrUpdate; - /** Resource for '/tests' has methods for the following verbs: get */ - (path: "/tests"): TestList; - /** Resource for '/tests/\{testId\}/files/\{fileName\}' has methods for the following verbs: put, get, delete */ - (path: "/tests/{testId}/files/{fileName}", testId: string, fileName: string): TestUploadFile; - /** Resource for '/tests/\{testId\}/files' has methods for the following verbs: get */ - (path: "/tests/{testId}/files", testId: string): TestListFiles; - /** Resource for '/tests/\{testId\}/app-components' has methods for the following verbs: patch, get */ - (path: "/tests/{testId}/app-components", testId: string): TestCreateOrUpdateAppComponents; - /** Resource for '/tests/\{testId\}/server-metrics-config' has methods for the following verbs: patch, get */ - ( - path: "/tests/{testId}/server-metrics-config", - testId: string, - ): TestCreateOrUpdateServerMetricsConfig; - /** Resource for '/test-runs/\{testRunId\}' has methods for the following verbs: delete, patch, get */ - (path: "/test-runs/{testRunId}", testRunId: string): TestRunDelete; - /** Resource for '/test-runs/\{testRunId\}/files/\{fileName\}' has methods for the following verbs: get */ - ( - path: "/test-runs/{testRunId}/files/{fileName}", - testRunId: string, - fileName: string, - ): TestRunGetFile; - /** Resource for '/test-runs' has methods for the following verbs: get */ - (path: "/test-runs"): TestRunList; - /** Resource for '/test-runs/\{testRunId\}:stop' has methods for the following verbs: post */ - (path: "/test-runs/{testRunId}:stop", testRunId: string): TestRunStop; - /** Resource for '/test-runs/\{testRunId\}/metric-namespaces' has methods for the following verbs: get */ - ( - path: "/test-runs/{testRunId}/metric-namespaces", - testRunId: string, - ): TestRunListMetricNamespaces; - /** Resource for '/test-runs/\{testRunId\}/metric-definitions' has methods for the following verbs: get */ - ( - path: "/test-runs/{testRunId}/metric-definitions", - testRunId: string, - ): TestRunListMetricDefinitions; - /** Resource for '/test-runs/\{testRunId\}/metrics' has methods for the following verbs: post */ - (path: "/test-runs/{testRunId}/metrics", testRunId: string): TestRunListMetrics; - /** Resource for '/test-runs/\{testRunId\}/metric-dimensions/\{name\}/values' has methods for the following verbs: get */ - ( - path: "/test-runs/{testRunId}/metric-dimensions/{name}/values", - testRunId: string, - name: string, - ): TestRunListMetricDimensionValues; - /** Resource for '/test-runs/\{testRunId\}/app-components' has methods for the following verbs: patch, get */ - ( - path: "/test-runs/{testRunId}/app-components", - testRunId: string, - ): TestRunCreateOrUpdateAppComponents; - /** Resource for '/test-runs/\{testRunId\}/server-metrics-config' has methods for the following verbs: patch, get */ - ( - path: "/test-runs/{testRunId}/server-metrics-config", - testRunId: string, - ): TestRunCreateOrUpdateServerMetricsConfig; -} - -export type AzureLoadTestingClient = Client & { - path: Routes; -}; diff --git a/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts b/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts index 58f85c1f7f59..2fc58c84e973 100644 --- a/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts +++ b/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts @@ -4,9 +4,12 @@ import { AbortError, AbortSignalLike } from "@azure/abort-controller"; import { CancelOnProgress, OperationState, SimplePollerLike } from "@azure/core-lro"; import { FileUploadAndValidatePoller, PolledOperationOptions } from "./models"; -import { AzureLoadTestingClient } from "./clientDefinitions"; -import { TestGetFile200Response, TestUploadFile201Response } from "./responses"; -import { isUnexpected } from "./isUnexpected"; +import { AzureLoadTestingClient } from "../generated/clientDefinitions"; +import { + LoadTestAdministrationGetTestFile200Response, + LoadTestAdministrationUploadTestFile201Response, +} from "../generated/responses"; +import { isUnexpected } from "../generated/isUnexpected"; import { sleep } from "./util/LROUtil"; /** @@ -17,7 +20,7 @@ import { sleep } from "./util/LROUtil"; */ export async function getFileValidationPoller( client: AzureLoadTestingClient, - fileUploadResult: TestUploadFile201Response, + fileUploadResult: LoadTestAdministrationUploadTestFile201Response, polledOperationOptions: PolledOperationOptions = {}, ): Promise { // get filename and testid from initial response @@ -27,21 +30,24 @@ export async function getFileValidationPoller( requestUrl.indexOf("tests/") + 6, requestUrl.lastIndexOf("/files"), ); - type Handler = (state: OperationState) => void; + type Handler = (state: OperationState) => void; - const state: OperationState = { + const state: OperationState = { status: "notStarted", }; const progressCallbacks = new Map(); const processProgressCallbacks = async (): Promise => progressCallbacks.forEach((h) => h(state)); - let resultPromise: Promise | undefined; + let resultPromise: Promise | undefined; let cancelJob: (() => void) | undefined; const abortController = new AbortController(); const currentPollIntervalInMs = polledOperationOptions.updateIntervalInMs ?? 2000; - const poller: SimplePollerLike, TestGetFile200Response> = { + const poller: SimplePollerLike< + OperationState, + LoadTestAdministrationGetTestFile200Response + > = { async poll(options?: { abortSignal?: AbortSignalLike }): Promise { if (options?.abortSignal?.aborted) { throw new AbortError("The polling was aborted."); @@ -89,7 +95,7 @@ export async function getFileValidationPoller( pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike; - }): Promise { + }): Promise { return (resultPromise ??= (async () => { const { abortSignal: inputAbortSignal } = pollOptions || {}; // In the future we can use AbortSignal.any() instead @@ -120,7 +126,7 @@ export async function getFileValidationPoller( case "succeeded": case "failed": case "canceled": { - return poller.getResult() as TestGetFile200Response; + return poller.getResult() as LoadTestAdministrationGetTestFile200Response; } case "notStarted": case "running": { @@ -134,7 +140,7 @@ export async function getFileValidationPoller( }, onProgress( - callback: (state: OperationState) => void, + callback: (state: OperationState) => void, ): CancelOnProgress { const s = Symbol(); progressCallbacks.set(s, callback); @@ -155,11 +161,11 @@ export async function getFileValidationPoller( return resultPromise === undefined; }, - getOperationState(): OperationState { + getOperationState(): OperationState { return state; }, - getResult(): TestGetFile200Response | undefined { + getResult(): LoadTestAdministrationGetTestFile200Response | undefined { return state.result; }, diff --git a/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts b/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts index 910d3cee0ad0..00fac5a087cd 100644 --- a/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts +++ b/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts @@ -4,13 +4,13 @@ import { AbortError, AbortSignalLike } from "@azure/abort-controller"; import { CancelOnProgress, OperationState, SimplePollerLike } from "@azure/core-lro"; import { TestRunCompletionPoller, PolledOperationOptions } from "./models"; -import { AzureLoadTestingClient } from "./clientDefinitions"; +import { AzureLoadTestingClient } from "../generated/clientDefinitions"; import { - TestRunCreateOrUpdate200Response, - TestRunCreateOrUpdate201Response, - TestRunGet200Response, -} from "./responses"; -import { isUnexpected } from "./isUnexpected"; + LoadTestRunCreateOrUpdateTestRun200Response, + LoadTestRunCreateOrUpdateTestRun201Response, + LoadTestRunGetTestRun200Response, +} from "../generated/responses"; +import { isUnexpected } from "../generated/isUnexpected"; import { sleep, isTestRunInProgress } from "./util/LROUtil"; /** @@ -21,25 +21,30 @@ import { sleep, isTestRunInProgress } from "./util/LROUtil"; */ export async function getTestRunCompletionPoller( client: AzureLoadTestingClient, - createTestRunResponse: TestRunCreateOrUpdate200Response | TestRunCreateOrUpdate201Response, + createTestRunResponse: + | LoadTestRunCreateOrUpdateTestRun200Response + | LoadTestRunCreateOrUpdateTestRun201Response, polledOperationOptions: PolledOperationOptions = {}, ): Promise { - type Handler = (state: OperationState) => void; + type Handler = (state: OperationState) => void; - const state: OperationState = { + const state: OperationState = { status: "notStarted", }; const progressCallbacks = new Map(); const processProgressCallbacks = async (): Promise => progressCallbacks.forEach((h) => h(state)); - let resultPromise: Promise | undefined; + let resultPromise: Promise | undefined; let cancelJob: (() => void) | undefined; const abortController = new AbortController(); const currentPollIntervalInMs = polledOperationOptions.updateIntervalInMs ?? 2000; const testRunId = createTestRunResponse.body.testRunId; - const poller: SimplePollerLike, TestRunGet200Response> = { + const poller: SimplePollerLike< + OperationState, + LoadTestRunGetTestRun200Response + > = { async poll(options?: { abortSignal?: AbortSignalLike }): Promise { if (options?.abortSignal?.aborted) { throw new AbortError("The polling was aborted."); @@ -74,7 +79,9 @@ export async function getTestRunCompletionPoller( } }, - pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise { + pollUntilDone(pollOptions?: { + abortSignal?: AbortSignalLike; + }): Promise { return (resultPromise ??= (async () => { const { abortSignal: inputAbortSignal } = pollOptions || {}; // In the future we can use AbortSignal.any() instead @@ -105,7 +112,7 @@ export async function getTestRunCompletionPoller( case "succeeded": case "failed": case "canceled": { - return poller.getResult() as TestRunGet200Response; + return poller.getResult() as LoadTestRunGetTestRun200Response; } case "notStarted": case "running": { @@ -118,7 +125,9 @@ export async function getTestRunCompletionPoller( })); }, - onProgress(callback: (state: OperationState) => void): CancelOnProgress { + onProgress( + callback: (state: OperationState) => void, + ): CancelOnProgress { const s = Symbol(); progressCallbacks.set(s, callback); @@ -138,11 +147,11 @@ export async function getTestRunCompletionPoller( return resultPromise === undefined; }, - getOperationState(): OperationState { + getOperationState(): OperationState { return state; }, - getResult(): TestRunGet200Response | undefined { + getResult(): LoadTestRunGetTestRun200Response | undefined { return state.result; }, diff --git a/sdk/loadtesting/load-testing-rest/src/index.ts b/sdk/loadtesting/load-testing-rest/src/index.ts index e5f7eab868f6..a848aa24c78c 100644 --- a/sdk/loadtesting/load-testing-rest/src/index.ts +++ b/sdk/loadtesting/load-testing-rest/src/index.ts @@ -1,15 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import AzureLoadTesting from "./azureLoadTesting"; +import AzureLoadTesting from "../generated/azureLoadTesting"; -export * from "./azureLoadTesting"; -export * from "./parameters"; -export * from "./responses"; -export * from "./clientDefinitions"; -export * from "./isUnexpected"; +export * from "../generated/azureLoadTesting"; +export * from "../generated/parameters"; +export * from "../generated/responses"; +export * from "../generated/clientDefinitions"; +export * from "../generated/isUnexpected"; +export * from "../generated/models"; export * from "./models"; -export * from "./outputModels"; -export * from "./paginateHelper"; +export * from "../generated/outputModels"; +export * from "../generated/paginateHelper"; export { getLongRunningPoller } from "./pollingHelper"; export default AzureLoadTesting; diff --git a/sdk/loadtesting/load-testing-rest/src/isUnexpected.ts b/sdk/loadtesting/load-testing-rest/src/isUnexpected.ts deleted file mode 100644 index 0a8a404ea398..000000000000 --- a/sdk/loadtesting/load-testing-rest/src/isUnexpected.ts +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - TestCreateOrUpdate200Response, - TestCreateOrUpdate201Response, - TestCreateOrUpdateDefaultResponse, - TestDelete204Response, - TestDeleteDefaultResponse, - TestGet200Response, - TestGetDefaultResponse, - TestList200Response, - TestListDefaultResponse, - TestUploadFile201Response, - TestUploadFileDefaultResponse, - TestGetFile200Response, - TestGetFileDefaultResponse, - TestDeleteFile204Response, - TestDeleteFileDefaultResponse, - TestListFiles200Response, - TestListFilesDefaultResponse, - TestCreateOrUpdateAppComponents200Response, - TestCreateOrUpdateAppComponents201Response, - TestCreateOrUpdateAppComponentsDefaultResponse, - TestListAppComponents200Response, - TestListAppComponentsDefaultResponse, - TestCreateOrUpdateServerMetricsConfig200Response, - TestCreateOrUpdateServerMetricsConfig201Response, - TestCreateOrUpdateServerMetricsConfigDefaultResponse, - TestListServerMetricsConfig200Response, - TestListServerMetricsConfigDefaultResponse, - TestRunDelete204Response, - TestRunDeleteDefaultResponse, - TestRunCreateOrUpdate200Response, - TestRunCreateOrUpdate201Response, - TestRunCreateOrUpdateDefaultResponse, - TestRunGet200Response, - TestRunGetDefaultResponse, - TestRunGetFile200Response, - TestRunGetFileDefaultResponse, - TestRunList200Response, - TestRunListDefaultResponse, - TestRunStop200Response, - TestRunStopDefaultResponse, - TestRunListMetricNamespaces200Response, - TestRunListMetricNamespacesDefaultResponse, - TestRunListMetricDefinitions200Response, - TestRunListMetricDefinitionsDefaultResponse, - TestRunListMetrics200Response, - TestRunListMetricsDefaultResponse, - TestRunListMetricDimensionValues200Response, - TestRunListMetricDimensionValuesDefaultResponse, - TestRunCreateOrUpdateAppComponents200Response, - TestRunCreateOrUpdateAppComponents201Response, - TestRunCreateOrUpdateAppComponentsDefaultResponse, - TestRunListAppComponents200Response, - TestRunListAppComponentsDefaultResponse, - TestRunCreateOrUpdateServerMetricsConfig200Response, - TestRunCreateOrUpdateServerMetricsConfig201Response, - TestRunCreateOrUpdateServerMetricsConfigDefaultResponse, - TestRunListServerMetricsConfig200Response, - TestRunListServerMetricsConfigDefaultResponse, -} from "./responses"; - -const responseMap: Record = { - "PATCH /tests/{testId}": ["200", "201"], - "DELETE /tests/{testId}": ["204"], - "GET /tests/{testId}": ["200"], - "GET /tests": ["200"], - "PUT /tests/{testId}/files/{fileName}": ["201"], - "GET /tests/{testId}/files/{fileName}": ["200"], - "DELETE /tests/{testId}/files/{fileName}": ["204"], - "GET /tests/{testId}/files": ["200"], - "PATCH /tests/{testId}/app-components": ["200", "201"], - "GET /tests/{testId}/app-components": ["200"], - "PATCH /tests/{testId}/server-metrics-config": ["200", "201"], - "GET /tests/{testId}/server-metrics-config": ["200"], - "DELETE /test-runs/{testRunId}": ["204"], - "PATCH /test-runs/{testRunId}": ["200", "201"], - "GET /test-runs/{testRunId}": ["200"], - "GET /test-runs/{testRunId}/files/{fileName}": ["200"], - "GET /test-runs": ["200"], - "POST /test-runs/{testRunId}:stop": ["200"], - "GET /test-runs/{testRunId}/metric-namespaces": ["200"], - "GET /test-runs/{testRunId}/metric-definitions": ["200"], - "POST /test-runs/{testRunId}/metrics": ["200"], - "GET /test-runs/{testRunId}/metric-dimensions/{name}/values": ["200"], - "PATCH /test-runs/{testRunId}/app-components": ["200", "201"], - "GET /test-runs/{testRunId}/app-components": ["200"], - "PATCH /test-runs/{testRunId}/server-metrics-config": ["200", "201"], - "GET /test-runs/{testRunId}/server-metrics-config": ["200"], -}; - -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: TestListFiles200Response | TestListFilesDefaultResponse, -): response is TestListFilesDefaultResponse; -export function isUnexpected( - response: - | TestCreateOrUpdateAppComponents200Response - | TestCreateOrUpdateAppComponents201Response - | TestCreateOrUpdateAppComponentsDefaultResponse, -): response is TestCreateOrUpdateAppComponentsDefaultResponse; -export function isUnexpected( - response: TestListAppComponents200Response | TestListAppComponentsDefaultResponse, -): response is TestListAppComponentsDefaultResponse; -export function isUnexpected( - response: - | TestCreateOrUpdateServerMetricsConfig200Response - | TestCreateOrUpdateServerMetricsConfig201Response - | TestCreateOrUpdateServerMetricsConfigDefaultResponse, -): response is TestCreateOrUpdateServerMetricsConfigDefaultResponse; -export function isUnexpected( - response: TestListServerMetricsConfig200Response | TestListServerMetricsConfigDefaultResponse, -): response is TestListServerMetricsConfigDefaultResponse; -export function isUnexpected( - response: TestRunDelete204Response | TestRunDeleteDefaultResponse, -): response is TestRunDeleteDefaultResponse; -export function isUnexpected( - response: - | TestRunCreateOrUpdate200Response - | TestRunCreateOrUpdate201Response - | 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: TestRunListMetricNamespaces200Response | TestRunListMetricNamespacesDefaultResponse, -): response is TestRunListMetricNamespacesDefaultResponse; -export function isUnexpected( - response: TestRunListMetricDefinitions200Response | TestRunListMetricDefinitionsDefaultResponse, -): response is TestRunListMetricDefinitionsDefaultResponse; -export function isUnexpected( - response: TestRunListMetrics200Response | TestRunListMetricsDefaultResponse, -): response is TestRunListMetricsDefaultResponse; -export function isUnexpected( - response: - | TestRunListMetricDimensionValues200Response - | TestRunListMetricDimensionValuesDefaultResponse, -): response is TestRunListMetricDimensionValuesDefaultResponse; -export function isUnexpected( - response: - | TestRunCreateOrUpdateAppComponents200Response - | TestRunCreateOrUpdateAppComponents201Response - | TestRunCreateOrUpdateAppComponentsDefaultResponse, -): response is TestRunCreateOrUpdateAppComponentsDefaultResponse; -export function isUnexpected( - response: TestRunListAppComponents200Response | TestRunListAppComponentsDefaultResponse, -): response is TestRunListAppComponentsDefaultResponse; -export function isUnexpected( - response: - | TestRunCreateOrUpdateServerMetricsConfig200Response - | TestRunCreateOrUpdateServerMetricsConfig201Response - | TestRunCreateOrUpdateServerMetricsConfigDefaultResponse, -): response is TestRunCreateOrUpdateServerMetricsConfigDefaultResponse; -export function isUnexpected( - response: - | TestRunListServerMetricsConfig200Response - | TestRunListServerMetricsConfigDefaultResponse, -): response is TestRunListServerMetricsConfigDefaultResponse; -export function isUnexpected( - response: - | TestCreateOrUpdate200Response - | TestCreateOrUpdate201Response - | TestCreateOrUpdateDefaultResponse - | TestDelete204Response - | TestDeleteDefaultResponse - | TestGet200Response - | TestGetDefaultResponse - | TestList200Response - | TestListDefaultResponse - | TestUploadFile201Response - | TestUploadFileDefaultResponse - | TestGetFile200Response - | TestGetFileDefaultResponse - | TestDeleteFile204Response - | TestDeleteFileDefaultResponse - | TestListFiles200Response - | TestListFilesDefaultResponse - | TestCreateOrUpdateAppComponents200Response - | TestCreateOrUpdateAppComponents201Response - | TestCreateOrUpdateAppComponentsDefaultResponse - | TestListAppComponents200Response - | TestListAppComponentsDefaultResponse - | TestCreateOrUpdateServerMetricsConfig200Response - | TestCreateOrUpdateServerMetricsConfig201Response - | TestCreateOrUpdateServerMetricsConfigDefaultResponse - | TestListServerMetricsConfig200Response - | TestListServerMetricsConfigDefaultResponse - | TestRunDelete204Response - | TestRunDeleteDefaultResponse - | TestRunCreateOrUpdate200Response - | TestRunCreateOrUpdate201Response - | TestRunCreateOrUpdateDefaultResponse - | TestRunGet200Response - | TestRunGetDefaultResponse - | TestRunGetFile200Response - | TestRunGetFileDefaultResponse - | TestRunList200Response - | TestRunListDefaultResponse - | TestRunStop200Response - | TestRunStopDefaultResponse - | TestRunListMetricNamespaces200Response - | TestRunListMetricNamespacesDefaultResponse - | TestRunListMetricDefinitions200Response - | TestRunListMetricDefinitionsDefaultResponse - | TestRunListMetrics200Response - | TestRunListMetricsDefaultResponse - | TestRunListMetricDimensionValues200Response - | TestRunListMetricDimensionValuesDefaultResponse - | TestRunCreateOrUpdateAppComponents200Response - | TestRunCreateOrUpdateAppComponents201Response - | TestRunCreateOrUpdateAppComponentsDefaultResponse - | TestRunListAppComponents200Response - | TestRunListAppComponentsDefaultResponse - | TestRunCreateOrUpdateServerMetricsConfig200Response - | TestRunCreateOrUpdateServerMetricsConfig201Response - | TestRunCreateOrUpdateServerMetricsConfigDefaultResponse - | TestRunListServerMetricsConfig200Response - | TestRunListServerMetricsConfigDefaultResponse, -): response is - | TestCreateOrUpdateDefaultResponse - | TestDeleteDefaultResponse - | TestGetDefaultResponse - | TestListDefaultResponse - | TestUploadFileDefaultResponse - | TestGetFileDefaultResponse - | TestDeleteFileDefaultResponse - | TestListFilesDefaultResponse - | TestCreateOrUpdateAppComponentsDefaultResponse - | TestListAppComponentsDefaultResponse - | TestCreateOrUpdateServerMetricsConfigDefaultResponse - | TestListServerMetricsConfigDefaultResponse - | TestRunDeleteDefaultResponse - | TestRunCreateOrUpdateDefaultResponse - | TestRunGetDefaultResponse - | TestRunGetFileDefaultResponse - | TestRunListDefaultResponse - | TestRunStopDefaultResponse - | TestRunListMetricNamespacesDefaultResponse - | TestRunListMetricDefinitionsDefaultResponse - | TestRunListMetricsDefaultResponse - | TestRunListMetricDimensionValuesDefaultResponse - | TestRunCreateOrUpdateAppComponentsDefaultResponse - | TestRunListAppComponentsDefaultResponse - | TestRunCreateOrUpdateServerMetricsConfigDefaultResponse - | TestRunListServerMetricsConfigDefaultResponse { - 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/loadtesting/load-testing-rest/src/models.ts b/sdk/loadtesting/load-testing-rest/src/models.ts index a892154e0bee..7a46a1e5d3e4 100644 --- a/sdk/loadtesting/load-testing-rest/src/models.ts +++ b/sdk/loadtesting/load-testing-rest/src/models.ts @@ -3,424 +3,31 @@ import { OperationState, SimplePollerLike } from "@azure/core-lro"; import { - TestGetFile200Response, - TestRunCreateOrUpdate200Response, - TestRunCreateOrUpdate201Response, - TestRunGet200Response, - TestUploadFile201Response, -} from "./responses"; - -/** Load test model */ -export interface Test { - /** Pass fail criteria for a test. */ - passFailCriteria?: PassFailCriteria; - /** 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; - /** Certificates metadata */ - certificate?: CertificateMetadata; - /** Environment variables which are defined as a set of pairs. */ - environmentVariables?: Record; - /** The load test configuration. */ - loadTestConfiguration?: LoadTestConfiguration; - /** The input artifacts for the test. */ - inputArtifacts?: TestInputArtifacts; - /** 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; - /** The creation datetime(ISO 8601 literal format). */ - createdDateTime?: Date | string; - /** The user that created. */ - createdBy?: string; - /** The last Modified datetime(ISO 8601 literal format). */ - lastModifiedDateTime?: Date | string; - /** The user that last modified. */ - lastModifiedBy?: string; -} - -/** Pass fail criteria for a test. */ -export interface PassFailCriteria { - /** Map of id and pass fail metrics { id : pass fail metrics }. */ - passFailMetrics?: Record; -} - -/** Pass fail metric */ -export interface PassFailMetric { - /** 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"; -} - -/** Secret */ -export interface Secret { - /** The value of the secret for the respective type */ - value?: string; - /** Type of secret */ - type?: "AKV_SECRET_URI" | "SECRET_VALUE"; -} - -/** Certificates metadata */ -export interface CertificateMetadata { - /** 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 LoadTestConfiguration { - /** 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; - /** If false, Azure Load Testing copies and processes your input files unmodified across all test engine instances. If true, Azure Load Testing splits the CSV input data evenly across all engine instances. If you provide multiple CSV files, each file will be split evenly. */ - splitAllCSVs?: boolean; - /** If true, optionalLoadTestConfig is required and JMX script for the load test is not required to upload. */ - quickStartTest?: boolean; - /** Optional load test config */ - optionalLoadTestConfig?: OptionalLoadTestConfig; -} - -/** Optional load test config */ -export interface OptionalLoadTestConfig { - /** Test URL. Provide the complete HTTP URL. For example, http://contoso-app.azurewebsites.net/login */ - endpointUrl?: string; - /** No of concurrent virtual users */ - virtualUsers?: number; - /** Ramp up time */ - rampUpTime?: number; - /** Test run duration */ - duration?: number; -} - -/** The input artifacts for the test. */ -export interface TestInputArtifacts { - /** File info */ - configFileInfo?: FileInfo; - /** File info */ - testScriptFileInfo?: FileInfo; - /** File info */ - userPropFileInfo?: FileInfo; - /** File info */ - inputArtifactsZipFileInfo?: FileInfo; - /** Additional supported files for the test run */ - additionalFileInfo?: Array; -} - -/** File info */ -export interface FileInfo { - /** File URL. */ - url?: string; - /** Name of the file. */ - fileName?: string; - /** File type */ - fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; - /** Expiry time of the file (ISO 8601 literal format) */ - expireDateTime?: Date | string; - /** Validation status of the file */ - validationStatus?: - | "NOT_VALIDATED" - | "VALIDATION_SUCCESS" - | "VALIDATION_FAILURE" - | "VALIDATION_INITIATED" - | "VALIDATION_NOT_REQUIRED"; - /** Validation failure error details */ - validationFailureDetails?: string; -} - -/** Test app component */ -export interface TestAppComponents { - /** Azure resource collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object } */ - components: Record; - /** Test identifier */ - testId?: string; - /** The creation datetime(ISO 8601 literal format). */ - createdDateTime?: Date | string; - /** The user that created. */ - createdBy?: string; - /** The last Modified datetime(ISO 8601 literal format). */ - lastModifiedDateTime?: Date | string; - /** The user that last modified. */ - lastModifiedBy?: string; -} - -/** 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; -} - -/** Test server metrics configuration */ -export interface TestServerMetricConfig { - /** Test identifier */ - testId?: string; - /** Azure resource metrics collection {metric id : metrics object} (Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition for metric id). */ - metrics?: Record; - /** The creation datetime(ISO 8601 literal format). */ - createdDateTime?: Date | string; - /** The user that created. */ - createdBy?: string; - /** The last Modified datetime(ISO 8601 literal format). */ - lastModifiedDateTime?: Date | string; - /** The user that last modified. */ - lastModifiedBy?: string; -} - -/** 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 ResourceMetric { - /** Unique name for metric. */ - id?: string; - /** Azure resource id. */ - resourceId: string; - /** Metric name space. */ - metricNamespace: string; - /** Metric description. */ - displayDescription?: string; - /** The invariant value of metric name */ - name: string; - /** Metric aggregation. */ - aggregation: string; - /** Metric unit. */ - unit?: string; - /** Azure resource type. */ - resourceType: string; -} - -/** Load test run model */ -export interface TestRun { - /** Pass fail criteria for a test. */ - passFailCriteria?: PassFailCriteria; - /** 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; - /** Certificates metadata */ - certificate?: CertificateMetadata; - /** 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. */ - loadTestConfiguration?: LoadTestConfiguration; - /** Collection of test run artifacts */ - testArtifacts?: TestRunArtifacts; - /** Test result for pass/Fail criteria used during the test run. */ - testResult?: "PASSED" | "NOT_APPLICABLE" | "FAILED"; - /** Number of virtual users, for which test has been run. */ - virtualUsers?: number; - /** 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; - /** Portal url. */ - portalUrl?: string; - /** Test run duration in milliseconds. */ - duration?: number; - /** Subnet ID on which the load test instances should run. */ - subnetId?: string; - /** The creation datetime(ISO 8601 literal format). */ - createdDateTime?: Date | string; - /** The user that created. */ - createdBy?: string; - /** The last Modified datetime(ISO 8601 literal format). */ - lastModifiedDateTime?: Date | string; - /** The user that last modified. */ - lastModifiedBy?: string; -} - -/** Error details if there is any failure in load test run */ -export interface ErrorDetails { - /** Error details in case test run was not successfully run. */ - message?: string; -} - -/** Test run statistics. */ -export interface TestRunStatistics { - /** 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; -} - -/** Collection of test run artifacts */ -export interface TestRunArtifacts { - /** The input artifacts for the test run. */ - inputArtifacts?: TestRunInputArtifacts; - /** The output artifacts for the test run. */ - outputArtifacts?: TestRunOutputArtifacts; -} - -/** The input artifacts for the test run. */ -export interface TestRunInputArtifacts { - /** File info */ - configFileInfo?: FileInfo; - /** File info */ - testScriptFileInfo?: FileInfo; - /** File info */ - userPropFileInfo?: FileInfo; - /** File info */ - inputArtifactsZipFileInfo?: FileInfo; - /** Additional supported files for the test run */ - additionalFileInfo?: Array; -} - -/** The output artifacts for the test run. */ -export interface TestRunOutputArtifacts { - /** File info */ - resultFileInfo?: FileInfo; - /** File info */ - logsFileInfo?: FileInfo; -} - -/** Filters to fetch the set of metric */ -export interface MetricRequestPayload { - /** Get metrics for specific dimension values. Example: Metric contains dimension like SamplerName, Error. To retrieve all the time series data where SamplerName is equals to HTTPRequest1 or HTTPRequest2, the DimensionFilter value will be {"SamplerName", ["HTTPRequest1", "HTTPRequest2"} */ - filters?: Array; -} - -/** Dimension name and values to filter */ -export interface DimensionFilter { - /** The dimension name */ - name?: string; - /** The dimension values. Maximum values can be 20. */ - values?: Array; -} - -/** Test run app component */ -export interface TestRunAppComponents { - /** Azure resource collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object } */ - components: Record; - /** Test run identifier */ - testRunId?: string; - /** The creation datetime(ISO 8601 literal format). */ - createdDateTime?: Date | string; - /** The user that created. */ - createdBy?: string; - /** The last Modified datetime(ISO 8601 literal format). */ - lastModifiedDateTime?: Date | string; - /** The user that last modified. */ - lastModifiedBy?: string; -} - -/** Test run server metrics configuration */ -export interface TestRunServerMetricConfig { - /** Test run identifier */ - testRunId?: string; - /** Azure resource metrics collection {metric id : metrics object} (Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition for metric id). */ - metrics?: Record; - /** The creation datetime(ISO 8601 literal format). */ - createdDateTime?: Date | string; - /** The user that created. */ - createdBy?: string; - /** The last Modified datetime(ISO 8601 literal format). */ - lastModifiedDateTime?: Date | string; - /** The user that last modified. */ - lastModifiedBy?: string; -} + LoadTestAdministrationGetTestFile200Response, + LoadTestRunCreateOrUpdateTestRun200Response, + LoadTestRunCreateOrUpdateTestRun201Response, + LoadTestRunGetTestRun200Response, + LoadTestAdministrationUploadTestFile201Response, +} from "../generated/responses"; /** * Describes a poller for NotificationHubJob types. */ export type FileUploadAndValidatePoller = SimplePollerLike< - OperationState, - TestGetFile200Response + OperationState, + LoadTestAdministrationGetTestFile200Response >; export type TestRunCompletionPoller = SimplePollerLike< - OperationState, - TestRunGet200Response + OperationState, + LoadTestRunGetTestRun200Response >; export type TestRunCreateOrUpdateSuccessResponse = - | TestRunCreateOrUpdate200Response - | TestRunCreateOrUpdate201Response; + | LoadTestRunCreateOrUpdateTestRun200Response + | LoadTestRunCreateOrUpdateTestRun201Response; -export type TestUploadFileSuccessResponse = TestUploadFile201Response; +export type TestUploadFileSuccessResponse = LoadTestAdministrationUploadTestFile201Response; export interface PolledOperationOptions { /** diff --git a/sdk/loadtesting/load-testing-rest/src/parameters.ts b/sdk/loadtesting/load-testing-rest/src/parameters.ts deleted file mode 100644 index 506bc4093798..000000000000 --- a/sdk/loadtesting/load-testing-rest/src/parameters.ts +++ /dev/null @@ -1,271 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { RequestParameters } from "@azure-rest/core-client"; -import { - Test, - TestAppComponents, - TestServerMetricConfig, - TestRun, - MetricRequestPayload, - TestRunAppComponents, - TestRunServerMetricConfig, -} from "./models"; - -export interface TestCreateOrUpdateBodyParam { - /** Load test model */ - body: Test; -} - -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 the supported fields in (field asc/desc) format. eg: lastModifiedDateTime asc. Supported fields - lastModifiedDateTime */ - orderby?: string; - /** Prefix based, case sensitive search on searchable fields - displayName, createdBy. For example, to search for a test, with display name is Login Test, the search parameter can be Login. */ - search?: string; - /** Start DateTime(ISO 8601 literal format) of the last updated time range to filter tests. */ - lastModifiedStartTime?: Date | string; - /** End DateTime(ISO 8601 literal format) of the last updated time range to filter tests. */ - lastModifiedEndTime?: 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 { - /** - * The file content as application/octet-stream. - * - * Value may contain any sequence of octets - */ - body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream; -} - -export interface TestUploadFileQueryParamProperties { - /** File type */ - fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; -} - -export interface TestUploadFileQueryParam { - queryParameters?: TestUploadFileQueryParamProperties; -} - -export interface TestUploadFileMediaTypesParam { - /** Request content type */ - contentType?: "application/octet-stream"; -} - -export type TestUploadFileParameters = TestUploadFileQueryParam & - TestUploadFileMediaTypesParam & - TestUploadFileBodyParam & - RequestParameters; -export type TestGetFileParameters = RequestParameters; -export type TestDeleteFileParameters = RequestParameters; - -export interface TestListFilesQueryParamProperties { - /** Continuation token to get the next page of response */ - continuationToken?: string; -} - -export interface TestListFilesQueryParam { - queryParameters?: TestListFilesQueryParamProperties; -} - -export type TestListFilesParameters = TestListFilesQueryParam & RequestParameters; - -export interface TestCreateOrUpdateAppComponentsBodyParam { - /** App Component model. */ - body: TestAppComponents; -} - -export interface TestCreateOrUpdateAppComponentsMediaTypesParam { - /** Request content type */ - contentType?: "application/merge-patch+json"; -} - -export type TestCreateOrUpdateAppComponentsParameters = - TestCreateOrUpdateAppComponentsMediaTypesParam & - TestCreateOrUpdateAppComponentsBodyParam & - RequestParameters; -export type TestListAppComponentsParameters = RequestParameters; - -export interface TestCreateOrUpdateServerMetricsConfigBodyParam { - /** Server metric configuration model. */ - body: TestServerMetricConfig; -} - -export interface TestCreateOrUpdateServerMetricsConfigMediaTypesParam { - /** Request content type */ - contentType?: "application/merge-patch+json"; -} - -export type TestCreateOrUpdateServerMetricsConfigParameters = - TestCreateOrUpdateServerMetricsConfigMediaTypesParam & - TestCreateOrUpdateServerMetricsConfigBodyParam & - RequestParameters; -export type TestListServerMetricsConfigParameters = RequestParameters; -export type TestRunDeleteParameters = RequestParameters; - -export interface TestRunCreateOrUpdateBodyParam { - /** Load test run model */ - body: TestRun; -} - -export interface TestRunCreateOrUpdateQueryParamProperties { - /** Existing test run identifier that should be rerun, if this is provided, the test will run with the JMX file, configuration and app components from the existing test run. You can override the configuration values for new test run in the request body. */ - 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 the supported fields in (field asc/desc) format. eg: executedDateTime asc. Supported fields - executedDateTime */ - orderby?: string; - /** Continuation token to get the next page of response */ - continuationToken?: string; - /** Prefix based, case sensitive search on searchable fields - description, executedUser. For example, to search for a test run, with description 500 VUs, the search parameter can be 500. */ - search?: string; - /** Unique name of an existing load test. */ - testId?: string; - /** Start DateTime(ISO 8601 literal format) of test-run execution time filter range. */ - executionFrom?: Date | string; - /** End 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 TestRunListMetricNamespacesParameters = RequestParameters; - -export interface TestRunListMetricDefinitionsQueryParamProperties { - /** Metric namespace to query metric definitions for. */ - metricNamespace: string; -} - -export interface TestRunListMetricDefinitionsQueryParam { - queryParameters: TestRunListMetricDefinitionsQueryParamProperties; -} - -export type TestRunListMetricDefinitionsParameters = TestRunListMetricDefinitionsQueryParam & - RequestParameters; - -export interface TestRunListMetricsBodyParam { - /** Metric dimension filter */ - body?: MetricRequestPayload; -} - -export interface TestRunListMetricsQueryParamProperties { - /** The aggregation */ - 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; - /** The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. */ - timespan: string; -} - -export interface TestRunListMetricsQueryParam { - queryParameters: TestRunListMetricsQueryParamProperties; -} - -export interface TestRunListMetricsMediaTypesParam { - /** Request content type */ - contentType?: "application/json"; -} - -export type TestRunListMetricsParameters = TestRunListMetricsQueryParam & - TestRunListMetricsMediaTypesParam & - TestRunListMetricsBodyParam & - RequestParameters; - -export interface TestRunListMetricDimensionValuesQueryParamProperties { - /** 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; - /** The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. */ - timespan: string; -} - -export interface TestRunListMetricDimensionValuesQueryParam { - queryParameters: TestRunListMetricDimensionValuesQueryParamProperties; -} - -export type TestRunListMetricDimensionValuesParameters = - TestRunListMetricDimensionValuesQueryParam & RequestParameters; - -export interface TestRunCreateOrUpdateAppComponentsBodyParam { - /** App Component model. */ - body: TestRunAppComponents; -} - -export interface TestRunCreateOrUpdateAppComponentsMediaTypesParam { - /** Request content type */ - contentType?: "application/merge-patch+json"; -} - -export type TestRunCreateOrUpdateAppComponentsParameters = - TestRunCreateOrUpdateAppComponentsMediaTypesParam & - TestRunCreateOrUpdateAppComponentsBodyParam & - RequestParameters; -export type TestRunListAppComponentsParameters = RequestParameters; - -export interface TestRunCreateOrUpdateServerMetricsConfigBodyParam { - /** Server metric configuration model. */ - body: TestRunServerMetricConfig; -} - -export interface TestRunCreateOrUpdateServerMetricsConfigMediaTypesParam { - /** Request content type */ - contentType?: "application/merge-patch+json"; -} - -export type TestRunCreateOrUpdateServerMetricsConfigParameters = - TestRunCreateOrUpdateServerMetricsConfigMediaTypesParam & - TestRunCreateOrUpdateServerMetricsConfigBodyParam & - RequestParameters; -export type TestRunListServerMetricsConfigParameters = RequestParameters; diff --git a/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts b/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts index a9a2dd93bd25..10137fef7c1b 100644 --- a/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts +++ b/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { AzureLoadTestingClient } from "./clientDefinitions"; +import { AzureLoadTestingClient } from "../generated/clientDefinitions"; import { getFileValidationPoller } from "./getFileValidationPoller"; import { getTestRunCompletionPoller } from "./getTestRunCompletionPoller"; import { diff --git a/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts b/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts index 728d110327ad..2d91fa61187b 100644 --- a/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts +++ b/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. import { AbortError, AbortSignalLike } from "@azure/abort-controller"; -import { TestRunOutput } from "../outputModels"; +import { TestRunOutput } from "..//../generated/outputModels"; const REJECTED_ERR = new AbortError("The polling was aborted."); diff --git a/sdk/loadtesting/load-testing-rest/swagger/README.md b/sdk/loadtesting/load-testing-rest/swagger/README.md index 0e01ea5538b9..da1057f5df6d 100644 --- a/sdk/loadtesting/load-testing-rest/swagger/README.md +++ b/sdk/loadtesting/load-testing-rest/swagger/README.md @@ -5,21 +5,23 @@ ## Configuration ```yaml +flavor: azure +openapi-type: data-plane package-name: "@azure-rest/load-testing" title: Azure Load Testing description: Azure Load Testing Client -generate-metadata: true +generate-metadata: false generate-test: true license-header: MICROSOFT_MIT_NO_VERSION output-folder: ../ source-code-folder-path: ./src -input-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/loadtestservice/data-plane/Microsoft.LoadTestService/stable/2022-11-01/loadtestservice.json +input-file: https://github.com/Azure/azure-rest-api-specs/blob/3e27c70e7c02c07b458bc0e94716c3d82d3fdd19/specification/loadtestservice/data-plane/Microsoft.LoadTestService/stable/2022-11-01/loadtestservice.json package-version: 1.0.1 rest-level-client: true security: AADToken security-scopes: "https://cnt-prod.loadtesting.azure.com/.default" use-extension: - "@autorest/typescript": "6.0.0-rc.3" + "@autorest/typescript": "latest" service-versions: - '2022-11-01' ``` diff --git a/sdk/loadtesting/load-testing-rest/test/public/testAdministration.spec.ts b/sdk/loadtesting/load-testing-rest/test/public/testAdministration.spec.ts index 91c0c02eac59..46759335b87d 100644 --- a/sdk/loadtesting/load-testing-rest/test/public/testAdministration.spec.ts +++ b/sdk/loadtesting/load-testing-rest/test/public/testAdministration.spec.ts @@ -4,8 +4,8 @@ import { assert } from "chai"; import { createClient, createRecorder } from "./utils/recordedClient"; import { Context } from "mocha"; -import { AzureLoadTestingClient, isUnexpected } from "../../src"; -import { env, isPlaybackMode, Recorder } from "@azure-tools/test-recorder"; +import { AzureLoadTestingClient, isUnexpected } from "../../generated"; +import { isPlaybackMode, Recorder } from "@azure-tools/test-recorder"; import * as fs from "fs"; import { isNodeLike } from "@azure/core-util"; import { getLongRunningPoller } from "../../src/pollingHelper"; @@ -106,19 +106,14 @@ describe("Test Creation", () => { }); it("should create the app components", async () => { - const SUBSCRIPTION_ID = env["SUBSCRIPTION_ID"] || ""; const result = await client.path("/tests/{testId}/app-components", "abc").patch({ contentType: "application/merge-patch+json", body: { - testId: "abc", components: { "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo": { - resourceId: - "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo", resourceName: "App-Service-Sample-Demo", resourceType: "Microsoft.Web/sites", - subscriptionId: SUBSCRIPTION_ID, }, }, }, diff --git a/sdk/loadtesting/load-testing-rest/test/public/testRun.spec.ts b/sdk/loadtesting/load-testing-rest/test/public/testRun.spec.ts index af5bd3020d7e..cd0702a3270c 100644 --- a/sdk/loadtesting/load-testing-rest/test/public/testRun.spec.ts +++ b/sdk/loadtesting/load-testing-rest/test/public/testRun.spec.ts @@ -1,19 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { env, isPlaybackMode, Recorder } from "@azure-tools/test-recorder"; +import { isPlaybackMode, Recorder } from "@azure-tools/test-recorder"; import { assert } from "chai"; import { createRecorder, createClient } from "./utils/recordedClient"; import { Context } from "mocha"; import * as fs from "fs"; -import { AzureLoadTestingClient, isUnexpected } from "../../src"; +import { AzureLoadTestingClient, isUnexpected } from "../../generated"; import { isNodeLike } from "@azure/core-util"; import { getLongRunningPoller } from "../../src/pollingHelper"; describe("Test Run Creation", () => { let recorder: Recorder; let client: AzureLoadTestingClient; - const SUBSCRIPTION_ID = env["SUBSCRIPTION_ID"] || ""; let readStreamTestFile: fs.ReadStream; beforeEach(async function (this: Context) { @@ -70,7 +69,6 @@ describe("Test Run Creation", () => { body: { testId: "abc", displayName: "sample123", - virtualUsers: 10, }, }); @@ -78,7 +76,6 @@ describe("Test Run Creation", () => { throw testRunCreationResult.body.error; } - testRunCreationResult.body.testRunId = "adjwfjsdmf"; const testRunPoller = await getLongRunningPoller(client, testRunCreationResult); await testRunPoller.pollUntilDone({ abortSignal: AbortSignal.timeout(60000), // timeout of 60 seconds @@ -95,7 +92,6 @@ describe("Test Run Creation", () => { body: { testId: "abc", displayName: "sample123", - virtualUsers: 10, }, }); @@ -122,7 +118,6 @@ describe("Test Run Creation", () => { body: { testId: "abc", displayName: "sample123", - virtualUsers: 10, }, }); @@ -151,11 +146,8 @@ describe("Test Run Creation", () => { components: { "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo": { - resourceId: - "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo", resourceName: "App-Service-Sample-Demo", resourceType: "Microsoft.Web/sites", - subscriptionId: SUBSCRIPTION_ID, }, }, }, diff --git a/sdk/loadtesting/load-testing-rest/tsconfig.json b/sdk/loadtesting/load-testing-rest/tsconfig.json index 513b0a33f593..0fdf0f098e55 100644 --- a/sdk/loadtesting/load-testing-rest/tsconfig.json +++ b/sdk/loadtesting/load-testing-rest/tsconfig.json @@ -7,5 +7,19 @@ "@azure-rest/load-testing": ["./src/index"] } }, - "include": ["src/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"] + "include": [ + "src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts", + "generated/azureLoadTesting.ts", + "generated/clientDefinitions.ts", + "generated/index.ts", + "generated/isUnexpected.ts", + "generated/logger.ts", + "generated/models.ts", + "generated/outputModels.ts", + "generated/paginateHelper.ts", + "generated/parameters.ts", + "generated/responses.ts" + ] } From a4fcbb6f697f7e517e065857396ffd131a7524fa Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:00:55 +0800 Subject: [PATCH 02/15] Update CHANGELOG.md --- sdk/loadtesting/load-testing-rest/CHANGELOG.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sdk/loadtesting/load-testing-rest/CHANGELOG.md b/sdk/loadtesting/load-testing-rest/CHANGELOG.md index 5c0c1e2a2b41..5873967f5f40 100644 --- a/sdk/loadtesting/load-testing-rest/CHANGELOG.md +++ b/sdk/loadtesting/load-testing-rest/CHANGELOG.md @@ -3,12 +3,7 @@ ## 1.0.1 (Unreleased) ### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes +- refresh @azure-rest/load-testing sdk ## 1.0.0 (2023-03-07) From 83db6eb250b4ec1cf510a24f4d4d6cdafb4645ae Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:04:04 +0800 Subject: [PATCH 03/15] Update CHANGELOG.md --- sdk/loadtesting/load-testing-rest/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/loadtesting/load-testing-rest/CHANGELOG.md b/sdk/loadtesting/load-testing-rest/CHANGELOG.md index 5873967f5f40..07fdbde47ea9 100644 --- a/sdk/loadtesting/load-testing-rest/CHANGELOG.md +++ b/sdk/loadtesting/load-testing-rest/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.1 (Unreleased) +## 1.0.1 (2024-09-09) ### Features Added - refresh @azure-rest/load-testing sdk From 56e5261da4a6477cb2d8846e0408dcf28706e45b Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Tue, 24 Sep 2024 15:25:44 +0800 Subject: [PATCH 04/15] Update ignore-links.txt --- eng/ignore-links.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index 505e160cb617..92f0670c113c 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -7,3 +7,4 @@ https://docs.microsoft.com/javascript/api/@azure/arm-redhatopenshift?view=azure- https://docs.microsoft.com/javascript/api/@azure/arm-computefleet?view=azure-node-preview https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md https://docs.microsoft.com/javascript/api/@azure/arm-healthdataaiservices?view=azure-node-preview +https://docs.microsoft.com/javascript/api/@azure/load-testing From 26464f289aff0c8fb0cf272102e207ecd218d64f Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Wed, 6 Nov 2024 13:53:46 +0800 Subject: [PATCH 05/15] update --- .../src/getFileValidationPoller.ts | 11 ++++++----- .../src/getTestRunCompletionPoller.ts | 11 ++++++----- sdk/loadtesting/load-testing-rest/src/models.ts | 4 ++-- .../load-testing-rest/src/pollingHelper.ts | 2 +- .../load-testing-rest/src/util/LROUtil.ts | 5 +++-- .../test/public/testAdministration.spec.ts | 12 +++--------- .../load-testing-rest/test/public/testRun.spec.ts | 14 ++++++++------ 7 files changed, 29 insertions(+), 30 deletions(-) diff --git a/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts b/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts index 2fc58c84e973..28094196d279 100644 --- a/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts +++ b/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { AbortError, AbortSignalLike } from "@azure/abort-controller"; -import { CancelOnProgress, OperationState, SimplePollerLike } from "@azure/core-lro"; -import { FileUploadAndValidatePoller, PolledOperationOptions } from "./models"; -import { AzureLoadTestingClient } from "../generated/clientDefinitions"; -import { +import type { AbortSignalLike } from "@azure/abort-controller"; +import { AbortError } from "@azure/abort-controller"; +import type { CancelOnProgress, OperationState, SimplePollerLike } from "@azure/core-lro"; +import type { FileUploadAndValidatePoller, PolledOperationOptions } from "./models"; +import type { AzureLoadTestingClient } from "../generated/clientDefinitions"; +import type { LoadTestAdministrationGetTestFile200Response, LoadTestAdministrationUploadTestFile201Response, } from "../generated/responses"; diff --git a/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts b/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts index 00fac5a087cd..7b14f080351c 100644 --- a/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts +++ b/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { AbortError, AbortSignalLike } from "@azure/abort-controller"; -import { CancelOnProgress, OperationState, SimplePollerLike } from "@azure/core-lro"; -import { TestRunCompletionPoller, PolledOperationOptions } from "./models"; -import { AzureLoadTestingClient } from "../generated/clientDefinitions"; -import { +import type { AbortSignalLike } from "@azure/abort-controller"; +import { AbortError } from "@azure/abort-controller"; +import type { CancelOnProgress, OperationState, SimplePollerLike } from "@azure/core-lro"; +import type { TestRunCompletionPoller, PolledOperationOptions } from "./models"; +import type { AzureLoadTestingClient } from "../generated/clientDefinitions"; +import type { LoadTestRunCreateOrUpdateTestRun200Response, LoadTestRunCreateOrUpdateTestRun201Response, LoadTestRunGetTestRun200Response, diff --git a/sdk/loadtesting/load-testing-rest/src/models.ts b/sdk/loadtesting/load-testing-rest/src/models.ts index 7a46a1e5d3e4..5d1586afa6de 100644 --- a/sdk/loadtesting/load-testing-rest/src/models.ts +++ b/sdk/loadtesting/load-testing-rest/src/models.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { OperationState, SimplePollerLike } from "@azure/core-lro"; -import { +import type { OperationState, SimplePollerLike } from "@azure/core-lro"; +import type { LoadTestAdministrationGetTestFile200Response, LoadTestRunCreateOrUpdateTestRun200Response, LoadTestRunCreateOrUpdateTestRun201Response, diff --git a/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts b/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts index 3feb8032a71e..3feb16db7a5c 100644 --- a/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts +++ b/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { AzureLoadTestingClient } from "../generated/clientDefinitions"; +import type { AzureLoadTestingClient } from "../generated/clientDefinitions"; import { getFileValidationPoller } from "./getFileValidationPoller"; import { getTestRunCompletionPoller } from "./getTestRunCompletionPoller"; import type { diff --git a/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts b/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts index 2d91fa61187b..c0d54a3b5325 100644 --- a/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts +++ b/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts @@ -1,7 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { AbortError, AbortSignalLike } from "@azure/abort-controller"; -import { TestRunOutput } from "..//../generated/outputModels"; +import type { AbortSignalLike } from "@azure/abort-controller"; +import { AbortError } from "@azure/abort-controller"; +import type { TestRunOutput } from "..//../generated/outputModels"; const REJECTED_ERR = new AbortError("The polling was aborted."); diff --git a/sdk/loadtesting/load-testing-rest/test/public/testAdministration.spec.ts b/sdk/loadtesting/load-testing-rest/test/public/testAdministration.spec.ts index 930003c3e90d..3893d09ba19d 100644 --- a/sdk/loadtesting/load-testing-rest/test/public/testAdministration.spec.ts +++ b/sdk/loadtesting/load-testing-rest/test/public/testAdministration.spec.ts @@ -3,17 +3,11 @@ import { assert } from "chai"; import { createClient, createRecorder } from "./utils/recordedClient"; -<<<<<<< HEAD -import { Context } from "mocha"; -import { AzureLoadTestingClient, isUnexpected } from "../../generated"; -import { isPlaybackMode, Recorder } from "@azure-tools/test-recorder"; -======= import type { Context } from "mocha"; -import type { AzureLoadTestingClient } from "../../src"; -import { isUnexpected } from "../../src"; +import type { AzureLoadTestingClient } from "../../generated"; +import { isUnexpected } from "../../generated"; import type { Recorder } from "@azure-tools/test-recorder"; -import { env, isPlaybackMode } from "@azure-tools/test-recorder"; ->>>>>>> main +import { isPlaybackMode } from "@azure-tools/test-recorder"; import * as fs from "fs"; import { isNodeLike } from "@azure/core-util"; import { getLongRunningPoller } from "../../src/pollingHelper"; diff --git a/sdk/loadtesting/load-testing-rest/test/public/testRun.spec.ts b/sdk/loadtesting/load-testing-rest/test/public/testRun.spec.ts index 9ccfe93471b3..515d1501140c 100644 --- a/sdk/loadtesting/load-testing-rest/test/public/testRun.spec.ts +++ b/sdk/loadtesting/load-testing-rest/test/public/testRun.spec.ts @@ -1,12 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { isPlaybackMode, Recorder } from "@azure-tools/test-recorder"; +import type { Recorder } from "@azure-tools/test-recorder"; +import { isPlaybackMode } from "@azure-tools/test-recorder"; import { assert } from "chai"; import { createRecorder, createClient } from "./utils/recordedClient"; import type { Context } from "mocha"; import * as fs from "fs"; -import { AzureLoadTestingClient, isUnexpected } from "../../generated"; +import type { AzureLoadTestingClient } from "../../generated"; +import { isUnexpected } from "../../generated"; import { isNodeLike } from "@azure/core-util"; import { getLongRunningPoller } from "../../src/pollingHelper"; @@ -145,10 +147,10 @@ describe("Test Run Creation", () => { body: { components: { "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo": - { - resourceName: "App-Service-Sample-Demo", - resourceType: "Microsoft.Web/sites", - }, + { + resourceName: "App-Service-Sample-Demo", + resourceType: "Microsoft.Web/sites", + }, }, }, }); From 374a08dc0e556f5f939c132a70df42e31de4d4ec Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Wed, 6 Nov 2024 14:14:00 +0800 Subject: [PATCH 06/15] Update load-testing.api.md --- .../load-testing-rest/review/load-testing.api.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sdk/loadtesting/load-testing-rest/review/load-testing.api.md b/sdk/loadtesting/load-testing-rest/review/load-testing.api.md index 87b1cdf7fbce..7508a7fbf7c6 100644 --- a/sdk/loadtesting/load-testing-rest/review/load-testing.api.md +++ b/sdk/loadtesting/load-testing-rest/review/load-testing.api.md @@ -4,17 +4,17 @@ ```ts -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; +import { Client } from '@azure-rest/core-client'; +import { ClientOptions } from '@azure-rest/core-client'; import type { HttpResponse } from '@azure-rest/core-client'; import type { OperationState } from '@azure/core-lro'; -import type { PagedAsyncIterableIterator } from '@azure/core-paging'; -import type { PathUncheckedResponse } from '@azure-rest/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PathUncheckedResponse } from '@azure-rest/core-client'; import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import type { RequestParameters } from '@azure-rest/core-client'; +import { RequestParameters } from '@azure-rest/core-client'; import type { SimplePollerLike } from '@azure/core-lro'; -import type { StreamableMethod } from '@azure-rest/core-client'; -import type { TokenCredential } from '@azure/core-auth'; +import { StreamableMethod } from '@azure-rest/core-client'; +import { TokenCredential } from '@azure/core-auth'; // @public export interface AppComponent { From e15ab413ddc33a31142d7c5020189355e2f5ae53 Mon Sep 17 00:00:00 2001 From: ZiWei Chen <98569699+kazrael2119@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:24:49 +0800 Subject: [PATCH 07/15] Update sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts Co-authored-by: Qiaoqiao Zhang <55688292+qiaozha@users.noreply.github.com> --- sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts b/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts index c0d54a3b5325..125f429e9ef7 100644 --- a/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts +++ b/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import type { AbortSignalLike } from "@azure/abort-controller"; import { AbortError } from "@azure/abort-controller"; -import type { TestRunOutput } from "..//../generated/outputModels"; +import type { TestRunOutput } from "../../generated/outputModels"; const REJECTED_ERR = new AbortError("The polling was aborted."); From dd53dad242b599ae158263fd4dbfbb9f761a8cf4 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:26:55 +0800 Subject: [PATCH 08/15] Update ignore-links.txt --- eng/ignore-links.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index e63610e4c600..c6c863c8255b 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -8,12 +8,9 @@ https://docs.microsoft.com/javascript/api/@azure/arm-computefleet?view=azure-nod https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md https://docs.microsoft.com/javascript/api/@azure/arm-computeschedule?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-healthdataaiservices?view=azure-node-preview -<<<<<<< HEAD https://docs.microsoft.com/javascript/api/@azure/load-testing -======= https://docs.microsoft.com/javascript/api/@azure/arm-fabric?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-trustedsigning?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-containerorchestratorruntime?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-iotoperations?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-databoundaries?view=azure-node-preview ->>>>>>> main From 1a84459a14498a2e6a9edbb7157a07668556d7eb Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 2 Dec 2024 16:56:37 +0800 Subject: [PATCH 09/15] update --- .../generated/azureLoadTesting.ts | 1 + .../generated/clientDefinitions.ts | 1 + .../generated/isUnexpected.ts | 1 + .../load-testing-rest/generated/logger.ts | 1 + .../load-testing-rest/generated/models.ts | 43 +- .../generated/outputModels.ts | 101 ++-- .../generated/paginateHelper.ts | 1 + .../load-testing-rest/generated/parameters.ts | 1 + .../load-testing-rest/generated/responses.ts | 1 + .../review/load-testing.api.md | 27 +- .../load-testing-rest/samples-dev/sample.ts | 10 +- .../load-testing-rest/src/azureLoadTesting.ts | 65 +++ .../src/clientDefinitions.ts | 375 ++++++++++++ .../src/getFileValidationPoller.ts | 6 +- .../src/getTestRunCompletionPoller.ts | 6 +- .../load-testing-rest/src/index.ts | 17 +- .../load-testing-rest/src/isUnexpected.ts | 375 ++++++++++++ .../load-testing-rest/src/logger.ts | 5 + .../load-testing-rest/src/models.ts | 243 +++++++- .../load-testing-rest/src/outputModels.ts | 532 ++++++++++++++++++ .../load-testing-rest/src/paginateHelper.ts | 267 +++++++++ .../load-testing-rest/src/parameters.ts | 275 +++++++++ .../load-testing-rest/src/pollingHelper.ts | 2 +- .../load-testing-rest/src/responses.ts | 527 +++++++++++++++++ .../load-testing-rest/src/util/LROUtil.ts | 2 +- .../test/public/testAdministration.spec.ts | 8 +- .../test/public/testRun.spec.ts | 8 +- .../test/public/utils/env-browser.mts | 2 - .../load-testing-rest/tsconfig.json | 20 +- 29 files changed, 2797 insertions(+), 126 deletions(-) create mode 100644 sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts create mode 100644 sdk/loadtesting/load-testing-rest/src/clientDefinitions.ts create mode 100644 sdk/loadtesting/load-testing-rest/src/isUnexpected.ts create mode 100644 sdk/loadtesting/load-testing-rest/src/logger.ts create mode 100644 sdk/loadtesting/load-testing-rest/src/outputModels.ts create mode 100644 sdk/loadtesting/load-testing-rest/src/paginateHelper.ts create mode 100644 sdk/loadtesting/load-testing-rest/src/parameters.ts create mode 100644 sdk/loadtesting/load-testing-rest/src/responses.ts delete mode 100644 sdk/loadtesting/load-testing-rest/test/public/utils/env-browser.mts diff --git a/sdk/loadtesting/load-testing-rest/generated/azureLoadTesting.ts b/sdk/loadtesting/load-testing-rest/generated/azureLoadTesting.ts index 0f69da505f4f..c87f22532d9f 100644 --- a/sdk/loadtesting/load-testing-rest/generated/azureLoadTesting.ts +++ b/sdk/loadtesting/load-testing-rest/generated/azureLoadTesting.ts @@ -12,6 +12,7 @@ export interface AzureLoadTestingClientOptions extends ClientOptions { apiVersion?: string; } + /** * Initialize a new instance of `AzureLoadTestingClient` * @param endpoint - URL to perform data plane API operations on the resource. diff --git a/sdk/loadtesting/load-testing-rest/generated/clientDefinitions.ts b/sdk/loadtesting/load-testing-rest/generated/clientDefinitions.ts index a43b72add285..4e1161326778 100644 --- a/sdk/loadtesting/load-testing-rest/generated/clientDefinitions.ts +++ b/sdk/loadtesting/load-testing-rest/generated/clientDefinitions.ts @@ -91,6 +91,7 @@ import { } from "./responses.js"; import { Client, StreamableMethod } from "@azure-rest/core-client"; + export interface LoadTestAdministrationCreateOrUpdateTest { /** Create a new test or update an existing test. */ patch( diff --git a/sdk/loadtesting/load-testing-rest/generated/isUnexpected.ts b/sdk/loadtesting/load-testing-rest/generated/isUnexpected.ts index 0a5461cc4daa..21fb5d3aab07 100644 --- a/sdk/loadtesting/load-testing-rest/generated/isUnexpected.ts +++ b/sdk/loadtesting/load-testing-rest/generated/isUnexpected.ts @@ -62,6 +62,7 @@ import { LoadTestRunGetServerMetricsConfigDefaultResponse, } from "./responses.js"; + const responseMap: Record = { "PATCH /tests/{testId}": ["200", "201"], "DELETE /tests/{testId}": ["204"], diff --git a/sdk/loadtesting/load-testing-rest/generated/logger.ts b/sdk/loadtesting/load-testing-rest/generated/logger.ts index 31a2389c94d0..e216e6dd7d82 100644 --- a/sdk/loadtesting/load-testing-rest/generated/logger.ts +++ b/sdk/loadtesting/load-testing-rest/generated/logger.ts @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { createClientLogger } from "@azure/logger"; export const logger = createClientLogger("load-testing"); diff --git a/sdk/loadtesting/load-testing-rest/generated/models.ts b/sdk/loadtesting/load-testing-rest/generated/models.ts index 0cf8fee62428..fc6c397ac8f8 100644 --- a/sdk/loadtesting/load-testing-rest/generated/models.ts +++ b/sdk/loadtesting/load-testing-rest/generated/models.ts @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + /** Load test model */ export interface Test { /** Pass fail criteria for a test. */ @@ -35,22 +36,22 @@ export interface PassFailCriteria { export interface PassFailMetric { /** The client metric on which the criteria should be applied. */ clientMetric?: - | "response_time_ms" - | "latency" - | "error" - | "requests" - | "requests_per_sec"; + | "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"; + | "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 */ @@ -127,11 +128,11 @@ export interface FileInfo { expireDateTime?: Date | string; /** Validation status of the file */ validationStatus?: - | "NOT_VALIDATED" - | "VALIDATION_SUCCESS" - | "VALIDATION_FAILURE" - | "VALIDATION_INITIATED" - | "VALIDATION_NOT_REQUIRED"; + | "NOT_VALIDATED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE" + | "VALIDATION_INITIATED" + | "VALIDATION_NOT_REQUIRED"; /** Validation failure error details */ validationFailureDetails?: string; } @@ -199,10 +200,10 @@ export interface TestRun { } /** Error details if there is any failure in load test run */ -export interface ErrorDetails {} +export interface ErrorDetails { } /** Test run statistics. */ -export interface TestRunStatistics {} +export interface TestRunStatistics { } /** Collection of test run artifacts */ export interface TestRunArtifacts { diff --git a/sdk/loadtesting/load-testing-rest/generated/outputModels.ts b/sdk/loadtesting/load-testing-rest/generated/outputModels.ts index 77c0f7de0544..9e8428524f2d 100644 --- a/sdk/loadtesting/load-testing-rest/generated/outputModels.ts +++ b/sdk/loadtesting/load-testing-rest/generated/outputModels.ts @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + /** Load test model */ export interface TestOutput { /** Pass fail criteria for a test. */ @@ -47,22 +48,22 @@ export interface PassFailCriteriaOutput { export interface PassFailMetricOutput { /** The client metric on which the criteria should be applied. */ clientMetric?: - | "response_time_ms" - | "latency" - | "error" - | "requests" - | "requests_per_sec"; + | "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"; + | "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 */ @@ -145,11 +146,11 @@ export interface FileInfoOutput { expireDateTime?: string; /** Validation status of the file */ validationStatus?: - | "NOT_VALIDATED" - | "VALIDATION_SUCCESS" - | "VALIDATION_FAILURE" - | "VALIDATION_INITIATED" - | "VALIDATION_NOT_REQUIRED"; + | "NOT_VALIDATED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE" + | "VALIDATION_INITIATED" + | "VALIDATION_NOT_REQUIRED"; /** Validation failure error details */ validationFailureDetails?: string; } @@ -290,22 +291,22 @@ export interface TestRunOutput { description?: string; /** The test run status. */ readonly status?: - | "ACCEPTED" - | "NOTSTARTED" - | "PROVISIONING" - | "PROVISIONED" - | "CONFIGURING" - | "CONFIGURED" - | "EXECUTING" - | "EXECUTED" - | "DEPROVISIONING" - | "DEPROVISIONED" - | "DONE" - | "CANCELLING" - | "CANCELLED" - | "FAILED" - | "VALIDATION_SUCCESS" - | "VALIDATION_FAILURE"; + | "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). */ readonly startDateTime?: string; /** The test run end DateTime(ISO 8601 literal format). */ @@ -436,25 +437,25 @@ export interface MetricDefinitionOutput { namespace?: string; /** The primary aggregation type value defining how to use the values for display. */ primaryAggregationType?: - | "Average" - | "Count" - | "None" - | "Total" - | "Percentile90" - | "Percentile95" - | "Percentile99"; + | "Average" + | "Count" + | "None" + | "Total" + | "Percentile90" + | "Percentile95" + | "Percentile99"; /** The collection of what all aggregation types are supported. */ supportedAggregationTypes?: Array; /** The unit of the metric. */ unit?: - | "NotSpecified" - | "Percent" - | "Count" - | "Seconds" - | "Milliseconds" - | "Bytes" - | "BytesPerSecond" - | "CountPerSecond"; + | "NotSpecified" + | "Percent" + | "Count" + | "Seconds" + | "Milliseconds" + | "Bytes" + | "BytesPerSecond" + | "CountPerSecond"; /** Metric availability specifies the time grain (aggregation interval or frequency). */ metricAvailabilities?: Array; } diff --git a/sdk/loadtesting/load-testing-rest/generated/paginateHelper.ts b/sdk/loadtesting/load-testing-rest/generated/paginateHelper.ts index 16d1ae144a77..3787fda685bc 100644 --- a/sdk/loadtesting/load-testing-rest/generated/paginateHelper.ts +++ b/sdk/loadtesting/load-testing-rest/generated/paginateHelper.ts @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; import { createRestError } from "@azure-rest/core-client"; diff --git a/sdk/loadtesting/load-testing-rest/generated/parameters.ts b/sdk/loadtesting/load-testing-rest/generated/parameters.ts index 9afcdf47a153..58e0c8b8e94d 100644 --- a/sdk/loadtesting/load-testing-rest/generated/parameters.ts +++ b/sdk/loadtesting/load-testing-rest/generated/parameters.ts @@ -12,6 +12,7 @@ import { TestRunServerMetricConfig, } from "./models.js"; + /** Load test model */ export type TestResourceMergeAndPatch = Partial; diff --git a/sdk/loadtesting/load-testing-rest/generated/responses.ts b/sdk/loadtesting/load-testing-rest/generated/responses.ts index de9380143bad..efc0511930c3 100644 --- a/sdk/loadtesting/load-testing-rest/generated/responses.ts +++ b/sdk/loadtesting/load-testing-rest/generated/responses.ts @@ -21,6 +21,7 @@ import type { TestRunServerMetricConfigOutput, } from "./outputModels.js"; + /** Create a new test or update an existing test. */ export interface LoadTestAdministrationCreateOrUpdateTest200Response extends HttpResponse { diff --git a/sdk/loadtesting/load-testing-rest/review/load-testing.api.md b/sdk/loadtesting/load-testing-rest/review/load-testing.api.md index 7508a7fbf7c6..a8cffbbdab72 100644 --- a/sdk/loadtesting/load-testing-rest/review/load-testing.api.md +++ b/sdk/loadtesting/load-testing-rest/review/load-testing.api.md @@ -4,17 +4,16 @@ ```ts -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; import type { HttpResponse } from '@azure-rest/core-client'; import type { OperationState } from '@azure/core-lro'; -import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { PathUncheckedResponse } from '@azure-rest/core-client'; +import type { PathUncheckedResponse } from '@azure-rest/core-client'; import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; import type { SimplePollerLike } from '@azure/core-lro'; -import { StreamableMethod } from '@azure-rest/core-client'; -import { TokenCredential } from '@azure/core-auth'; +import type { StreamableMethod } from '@azure-rest/core-client'; +import type { TokenCredential } from '@azure/core-auth'; // @public export interface AppComponent { @@ -142,7 +141,7 @@ export function getLongRunningPoller(client: AzureLoadTestingClient, initialResp export function getLongRunningPoller(client: AzureLoadTestingClient, initialResponse: TestRunCreateOrUpdateSuccessResponse): Promise; // @public -export type GetPage = (pageLink: string, maxPageSize?: number) => Promise<{ +export type GetPage = (pageLink: string) => Promise<{ page: TPage; nextPageLink?: string; }>; @@ -1295,6 +1294,18 @@ export interface OptionalLoadTestConfigOutput { virtualUsers?: number; } +// @public +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator; + next(): Promise>; +} + +// @public +export interface PageSettings { + continuationToken?: string; +} + // @public export function paginate(client: Client, initialResponse: TResponse, options?: PagingOptions): PagedAsyncIterableIterator>; diff --git a/sdk/loadtesting/load-testing-rest/samples-dev/sample.ts b/sdk/loadtesting/load-testing-rest/samples-dev/sample.ts index 5a928150ee6f..27c12dc5ec9d 100644 --- a/sdk/loadtesting/load-testing-rest/samples-dev/sample.ts +++ b/sdk/loadtesting/load-testing-rest/samples-dev/sample.ts @@ -70,7 +70,7 @@ async function main(): Promise { if (fileValidatePoller.getOperationState().status !== "succeeded" && fileValidateResult) { throw new Error( "There is some issue in validation, please make sure uploaded file is a valid JMX." + - fileValidateResult.body.validationFailureDetails, + fileValidateResult.body.validationFailureDetails, ); } @@ -82,10 +82,10 @@ async function main(): Promise { body: { components: { "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo": - { - resourceName: "App-Service-Sample-Demo", - resourceType: "Microsoft.Web/sites", - }, + { + resourceName: "App-Service-Sample-Demo", + resourceType: "Microsoft.Web/sites", + }, }, }, }); diff --git a/sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts b/sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts new file mode 100644 index 000000000000..f3b5b7606b08 --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; +import { logger } from "./logger.js"; +import type { TokenCredential } from "@azure/core-auth"; +import type { AzureLoadTestingClient } from "./clientDefinitions.js"; + +/** The optional parameters for the client */ +export interface AzureLoadTestingClientOptions extends ClientOptions { + /** The api version option of the client */ + apiVersion?: string; +} + +/** + * Initialize a new instance of `AzureLoadTestingClient` + * @param endpoint - URL to perform data plane API operations on the resource. + * @param credentials - uniquely identify client credential + * @param options - the parameter for all optional parameters + */ +export default function createClient( + endpoint: string, + credentials: TokenCredential, + { apiVersion = "2022-11-01", ...options }: AzureLoadTestingClientOptions = {}, +): AzureLoadTestingClient { + const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://${endpoint}`; + const userAgentInfo = `azsdk-js-load-testing-rest/1.0.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + credentials: { + scopes: options.credentials?.scopes ?? ["https://cnt-prod.loadtesting.azure.com/.default"], + }, + }; + const client = getClient(endpointUrl, credentials, options) as AzureLoadTestingClient; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + client.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version") && apiVersion) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + + return client; +} diff --git a/sdk/loadtesting/load-testing-rest/src/clientDefinitions.ts b/sdk/loadtesting/load-testing-rest/src/clientDefinitions.ts new file mode 100644 index 000000000000..ad15e1547340 --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/src/clientDefinitions.ts @@ -0,0 +1,375 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + LoadTestAdministrationCreateOrUpdateTestParameters, + LoadTestAdministrationDeleteTestParameters, + LoadTestAdministrationGetTestParameters, + LoadTestAdministrationListTestsParameters, + LoadTestAdministrationUploadTestFileParameters, + LoadTestAdministrationGetTestFileParameters, + LoadTestAdministrationDeleteTestFileParameters, + LoadTestAdministrationListTestFilesParameters, + LoadTestAdministrationCreateOrUpdateAppComponentsParameters, + LoadTestAdministrationGetAppComponentsParameters, + LoadTestAdministrationCreateOrUpdateServerMetricsConfigParameters, + LoadTestAdministrationGetServerMetricsConfigParameters, + LoadTestRunCreateOrUpdateTestRunParameters, + LoadTestRunGetTestRunParameters, + LoadTestRunDeleteTestRunParameters, + LoadTestRunGetTestRunFileParameters, + LoadTestRunListTestRunsParameters, + LoadTestRunStopTestRunParameters, + LoadTestRunListMetricNamespacesParameters, + LoadTestRunListMetricDefinitionsParameters, + LoadTestRunListMetricsParameters, + LoadTestRunListMetricDimensionValuesParameters, + LoadTestRunCreateOrUpdateAppComponentsParameters, + LoadTestRunGetAppComponentsParameters, + LoadTestRunCreateOrUpdateServerMetricsConfigParameters, + LoadTestRunGetServerMetricsConfigParameters, +} from "./parameters.js"; +import type { + LoadTestAdministrationCreateOrUpdateTest200Response, + LoadTestAdministrationCreateOrUpdateTest201Response, + LoadTestAdministrationCreateOrUpdateTestDefaultResponse, + LoadTestAdministrationDeleteTest204Response, + LoadTestAdministrationDeleteTestDefaultResponse, + LoadTestAdministrationGetTest200Response, + LoadTestAdministrationGetTestDefaultResponse, + LoadTestAdministrationListTests200Response, + LoadTestAdministrationListTestsDefaultResponse, + LoadTestAdministrationUploadTestFile201Response, + LoadTestAdministrationUploadTestFileDefaultResponse, + LoadTestAdministrationGetTestFile200Response, + LoadTestAdministrationGetTestFileDefaultResponse, + LoadTestAdministrationDeleteTestFile204Response, + LoadTestAdministrationDeleteTestFileDefaultResponse, + LoadTestAdministrationListTestFiles200Response, + LoadTestAdministrationListTestFilesDefaultResponse, + LoadTestAdministrationCreateOrUpdateAppComponents200Response, + LoadTestAdministrationCreateOrUpdateAppComponents201Response, + LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse, + LoadTestAdministrationGetAppComponents200Response, + LoadTestAdministrationGetAppComponentsDefaultResponse, + LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response, + LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response, + LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse, + LoadTestAdministrationGetServerMetricsConfig200Response, + LoadTestAdministrationGetServerMetricsConfigDefaultResponse, + LoadTestRunCreateOrUpdateTestRun200Response, + LoadTestRunCreateOrUpdateTestRun201Response, + LoadTestRunCreateOrUpdateTestRunDefaultResponse, + LoadTestRunGetTestRun200Response, + LoadTestRunGetTestRunDefaultResponse, + LoadTestRunDeleteTestRun204Response, + LoadTestRunDeleteTestRunDefaultResponse, + LoadTestRunGetTestRunFile200Response, + LoadTestRunGetTestRunFileDefaultResponse, + LoadTestRunListTestRuns200Response, + LoadTestRunListTestRunsDefaultResponse, + LoadTestRunStopTestRun200Response, + LoadTestRunStopTestRunDefaultResponse, + LoadTestRunListMetricNamespaces200Response, + LoadTestRunListMetricNamespacesDefaultResponse, + LoadTestRunListMetricDefinitions200Response, + LoadTestRunListMetricDefinitionsDefaultResponse, + LoadTestRunListMetrics200Response, + LoadTestRunListMetricsDefaultResponse, + LoadTestRunListMetricDimensionValues200Response, + LoadTestRunListMetricDimensionValuesDefaultResponse, + LoadTestRunCreateOrUpdateAppComponents200Response, + LoadTestRunCreateOrUpdateAppComponents201Response, + LoadTestRunCreateOrUpdateAppComponentsDefaultResponse, + LoadTestRunGetAppComponents200Response, + LoadTestRunGetAppComponentsDefaultResponse, + LoadTestRunCreateOrUpdateServerMetricsConfig200Response, + LoadTestRunCreateOrUpdateServerMetricsConfig201Response, + LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse, + LoadTestRunGetServerMetricsConfig200Response, + LoadTestRunGetServerMetricsConfigDefaultResponse, +} from "./responses.js"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; + +export interface LoadTestAdministrationCreateOrUpdateTest { + /** Create a new test or update an existing test. */ + patch( + options: LoadTestAdministrationCreateOrUpdateTestParameters, + ): StreamableMethod< + | LoadTestAdministrationCreateOrUpdateTest200Response + | LoadTestAdministrationCreateOrUpdateTest201Response + | LoadTestAdministrationCreateOrUpdateTestDefaultResponse + >; + /** Delete a test by its name. */ + delete( + options?: LoadTestAdministrationDeleteTestParameters, + ): StreamableMethod< + LoadTestAdministrationDeleteTest204Response | LoadTestAdministrationDeleteTestDefaultResponse + >; + /** Get load test details by test name */ + get( + options?: LoadTestAdministrationGetTestParameters, + ): StreamableMethod< + LoadTestAdministrationGetTest200Response | LoadTestAdministrationGetTestDefaultResponse + >; +} + +export interface LoadTestAdministrationListTests { + /** Get all load tests by the fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. */ + get( + options?: LoadTestAdministrationListTestsParameters, + ): StreamableMethod< + LoadTestAdministrationListTests200Response | LoadTestAdministrationListTestsDefaultResponse + >; +} + +export interface LoadTestAdministrationUploadTestFile { + /** Upload input file for a given test name. File size can't be more than 50 MB. Existing file with same name for the given test will be overwritten. File should be provided in the request body as application/octet-stream. */ + put( + options: LoadTestAdministrationUploadTestFileParameters, + ): StreamableMethod< + | LoadTestAdministrationUploadTestFile201Response + | LoadTestAdministrationUploadTestFileDefaultResponse + >; + /** Get test file by the file name. */ + get( + options?: LoadTestAdministrationGetTestFileParameters, + ): StreamableMethod< + LoadTestAdministrationGetTestFile200Response | LoadTestAdministrationGetTestFileDefaultResponse + >; + /** Delete file by the file name for a test */ + delete( + options?: LoadTestAdministrationDeleteTestFileParameters, + ): StreamableMethod< + | LoadTestAdministrationDeleteTestFile204Response + | LoadTestAdministrationDeleteTestFileDefaultResponse + >; +} + +export interface LoadTestAdministrationListTestFiles { + /** Get all test files. */ + get( + options?: LoadTestAdministrationListTestFilesParameters, + ): StreamableMethod< + | LoadTestAdministrationListTestFiles200Response + | LoadTestAdministrationListTestFilesDefaultResponse + >; +} + +export interface LoadTestAdministrationCreateOrUpdateAppComponents { + /** Associate an app component (collection of azure resources) to a test */ + patch( + options: LoadTestAdministrationCreateOrUpdateAppComponentsParameters, + ): StreamableMethod< + | LoadTestAdministrationCreateOrUpdateAppComponents200Response + | LoadTestAdministrationCreateOrUpdateAppComponents201Response + | LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse + >; + /** Get associated app component (collection of azure resources) for the given test. */ + get( + options?: LoadTestAdministrationGetAppComponentsParameters, + ): StreamableMethod< + | LoadTestAdministrationGetAppComponents200Response + | LoadTestAdministrationGetAppComponentsDefaultResponse + >; +} + +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfig { + /** Configure server metrics for a test */ + patch( + options: LoadTestAdministrationCreateOrUpdateServerMetricsConfigParameters, + ): StreamableMethod< + | LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response + | LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response + | LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse + >; + /** List server metrics configuration for the given test. */ + get( + options?: LoadTestAdministrationGetServerMetricsConfigParameters, + ): StreamableMethod< + | LoadTestAdministrationGetServerMetricsConfig200Response + | LoadTestAdministrationGetServerMetricsConfigDefaultResponse + >; +} + +export interface LoadTestRunCreateOrUpdateTestRun { + /** Create and start a new test run with the given name. */ + patch( + options: LoadTestRunCreateOrUpdateTestRunParameters, + ): StreamableMethod< + | LoadTestRunCreateOrUpdateTestRun200Response + | LoadTestRunCreateOrUpdateTestRun201Response + | LoadTestRunCreateOrUpdateTestRunDefaultResponse + >; + /** Get test run details by name. */ + get( + options?: LoadTestRunGetTestRunParameters, + ): StreamableMethod; + /** Delete a test run by its name. */ + delete( + options?: LoadTestRunDeleteTestRunParameters, + ): StreamableMethod< + LoadTestRunDeleteTestRun204Response | LoadTestRunDeleteTestRunDefaultResponse + >; +} + +export interface LoadTestRunGetTestRunFile { + /** Get test run file by file name. */ + get( + options?: LoadTestRunGetTestRunFileParameters, + ): StreamableMethod< + LoadTestRunGetTestRunFile200Response | LoadTestRunGetTestRunFileDefaultResponse + >; +} + +export interface LoadTestRunListTestRuns { + /** Get all test runs with given filters */ + get( + options?: LoadTestRunListTestRunsParameters, + ): StreamableMethod; +} + +export interface LoadTestRunStopTestRun { + /** Stop test run by name. */ + post( + options?: LoadTestRunStopTestRunParameters, + ): StreamableMethod; +} + +export interface LoadTestRunListMetricNamespaces { + /** List the metric namespaces for a load test run. */ + get( + options?: LoadTestRunListMetricNamespacesParameters, + ): StreamableMethod< + LoadTestRunListMetricNamespaces200Response | LoadTestRunListMetricNamespacesDefaultResponse + >; +} + +export interface LoadTestRunListMetricDefinitions { + /** List the metric definitions for a load test run. */ + get( + options: LoadTestRunListMetricDefinitionsParameters, + ): StreamableMethod< + LoadTestRunListMetricDefinitions200Response | LoadTestRunListMetricDefinitionsDefaultResponse + >; +} + +export interface LoadTestRunListMetrics { + /** List the metric values for a load test run. */ + post( + options: LoadTestRunListMetricsParameters, + ): StreamableMethod; +} + +export interface LoadTestRunListMetricDimensionValues { + /** List the dimension values for the given metric dimension name. */ + get( + options: LoadTestRunListMetricDimensionValuesParameters, + ): StreamableMethod< + | LoadTestRunListMetricDimensionValues200Response + | LoadTestRunListMetricDimensionValuesDefaultResponse + >; +} + +export interface LoadTestRunCreateOrUpdateAppComponents { + /** Associate an app component (collection of azure resources) to a test run */ + patch( + options: LoadTestRunCreateOrUpdateAppComponentsParameters, + ): StreamableMethod< + | LoadTestRunCreateOrUpdateAppComponents200Response + | LoadTestRunCreateOrUpdateAppComponents201Response + | LoadTestRunCreateOrUpdateAppComponentsDefaultResponse + >; + /** Get associated app component (collection of azure resources) for the given test run. */ + get( + options?: LoadTestRunGetAppComponentsParameters, + ): StreamableMethod< + LoadTestRunGetAppComponents200Response | LoadTestRunGetAppComponentsDefaultResponse + >; +} + +export interface LoadTestRunCreateOrUpdateServerMetricsConfig { + /** Configure server metrics for a test run */ + patch( + options: LoadTestRunCreateOrUpdateServerMetricsConfigParameters, + ): StreamableMethod< + | LoadTestRunCreateOrUpdateServerMetricsConfig200Response + | LoadTestRunCreateOrUpdateServerMetricsConfig201Response + | LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse + >; + /** List server metrics configuration for the given test run. */ + get( + options?: LoadTestRunGetServerMetricsConfigParameters, + ): StreamableMethod< + LoadTestRunGetServerMetricsConfig200Response | LoadTestRunGetServerMetricsConfigDefaultResponse + >; +} + +export interface Routes { + /** Resource for '/tests/\{testId\}' has methods for the following verbs: patch, delete, get */ + (path: "/tests/{testId}", testId: string): LoadTestAdministrationCreateOrUpdateTest; + /** Resource for '/tests' has methods for the following verbs: get */ + (path: "/tests"): LoadTestAdministrationListTests; + /** Resource for '/tests/\{testId\}/files/\{fileName\}' has methods for the following verbs: put, get, delete */ + ( + path: "/tests/{testId}/files/{fileName}", + testId: string, + fileName: string, + ): LoadTestAdministrationUploadTestFile; + /** Resource for '/tests/\{testId\}/files' has methods for the following verbs: get */ + (path: "/tests/{testId}/files", testId: string): LoadTestAdministrationListTestFiles; + /** Resource for '/tests/\{testId\}/app-components' has methods for the following verbs: patch, get */ + ( + path: "/tests/{testId}/app-components", + testId: string, + ): LoadTestAdministrationCreateOrUpdateAppComponents; + /** Resource for '/tests/\{testId\}/server-metrics-config' has methods for the following verbs: patch, get */ + ( + path: "/tests/{testId}/server-metrics-config", + testId: string, + ): LoadTestAdministrationCreateOrUpdateServerMetricsConfig; + /** Resource for '/test-runs/\{testRunId\}' has methods for the following verbs: patch, get, delete */ + (path: "/test-runs/{testRunId}", testRunId: string): LoadTestRunCreateOrUpdateTestRun; + /** Resource for '/test-runs/\{testRunId\}/files/\{fileName\}' has methods for the following verbs: get */ + ( + path: "/test-runs/{testRunId}/files/{fileName}", + testRunId: string, + fileName: string, + ): LoadTestRunGetTestRunFile; + /** Resource for '/test-runs' has methods for the following verbs: get */ + (path: "/test-runs"): LoadTestRunListTestRuns; + /** Resource for '/test-runs/\{testRunId\}:stop' has methods for the following verbs: post */ + (path: "/test-runs/{testRunId}:stop", testRunId: string): LoadTestRunStopTestRun; + /** Resource for '/test-runs/\{testRunId\}/metric-namespaces' has methods for the following verbs: get */ + ( + path: "/test-runs/{testRunId}/metric-namespaces", + testRunId: string, + ): LoadTestRunListMetricNamespaces; + /** Resource for '/test-runs/\{testRunId\}/metric-definitions' has methods for the following verbs: get */ + ( + path: "/test-runs/{testRunId}/metric-definitions", + testRunId: string, + ): LoadTestRunListMetricDefinitions; + /** Resource for '/test-runs/\{testRunId\}/metrics' has methods for the following verbs: post */ + (path: "/test-runs/{testRunId}/metrics", testRunId: string): LoadTestRunListMetrics; + /** Resource for '/test-runs/\{testRunId\}/metric-dimensions/\{name\}/values' has methods for the following verbs: get */ + ( + path: "/test-runs/{testRunId}/metric-dimensions/{name}/values", + testRunId: string, + name: string, + ): LoadTestRunListMetricDimensionValues; + /** Resource for '/test-runs/\{testRunId\}/app-components' has methods for the following verbs: patch, get */ + ( + path: "/test-runs/{testRunId}/app-components", + testRunId: string, + ): LoadTestRunCreateOrUpdateAppComponents; + /** Resource for '/test-runs/\{testRunId\}/server-metrics-config' has methods for the following verbs: patch, get */ + ( + path: "/test-runs/{testRunId}/server-metrics-config", + testRunId: string, + ): LoadTestRunCreateOrUpdateServerMetricsConfig; +} + +export type AzureLoadTestingClient = Client & { + path: Routes; +}; diff --git a/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts b/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts index 166e6b7acb82..eae67c2c8673 100644 --- a/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts +++ b/sdk/loadtesting/load-testing-rest/src/getFileValidationPoller.ts @@ -5,12 +5,12 @@ import type { AbortSignalLike } from "@azure/abort-controller"; import { AbortError } from "@azure/abort-controller"; import type { CancelOnProgress, OperationState, SimplePollerLike } from "@azure/core-lro"; import type { FileUploadAndValidatePoller, PolledOperationOptions } from "./models.js"; -import type { AzureLoadTestingClient } from "../generated/clientDefinitions.js"; +import type { AzureLoadTestingClient } from "./clientDefinitions.js"; import type { LoadTestAdministrationGetTestFile200Response, LoadTestAdministrationUploadTestFile201Response, -} from "../generated/responses.js"; -import { isUnexpected } from "../generated/isUnexpected.js"; +} from "./responses.js"; +import { isUnexpected } from "./isUnexpected.js"; import { sleep } from "./util/LROUtil.js"; /** diff --git a/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts b/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts index ca67f473f2e6..acd0f348e17c 100644 --- a/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts +++ b/sdk/loadtesting/load-testing-rest/src/getTestRunCompletionPoller.ts @@ -5,13 +5,13 @@ import type { AbortSignalLike } from "@azure/abort-controller"; import { AbortError } from "@azure/abort-controller"; import type { CancelOnProgress, OperationState, SimplePollerLike } from "@azure/core-lro"; import type { TestRunCompletionPoller, PolledOperationOptions } from "./models.js"; -import type { AzureLoadTestingClient } from "../generated/clientDefinitions.js"; +import type { AzureLoadTestingClient } from "./clientDefinitions.js"; import type { LoadTestRunCreateOrUpdateTestRun200Response, LoadTestRunCreateOrUpdateTestRun201Response, LoadTestRunGetTestRun200Response, -} from "../generated/responses.js"; -import { isUnexpected } from "../generated/isUnexpected.js"; +} from "./responses.js"; +import { isUnexpected } from "./isUnexpected.js"; import { sleep, isTestRunInProgress } from "./util/LROUtil.js"; /** diff --git a/sdk/loadtesting/load-testing-rest/src/index.ts b/sdk/loadtesting/load-testing-rest/src/index.ts index 7064882fcae5..e9866d40d3cb 100644 --- a/sdk/loadtesting/load-testing-rest/src/index.ts +++ b/sdk/loadtesting/load-testing-rest/src/index.ts @@ -1,16 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import AzureLoadTesting from "../generated/azureLoadTesting.js"; +import AzureLoadTesting from "./azureLoadTesting.js"; -export * from "../generated/azureLoadTesting.js"; -export * from "../generated/parameters.js"; -export * from "../generated/responses.js"; -export * from "../generated/clientDefinitions.js"; -export * from "../generated/isUnexpected.js"; -export * from "../generated/models.js"; +export * from "./azureLoadTesting.js"; +export * from "./parameters.js"; +export * from "./responses.js"; +export * from "./clientDefinitions.js"; +export * from "./isUnexpected.js"; export * from "./models.js"; -export * from "../generated/outputModels.js"; -export * from "../generated/paginateHelper.js"; +export * from "./outputModels.js"; +export * from "./paginateHelper.js"; export { getLongRunningPoller } from "./pollingHelper.js"; export default AzureLoadTesting; diff --git a/sdk/loadtesting/load-testing-rest/src/isUnexpected.ts b/sdk/loadtesting/load-testing-rest/src/isUnexpected.ts new file mode 100644 index 000000000000..87dbc82fe80e --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/src/isUnexpected.ts @@ -0,0 +1,375 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + LoadTestAdministrationCreateOrUpdateTest200Response, + LoadTestAdministrationCreateOrUpdateTest201Response, + LoadTestAdministrationCreateOrUpdateTestDefaultResponse, + LoadTestAdministrationDeleteTest204Response, + LoadTestAdministrationDeleteTestDefaultResponse, + LoadTestAdministrationGetTest200Response, + LoadTestAdministrationGetTestDefaultResponse, + LoadTestAdministrationListTests200Response, + LoadTestAdministrationListTestsDefaultResponse, + LoadTestAdministrationUploadTestFile201Response, + LoadTestAdministrationUploadTestFileDefaultResponse, + LoadTestAdministrationGetTestFile200Response, + LoadTestAdministrationGetTestFileDefaultResponse, + LoadTestAdministrationDeleteTestFile204Response, + LoadTestAdministrationDeleteTestFileDefaultResponse, + LoadTestAdministrationListTestFiles200Response, + LoadTestAdministrationListTestFilesDefaultResponse, + LoadTestAdministrationCreateOrUpdateAppComponents200Response, + LoadTestAdministrationCreateOrUpdateAppComponents201Response, + LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse, + LoadTestAdministrationGetAppComponents200Response, + LoadTestAdministrationGetAppComponentsDefaultResponse, + LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response, + LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response, + LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse, + LoadTestAdministrationGetServerMetricsConfig200Response, + LoadTestAdministrationGetServerMetricsConfigDefaultResponse, + LoadTestRunCreateOrUpdateTestRun200Response, + LoadTestRunCreateOrUpdateTestRun201Response, + LoadTestRunCreateOrUpdateTestRunDefaultResponse, + LoadTestRunGetTestRun200Response, + LoadTestRunGetTestRunDefaultResponse, + LoadTestRunDeleteTestRun204Response, + LoadTestRunDeleteTestRunDefaultResponse, + LoadTestRunGetTestRunFile200Response, + LoadTestRunGetTestRunFileDefaultResponse, + LoadTestRunListTestRuns200Response, + LoadTestRunListTestRunsDefaultResponse, + LoadTestRunStopTestRun200Response, + LoadTestRunStopTestRunDefaultResponse, + LoadTestRunListMetricNamespaces200Response, + LoadTestRunListMetricNamespacesDefaultResponse, + LoadTestRunListMetricDefinitions200Response, + LoadTestRunListMetricDefinitionsDefaultResponse, + LoadTestRunListMetrics200Response, + LoadTestRunListMetricsDefaultResponse, + LoadTestRunListMetricDimensionValues200Response, + LoadTestRunListMetricDimensionValuesDefaultResponse, + LoadTestRunCreateOrUpdateAppComponents200Response, + LoadTestRunCreateOrUpdateAppComponents201Response, + LoadTestRunCreateOrUpdateAppComponentsDefaultResponse, + LoadTestRunGetAppComponents200Response, + LoadTestRunGetAppComponentsDefaultResponse, + LoadTestRunCreateOrUpdateServerMetricsConfig200Response, + LoadTestRunCreateOrUpdateServerMetricsConfig201Response, + LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse, + LoadTestRunGetServerMetricsConfig200Response, + LoadTestRunGetServerMetricsConfigDefaultResponse, +} from "./responses.js"; + +const responseMap: Record = { + "PATCH /tests/{testId}": ["200", "201"], + "DELETE /tests/{testId}": ["204"], + "GET /tests/{testId}": ["200"], + "GET /tests": ["200"], + "PUT /tests/{testId}/files/{fileName}": ["201"], + "GET /tests/{testId}/files/{fileName}": ["200"], + "DELETE /tests/{testId}/files/{fileName}": ["204"], + "GET /tests/{testId}/files": ["200"], + "PATCH /tests/{testId}/app-components": ["200", "201"], + "GET /tests/{testId}/app-components": ["200"], + "PATCH /tests/{testId}/server-metrics-config": ["200", "201"], + "GET /tests/{testId}/server-metrics-config": ["200"], + "PATCH /test-runs/{testRunId}": ["200", "201"], + "GET /test-runs/{testRunId}": ["200"], + "DELETE /test-runs/{testRunId}": ["204"], + "GET /test-runs/{testRunId}/files/{fileName}": ["200"], + "GET /test-runs": ["200"], + "POST /test-runs/{testRunId}:stop": ["200"], + "GET /test-runs/{testRunId}/metric-namespaces": ["200"], + "GET /test-runs/{testRunId}/metric-definitions": ["200"], + "POST /test-runs/{testRunId}/metrics": ["200"], + "GET /test-runs/{testRunId}/metric-dimensions/{name}/values": ["200"], + "PATCH /test-runs/{testRunId}/app-components": ["200", "201"], + "GET /test-runs/{testRunId}/app-components": ["200"], + "PATCH /test-runs/{testRunId}/server-metrics-config": ["200", "201"], + "GET /test-runs/{testRunId}/server-metrics-config": ["200"], +}; + +export function isUnexpected( + response: + | LoadTestAdministrationCreateOrUpdateTest200Response + | LoadTestAdministrationCreateOrUpdateTest201Response + | LoadTestAdministrationCreateOrUpdateTestDefaultResponse, +): response is LoadTestAdministrationCreateOrUpdateTestDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationDeleteTest204Response + | LoadTestAdministrationDeleteTestDefaultResponse, +): response is LoadTestAdministrationDeleteTestDefaultResponse; +export function isUnexpected( + response: LoadTestAdministrationGetTest200Response | LoadTestAdministrationGetTestDefaultResponse, +): response is LoadTestAdministrationGetTestDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationListTests200Response + | LoadTestAdministrationListTestsDefaultResponse, +): response is LoadTestAdministrationListTestsDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationUploadTestFile201Response + | LoadTestAdministrationUploadTestFileDefaultResponse, +): response is LoadTestAdministrationUploadTestFileDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationGetTestFile200Response + | LoadTestAdministrationGetTestFileDefaultResponse, +): response is LoadTestAdministrationGetTestFileDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationDeleteTestFile204Response + | LoadTestAdministrationDeleteTestFileDefaultResponse, +): response is LoadTestAdministrationDeleteTestFileDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationListTestFiles200Response + | LoadTestAdministrationListTestFilesDefaultResponse, +): response is LoadTestAdministrationListTestFilesDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationCreateOrUpdateAppComponents200Response + | LoadTestAdministrationCreateOrUpdateAppComponents201Response + | LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse, +): response is LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationGetAppComponents200Response + | LoadTestAdministrationGetAppComponentsDefaultResponse, +): response is LoadTestAdministrationGetAppComponentsDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response + | LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response + | LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse, +): response is LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationGetServerMetricsConfig200Response + | LoadTestAdministrationGetServerMetricsConfigDefaultResponse, +): response is LoadTestAdministrationGetServerMetricsConfigDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunCreateOrUpdateTestRun200Response + | LoadTestRunCreateOrUpdateTestRun201Response + | LoadTestRunCreateOrUpdateTestRunDefaultResponse, +): response is LoadTestRunCreateOrUpdateTestRunDefaultResponse; +export function isUnexpected( + response: LoadTestRunGetTestRun200Response | LoadTestRunGetTestRunDefaultResponse, +): response is LoadTestRunGetTestRunDefaultResponse; +export function isUnexpected( + response: LoadTestRunDeleteTestRun204Response | LoadTestRunDeleteTestRunDefaultResponse, +): response is LoadTestRunDeleteTestRunDefaultResponse; +export function isUnexpected( + response: LoadTestRunGetTestRunFile200Response | LoadTestRunGetTestRunFileDefaultResponse, +): response is LoadTestRunGetTestRunFileDefaultResponse; +export function isUnexpected( + response: LoadTestRunListTestRuns200Response | LoadTestRunListTestRunsDefaultResponse, +): response is LoadTestRunListTestRunsDefaultResponse; +export function isUnexpected( + response: LoadTestRunStopTestRun200Response | LoadTestRunStopTestRunDefaultResponse, +): response is LoadTestRunStopTestRunDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunListMetricNamespaces200Response + | LoadTestRunListMetricNamespacesDefaultResponse, +): response is LoadTestRunListMetricNamespacesDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunListMetricDefinitions200Response + | LoadTestRunListMetricDefinitionsDefaultResponse, +): response is LoadTestRunListMetricDefinitionsDefaultResponse; +export function isUnexpected( + response: LoadTestRunListMetrics200Response | LoadTestRunListMetricsDefaultResponse, +): response is LoadTestRunListMetricsDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunListMetricDimensionValues200Response + | LoadTestRunListMetricDimensionValuesDefaultResponse, +): response is LoadTestRunListMetricDimensionValuesDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunCreateOrUpdateAppComponents200Response + | LoadTestRunCreateOrUpdateAppComponents201Response + | LoadTestRunCreateOrUpdateAppComponentsDefaultResponse, +): response is LoadTestRunCreateOrUpdateAppComponentsDefaultResponse; +export function isUnexpected( + response: LoadTestRunGetAppComponents200Response | LoadTestRunGetAppComponentsDefaultResponse, +): response is LoadTestRunGetAppComponentsDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunCreateOrUpdateServerMetricsConfig200Response + | LoadTestRunCreateOrUpdateServerMetricsConfig201Response + | LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse, +): response is LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse; +export function isUnexpected( + response: + | LoadTestRunGetServerMetricsConfig200Response + | LoadTestRunGetServerMetricsConfigDefaultResponse, +): response is LoadTestRunGetServerMetricsConfigDefaultResponse; +export function isUnexpected( + response: + | LoadTestAdministrationCreateOrUpdateTest200Response + | LoadTestAdministrationCreateOrUpdateTest201Response + | LoadTestAdministrationCreateOrUpdateTestDefaultResponse + | LoadTestAdministrationDeleteTest204Response + | LoadTestAdministrationDeleteTestDefaultResponse + | LoadTestAdministrationGetTest200Response + | LoadTestAdministrationGetTestDefaultResponse + | LoadTestAdministrationListTests200Response + | LoadTestAdministrationListTestsDefaultResponse + | LoadTestAdministrationUploadTestFile201Response + | LoadTestAdministrationUploadTestFileDefaultResponse + | LoadTestAdministrationGetTestFile200Response + | LoadTestAdministrationGetTestFileDefaultResponse + | LoadTestAdministrationDeleteTestFile204Response + | LoadTestAdministrationDeleteTestFileDefaultResponse + | LoadTestAdministrationListTestFiles200Response + | LoadTestAdministrationListTestFilesDefaultResponse + | LoadTestAdministrationCreateOrUpdateAppComponents200Response + | LoadTestAdministrationCreateOrUpdateAppComponents201Response + | LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse + | LoadTestAdministrationGetAppComponents200Response + | LoadTestAdministrationGetAppComponentsDefaultResponse + | LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response + | LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response + | LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse + | LoadTestAdministrationGetServerMetricsConfig200Response + | LoadTestAdministrationGetServerMetricsConfigDefaultResponse + | LoadTestRunCreateOrUpdateTestRun200Response + | LoadTestRunCreateOrUpdateTestRun201Response + | LoadTestRunCreateOrUpdateTestRunDefaultResponse + | LoadTestRunGetTestRun200Response + | LoadTestRunGetTestRunDefaultResponse + | LoadTestRunDeleteTestRun204Response + | LoadTestRunDeleteTestRunDefaultResponse + | LoadTestRunGetTestRunFile200Response + | LoadTestRunGetTestRunFileDefaultResponse + | LoadTestRunListTestRuns200Response + | LoadTestRunListTestRunsDefaultResponse + | LoadTestRunStopTestRun200Response + | LoadTestRunStopTestRunDefaultResponse + | LoadTestRunListMetricNamespaces200Response + | LoadTestRunListMetricNamespacesDefaultResponse + | LoadTestRunListMetricDefinitions200Response + | LoadTestRunListMetricDefinitionsDefaultResponse + | LoadTestRunListMetrics200Response + | LoadTestRunListMetricsDefaultResponse + | LoadTestRunListMetricDimensionValues200Response + | LoadTestRunListMetricDimensionValuesDefaultResponse + | LoadTestRunCreateOrUpdateAppComponents200Response + | LoadTestRunCreateOrUpdateAppComponents201Response + | LoadTestRunCreateOrUpdateAppComponentsDefaultResponse + | LoadTestRunGetAppComponents200Response + | LoadTestRunGetAppComponentsDefaultResponse + | LoadTestRunCreateOrUpdateServerMetricsConfig200Response + | LoadTestRunCreateOrUpdateServerMetricsConfig201Response + | LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse + | LoadTestRunGetServerMetricsConfig200Response + | LoadTestRunGetServerMetricsConfigDefaultResponse, +): response is + | LoadTestAdministrationCreateOrUpdateTestDefaultResponse + | LoadTestAdministrationDeleteTestDefaultResponse + | LoadTestAdministrationGetTestDefaultResponse + | LoadTestAdministrationListTestsDefaultResponse + | LoadTestAdministrationUploadTestFileDefaultResponse + | LoadTestAdministrationGetTestFileDefaultResponse + | LoadTestAdministrationDeleteTestFileDefaultResponse + | LoadTestAdministrationListTestFilesDefaultResponse + | LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse + | LoadTestAdministrationGetAppComponentsDefaultResponse + | LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse + | LoadTestAdministrationGetServerMetricsConfigDefaultResponse + | LoadTestRunCreateOrUpdateTestRunDefaultResponse + | LoadTestRunGetTestRunDefaultResponse + | LoadTestRunDeleteTestRunDefaultResponse + | LoadTestRunGetTestRunFileDefaultResponse + | LoadTestRunListTestRunsDefaultResponse + | LoadTestRunStopTestRunDefaultResponse + | LoadTestRunListMetricNamespacesDefaultResponse + | LoadTestRunListMetricDefinitionsDefaultResponse + | LoadTestRunListMetricsDefaultResponse + | LoadTestRunListMetricDimensionValuesDefaultResponse + | LoadTestRunCreateOrUpdateAppComponentsDefaultResponse + | LoadTestRunGetAppComponentsDefaultResponse + | LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse + | LoadTestRunGetServerMetricsConfigDefaultResponse { + 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 = getParametrizedPathSuccess(method, url.pathname); + } + return !pathDetails.includes(response.status); +} + +function getParametrizedPathSuccess(method: string, path: string): string[] { + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: string[] = []; + + // 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("/"); + + // track if we have found a match to return the values found. + let found = true; + for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { + if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( + pathParts[j] || "", + ); + + if (!isMatched) { + found = false; + break; + } + 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[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/sdk/loadtesting/load-testing-rest/src/logger.ts b/sdk/loadtesting/load-testing-rest/src/logger.ts new file mode 100644 index 000000000000..31a2389c94d0 --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("load-testing"); diff --git a/sdk/loadtesting/load-testing-rest/src/models.ts b/sdk/loadtesting/load-testing-rest/src/models.ts index 82fd4225fe64..045f74b7c3b3 100644 --- a/sdk/loadtesting/load-testing-rest/src/models.ts +++ b/sdk/loadtesting/load-testing-rest/src/models.ts @@ -8,7 +8,248 @@ import type { LoadTestRunCreateOrUpdateTestRun201Response, LoadTestRunGetTestRun200Response, LoadTestAdministrationUploadTestFile201Response, -} from "../generated/responses.js"; +} from "./responses.js"; + +/** Load test model */ +export interface Test { + /** Pass fail criteria for a test. */ + passFailCriteria?: PassFailCriteria; + /** 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; + /** Certificates metadata */ + certificate?: CertificateMetadata; + /** Environment variables which are defined as a set of pairs. */ + environmentVariables?: Record; + /** The load test configuration. */ + loadTestConfiguration?: LoadTestConfiguration; + /** 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; +} + +/** Pass fail criteria for a test. */ +export interface PassFailCriteria { + /** Map of id and pass fail metrics { id : pass fail metrics }. */ + passFailMetrics?: Record; +} + +/** Pass fail metric */ +export interface PassFailMetric { + /** 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?: "continue" | "stop"; +} + +/** Secret */ +export interface Secret { + /** The value of the secret for the respective type */ + value?: string; + /** Type of secret */ + type?: "AKV_SECRET_URI" | "SECRET_VALUE"; +} + +/** Certificates metadata */ +export interface CertificateMetadata { + /** 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 LoadTestConfiguration { + /** 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; + /** If false, Azure Load Testing copies and processes your input files unmodified across all test engine instances. If true, Azure Load Testing splits the CSV input data evenly across all engine instances. If you provide multiple CSV files, each file will be split evenly. */ + splitAllCSVs?: boolean; + /** If true, optionalLoadTestConfig is required and JMX script for the load test is not required to upload. */ + quickStartTest?: boolean; + /** Optional load test config */ + optionalLoadTestConfig?: OptionalLoadTestConfig; +} + +/** Optional load test config */ +export interface OptionalLoadTestConfig { + /** Test URL. Provide the complete HTTP URL. For example, http://contoso-app.azurewebsites.net/login */ + endpointUrl?: string; + /** No of concurrent virtual users */ + virtualUsers?: number; + /** Ramp up time */ + rampUpTime?: number; + /** Test run duration */ + duration?: number; +} + +/** The input artifacts for the test. */ +export interface TestInputArtifacts { + /** File info */ + configFileInfo?: FileInfo; + /** File info */ + testScriptFileInfo?: FileInfo; + /** File info */ + userPropFileInfo?: FileInfo; + /** File info */ + inputArtifactsZipFileInfo?: FileInfo; +} + +/** File info */ +export interface FileInfo { + /** File URL. */ + url?: string; + /** Name of the file. */ + fileName?: string; + /** File type */ + fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; + /** Expiry time of the file (ISO 8601 literal format) */ + expireDateTime?: Date | string; + /** Validation status of the file */ + validationStatus?: + | "NOT_VALIDATED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE" + | "VALIDATION_INITIATED" + | "VALIDATION_NOT_REQUIRED"; + /** Validation failure error details */ + validationFailureDetails?: string; +} + +/** Test app component */ +export interface TestAppComponents { + /** Azure resource collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object } */ + components: 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 { + /** 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; + /** Kind of Azure resource type */ + kind?: string; +} + +/** Test server metrics configuration */ +export interface TestServerMetricConfig { + /** Azure resource metrics collection {metric id : metrics object} (Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition for metric id). */ + 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 ResourceMetric { + /** Azure resource id. */ + resourceId: string; + /** Metric name space. */ + metricNamespace: string; + /** Metric description. */ + displayDescription?: string; + /** The invariant value of metric name */ + name: string; + /** Metric aggregation. */ + aggregation: string; + /** Metric unit. */ + unit?: string; + /** Azure resource type. */ + resourceType: string; +} + +/** Load test run model */ +export interface TestRun { + /** Pass fail criteria for a test. */ + passFailCriteria?: PassFailCriteria; + /** 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; + /** Certificates metadata */ + certificate?: CertificateMetadata; + /** Environment variables which are defined as a set of pairs. */ + environmentVariables?: Record; + /** The load test configuration. */ + loadTestConfiguration?: LoadTestConfiguration; + /** Display name of a testRun. */ + displayName?: string; + /** Associated test Id. */ + testId?: string; + /** The test run description. */ + description?: string; +} + +/** Error details if there is any failure in load test run */ +export interface ErrorDetails {} + +/** Test run statistics. */ +export interface TestRunStatistics {} + +/** Collection of test run artifacts */ +export interface TestRunArtifacts { + /** The output artifacts for the test run. */ + outputArtifacts?: TestRunOutputArtifacts; +} + +/** The input artifacts for the test run. */ +export interface TestRunInputArtifacts { + /** File info */ + configFileInfo?: FileInfo; + /** File info */ + testScriptFileInfo?: FileInfo; + /** File info */ + userPropFileInfo?: FileInfo; + /** File info */ + inputArtifactsZipFileInfo?: FileInfo; +} + +/** The output artifacts for the test run. */ +export interface TestRunOutputArtifacts { + /** File info */ + resultFileInfo?: FileInfo; + /** File info */ + logsFileInfo?: FileInfo; +} + +/** Filters to fetch the set of metric */ +export interface MetricRequestPayload { + /** Get metrics for specific dimension values. Example: Metric contains dimension like SamplerName, Error. To retrieve all the time series data where SamplerName is equals to HTTPRequest1 or HTTPRequest2, the DimensionFilter value will be {"SamplerName", ["HTTPRequest1", "HTTPRequest2"} */ + filters?: Array; +} + +/** Dimension name and values to filter */ +export interface DimensionFilter { + /** The dimension name */ + name?: string; + /** The dimension values. Maximum values can be 20. */ + values?: Array; +} + +/** Test run app component */ +export interface TestRunAppComponents { + /** Azure resource collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object } */ + components: Record; +} + +/** Test run server metrics configuration */ +export interface TestRunServerMetricConfig { + /** Azure resource metrics collection {metric id : metrics object} (Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition for metric id). */ + metrics?: Record; +} /** * Describes a poller for NotificationHubJob types. diff --git a/sdk/loadtesting/load-testing-rest/src/outputModels.ts b/sdk/loadtesting/load-testing-rest/src/outputModels.ts new file mode 100644 index 000000000000..f97a32fc9613 --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/src/outputModels.ts @@ -0,0 +1,532 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** Load test model */ +export interface TestOutput { + /** Pass fail criteria for a test. */ + passFailCriteria?: PassFailCriteriaOutput; + /** 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; + /** Certificates metadata */ + certificate?: CertificateMetadataOutput; + /** Environment variables which are defined as a set of pairs. */ + environmentVariables?: Record; + /** The load test configuration. */ + loadTestConfiguration?: LoadTestConfigurationOutput; + /** The input artifacts for the test. */ + readonly inputArtifacts?: TestInputArtifactsOutput; + /** Unique test name as identifier. */ + readonly 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; + /** The creation datetime(ISO 8601 literal format). */ + readonly createdDateTime?: string; + /** The user that created. */ + readonly createdBy?: string; + /** The last Modified datetime(ISO 8601 literal format). */ + readonly lastModifiedDateTime?: string; + /** The user that last modified. */ + readonly lastModifiedBy?: string; +} + +/** Pass fail criteria for a test. */ +export interface PassFailCriteriaOutput { + /** Map of id and pass fail metrics { id : pass fail metrics }. */ + passFailMetrics?: Record; +} + +/** Pass fail metric */ +export interface PassFailMetricOutput { + /** 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?: "continue" | "stop"; + /** The actual value of the client metric for the test run. */ + readonly actualValue?: number; + /** Outcome of the test run. */ + readonly result?: "passed" | "undetermined" | "failed"; +} + +/** Secret */ +export interface SecretOutput { + /** The value of the secret for the respective type */ + value?: string; + /** Type of secret */ + type?: "AKV_SECRET_URI" | "SECRET_VALUE"; +} + +/** Certificates metadata */ +export interface CertificateMetadataOutput { + /** 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 LoadTestConfigurationOutput { + /** 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; + /** If false, Azure Load Testing copies and processes your input files unmodified across all test engine instances. If true, Azure Load Testing splits the CSV input data evenly across all engine instances. If you provide multiple CSV files, each file will be split evenly. */ + splitAllCSVs?: boolean; + /** If true, optionalLoadTestConfig is required and JMX script for the load test is not required to upload. */ + quickStartTest?: boolean; + /** Optional load test config */ + optionalLoadTestConfig?: OptionalLoadTestConfigOutput; +} + +/** Optional load test config */ +export interface OptionalLoadTestConfigOutput { + /** Test URL. Provide the complete HTTP URL. For example, http://contoso-app.azurewebsites.net/login */ + endpointUrl?: string; + /** No of concurrent virtual users */ + virtualUsers?: number; + /** Ramp up time */ + rampUpTime?: number; + /** Test run duration */ + duration?: number; +} + +/** The input artifacts for the test. */ +export interface TestInputArtifactsOutput { + /** File info */ + configFileInfo?: FileInfoOutput; + /** File info */ + testScriptFileInfo?: FileInfoOutput; + /** File info */ + userPropFileInfo?: FileInfoOutput; + /** File info */ + inputArtifactsZipFileInfo?: FileInfoOutput; + /** Additional supported files for the test run */ + readonly additionalFileInfo?: Array; +} + +/** File info */ +export interface FileInfoOutput { + /** File URL. */ + url?: string; + /** Name of the file. */ + fileName?: string; + /** File type */ + fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; + /** Expiry time of the file (ISO 8601 literal format) */ + expireDateTime?: string; + /** Validation status of the file */ + validationStatus?: + | "NOT_VALIDATED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE" + | "VALIDATION_INITIATED" + | "VALIDATION_NOT_REQUIRED"; + /** Validation failure error details */ + validationFailureDetails?: 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; +} + +/** Collection of tests */ +export interface TestsListOutput { + /** List of tests */ + value: Array; + /** Link for the next list of tests in case of paginated results, if applicable */ + nextLink?: string; +} + +/** Collection of files. */ +export interface FileInfoListOutput { + /** List of file info. */ + value: Array; + /** Link for the next list of file URLs, if applicable */ + nextLink?: string; +} + +/** Test app component */ +export interface TestAppComponentsOutput { + /** Azure resource collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object } */ + components: Record; + /** Test identifier */ + readonly testId?: string; + /** The creation datetime(ISO 8601 literal format). */ + readonly createdDateTime?: string; + /** The user that created. */ + readonly createdBy?: string; + /** The last Modified datetime(ISO 8601 literal format). */ + readonly lastModifiedDateTime?: string; + /** The user that last modified. */ + readonly lastModifiedBy?: string; +} + +/** 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} */ + readonly 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 */ + readonly resourceGroup?: string; + /** Subscription Id of the Azure resource */ + readonly subscriptionId?: string; + /** Kind of Azure resource type */ + kind?: string; +} + +/** Test server metrics configuration */ +export interface TestServerMetricConfigOutput { + /** Test identifier */ + readonly testId?: string; + /** Azure resource metrics collection {metric id : metrics object} (Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition for metric id). */ + metrics?: Record; + /** The creation datetime(ISO 8601 literal format). */ + readonly createdDateTime?: string; + /** The user that created. */ + readonly createdBy?: string; + /** The last Modified datetime(ISO 8601 literal format). */ + readonly lastModifiedDateTime?: string; + /** The user that last modified. */ + readonly lastModifiedBy?: string; +} + +/** 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 ResourceMetricOutput { + /** Unique name for metric. */ + readonly id?: string; + /** Azure resource id. */ + resourceId: string; + /** Metric name space. */ + metricNamespace: string; + /** Metric description. */ + displayDescription?: string; + /** The invariant value of metric name */ + name: string; + /** Metric aggregation. */ + aggregation: string; + /** Metric unit. */ + unit?: string; + /** Azure resource type. */ + resourceType: string; +} + +/** Load test run model */ +export interface TestRunOutput { + /** Pass fail criteria for a test. */ + passFailCriteria?: PassFailCriteriaOutput; + /** 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; + /** Certificates metadata */ + certificate?: CertificateMetadataOutput; + /** Environment variables which are defined as a set of pairs. */ + environmentVariables?: Record; + /** Error details if there is any failure in load test run */ + readonly errorDetails?: Array; + /** Test run statistics. */ + readonly testRunStatistics?: Record; + /** The load test configuration. */ + loadTestConfiguration?: LoadTestConfigurationOutput; + /** Collection of test run artifacts */ + readonly testArtifacts?: TestRunArtifactsOutput; + /** Test result for pass/Fail criteria used during the test run. */ + readonly testResult?: "PASSED" | "NOT_APPLICABLE" | "FAILED"; + /** Number of virtual users, for which test has been run. */ + readonly virtualUsers?: number; + /** Unique test run name as identifier */ + readonly testRunId?: string; + /** Display name of a testRun. */ + displayName?: string; + /** Associated test Id. */ + testId?: string; + /** The test run description. */ + description?: string; + /** The test run status. */ + readonly 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). */ + readonly startDateTime?: string; + /** The test run end DateTime(ISO 8601 literal format). */ + readonly endDateTime?: string; + /** Test run initiated time. */ + readonly executedDateTime?: string; + /** Portal url. */ + readonly portalUrl?: string; + /** Test run duration in milliseconds. */ + readonly duration?: number; + /** Subnet ID on which the load test instances should run. */ + readonly subnetId?: string; + /** The creation datetime(ISO 8601 literal format). */ + readonly createdDateTime?: string; + /** The user that created. */ + readonly createdBy?: string; + /** The last Modified datetime(ISO 8601 literal format). */ + readonly lastModifiedDateTime?: string; + /** The user that last modified. */ + readonly lastModifiedBy?: string; +} + +/** Error details if there is any failure in load test run */ +export interface ErrorDetailsOutput { + /** Error details in case test run was not successfully run. */ + readonly message?: string; +} + +/** Test run statistics. */ +export interface TestRunStatisticsOutput { + /** Transaction name. */ + readonly transaction?: string; + /** Sampler count. */ + readonly sampleCount?: number; + /** Error count. */ + readonly errorCount?: number; + /** Error percentage. */ + readonly errorPct?: number; + /** Mean response time. */ + readonly meanResTime?: number; + /** Median response time. */ + readonly medianResTime?: number; + /** Max response time. */ + readonly maxResTime?: number; + /** Minimum response time. */ + readonly minResTime?: number; + /** 90 percentile response time. */ + readonly pct1ResTime?: number; + /** 95 percentile response time. */ + readonly pct2ResTime?: number; + /** 99 percentile response time. */ + readonly pct3ResTime?: number; + /** Throughput. */ + readonly throughput?: number; + /** Received network bytes. */ + readonly receivedKBytesPerSec?: number; + /** Send network bytes. */ + readonly sentKBytesPerSec?: number; +} + +/** Collection of test run artifacts */ +export interface TestRunArtifactsOutput { + /** The input artifacts for the test run. */ + readonly inputArtifacts?: TestRunInputArtifactsOutput; + /** The output artifacts for the test run. */ + outputArtifacts?: TestRunOutputArtifactsOutput; +} + +/** The input artifacts for the test run. */ +export interface TestRunInputArtifactsOutput { + /** File info */ + configFileInfo?: FileInfoOutput; + /** File info */ + testScriptFileInfo?: FileInfoOutput; + /** File info */ + userPropFileInfo?: FileInfoOutput; + /** File info */ + inputArtifactsZipFileInfo?: FileInfoOutput; + /** Additional supported files for the test run */ + readonly additionalFileInfo?: Array; +} + +/** The output artifacts for the test run. */ +export interface TestRunOutputArtifactsOutput { + /** File info */ + resultFileInfo?: FileInfoOutput; + /** File info */ + logsFileInfo?: FileInfoOutput; +} + +/** Collection of test runs */ +export interface TestRunsListOutput { + /** List of test runs */ + value: Array; + /** Link for the next list of test runs 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 namespace description. */ + description?: string; + /** The metric namespace name. */ + name?: string; +} + +/** Represents collection of metric definitions. */ +export interface MetricDefinitionCollectionOutput { + /** the values for the metric definitions. */ + value: Array; +} + +/** Metric definition */ +export interface MetricDefinitionOutput { + /** List of dimensions */ + dimensions?: Array; + /** The metric description */ + description?: string; + /** The metric name */ + name?: string; + /** The namespace the metric belongs to. */ + namespace?: string; + /** The primary aggregation type value defining how to use the values for display. */ + primaryAggregationType?: + | "Average" + | "Count" + | "None" + | "Total" + | "Percentile90" + | "Percentile95" + | "Percentile99"; + /** The collection of what all 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). */ + metricAvailabilities?: Array; +} + +/** The name and description */ +export interface NameAndDescOutput { + /** The description */ + description?: string; + /** The name */ + name?: string; +} + +/** 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 MetricsOutput { + /** Timeseries data for metric query. */ + value?: Array; + /** Link for the next set of timeseries in case of paginated results, if applicable */ + nextLink?: string; +} + +/** The time series returned when a data query is performed. */ +export interface TimeSeriesElementOutput { + /** An array of data points representing the metric values. */ + data?: Array; + /** The dimension values */ + dimensionValues?: Array; +} + +/** Represents a metric value. */ +export interface MetricValueOutput { + /** The timestamp for the metric value in ISO 8601 format. */ + timestamp?: string; + /** The metric value. */ + value?: number; +} + +/** Represents a metric dimension value. */ +export interface DimensionValueOutput { + /** The name of the dimension. */ + name?: string; + /** The value of the dimension. */ + value?: string; +} + +/** Metrics dimension values. */ +export interface DimensionValueListOutput { + /** The dimension values */ + value?: Array; + /** Link for the next set of values in case of paginated results, if applicable */ + nextLink?: string; +} + +/** Test run app component */ +export interface TestRunAppComponentsOutput { + /** Azure resource collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object } */ + components: Record; + /** Test run identifier */ + readonly testRunId?: string; + /** The creation datetime(ISO 8601 literal format). */ + readonly createdDateTime?: string; + /** The user that created. */ + readonly createdBy?: string; + /** The last Modified datetime(ISO 8601 literal format). */ + readonly lastModifiedDateTime?: string; + /** The user that last modified. */ + readonly lastModifiedBy?: string; +} + +/** Test run server metrics configuration */ +export interface TestRunServerMetricConfigOutput { + /** Test run identifier */ + readonly testRunId?: string; + /** Azure resource metrics collection {metric id : metrics object} (Refer : https://docs.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition for metric id). */ + metrics?: Record; + /** The creation datetime(ISO 8601 literal format). */ + readonly createdDateTime?: string; + /** The user that created. */ + readonly createdBy?: string; + /** The last Modified datetime(ISO 8601 literal format). */ + readonly lastModifiedDateTime?: string; + /** The user that last modified. */ + readonly lastModifiedBy?: string; +} diff --git a/sdk/loadtesting/load-testing-rest/src/paginateHelper.ts b/sdk/loadtesting/load-testing-rest/src/paginateHelper.ts new file mode 100644 index 000000000000..9ea946d9d6c5 --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/src/paginateHelper.ts @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings = PageSettings, + TLink = string, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + (((settings?: PageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken as unknown as TLink | undefined, + }); + }) as unknown as (settings?: TPageSettings) => AsyncIterableIterator), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + const firstVal = await pages.next(); + // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is + if (!Array.isArray(firstVal.value)) { + // can extract elements from this page + const { toElements } = pagedResult; + if (toElements) { + yield* toElements(firstVal.value) as TElement[]; + for await (const page of pages) { + yield* toElements(page) as TElement[]; + } + } else { + yield firstVal.value; + // `pages` is of type `AsyncIterableIterator` but TPage = TElement in this case + yield* pages as unknown as AsyncIterableIterator; + } + } else { + yield* firstVal.value; + for await (const page of pages) { + // pages is of type `AsyncIterableIterator` so `page` is of type `TPage`. In this branch, + // it must be the case that `TPage = TElement[]` + yield* page as unknown as TElement[]; + } + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: TLink; + } = {}, +): AsyncIterableIterator { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + yield response.page; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + yield response.page; + } +} + +/** + * An interface that tracks the settings for paged iteration + */ +export interface PageSettings { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +} + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator; +} + +/** + * An interface that describes how to communicate with the service. + */ +interface PagedResult { + /** + * Link to the first page of results. + */ + firstPageLink: TLink; + /** + * A method that returns a page of results. + */ + getPage: (pageLink: TLink) => Promise<{ page: TPage; nextPageLink?: TLink } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => unknown[]; +} + +/** + * 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) => 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/loadtesting/load-testing-rest/src/parameters.ts b/sdk/loadtesting/load-testing-rest/src/parameters.ts new file mode 100644 index 000000000000..b96ad64ed18d --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/src/parameters.ts @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { RequestParameters } from "@azure-rest/core-client"; +import type { + Test, + TestAppComponents, + TestServerMetricConfig, + TestRun, + MetricRequestPayload, + TestRunAppComponents, + TestRunServerMetricConfig, +} from "./models.js"; + +/** Load test model */ +export type TestResourceMergeAndPatch = Partial; + +export interface LoadTestAdministrationCreateOrUpdateTestBodyParam { + /** Load test model */ + body: TestResourceMergeAndPatch; +} + +export interface LoadTestAdministrationCreateOrUpdateTestMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type LoadTestAdministrationCreateOrUpdateTestParameters = + LoadTestAdministrationCreateOrUpdateTestMediaTypesParam & + LoadTestAdministrationCreateOrUpdateTestBodyParam & + RequestParameters; +export type LoadTestAdministrationDeleteTestParameters = RequestParameters; +export type LoadTestAdministrationGetTestParameters = RequestParameters; + +export interface LoadTestAdministrationListTestsQueryParamProperties { + /** Sort on the supported fields in (field asc/desc) format. eg: lastModifiedDateTime asc. Supported fields - lastModifiedDateTime */ + orderby?: string; + /** Prefix based, case sensitive search on searchable fields - displayName, createdBy. For example, to search for a test, with display name is Login Test, the search parameter can be Login. */ + search?: string; + /** Start DateTime(ISO 8601 literal format) of the last updated time range to filter tests. */ + lastModifiedStartTime?: Date | string; + /** End DateTime(ISO 8601 literal format) of the last updated time range to filter tests. */ + lastModifiedEndTime?: Date | string; + /** Number of results in response. */ + maxpagesize?: number; +} + +export interface LoadTestAdministrationListTestsQueryParam { + queryParameters?: LoadTestAdministrationListTestsQueryParamProperties; +} + +export type LoadTestAdministrationListTestsParameters = LoadTestAdministrationListTestsQueryParam & + RequestParameters; + +export interface LoadTestAdministrationUploadTestFileBodyParam { + /** + * The file content as application/octet-stream. + * + * Value may contain any sequence of octets + */ + body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream; +} + +export interface LoadTestAdministrationUploadTestFileQueryParamProperties { + /** File type */ + fileType?: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; +} + +export interface LoadTestAdministrationUploadTestFileQueryParam { + queryParameters?: LoadTestAdministrationUploadTestFileQueryParamProperties; +} + +export interface LoadTestAdministrationUploadTestFileMediaTypesParam { + /** Request content type */ + contentType?: "application/octet-stream"; +} + +export type LoadTestAdministrationUploadTestFileParameters = + LoadTestAdministrationUploadTestFileQueryParam & + LoadTestAdministrationUploadTestFileMediaTypesParam & + LoadTestAdministrationUploadTestFileBodyParam & + RequestParameters; +export type LoadTestAdministrationGetTestFileParameters = RequestParameters; +export type LoadTestAdministrationDeleteTestFileParameters = RequestParameters; +export type LoadTestAdministrationListTestFilesParameters = RequestParameters; +/** App Component model. */ +export type TestAppComponentsResourceMergeAndPatch = Partial; + +export interface LoadTestAdministrationCreateOrUpdateAppComponentsBodyParam { + /** App Component model. */ + body: TestAppComponentsResourceMergeAndPatch; +} + +export interface LoadTestAdministrationCreateOrUpdateAppComponentsMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type LoadTestAdministrationCreateOrUpdateAppComponentsParameters = + LoadTestAdministrationCreateOrUpdateAppComponentsMediaTypesParam & + LoadTestAdministrationCreateOrUpdateAppComponentsBodyParam & + RequestParameters; +export type LoadTestAdministrationGetAppComponentsParameters = RequestParameters; +/** Server metric configuration model. */ +export type TestServerMetricConfigResourceMergeAndPatch = Partial; + +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigBodyParam { + /** Server metric configuration model. */ + body: TestServerMetricConfigResourceMergeAndPatch; +} + +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type LoadTestAdministrationCreateOrUpdateServerMetricsConfigParameters = + LoadTestAdministrationCreateOrUpdateServerMetricsConfigMediaTypesParam & + LoadTestAdministrationCreateOrUpdateServerMetricsConfigBodyParam & + RequestParameters; +export type LoadTestAdministrationGetServerMetricsConfigParameters = RequestParameters; +/** Load test run model */ +export type TestRunResourceMergeAndPatch = Partial; + +export interface LoadTestRunCreateOrUpdateTestRunBodyParam { + /** Load test run model */ + body: TestRunResourceMergeAndPatch; +} + +export interface LoadTestRunCreateOrUpdateTestRunQueryParamProperties { + /** Existing test run identifier that should be rerun, if this is provided, the test will run with the JMX file, configuration and app components from the existing test run. You can override the configuration values for new test run in the request body. */ + oldTestRunId?: string; +} + +export interface LoadTestRunCreateOrUpdateTestRunQueryParam { + queryParameters?: LoadTestRunCreateOrUpdateTestRunQueryParamProperties; +} + +export interface LoadTestRunCreateOrUpdateTestRunMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type LoadTestRunCreateOrUpdateTestRunParameters = + LoadTestRunCreateOrUpdateTestRunQueryParam & + LoadTestRunCreateOrUpdateTestRunMediaTypesParam & + LoadTestRunCreateOrUpdateTestRunBodyParam & + RequestParameters; +export type LoadTestRunGetTestRunParameters = RequestParameters; +export type LoadTestRunDeleteTestRunParameters = RequestParameters; +export type LoadTestRunGetTestRunFileParameters = RequestParameters; + +export interface LoadTestRunListTestRunsQueryParamProperties { + /** Sort on the supported fields in (field asc/desc) format. eg: executedDateTime asc. Supported fields - executedDateTime */ + orderby?: string; + /** Prefix based, case sensitive search on searchable fields - description, executedUser. For example, to search for a test run, with description 500 VUs, the search parameter can be 500. */ + search?: string; + /** Unique name of an existing load test. */ + testId?: string; + /** Start DateTime(ISO 8601 literal format) of test-run execution time filter range. */ + executionFrom?: Date | string; + /** End 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 LoadTestRunListTestRunsQueryParam { + queryParameters?: LoadTestRunListTestRunsQueryParamProperties; +} + +export type LoadTestRunListTestRunsParameters = LoadTestRunListTestRunsQueryParam & + RequestParameters; +export type LoadTestRunStopTestRunParameters = RequestParameters; +export type LoadTestRunListMetricNamespacesParameters = RequestParameters; + +export interface LoadTestRunListMetricDefinitionsQueryParamProperties { + /** Metric namespace to query metric definitions for. */ + metricNamespace: string; +} + +export interface LoadTestRunListMetricDefinitionsQueryParam { + queryParameters: LoadTestRunListMetricDefinitionsQueryParamProperties; +} + +export type LoadTestRunListMetricDefinitionsParameters = + LoadTestRunListMetricDefinitionsQueryParam & RequestParameters; + +export interface LoadTestRunListMetricsBodyParam { + /** Metric dimension filter */ + body?: MetricRequestPayload; +} + +export interface LoadTestRunListMetricsQueryParamProperties { + /** The aggregation */ + 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; + /** The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. */ + timespan: string; +} + +export interface LoadTestRunListMetricsQueryParam { + queryParameters: LoadTestRunListMetricsQueryParamProperties; +} + +export interface LoadTestRunListMetricsMediaTypesParam { + /** Request content type */ + contentType?: "application/json"; +} + +export type LoadTestRunListMetricsParameters = LoadTestRunListMetricsQueryParam & + LoadTestRunListMetricsMediaTypesParam & + LoadTestRunListMetricsBodyParam & + RequestParameters; + +export interface LoadTestRunListMetricDimensionValuesQueryParamProperties { + /** 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; + /** The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. */ + timespan: string; +} + +export interface LoadTestRunListMetricDimensionValuesQueryParam { + queryParameters: LoadTestRunListMetricDimensionValuesQueryParamProperties; +} + +export type LoadTestRunListMetricDimensionValuesParameters = + LoadTestRunListMetricDimensionValuesQueryParam & RequestParameters; +/** App Component model. */ +export type TestRunAppComponentsResourceMergeAndPatch = Partial; + +export interface LoadTestRunCreateOrUpdateAppComponentsBodyParam { + /** App Component model. */ + body: TestRunAppComponentsResourceMergeAndPatch; +} + +export interface LoadTestRunCreateOrUpdateAppComponentsMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type LoadTestRunCreateOrUpdateAppComponentsParameters = + LoadTestRunCreateOrUpdateAppComponentsMediaTypesParam & + LoadTestRunCreateOrUpdateAppComponentsBodyParam & + RequestParameters; +export type LoadTestRunGetAppComponentsParameters = RequestParameters; +/** Server metric configuration model. */ +export type TestRunServerMetricConfigResourceMergeAndPatch = Partial; + +export interface LoadTestRunCreateOrUpdateServerMetricsConfigBodyParam { + /** Server metric configuration model. */ + body: TestRunServerMetricConfigResourceMergeAndPatch; +} + +export interface LoadTestRunCreateOrUpdateServerMetricsConfigMediaTypesParam { + /** Request content type */ + contentType?: "application/merge-patch+json"; +} + +export type LoadTestRunCreateOrUpdateServerMetricsConfigParameters = + LoadTestRunCreateOrUpdateServerMetricsConfigMediaTypesParam & + LoadTestRunCreateOrUpdateServerMetricsConfigBodyParam & + RequestParameters; +export type LoadTestRunGetServerMetricsConfigParameters = RequestParameters; diff --git a/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts b/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts index f2793766531c..eb01bcefc65b 100644 --- a/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts +++ b/sdk/loadtesting/load-testing-rest/src/pollingHelper.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { AzureLoadTestingClient } from "../generated/clientDefinitions.js"; +import type { AzureLoadTestingClient } from "./clientDefinitions.js"; import { getFileValidationPoller } from "./getFileValidationPoller.js"; import { getTestRunCompletionPoller } from "./getTestRunCompletionPoller.js"; import type { diff --git a/sdk/loadtesting/load-testing-rest/src/responses.ts b/sdk/loadtesting/load-testing-rest/src/responses.ts new file mode 100644 index 000000000000..c270ac9d9d65 --- /dev/null +++ b/sdk/loadtesting/load-testing-rest/src/responses.ts @@ -0,0 +1,527 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; +import type { HttpResponse } from "@azure-rest/core-client"; +import type { + TestOutput, + ErrorResponseBodyOutput, + TestsListOutput, + FileInfoOutput, + FileInfoListOutput, + TestAppComponentsOutput, + TestServerMetricConfigOutput, + TestRunOutput, + TestRunsListOutput, + MetricNamespaceCollectionOutput, + MetricDefinitionCollectionOutput, + MetricsOutput, + DimensionValueListOutput, + TestRunAppComponentsOutput, + TestRunServerMetricConfigOutput, +} from "./outputModels.js"; + +/** Create a new test or update an existing test. */ +export interface LoadTestAdministrationCreateOrUpdateTest200Response extends HttpResponse { + status: "200"; + body: TestOutput; +} + +/** Create a new test or update an existing test. */ +export interface LoadTestAdministrationCreateOrUpdateTest201Response extends HttpResponse { + status: "201"; + body: TestOutput; +} + +export interface LoadTestAdministrationCreateOrUpdateTestDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Create a new test or update an existing test. */ +export interface LoadTestAdministrationCreateOrUpdateTestDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestAdministrationCreateOrUpdateTestDefaultHeaders; +} + +/** Delete a test by its name. */ +export interface LoadTestAdministrationDeleteTest204Response extends HttpResponse { + status: "204"; +} + +export interface LoadTestAdministrationDeleteTestDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Delete a test by its name. */ +export interface LoadTestAdministrationDeleteTestDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestAdministrationDeleteTestDefaultHeaders; +} + +/** Get load test details by test name */ +export interface LoadTestAdministrationGetTest200Response extends HttpResponse { + status: "200"; + body: TestOutput; +} + +export interface LoadTestAdministrationGetTestDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get load test details by test name */ +export interface LoadTestAdministrationGetTestDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestAdministrationGetTestDefaultHeaders; +} + +/** Get all load tests by the fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. */ +export interface LoadTestAdministrationListTests200Response extends HttpResponse { + status: "200"; + body: TestsListOutput; +} + +export interface LoadTestAdministrationListTestsDefaultHeaders { + /** 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 LoadTestAdministrationListTestsDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestAdministrationListTestsDefaultHeaders; +} + +/** Upload input file for a given test name. File size can't be more than 50 MB. Existing file with same name for the given test will be overwritten. File should be provided in the request body as application/octet-stream. */ +export interface LoadTestAdministrationUploadTestFile201Response extends HttpResponse { + status: "201"; + body: FileInfoOutput; +} + +export interface LoadTestAdministrationUploadTestFileDefaultHeaders { + /** 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 application/octet-stream. */ +export interface LoadTestAdministrationUploadTestFileDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestAdministrationUploadTestFileDefaultHeaders; +} + +/** Get test file by the file name. */ +export interface LoadTestAdministrationGetTestFile200Response extends HttpResponse { + status: "200"; + body: FileInfoOutput; +} + +export interface LoadTestAdministrationGetTestFileDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get test file by the file name. */ +export interface LoadTestAdministrationGetTestFileDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestAdministrationGetTestFileDefaultHeaders; +} + +/** Delete file by the file name for a test */ +export interface LoadTestAdministrationDeleteTestFile204Response extends HttpResponse { + status: "204"; +} + +export interface LoadTestAdministrationDeleteTestFileDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Delete file by the file name for a test */ +export interface LoadTestAdministrationDeleteTestFileDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestAdministrationDeleteTestFileDefaultHeaders; +} + +/** Get all test files. */ +export interface LoadTestAdministrationListTestFiles200Response extends HttpResponse { + status: "200"; + body: FileInfoListOutput; +} + +export interface LoadTestAdministrationListTestFilesDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get all test files. */ +export interface LoadTestAdministrationListTestFilesDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestAdministrationListTestFilesDefaultHeaders; +} + +/** Associate an app component (collection of azure resources) to a test */ +export interface LoadTestAdministrationCreateOrUpdateAppComponents200Response extends HttpResponse { + status: "200"; + body: TestAppComponentsOutput; +} + +/** Associate an app component (collection of azure resources) to a test */ +export interface LoadTestAdministrationCreateOrUpdateAppComponents201Response extends HttpResponse { + status: "201"; + body: TestAppComponentsOutput; +} + +export interface LoadTestAdministrationCreateOrUpdateAppComponentsDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Associate an app component (collection of azure resources) to a test */ +export interface LoadTestAdministrationCreateOrUpdateAppComponentsDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestAdministrationCreateOrUpdateAppComponentsDefaultHeaders; +} + +/** Get associated app component (collection of azure resources) for the given test. */ +export interface LoadTestAdministrationGetAppComponents200Response extends HttpResponse { + status: "200"; + body: TestAppComponentsOutput; +} + +export interface LoadTestAdministrationGetAppComponentsDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get associated app component (collection of azure resources) for the given test. */ +export interface LoadTestAdministrationGetAppComponentsDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestAdministrationGetAppComponentsDefaultHeaders; +} + +/** Configure server metrics for a test */ +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response + extends HttpResponse { + status: "200"; + body: TestServerMetricConfigOutput; +} + +/** Configure server metrics for a test */ +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response + extends HttpResponse { + status: "201"; + body: TestServerMetricConfigOutput; +} + +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Configure server metrics for a test */ +export interface LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestAdministrationCreateOrUpdateServerMetricsConfigDefaultHeaders; +} + +/** List server metrics configuration for the given test. */ +export interface LoadTestAdministrationGetServerMetricsConfig200Response extends HttpResponse { + status: "200"; + body: TestServerMetricConfigOutput; +} + +export interface LoadTestAdministrationGetServerMetricsConfigDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** List server metrics configuration for the given test. */ +export interface LoadTestAdministrationGetServerMetricsConfigDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestAdministrationGetServerMetricsConfigDefaultHeaders; +} + +/** Create and start a new test run with the given name. */ +export interface LoadTestRunCreateOrUpdateTestRun200Response extends HttpResponse { + status: "200"; + body: TestRunOutput; +} + +/** Create and start a new test run with the given name. */ +export interface LoadTestRunCreateOrUpdateTestRun201Response extends HttpResponse { + status: "201"; + body: TestRunOutput; +} + +export interface LoadTestRunCreateOrUpdateTestRunDefaultHeaders { + /** 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 LoadTestRunCreateOrUpdateTestRunDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunCreateOrUpdateTestRunDefaultHeaders; +} + +/** Get test run details by name. */ +export interface LoadTestRunGetTestRun200Response extends HttpResponse { + status: "200"; + body: TestRunOutput; +} + +export interface LoadTestRunGetTestRunDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get test run details by name. */ +export interface LoadTestRunGetTestRunDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunGetTestRunDefaultHeaders; +} + +/** Delete a test run by its name. */ +export interface LoadTestRunDeleteTestRun204Response extends HttpResponse { + status: "204"; +} + +export interface LoadTestRunDeleteTestRunDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Delete a test run by its name. */ +export interface LoadTestRunDeleteTestRunDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunDeleteTestRunDefaultHeaders; +} + +/** Get test run file by file name. */ +export interface LoadTestRunGetTestRunFile200Response extends HttpResponse { + status: "200"; + body: FileInfoOutput; +} + +export interface LoadTestRunGetTestRunFileDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get test run file by file name. */ +export interface LoadTestRunGetTestRunFileDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunGetTestRunFileDefaultHeaders; +} + +/** Get all test runs with given filters */ +export interface LoadTestRunListTestRuns200Response extends HttpResponse { + status: "200"; + body: TestRunsListOutput; +} + +export interface LoadTestRunListTestRunsDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get all test runs with given filters */ +export interface LoadTestRunListTestRunsDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunListTestRunsDefaultHeaders; +} + +/** Stop test run by name. */ +export interface LoadTestRunStopTestRun200Response extends HttpResponse { + status: "200"; + body: TestRunOutput; +} + +export interface LoadTestRunStopTestRunDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Stop test run by name. */ +export interface LoadTestRunStopTestRunDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunStopTestRunDefaultHeaders; +} + +/** List the metric namespaces for a load test run. */ +export interface LoadTestRunListMetricNamespaces200Response extends HttpResponse { + status: "200"; + body: MetricNamespaceCollectionOutput; +} + +export interface LoadTestRunListMetricNamespacesDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** List the metric namespaces for a load test run. */ +export interface LoadTestRunListMetricNamespacesDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunListMetricNamespacesDefaultHeaders; +} + +/** List the metric definitions for a load test run. */ +export interface LoadTestRunListMetricDefinitions200Response extends HttpResponse { + status: "200"; + body: MetricDefinitionCollectionOutput; +} + +export interface LoadTestRunListMetricDefinitionsDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** List the metric definitions for a load test run. */ +export interface LoadTestRunListMetricDefinitionsDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunListMetricDefinitionsDefaultHeaders; +} + +/** List the metric values for a load test run. */ +export interface LoadTestRunListMetrics200Response extends HttpResponse { + status: "200"; + body: MetricsOutput; +} + +export interface LoadTestRunListMetricsDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** List the metric values for a load test run. */ +export interface LoadTestRunListMetricsDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunListMetricsDefaultHeaders; +} + +/** List the dimension values for the given metric dimension name. */ +export interface LoadTestRunListMetricDimensionValues200Response extends HttpResponse { + status: "200"; + body: DimensionValueListOutput; +} + +export interface LoadTestRunListMetricDimensionValuesDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** List the dimension values for the given metric dimension name. */ +export interface LoadTestRunListMetricDimensionValuesDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunListMetricDimensionValuesDefaultHeaders; +} + +/** Associate an app component (collection of azure resources) to a test run */ +export interface LoadTestRunCreateOrUpdateAppComponents200Response extends HttpResponse { + status: "200"; + body: TestRunAppComponentsOutput; +} + +/** Associate an app component (collection of azure resources) to a test run */ +export interface LoadTestRunCreateOrUpdateAppComponents201Response extends HttpResponse { + status: "201"; + body: TestRunAppComponentsOutput; +} + +export interface LoadTestRunCreateOrUpdateAppComponentsDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Associate an app component (collection of azure resources) to a test run */ +export interface LoadTestRunCreateOrUpdateAppComponentsDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunCreateOrUpdateAppComponentsDefaultHeaders; +} + +/** Get associated app component (collection of azure resources) for the given test run. */ +export interface LoadTestRunGetAppComponents200Response extends HttpResponse { + status: "200"; + body: TestRunAppComponentsOutput; +} + +export interface LoadTestRunGetAppComponentsDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Get associated app component (collection of azure resources) for the given test run. */ +export interface LoadTestRunGetAppComponentsDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunGetAppComponentsDefaultHeaders; +} + +/** Configure server metrics for a test run */ +export interface LoadTestRunCreateOrUpdateServerMetricsConfig200Response extends HttpResponse { + status: "200"; + body: TestRunServerMetricConfigOutput; +} + +/** Configure server metrics for a test run */ +export interface LoadTestRunCreateOrUpdateServerMetricsConfig201Response extends HttpResponse { + status: "201"; + body: TestRunServerMetricConfigOutput; +} + +export interface LoadTestRunCreateOrUpdateServerMetricsConfigDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** Configure server metrics for a test run */ +export interface LoadTestRunCreateOrUpdateServerMetricsConfigDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunCreateOrUpdateServerMetricsConfigDefaultHeaders; +} + +/** List server metrics configuration for the given test run. */ +export interface LoadTestRunGetServerMetricsConfig200Response extends HttpResponse { + status: "200"; + body: TestRunServerMetricConfigOutput; +} + +export interface LoadTestRunGetServerMetricsConfigDefaultHeaders { + /** The error code for specific error that occurred. */ + "x-ms-error-code"?: string; +} + +/** List server metrics configuration for the given test run. */ +export interface LoadTestRunGetServerMetricsConfigDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseBodyOutput; + headers: RawHttpHeaders & LoadTestRunGetServerMetricsConfigDefaultHeaders; +} diff --git a/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts b/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts index 5597c1451734..e086aed853b8 100644 --- a/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts +++ b/sdk/loadtesting/load-testing-rest/src/util/LROUtil.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import type { AbortSignalLike } from "@azure/abort-controller"; import { AbortError } from "@azure/abort-controller"; -import type { TestRunOutput } from "../../generated/outputModels.js"; +import type { TestRunOutput } from ".././outputModels.js"; const REJECTED_ERR = new AbortError("The polling was aborted."); diff --git a/sdk/loadtesting/load-testing-rest/test/public/testAdministration.spec.ts b/sdk/loadtesting/load-testing-rest/test/public/testAdministration.spec.ts index 576850153153..10ebf18dbd73 100644 --- a/sdk/loadtesting/load-testing-rest/test/public/testAdministration.spec.ts +++ b/sdk/loadtesting/load-testing-rest/test/public/testAdministration.spec.ts @@ -112,10 +112,10 @@ describe("Test Creation", () => { body: { components: { "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo": - { - resourceName: "App-Service-Sample-Demo", - resourceType: "Microsoft.Web/sites", - }, + { + resourceName: "App-Service-Sample-Demo", + resourceType: "Microsoft.Web/sites", + }, }, }, }); diff --git a/sdk/loadtesting/load-testing-rest/test/public/testRun.spec.ts b/sdk/loadtesting/load-testing-rest/test/public/testRun.spec.ts index 1ab908a381a0..632d3d350e57 100644 --- a/sdk/loadtesting/load-testing-rest/test/public/testRun.spec.ts +++ b/sdk/loadtesting/load-testing-rest/test/public/testRun.spec.ts @@ -146,10 +146,10 @@ describe("Test Run Creation", () => { body: { components: { "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo": - { - resourceName: "App-Service-Sample-Demo", - resourceType: "Microsoft.Web/sites", - }, + { + resourceName: "App-Service-Sample-Demo", + resourceType: "Microsoft.Web/sites", + }, }, }, }); diff --git a/sdk/loadtesting/load-testing-rest/test/public/utils/env-browser.mts b/sdk/loadtesting/load-testing-rest/test/public/utils/env-browser.mts deleted file mode 100644 index fc36ab244fad..000000000000 --- a/sdk/loadtesting/load-testing-rest/test/public/utils/env-browser.mts +++ /dev/null @@ -1,2 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. diff --git a/sdk/loadtesting/load-testing-rest/tsconfig.json b/sdk/loadtesting/load-testing-rest/tsconfig.json index 8ddd3475c84e..75e93289e93b 100644 --- a/sdk/loadtesting/load-testing-rest/tsconfig.json +++ b/sdk/loadtesting/load-testing-rest/tsconfig.json @@ -2,9 +2,7 @@ "extends": "../../../tsconfig", "compilerOptions": { "paths": { - "@azure-rest/load-testing": [ - "./src/index" - ] + "@azure-rest/load-testing": ["./src/index"] }, "module": "NodeNext", "moduleResolution": "NodeNext", @@ -12,17 +10,11 @@ }, "include": [ "src/**/*.ts", - "./test/**/*.ts", + "src/**/*.mts", + "src/**/*.cts", "samples-dev/**/*.ts", - "generated/azureLoadTesting.ts", - "generated/clientDefinitions.ts", - "generated/index.ts", - "generated/isUnexpected.ts", - "generated/logger.ts", - "generated/models.ts", - "generated/outputModels.ts", - "generated/paginateHelper.ts", - "generated/parameters.ts", - "generated/responses.ts" + "test/**/*.ts", + "test/**/*.mts", + "test/**/*.cts" ] } From 8da66790dfca3a31a55c2927e9fcbdbf69c3aab3 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 2 Dec 2024 17:22:38 +0800 Subject: [PATCH 10/15] update --- sdk/loadtesting/load-testing-rest/test/public/utils/env.ts | 6 ------ .../load-testing-rest/test/public/utils/recordedClient.ts | 1 - 2 files changed, 7 deletions(-) delete mode 100644 sdk/loadtesting/load-testing-rest/test/public/utils/env.ts diff --git a/sdk/loadtesting/load-testing-rest/test/public/utils/env.ts b/sdk/loadtesting/load-testing-rest/test/public/utils/env.ts deleted file mode 100644 index 866412f4082d..000000000000 --- a/sdk/loadtesting/load-testing-rest/test/public/utils/env.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import * as dotenv from "dotenv"; - -dotenv.config(); diff --git a/sdk/loadtesting/load-testing-rest/test/public/utils/recordedClient.ts b/sdk/loadtesting/load-testing-rest/test/public/utils/recordedClient.ts index a936bc0f1ba6..39651eac49ac 100644 --- a/sdk/loadtesting/load-testing-rest/test/public/utils/recordedClient.ts +++ b/sdk/loadtesting/load-testing-rest/test/public/utils/recordedClient.ts @@ -5,7 +5,6 @@ import type { AzureLoadTestingClient } from "../../../src/index.js"; import AzureLoadTesting from "../../../src/index.js"; import type { RecorderStartOptions, TestInfo } from "@azure-tools/test-recorder"; import { Recorder, env } from "@azure-tools/test-recorder"; -import "./env.js"; import type { ClientOptions } from "@azure-rest/core-client"; import { createTestCredential } from "@azure-tools/test-credential"; From 6fbf8d4a0ca8d0ee5e9cf72782440479023ae1e8 Mon Sep 17 00:00:00 2001 From: ZiWei Chen <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:06:21 +0800 Subject: [PATCH 11/15] Update sdk/loadtesting/load-testing-rest/CHANGELOG.md --- sdk/loadtesting/load-testing-rest/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/loadtesting/load-testing-rest/CHANGELOG.md b/sdk/loadtesting/load-testing-rest/CHANGELOG.md index 0cfb32549458..ede8c2bf7d07 100644 --- a/sdk/loadtesting/load-testing-rest/CHANGELOG.md +++ b/sdk/loadtesting/load-testing-rest/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.1 (2024-09-09) +## 1.0.1 (2024-12-16) ### Features Added - refresh @azure-rest/load-testing sdk From 0cd88693a9c4599bed4b4928d8b2dbc2e49783c6 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:33:08 +0800 Subject: [PATCH 12/15] Update eslint.config.mjs --- sdk/loadtesting/load-testing-rest/eslint.config.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/loadtesting/load-testing-rest/eslint.config.mjs b/sdk/loadtesting/load-testing-rest/eslint.config.mjs index 7e90a7fc519b..48face69cf92 100644 --- a/sdk/loadtesting/load-testing-rest/eslint.config.mjs +++ b/sdk/loadtesting/load-testing-rest/eslint.config.mjs @@ -3,6 +3,7 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; export default azsdkEslint.config([ { rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", "tsdoc/syntax": "warn", }, }, From 071ec200ca029ec8abb0cb04ba5b390a97861aa3 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Thu, 19 Dec 2024 17:21:23 +0800 Subject: [PATCH 13/15] update --- sdk/loadtesting/load-testing-rest/CHANGELOG.md | 2 +- .../load-testing-rest/generated/azureLoadTesting.ts | 2 +- sdk/loadtesting/load-testing-rest/package.json | 2 +- sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts | 7 +++---- sdk/loadtesting/load-testing-rest/swagger/README.md | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sdk/loadtesting/load-testing-rest/CHANGELOG.md b/sdk/loadtesting/load-testing-rest/CHANGELOG.md index ede8c2bf7d07..7b647d6ac30d 100644 --- a/sdk/loadtesting/load-testing-rest/CHANGELOG.md +++ b/sdk/loadtesting/load-testing-rest/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.1 (2024-12-16) +## 2.0.0 (2024-12-16) ### Features Added - refresh @azure-rest/load-testing sdk diff --git a/sdk/loadtesting/load-testing-rest/generated/azureLoadTesting.ts b/sdk/loadtesting/load-testing-rest/generated/azureLoadTesting.ts index c87f22532d9f..7b07a31c7aab 100644 --- a/sdk/loadtesting/load-testing-rest/generated/azureLoadTesting.ts +++ b/sdk/loadtesting/load-testing-rest/generated/azureLoadTesting.ts @@ -26,7 +26,7 @@ export default function createClient( ): AzureLoadTestingClient { const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://${endpoint}`; - const userAgentInfo = `azsdk-js-load-testing-rest/1.0.1`; + const userAgentInfo = `azsdk-js-load-testing-rest/2.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` diff --git a/sdk/loadtesting/load-testing-rest/package.json b/sdk/loadtesting/load-testing-rest/package.json index 28a57117d925..e7c945192050 100644 --- a/sdk/loadtesting/load-testing-rest/package.json +++ b/sdk/loadtesting/load-testing-rest/package.json @@ -2,7 +2,7 @@ "name": "@azure-rest/load-testing", "sdk-type": "client", "author": "Microsoft Corporation", - "version": "1.0.1", + "version": "2.0.0", "description": "This package contains Microsoft Azure LoadTestingClient client library.", "keywords": [ "node", diff --git a/sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts b/sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts index f3b5b7606b08..9cc90207a018 100644 --- a/sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts +++ b/sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts @@ -25,7 +25,7 @@ export default function createClient( { apiVersion = "2022-11-01", ...options }: AzureLoadTestingClientOptions = {}, ): AzureLoadTestingClient { const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://${endpoint}`; - const userAgentInfo = `azsdk-js-load-testing-rest/1.0.1`; + const userAgentInfo = `azsdk-js-load-testing-rest/2.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` @@ -52,9 +52,8 @@ export default function createClient( // Append one if there is no apiVersion and we have one at client options const url = new URL(req.url); if (!url.searchParams.get("api-version") && apiVersion) { - req.url = `${req.url}${ - Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" - }api-version=${apiVersion}`; + req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; } return next(req); diff --git a/sdk/loadtesting/load-testing-rest/swagger/README.md b/sdk/loadtesting/load-testing-rest/swagger/README.md index da1057f5df6d..d65b371edc15 100644 --- a/sdk/loadtesting/load-testing-rest/swagger/README.md +++ b/sdk/loadtesting/load-testing-rest/swagger/README.md @@ -16,7 +16,7 @@ license-header: MICROSOFT_MIT_NO_VERSION output-folder: ../ source-code-folder-path: ./src input-file: https://github.com/Azure/azure-rest-api-specs/blob/3e27c70e7c02c07b458bc0e94716c3d82d3fdd19/specification/loadtestservice/data-plane/Microsoft.LoadTestService/stable/2022-11-01/loadtestservice.json -package-version: 1.0.1 +package-version: 2.0.0 rest-level-client: true security: AADToken security-scopes: "https://cnt-prod.loadtesting.azure.com/.default" From fc847fffc8dbaadd091d0bbb2088c587b620506e Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Thu, 19 Dec 2024 17:35:35 +0800 Subject: [PATCH 14/15] update --- .../load-testing-rest/samples/v2/javascript/README.md | 2 +- .../load-testing-rest/samples/v2/typescript/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/loadtesting/load-testing-rest/samples/v2/javascript/README.md b/sdk/loadtesting/load-testing-rest/samples/v2/javascript/README.md index 1a27990383aa..9be2ca2b282e 100644 --- a/sdk/loadtesting/load-testing-rest/samples/v2/javascript/README.md +++ b/sdk/loadtesting/load-testing-rest/samples/v2/javascript/README.md @@ -58,7 +58,7 @@ Take a look at our [API Documentation][apiref] for more information about the AP [sample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v2/javascript/sample.js [stoptest]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v2/javascript/stopTest.js -[apiref]: https://learn.microsoft.com/javascript/api/@azure/load-testing +[apiref]: https://learn.microsoft.com/javascript/api/@azure-rest/load-testing [freesub]: https://azure.microsoft.com/free/ [createinstance_azureloadtestingserviceinstance]: https://learn.microsoft.com/azure/load-testing/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtesting/load-testing-rest/README.md diff --git a/sdk/loadtesting/load-testing-rest/samples/v2/typescript/README.md b/sdk/loadtesting/load-testing-rest/samples/v2/typescript/README.md index b8484d86de1f..c37e1e3f1abf 100644 --- a/sdk/loadtesting/load-testing-rest/samples/v2/typescript/README.md +++ b/sdk/loadtesting/load-testing-rest/samples/v2/typescript/README.md @@ -70,7 +70,7 @@ Take a look at our [API Documentation][apiref] for more information about the AP [sample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v2/typescript/src/sample.ts [stoptest]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/loadtesting/load-testing-rest/samples/v2/typescript/src/stopTest.ts -[apiref]: https://learn.microsoft.com/javascript/api/@azure/load-testing +[apiref]: https://learn.microsoft.com/javascript/api/@azure-rest/load-testing [freesub]: https://azure.microsoft.com/free/ [createinstance_azureloadtestingserviceinstance]: https://learn.microsoft.com/azure/load-testing/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtesting/load-testing-rest/README.md From 3c9cde189b864ce06f90e5d1eda66466f1981e65 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:14:58 +0800 Subject: [PATCH 15/15] Update ignore-links.txt --- eng/ignore-links.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index d20b35903ba0..faf53e14b468 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -8,11 +8,8 @@ https://docs.microsoft.com/javascript/api/@azure/arm-computefleet?view=azure-nod https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md https://docs.microsoft.com/javascript/api/@azure/arm-computeschedule?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-healthdataaiservices?view=azure-node-preview -<<<<<<< HEAD https://docs.microsoft.com/javascript/api/@azure/load-testing -======= https://docs.microsoft.com/javascript/api/@azure/ai-document-translator ->>>>>>> main https://docs.microsoft.com/javascript/api/@azure/arm-fabric?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-trustedsigning?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-containerorchestratorruntime?view=azure-node-preview