File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,11 @@ class ConfigJupyterDrivesHandler(JupyterDrivesAPIHandler):
4949 def initialize (self , logger : logging .Logger , manager : JupyterDrivesManager ):
5050 return super ().initialize (logger , manager )
5151
52+ @tornado .web .authenticated
53+ async def get (self ):
54+ result = self ._manager .get_excluded_drives ()
55+ self .finish (json .dumps (result ["data" ]))
56+
5257 @tornado .web .authenticated
5358 async def post (self ):
5459 body = self .get_json_body ()
Original file line number Diff line number Diff line change @@ -188,6 +188,33 @@ def exclude_drive(self, exclude_drive_name):
188188
189189 return
190190
191+ def get_excluded_drives (self ):
192+ """Get list of excluded drives.
193+
194+ Returns:
195+ List of excluded drives and their properties.
196+ """
197+ data = []
198+ for drive in self ._excluded_drives :
199+ try :
200+ data .append ({
201+ "name" : drive ,
202+ "region" : self ._config .region_name ,
203+ "creationDate" : datetime .now ().isoformat (timespec = 'milliseconds' ).replace ('+00:00' , 'Z' ),
204+ "mounted" : False if drive not in self ._content_managers else True ,
205+ "provider" : self ._config .provider
206+ })
207+ except Exception as e :
208+ raise tornado .web .HTTPError (
209+ status_code = httpx .codes .BAD_REQUEST ,
210+ reason = f"The following error occured when listing excluded drives: { e } " ,
211+ )
212+
213+ response = {
214+ "data" : data
215+ }
216+ return response
217+
191218 def include_drive (self , include_drive_name ):
192219 """Include drive in listing.
193220
You can’t perform that action at this time.
0 commit comments