File tree 1 file changed +5
-4
lines changed
aws_sra_examples/solutions/genai/bedrock_org/lambda/src
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -102,16 +102,17 @@ def apply_bucket_policy(self, bucket: str) -> None:
102
102
Args:
103
103
bucket (str): Name of the S3 bucket to apply the policy to
104
104
"""
105
- self .LOGGER .info (self .BUCKET_POLICY_TEMPLATE )
106
- for sid in self .BUCKET_POLICY_TEMPLATE ["Statement" ]:
105
+ self .LOGGER .info (f"Original policy template: { self .BUCKET_POLICY_TEMPLATE } " )
106
+ policy_template = json .loads (json .dumps (self .BUCKET_POLICY_TEMPLATE ))
107
+ for sid in policy_template ["Statement" ]:
107
108
if isinstance (sid ["Resource" ], list ):
108
109
sid ["Resource" ] = list (map (lambda x : x .replace ("BUCKET_NAME" , bucket ), sid ["Resource" ])) # noqa C417
109
110
else :
110
111
sid ["Resource" ] = sid ["Resource" ].replace ("BUCKET_NAME" , bucket )
111
- self .LOGGER .info (self . BUCKET_POLICY_TEMPLATE )
112
+ self .LOGGER .info (f"Updated policy template: { policy_template } " )
112
113
bucket_policy_response = self .S3_CLIENT .put_bucket_policy (
113
114
Bucket = bucket ,
114
- Policy = json .dumps (self . BUCKET_POLICY_TEMPLATE ),
115
+ Policy = json .dumps (policy_template ),
115
116
)
116
117
self .LOGGER .info (bucket_policy_response )
117
118
You can’t perform that action at this time.
0 commit comments