Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async deployOperation(resource: ApiManagementServiceResource, api: ApiContract, backend: BackendContract, operation: OperationContract, functionName: string): Promise {
try {
const client = new ApiManagementClient(this.credentials, this.subscriptionId);
const operationConfig: OperationContract = {
name: operation.name || functionName,
displayName: operation.displayName || functionName,
description: operation.description || "",
method: operation.method,
urlTemplate: operation.urlTemplate,
templateParameters: operation.templateParameters || [],
responses: operation.responses || [],
};
// Ensure a single path seperator in the operation path
const operationPath = `/${api.path}/${operationConfig.urlTemplate}`.replace(/\/+/g, "/");
const operationUrl = `${resource.gatewayUrl}${operationPath}`;
this.log(`--> ${operationConfig.name}: [${operationConfig.method.toUpperCase()}] ${operationUrl}`);
constructor(clientId, clientSecret, tenantId, subscriptionId) {
this.clientId = clientId;
this.clientSecret = clientSecret;
this.tenantId = tenantId;
this.subscriptionId = subscriptionId;
this.classList = new Map();
this.classList.set('WebSiteManagementClient', WebSiteManagementClient);
this.classList.set('ResourceManagementClient', ResourceManagementClient);
this.classList.set('StorageManagementClient', StorageManagementClient);
this.classList.set('ApiManagementClient', ApiManagementClient);
this.classList.set('CdnManagementClient', CdnManagementClient);
this.classList.set('CosmosDBManagementClient', CosmosDBManagementClient);
this.classList.set('EventHubManagementClient', EventHubManagementClient);
this.classList.set('ServiceBusManagementClient', ServiceBusManagementClient);
this.instanceList = new Map();
}
public async Execute(): Promise {
try {
this._logger.log(`API Manamgement: Base Logging - ${this._ingredient.properties.source}`)
let aiClient = new ApplicationInsightsManagementClient(this._ctx.AuthToken, this._ctx.Environment.authentication.subscriptionId);
let client = new ApiManagementClient(this._ctx.AuthToken, this._ctx.Environment.authentication.subscriptionId)
let util = IngredientManager.getIngredientFunction("coreutils", this._ctx)
const helper = new ARMHelper(this._ctx);
let params = await helper.BakeParamsToARMParamsAsync(this._name, this._ingredient.properties.parameters)
let serviceName = params["apiManagementServiceName"].value
//Import deployment parameters
let properties = params["properties"]
delete params["properties"]
let loggerProps = params["logger"]
delete params["logger"]
params = await helper.ConfigureDiagnostics(params);
//Deploy primary ARM template
await helper.DeployTemplate(this._name, ApimTemplate, params, await util.resource_group())
//Deploy named Key/Value pairs
if (properties) {
let keys = Object.keys(properties.value)
};
}
if (!this.apimConfig.name) {
this.apimConfig.name = ApimResource.getResourceName(this.config);
}
if (!this.apimConfig.apis) {
this.apimConfig.apis = [];
}
if (!this.apimConfig.backends) {
this.apimConfig.backends = [];
}
this.apimClient = new ApiManagementClient(this.credentials, this.subscriptionId);
this.functionAppService = new FunctionAppService(serverless, options);
}