Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async get_instrumentation_key(shortName: string, rgShortName: string | null = null): Promise {
let util = IngredientManager.getIngredientFunction("coreutils", this.context)
//App Insights telemetry will be centralized. Therefore don't append a region code.
//Also, pass in shortname rather than using default. The default is the package name being deployed but we want the App Insights resource name/group.
const aiName = util.create_resource_name("ai", shortName, false);
const rgName: string = await util.resource_group(rgShortName, false);
const client = new ApplicationInsightsManagementClient(this.context.AuthToken, this.context.Environment.authentication.subscriptionId);
let response = await client.components.get(rgName, aiName);
let key: string = ""
if (response.instrumentationKey) {
key = response.instrumentationKey || ""
}
return key
}
}
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) {