Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft pr for load-testing #26166

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions sdk/loadtesting/load-testing-rest/src/azureLoadTesting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@
// 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";

/**
* 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
* Initialize a new instance of `AzureLoadTestingClient`
* @param endpoint - A sequence of textual characters.
* @param credentials - uniquely identify client credential
* @param options - the parameter for all optional parameters
*/
export default function createClient(
Endpoint: string,
endpoint: string,
credentials: TokenCredential,
options: ClientOptions = {}
): AzureLoadTestingClient {
const baseUrl = options.baseUrl ?? `https://${Endpoint}`;
const baseUrl = options.baseUrl ?? `https://${endpoint}`;
options.apiVersion = options.apiVersion ?? "2022-11-01";
options = {
...options,
credentials: {
scopes: ["https://cnt-prod.loadtesting.azure.com/.default"],
scopes: options.credentials?.scopes ?? ["https://cnt-prod.loadtesting.azure.com/.default"],
},
};

Expand All @@ -34,6 +36,9 @@ export default function createClient(
userAgentOptions: {
userAgentPrefix,
},
loggingOptions: {
logger: options.loggingOptions?.logger ?? logger.info,
},
};

const client = getClient(baseUrl, credentials, options) as AzureLoadTestingClient;
Expand Down
Loading