Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
enabled: true,
generateDistinctId: true,
name: `${name}-api-key`,
stageKeys: [
{ restApiId: new Token(this.apiGateway.restApiId), stageName: 'prod' },
],
}
const usagePlanConfig = {
apiStages: [
{ apiId: new Token(this.apiGateway.restApiId), stage: 'prod' },
],
description: 'universal plan to secure the api gateway',
usagePlanName: 'universal plan',
}
const apiKey = new CfnApiKey(this, 'lambdaApiKey', apiKeyConfig)
const usagePlan = new CfnUsagePlan(this, 'usagePlan', usagePlanConfig)
const usageKeyConfig = {
keyId: new Token(apiKey.apiKeyId),
keyType: 'API_KEY',
usagePlanId: new Token(usagePlan.usagePlanId),
}
// tslint:disable-next-line:no-unused-expression
new CfnUsagePlanKey(this, 'usageKey', usageKeyConfig)
const proxy = this.apiGateway.root.addResource('{any+}')
this.apiGateway.root.addMethod('GET', this.defaultIntegration, {
apiKeyRequired: true,
})
this.apiGateway.root.addMethod('POST', this.defaultIntegration, {
apiKeyRequired: true,
})
this.apiGateway.root.addMethod('DELETE', this.defaultIntegration, {