mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
Generated new sdk for data plane api version 2025-11-01-preview SDK is generated with the help of typespec API spec change PR - https://github.com/Azure/azure-rest-api-specs/pull/39372 ### Packages impacted by this PR @azure-rest/load-testing ### Issues associated with this PR ### Describe the problem that is addressed by this PR SDK for new data plane api version ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ API spec change PR - https://github.com/Azure/azure-rest-api-specs/pull/39372 ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ Referred this doc for sdk generation - https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-quickstart.md Updated tsp-location.yaml and ran tsp-client update ### Checklists - [x] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [x] Added a changelog (if necessary)
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
/**
|
|
* This sample demonstrates how to generate AI-powered test plan recommendations
|
|
* using an uploaded browser recording file.
|
|
*
|
|
* @summary Demonstrates how to generate test plan recommendations for a load test.
|
|
*/
|
|
|
|
import AzureLoadTesting, { isUnexpected, getLongRunningPoller } from "@azure-rest/load-testing";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
|
|
async function main(): Promise<void> {
|
|
const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || "";
|
|
const credential = new DefaultAzureCredential();
|
|
const testId = process.env["LOADTESTSERVICE_TESTID"] || ""; // TestId of a test with a browser recording file already uploaded.
|
|
|
|
const client = AzureLoadTesting(endpoint, credential);
|
|
|
|
// Generate test plan recommendations (requires a browser recording file uploaded to the test)
|
|
const generateResult = await client
|
|
.path("/tests/{testId}:generateTestPlanRecommendations", testId)
|
|
.post();
|
|
|
|
if (isUnexpected(generateResult)) {
|
|
throw generateResult.body.error;
|
|
}
|
|
|
|
// Recommendations generation returns 202 Accepted (LRO). Poll until complete.
|
|
const recommendationsPoller = await getLongRunningPoller(client, generateResult);
|
|
const result = await recommendationsPoller.pollUntilDone();
|
|
|
|
console.log(`Recommendations generated successfully.`);
|
|
console.log(JSON.stringify(result.body, null, 2));
|
|
}
|
|
|
|
main().catch(console.error);
|