|  | @@ 517-538 (lines=22) @@ | 
                                                            
                                    | 514 |  |         evc.sync() | 
                                                            
                                    | 515 |  |         return JSONResponse("Operation successful", status_code=201) | 
                                                            
                                    | 516 |  |  | 
                                                            
                                    | 517 |  |     @rest("/v2/evc/metadata/{key}", methods=["DELETE"]) | 
                                                            
                                    | 518 |  |     @validate_openapi(spec) | 
                                                            
                                    | 519 |  |     def bulk_delete_metadata(self, request: Request) -> JSONResponse: | 
                                                            
                                    | 520 |  |         """Delete metada from a bulk of EVCs""" | 
                                                            
                                    | 521 |  |         data = get_json_or_400(request, self.controller.loop) | 
                                                            
                                    | 522 |  |         key = request.path_params["key"] | 
                                                            
                                    | 523 |  |         circuit_ids = data.pop("circuit_ids") | 
                                                            
                                    | 524 |  |         self.mongo_controller.update_evcs_metadata( | 
                                                            
                                    | 525 |  |             circuit_ids, {key: ""}, "del" | 
                                                            
                                    | 526 |  |         ) | 
                                                            
                                    | 527 |  |  | 
                                                            
                                    | 528 |  |         fail_evcs = [] | 
                                                            
                                    | 529 |  |         for _id in circuit_ids: | 
                                                            
                                    | 530 |  |             try: | 
                                                            
                                    | 531 |  |                 evc = self.circuits[_id] | 
                                                            
                                    | 532 |  |                 evc.remove_metadata(key) | 
                                                            
                                    | 533 |  |             except KeyError: | 
                                                            
                                    | 534 |  |                 fail_evcs.append(_id) | 
                                                            
                                    | 535 |  |  | 
                                                            
                                    | 536 |  |         if fail_evcs: | 
                                                            
                                    | 537 |  |             raise HTTPException(404, detail=fail_evcs) | 
                                                            
                                    | 538 |  |         return JSONResponse("Operation successful") | 
                                                            
                                    | 539 |  |  | 
                                                            
                                    | 540 |  |     @rest("/v2/evc/{circuit_id}/metadata/{key}", methods=["DELETE"]) | 
                                                            
                                    | 541 |  |     def delete_metadata(self, request: Request) -> JSONResponse: | 
                                                                                
                                |  | @@ 476-495 (lines=20) @@ | 
                                                            
                                    | 473 |  |                 detail=f"circuit_id {circuit_id} not found." | 
                                                            
                                    | 474 |  |             ) from error | 
                                                            
                                    | 475 |  |  | 
                                                            
                                    | 476 |  |     @rest("/v2/evc/metadata", methods=["POST"]) | 
                                                            
                                    | 477 |  |     @validate_openapi(spec) | 
                                                            
                                    | 478 |  |     def bulk_add_metadata(self, request: Request) -> JSONResponse: | 
                                                            
                                    | 479 |  |         """Add metadata to a bulk of EVCs.""" | 
                                                            
                                    | 480 |  |         data = get_json_or_400(request, self.controller.loop) | 
                                                            
                                    | 481 |  |         circuit_ids = data.pop("circuit_ids") | 
                                                            
                                    | 482 |  |  | 
                                                            
                                    | 483 |  |         self.mongo_controller.update_evcs_metadata(circuit_ids, data, "add") | 
                                                            
                                    | 484 |  |  | 
                                                            
                                    | 485 |  |         fail_evcs = [] | 
                                                            
                                    | 486 |  |         for _id in circuit_ids: | 
                                                            
                                    | 487 |  |             try: | 
                                                            
                                    | 488 |  |                 evc = self.circuits[_id] | 
                                                            
                                    | 489 |  |                 evc.extend_metadata(data) | 
                                                            
                                    | 490 |  |             except KeyError: | 
                                                            
                                    | 491 |  |                 fail_evcs.append(_id) | 
                                                            
                                    | 492 |  |  | 
                                                            
                                    | 493 |  |         if fail_evcs: | 
                                                            
                                    | 494 |  |             raise HTTPException(404, detail=fail_evcs) | 
                                                            
                                    | 495 |  |         return JSONResponse("Operation successful", status_code=201) | 
                                                            
                                    | 496 |  |  | 
                                                            
                                    | 497 |  |     @rest("/v2/evc/{circuit_id}/metadata", methods=["POST"]) | 
                                                            
                                    | 498 |  |     @validate_openapi(spec) |