@azure-rest/arm-compute
Version:
31 lines • 1.75 kB
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { getClient } from "@azure-rest/core-client";
import { logger } from "./logger.js";
/**
* Initialize a new instance of `ComputeManagementClient`
* @param credentials - uniquely identify client credential
* @param options - the parameter for all optional parameters
*/
export default function createClient(credentials, options = {}) {
var _a, _b, _c, _d, _e, _f;
const endpointUrl = (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUrl) !== null && _b !== void 0 ? _b : `https://management.azure.com`;
const userAgentInfo = `azsdk-js-arm-compute-rest/1.0.0-beta.3`;
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
: `${userAgentInfo}`;
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
userAgentPrefix,
}, loggingOptions: {
logger: (_d = (_c = options.loggingOptions) === null || _c === void 0 ? void 0 : _c.logger) !== null && _d !== void 0 ? _d : logger.info,
}, credentials: {
scopes: (_f = (_e = options.credentials) === null || _e === void 0 ? void 0 : _e.scopes) !== null && _f !== void 0 ? _f : ["https://management.azure.com/.default"],
} });
const client = getClient(endpointUrl, credentials, options);
client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
if (options.apiVersion) {
logger.warning("This client does not support client api-version, please change it at the operation level");
}
return client;
}
//# sourceMappingURL=computeManagementClient.js.map