7373 JobListingResponse ,
7474 ProcessListingResponse ,
7575 ValidationResponse ,
76+ federation_extension ,
7677)
7778from openeo .rest .result import SaveResult
7879from openeo .rest .service import Service
@@ -734,7 +735,7 @@ def list_collections(self) -> CollectionListingResponse:
734735 # TODO: add caching #383, but reset cache on auth change #254
735736 # TODO #677 add pagination support?
736737 data = self .get ("/collections" , expected_status = 200 ).json ()
737- return CollectionListingResponse (response_data = data )
738+ return CollectionListingResponse (response_data = data , connection = self )
738739
739740 def list_collection_ids (self ) -> List [str ]:
740741 """
@@ -776,7 +777,13 @@ def list_file_formats(self) -> dict:
776777 key = "file_formats" ,
777778 load = lambda : self .get ('/file_formats' , expected_status = 200 ).json ()
778779 )
779- return VisualDict ("file-formats" , data = formats )
780+ federation_missing = federation_extension .get_federation_missing (data = formats , resource_name = "file_formats" )
781+ federation = self .capabilities ().ext_federation_backend_details ()
782+ return VisualDict (
783+ "file-formats" ,
784+ data = formats ,
785+ parameters = {"missing" : federation_missing , "federation" : federation },
786+ )
780787
781788 def list_service_types (self ) -> dict :
782789 """
@@ -800,17 +807,24 @@ def list_udf_runtimes(self) -> dict:
800807 key = "udf_runtimes" ,
801808 load = lambda : self .get ('/udf_runtimes' , expected_status = 200 ).json ()
802809 )
803- return VisualDict ("udf-runtimes" , data = runtimes )
810+ federation = self .capabilities ().ext_federation_backend_details ()
811+ return VisualDict ("udf-runtimes" , data = runtimes , parameters = {"federation" : federation })
804812
805- def list_services (self ) -> dict :
813+ def list_services (self ) -> list :
806814 """
807815 Loads all available services of the authenticated user.
808816
809817 :return: data_dict: Dict All available services
810818 """
811819 # TODO return parsed service objects
812820 services = self .get ('/services' , expected_status = 200 ).json ()["services" ]
813- return VisualList ("data-table" , data = services , parameters = {'columns' : 'services' })
821+ federation_missing = federation_extension .get_federation_missing (data = services , resource_name = "services" )
822+ federation = self .capabilities ().ext_federation_backend_details ()
823+ return VisualList (
824+ "data-table" ,
825+ data = services ,
826+ parameters = {"columns" : "services" , "missing" : federation_missing , "federation" : federation },
827+ )
814828
815829 def describe_collection (self , collection_id : str ) -> dict :
816830 """
@@ -827,7 +841,8 @@ def describe_collection(self, collection_id: str) -> dict:
827841 # TODO: duplication with `Connection.collection_metadata`: deprecate one or the other?
828842 # TODO: add caching #383
829843 data = self .get (f"/collections/{ collection_id } " , expected_status = 200 ).json ()
830- return VisualDict ("collection" , data = data )
844+ federation = self .capabilities ().ext_federation_backend_details ()
845+ return VisualDict ("collection" , data = data , parameters = {"federation" : federation })
831846
832847 def collection_items (
833848 self ,
@@ -865,11 +880,22 @@ def collection_items(
865880 if limit is not None and limit > 0 :
866881 params ['limit' ] = limit
867882
868- return paginate (self , url , params , lambda response , page : VisualDict ("items" , data = response , parameters = {'show-map' : True , 'heading' : 'Page {} - Items' .format (page )}))
883+ federation = self .capabilities ().ext_federation_backend_details ()
884+ return paginate (
885+ self ,
886+ url ,
887+ params ,
888+ lambda response , page : VisualDict (
889+ "items" ,
890+ data = response ,
891+ parameters = {"show-map" : True , "heading" : "Page {} - Items" .format (page ), "federation" : federation },
892+ ),
893+ )
869894
870895 def collection_metadata (self , name ) -> CollectionMetadata :
871896 # TODO: duplication with `Connection.describe_collection`: deprecate one or the other?
872- return CollectionMetadata (metadata = self .describe_collection (name ))
897+ federation = self .capabilities ().ext_federation_backend_details ()
898+ return CollectionMetadata (metadata = self .describe_collection (name ), _federation = federation )
873899
874900 def list_processes (self , namespace : Optional [str ] = None ) -> ProcessListingResponse :
875901 """
@@ -891,7 +917,7 @@ def list_processes(self, namespace: Optional[str] = None) -> ProcessListingRespo
891917 )
892918 else :
893919 response = self .get ("/processes/" + namespace , expected_status = 200 ).json ()
894- return ProcessListingResponse (response_data = response )
920+ return ProcessListingResponse (response_data = response , connection = self )
895921
896922 def describe_process (self , id : str , namespace : Optional [str ] = None ) -> dict :
897923 """
@@ -904,9 +930,14 @@ def describe_process(self, id: str, namespace: Optional[str] = None) -> dict:
904930 """
905931
906932 processes = self .list_processes (namespace )
933+ federation = self .capabilities ().ext_federation_backend_details ()
907934 for process in processes :
908935 if process ["id" ] == id :
909- return VisualDict ("process" , data = process , parameters = {'show-graph' : True , 'provide-download' : False })
936+ return VisualDict (
937+ "process" ,
938+ data = process ,
939+ parameters = {"show-graph" : True , "provide-download" : False , "federation" : federation },
940+ )
910941
911942 raise OpenEoClientException ("Process does not exist." )
912943
@@ -933,7 +964,7 @@ def list_jobs(self, limit: Union[int, None] = 100) -> JobListingResponse:
933964 # TODO: Parse the result so that Job classes returned?
934965 # TODO: when pagination is enabled: how to expose link to next page?
935966 resp = self .get ("/jobs" , params = {"limit" : limit }, expected_status = 200 ).json ()
936- return JobListingResponse (response_data = resp )
967+ return JobListingResponse (response_data = resp , connection = self )
937968
938969 def assert_user_defined_process_support (self ):
939970 """
@@ -996,7 +1027,7 @@ def list_user_defined_processes(self) -> ProcessListingResponse:
9961027 # TODO #677 add pagination support?
9971028 self .assert_user_defined_process_support ()
9981029 data = self .get ("/process_graphs" , expected_status = 200 ).json ()
999- return ProcessListingResponse (response_data = data )
1030+ return ProcessListingResponse (response_data = data , connection = self )
10001031
10011032 def user_defined_process (self , user_defined_process_id : str ) -> RESTUserDefinedProcess :
10021033 """
@@ -1496,9 +1527,15 @@ def list_files(self) -> List[UserFile]:
14961527
14971528 :return: List of the user-uploaded files.
14981529 """
1499- files = self .get ('/files' , expected_status = 200 ).json ()['files' ]
1500- files = [UserFile .from_metadata (metadata = f , connection = self ) for f in files ]
1501- return VisualList ("data-table" , data = files , parameters = {'columns' : 'files' })
1530+ data = self .get ("/files" , expected_status = 200 ).json ()
1531+ files = [UserFile .from_metadata (metadata = f , connection = self ) for f in data .get ("files" , [])]
1532+ federation_missing = federation_extension .get_federation_missing (data = data , resource_name = "files" )
1533+ federation = self .capabilities ().ext_federation_backend_details ()
1534+ return VisualList (
1535+ "data-table" ,
1536+ data = files ,
1537+ parameters = {"columns" : "files" , "missing" : federation_missing , "federation" : federation },
1538+ )
15021539
15031540 def get_file (
15041541 self , path : Union [str , PurePosixPath ], metadata : Optional [dict ] = None
0 commit comments