File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
aws_sra_examples/solutions/genai/bedrock_org/lambda/src Expand file tree Collapse file tree 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:
102102 Args:
103103 bucket (str): Name of the S3 bucket to apply the policy to
104104 """
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" ]:
107108 if isinstance (sid ["Resource" ], list ):
108109 sid ["Resource" ] = list (map (lambda x : x .replace ("BUCKET_NAME" , bucket ), sid ["Resource" ])) # noqa C417
109110 else :
110111 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 } " )
112113 bucket_policy_response = self .S3_CLIENT .put_bucket_policy (
113114 Bucket = bucket ,
114- Policy = json .dumps (self . BUCKET_POLICY_TEMPLATE ),
115+ Policy = json .dumps (policy_template ),
115116 )
116117 self .LOGGER .info (bucket_policy_response )
117118
You can’t perform that action at this time.
0 commit comments