@@ -427,6 +427,37 @@ def set_pipe_status(event, context):
427427
428428 return http_response (HTTPStatus .OK , status_info )
429429
430+ def delete_pipe_status (event , context ):
431+ """Deletes the status of a PIPE machine.
432+
433+ Args:
434+ event.pathParameters.pipe_id (str): Identifier for the PIPE machine
435+
436+ Returns:
437+ 200 status code if successful or if the PIPE status doesn't exist
438+ 400 status code if the pipe_id is missing
439+ """
440+ pipe_id = event ['pathParameters' ]['pipe_id' ]
441+
442+ if not pipe_id :
443+ log .error ("Missing required field: pipe_id" )
444+ return http_response (
445+ HTTPStatus .BAD_REQUEST ,
446+ "Missing required field: pipe_id"
447+ )
448+
449+ # Delete the status item
450+ PIPE_QUEUE_TABLE .delete_item (
451+ Key = {
452+ 'pk' : f"STATUS#{ pipe_id } " ,
453+ 'sk' : 'INFO'
454+ }
455+ )
456+
457+ return http_response (
458+ HTTPStatus .OK ,
459+ {"message" : f"Status deleted for PIPE: { pipe_id } " }
460+ )
430461
431462def get_pipe_status_handler (event , context ):
432463 """Gets the status of a PIPE machine.
@@ -456,4 +487,4 @@ def get_all_pipe_statuses_handler(event, context):
456487 200 status code with status information for all PIPE machines
457488 """
458489 statuses = get_all_pipe_statuses ()
459- return http_response (HTTPStatus .OK , statuses )
490+ return http_response (HTTPStatus .OK , statuses )
0 commit comments