File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
lambdas/filenameprocessor/src Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -262,9 +262,11 @@ resource "aws_s3_bucket_policy" "batch_data_ea_bucket_policy" {
262262 Action : var.environment == " prod" ? [
263263 " s3:ListBucket" ,
264264 " s3:GetObject" ,
265+ " s3:PutObject" ,
265266 ] : [
266267 " s3:ListBucket" ,
267268 " s3:GetObject" ,
269+ " s3:PutObject" ,
268270 " s3:DeleteObject"
269271 ],
270272 Resource : [
Original file line number Diff line number Diff line change @@ -142,10 +142,17 @@ def handle_record(record) -> dict:
142142
143143 # NB: we don't have the vaccine type & supplier - we have to rethink the queue_name field.
144144 # Akin will talk to Paul
145+
146+ # ** NB! the current upsert_audit_table() does not allow duplicate message_id.
147+ # Surely we want to overwrite the PROCESSING message. (as a state machine)
148+ # To do: fix that method, and its unit tests.
149+ # For now, as a PoC, we'll generate a new message_id (and a new entry).
150+ message_id = str (uuid4 ())
145151
146152 if is_file_in_bucket (dest_bucket_name , file_key ):
147153 status_code = 200
148154 message = (f"Successfully sent to { dest_bucket_name } for further processing" ,)
155+ logger .info (message )
149156 file_status = FileStatus .PROCESSED
150157 upsert_audit_table (
151158 message_id ,
@@ -155,6 +162,7 @@ def handle_record(record) -> dict:
155162 queue_name ,
156163 file_status ,
157164 )
165+ logger .info ("Deleting object from {bucket_name}" )
158166 s3_client .delete_object (
159167 Bucket = bucket_name ,
160168 Key = file_key ,
@@ -163,6 +171,7 @@ def handle_record(record) -> dict:
163171 else :
164172 status_code = 400
165173 message = (f"Failed to send to { dest_bucket_name } for further processing" ,)
174+ logger .info (message )
166175 file_status = FileStatus .FAILED
167176 upsert_audit_table (
168177 message_id ,
You can’t perform that action at this time.
0 commit comments