async def request_update_status(args: Namespace) -> ExitCode: """Update the status of a TransferRequest in the LTA DB.""" right_now = now() patch_body = {} patch_body["status"] = args.new_status patch_body["update_timestamp"] = right_now if not args.keep_claim: patch_body["claimed"] = False if not args.keep_priority: patch_body["work_priority_timestamp"] = right_now await args.di["lta_rc"].request("PATCH", f"/TransferRequests/{args.uuid}", patch_body) return EXIT_OK
async def bundle_priority_reset(args: Namespace) -> ExitCode: """List all of the Bundle objects in the LTA DB.""" response = await args.di["lta_rc"].request("GET", "/Bundles") results = response["results"] for uuid in results: response2 = await args.di["lta_rc"].request("GET", f"/Bundles/{uuid}?contents=0") patch_body = { "update_timestamp": now(), "work_priority_timestamp": response2["create_timestamp"], } await args.di["lta_rc"].request("PATCH", f"/Bundles/{uuid}", patch_body) return EXIT_OK
async def request_priority_reset(args: Namespace) -> ExitCode: """Reset the work priority timestamp for every TransferRequest.""" # find every transfer request and set work_priority_timestamp to create_timestamp response = await args.di["lta_rc"].request("GET", "/TransferRequests") results = response["results"] for request in results: uuid = request["uuid"] patch_body = { "update_timestamp": now(), "work_priority_timestamp": request["create_timestamp"], } await args.di["lta_rc"].request("PATCH", f"/TransferRequests/{uuid}", patch_body) return EXIT_OK