-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(spec2cdk): support for auto-generated grants in alpha modules #36206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "resources": { | ||
| "ServerlessCache": { | ||
| "grants": { | ||
| "connect": { | ||
| "actions": [ | ||
| "elasticache:Connect", "elasticache:DescribeServerlessCaches" | ||
| ], | ||
| "docSummary": "Grant connect permissions to the cache" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ import generateServiceSubmoduleFiles from './submodules'; | |
| import writeCloudFormationIncludeMapping from './submodules/cloudformation-include'; | ||
|
|
||
| const awsCdkLibDir = path.join(__dirname, '..'); | ||
| const atAwsCdkDir = path.join(__dirname, '../../@aws-cdk'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this tool, which lives in I don't like that very much. I think we can't get around making the generator a standalone tool, perhaps move all this code into |
||
| const pkgJsonPath = path.join(awsCdkLibDir, 'package.json'); | ||
| const topLevelIndexFilePath = path.join(awsCdkLibDir, 'index.ts'); | ||
| const scopeMapPath = path.join(__dirname, 'scope-map.json'); | ||
|
|
@@ -20,7 +21,7 @@ main().catch(e => { | |
| async function main() { | ||
| // Generate all L1s based on config in scope-map.json | ||
|
|
||
| const generated = (await generateAll(awsCdkLibDir, { | ||
| const generated = (await generateAll(awsCdkLibDir, atAwsCdkDir, { | ||
| skippedServices: [], | ||
| scopeMapPath, | ||
| })); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| import * as path from 'node:path'; | ||
| import { Module, TypeScriptRenderer } from '@cdklabs/typewriter'; | ||
| import * as fs from 'fs-extra'; | ||
| import * as log from './log'; | ||
|
|
@@ -10,14 +9,10 @@ export interface IWriter { | |
| export class TsFileWriter implements IWriter { | ||
| public outputFiles = new Array<string>(); | ||
|
|
||
| constructor( | ||
| private readonly rootDir: string, | ||
| private readonly renderer: TypeScriptRenderer, | ||
| ) {} | ||
| constructor(private readonly renderer: TypeScriptRenderer) {} | ||
|
|
||
| public write(module: Module, filePath: string): string { | ||
| log.debug(module.name, filePath, 'render'); | ||
| const fullPath = path.join(this.rootDir, filePath); | ||
| public write(module: Module, fullPath: string): string { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The behavior here has changed: the second parameter is an absolute path, instead of relative to some root directory passed to the constructor. |
||
| log.debug(module.name, fullPath, 'render'); | ||
| fs.outputFileSync(fullPath, this.renderer.render(module)); | ||
| this.outputFiles.push(fullPath); | ||
| return fullPath; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've confirmed that this is the correct ARN format for a serverless cache.