Files
powerpoint-toolbox/node_modules/@azure/arm-resources/dist-esm/src/resourceManagementClient.js
T
2025-03-07 19:22:02 +01:00

76 lines
3.9 KiB
JavaScript

/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import * as coreClient from "@azure/core-client";
import * as coreRestPipeline from "@azure/core-rest-pipeline";
import { OperationsImpl, DeploymentsImpl, ProvidersImpl, ProviderResourceTypesImpl, ResourcesImpl, ResourceGroupsImpl, TagsOperationsImpl, DeploymentOperationsImpl } from "./operations";
export class ResourceManagementClient extends coreClient.ServiceClient {
/**
* Initializes a new instance of the ResourceManagementClient class.
* @param credentials Subscription credentials which uniquely identify client subscription.
* @param subscriptionId The Microsoft Azure subscription ID.
* @param options The parameter options
*/
constructor(credentials, subscriptionId, options) {
var _a, _b;
if (credentials === undefined) {
throw new Error("'credentials' cannot be null");
}
if (subscriptionId === undefined) {
throw new Error("'subscriptionId' cannot be null");
}
// Initializing default values for options
if (!options) {
options = {};
}
const defaults = {
requestContentType: "application/json; charset=utf-8",
credential: credentials
};
const packageDetails = `azsdk-js-arm-resources/5.0.1`;
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
: `${packageDetails}`;
if (!options.credentialScopes) {
options.credentialScopes = ["https://management.azure.com/.default"];
}
const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
userAgentPrefix
}, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
super(optionsWithDefaults);
if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
const pipelinePolicies = options.pipeline.getOrderedPolicies();
const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
coreRestPipeline.bearerTokenAuthenticationPolicyName);
if (!bearerTokenAuthenticationPolicyFound) {
this.pipeline.removePolicy({
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
});
this.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
scopes: `${optionsWithDefaults.baseUri}/.default`,
challengeCallbacks: {
authorizeRequestOnChallenge: coreClient.authorizeRequestOnClaimChallenge
}
}));
}
}
// Parameter assignments
this.subscriptionId = subscriptionId;
// Assigning values to Constant parameters
this.$host = options.$host || "https://management.azure.com";
this.apiVersion = options.apiVersion || "2021-04-01";
this.operations = new OperationsImpl(this);
this.deployments = new DeploymentsImpl(this);
this.providers = new ProvidersImpl(this);
this.providerResourceTypes = new ProviderResourceTypesImpl(this);
this.resources = new ResourcesImpl(this);
this.resourceGroups = new ResourceGroupsImpl(this);
this.tagsOperations = new TagsOperationsImpl(this);
this.deploymentOperations = new DeploymentOperationsImpl(this);
}
}
//# sourceMappingURL=resourceManagementClient.js.map