Skip to content

Commit 83153af

Browse files
committed
feat(import): capture executionRoleArn during memory import
Map the API field memoryExecutionRoleArn to executionRoleArn in CLI schema to match the runtime convention. Also update CDK L3 construct to use an imported role via Role.fromRoleArn when executionRoleArn is provided instead of always creating a new one.
1 parent 61024d3 commit 83153af

3 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/cli/aws/agentcore-control.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ export interface MemoryDetail {
261261
}[];
262262
tags?: Record<string, string>;
263263
encryptionKeyArn?: string;
264+
executionRoleArn?: string;
264265
}
265266

266267
/**
@@ -316,6 +317,7 @@ export async function getMemoryDetail(options: GetMemoryOptions): Promise<Memory
316317
eventExpiryDuration: memory.eventExpiryDuration,
317318
tags,
318319
encryptionKeyArn: memory.encryptionKeyArn,
320+
executionRoleArn: memory.memoryExecutionRoleArn,
319321
strategies: (memory.strategies ?? []).map(s => {
320322
if (!s.type) {
321323
throw new Error(`Memory ${options.memoryId} has a strategy with missing required field: type`);

src/cli/commands/import/import-memory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ function toMemorySpec(memory: MemoryDetail, localName: string): Memory {
6868
strategies,
6969
...(memory.tags && Object.keys(memory.tags).length > 0 && { tags: memory.tags }),
7070
...(memory.encryptionKeyArn && { encryptionKeyArn: memory.encryptionKeyArn }),
71+
...(memory.executionRoleArn && { executionRoleArn: memory.executionRoleArn }),
7172
};
7273
}
7374

src/schema/schemas/agentcore-project.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export const MemorySchema = z.object({
104104
),
105105
tags: TagsSchema.optional(),
106106
encryptionKeyArn: z.string().optional(),
107+
executionRoleArn: z.string().optional(),
107108
});
108109

109110
export type Memory = z.infer<typeof MemorySchema>;

0 commit comments

Comments
 (0)