知识卡片
资源复用仍需核对关联
两个资源已经存在,仍可能没有建立它们之间的连接。附录练习可在桶和 Lambda 已存在时新增订阅。再次运行时即使跳过创建资源,也可能因固定的授权声明 ID 已存在而失败。
要判断一次部署是否已完成,可以分别核验可调用权限和桶的通知配置。书中建议读取桶通知并匹配 Lambda ARN。结合前文的调用顺序,前次运行可能已经写入权限但尚未写入通知,因此检查到资源存在或只检查通知,都不足以表明其他步骤已经完成。
相关卡片 [[桶事件如何触发函数]]、[[先查询再创建云资源]]。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Exercise solutions 第 9 章练习:重复部署与状态 · 查看原书依据
What’s nice is that the event can still be created even if the bucket and lambda already exist. But running it an additional time will cause a complaint about the statement ID already existing (you may remember we hardcoded that particular ID). To fix that, you have to check the bucket configuration (get_bucket_notification_configuration()) to see if the configuration for our lambda ARN is already present.
参考来源
- 位置:《Write Powerful Rust Macros》附录 A《Exercise solutions》(book-source:extracted/Write Powerful Rust Macros/_epub-src/OEBPS/Text/appendix-a.xhtml#p172)
- 结论依据:原文给出资源复用后硬编码 statement ID 重复的失败,并建议检查已有通知配置中的目标 ARN。
- 原始内容:What’s nice is that the event can still be created even if the bucket and lambda already exist. But running it an additional time will cause a complaint about the statement ID already existing (you may remember we hardcoded that particular ID). To fix that, you have to check the bucket configuration (get_bucket_notification_configuration()) to see if the configuration for our lambda ARN is already present.