@@ -593,6 +593,44 @@ public function operationUpdate(
593593 return ControlPlaneProtocol::json ($ this ->serializeOperation ($ operation ->refresh (), $ endpoint , $ service ));
594594 }
595595
596+ public function serviceCallShow (
597+ Request $ request ,
598+ string $ endpointName ,
599+ string $ serviceName ,
600+ string $ operationName ,
601+ string $ serviceCallId ,
602+ ): JsonResponse {
603+ if ($ response = ControlPlaneProtocol::rejectUnsupported ($ request )) {
604+ return $ response ;
605+ }
606+
607+ $ endpoint = $ this ->findEndpoint ($ request , $ endpointName );
608+
609+ if (! $ endpoint ) {
610+ return $ this ->endpointNotFound ($ request , $ endpointName );
611+ }
612+
613+ $ service = $ this ->findService ($ request , $ endpoint , $ serviceName );
614+
615+ if (! $ service ) {
616+ return $ this ->serviceNotFound ($ endpoint , $ serviceName );
617+ }
618+
619+ $ operation = $ this ->findOperation ($ request , $ service , $ operationName );
620+
621+ if (! $ operation ) {
622+ return $ this ->operationNotFound ($ endpoint , $ service , $ operationName );
623+ }
624+
625+ $ serviceCall = $ this ->findServiceCall ($ request , $ operation , $ serviceCallId );
626+
627+ if (! $ serviceCall ) {
628+ return $ this ->serviceCallNotFound ($ endpoint , $ service , $ operation , $ serviceCallId );
629+ }
630+
631+ return ControlPlaneProtocol::json ($ this ->serializeServiceCall ($ serviceCall , $ endpoint , $ service , $ operation ));
632+ }
633+
596634 public function operationDestroy (
597635 Request $ request ,
598636 string $ endpointName ,
@@ -750,6 +788,18 @@ private function findOperation(
750788 ->first ();
751789 }
752790
791+ private function findServiceCall (
792+ Request $ request ,
793+ WorkflowServiceOperation $ operation ,
794+ string $ serviceCallId ,
795+ ): ?WorkflowServiceCall {
796+ return WorkflowServiceCall::query ()
797+ ->where ('namespace ' , $ this ->namespace ($ request ))
798+ ->where ('workflow_service_operation_id ' , $ operation ->id )
799+ ->where ('id ' , trim ($ serviceCallId ))
800+ ->first ();
801+ }
802+
753803 private function endpointNotFound (Request $ request , string $ endpointName ): JsonResponse
754804 {
755805 $ namespace = $ this ->namespace ($ request );
@@ -808,6 +858,32 @@ private function operationNotFound(
808858 ], 404 );
809859 }
810860
861+ private function serviceCallNotFound (
862+ WorkflowServiceEndpoint $ endpoint ,
863+ WorkflowService $ service ,
864+ WorkflowServiceOperation $ operation ,
865+ string $ serviceCallId ,
866+ ): JsonResponse {
867+ $ normalizedId = trim ($ serviceCallId );
868+
869+ return ControlPlaneProtocol::json ([
870+ 'message ' => sprintf (
871+ 'Service call [%s] not found under operation [%s] for service [%s] at endpoint [%s] in namespace [%s]. ' ,
872+ $ normalizedId ,
873+ $ operation ->operation_name ,
874+ $ service ->service_name ,
875+ $ endpoint ->endpoint_name ,
876+ $ service ->namespace ,
877+ ),
878+ 'reason ' => 'service_call_not_found ' ,
879+ 'namespace ' => $ service ->namespace ,
880+ 'endpoint_name ' => $ endpoint ->endpoint_name ,
881+ 'service_name ' => $ service ->service_name ,
882+ 'operation_name ' => $ operation ->operation_name ,
883+ 'service_call_id ' => $ normalizedId ,
884+ ], 404 );
885+ }
886+
811887 /**
812888 * @return array<string, mixed>
813889 */
@@ -874,6 +950,57 @@ private function serializeOperation(
874950 ];
875951 }
876952
953+ /**
954+ * @return array<string, mixed>
955+ */
956+ private function serializeServiceCall (
957+ WorkflowServiceCall $ serviceCall ,
958+ WorkflowServiceEndpoint $ endpoint ,
959+ WorkflowService $ service ,
960+ WorkflowServiceOperation $ operation ,
961+ ): array {
962+ return [
963+ 'id ' => $ serviceCall ->id ,
964+ 'namespace ' => $ serviceCall ->namespace ,
965+ 'endpoint_id ' => $ endpoint ->id ,
966+ 'endpoint_name ' => $ endpoint ->endpoint_name ,
967+ 'service_id ' => $ service ->id ,
968+ 'service_name ' => $ service ->service_name ,
969+ 'operation_id ' => $ operation ->id ,
970+ 'operation_name ' => $ operation ->operation_name ,
971+ 'caller_namespace ' => $ serviceCall ->caller_namespace ,
972+ 'caller_workflow_instance_id ' => $ serviceCall ->caller_workflow_instance_id ,
973+ 'caller_workflow_run_id ' => $ serviceCall ->caller_workflow_run_id ,
974+ 'target_namespace ' => $ serviceCall ->target_namespace ,
975+ 'linked_workflow_instance_id ' => $ serviceCall ->linked_workflow_instance_id ,
976+ 'linked_workflow_run_id ' => $ serviceCall ->linked_workflow_run_id ,
977+ 'linked_workflow_update_id ' => $ serviceCall ->linked_workflow_update_id ,
978+ 'status ' => $ serviceCall ->status ,
979+ 'operation_mode ' => $ serviceCall ->operation_mode ,
980+ 'resolved_binding_kind ' => $ serviceCall ->resolved_binding_kind ,
981+ 'resolved_target_reference ' => $ serviceCall ->resolved_target_reference ,
982+ 'payload_codec ' => $ serviceCall ->payload_codec ,
983+ 'input_payload_reference ' => $ serviceCall ->input_payload_reference ,
984+ 'output_payload_reference ' => $ serviceCall ->output_payload_reference ,
985+ 'failure_payload_reference ' => $ serviceCall ->failure_payload_reference ,
986+ 'failure_message ' => $ serviceCall ->failure_message ,
987+ 'idempotency_key ' => $ serviceCall ->idempotency_key ,
988+ 'deadline_policy ' => $ serviceCall ->deadline_policy ,
989+ 'idempotency_policy ' => $ serviceCall ->idempotency_policy ,
990+ 'cancellation_policy ' => $ serviceCall ->cancellation_policy ,
991+ 'retry_policy ' => $ serviceCall ->retry_policy ,
992+ 'boundary_policy ' => $ serviceCall ->boundary_policy ,
993+ 'metadata ' => $ serviceCall ->metadata ,
994+ 'accepted_at ' => $ serviceCall ->accepted_at ?->toIso8601String(),
995+ 'started_at ' => $ serviceCall ->started_at ?->toIso8601String(),
996+ 'completed_at ' => $ serviceCall ->completed_at ?->toIso8601String(),
997+ 'failed_at ' => $ serviceCall ->failed_at ?->toIso8601String(),
998+ 'cancelled_at ' => $ serviceCall ->cancelled_at ?->toIso8601String(),
999+ 'created_at ' => $ serviceCall ->created_at ?->toIso8601String(),
1000+ 'updated_at ' => $ serviceCall ->updated_at ?->toIso8601String(),
1001+ ];
1002+ }
1003+
8771004 private function normalizeCatalogName (string $ name ): string
8781005 {
8791006 return strtolower ($ name );
0 commit comments