@@ -39,21 +39,60 @@ module.exports = {
3939		} 
4040	} , 
4141
42- 	async  getDbCollectionsNames ( connectionInfo ,  logger ,  cb ,  app )  { 
43- 		const  sshService  =  app . require ( '@hackolade/ssh-service' ) ; 
44- 
42+ 	async  validateConnection ( connectionInfo ,  logger ,  cb )  { 
4543		const  log  =  createLogger ( { 
46- 			title : 'Retrieving databases and collections information ' , 
44+ 			title : 'Validate connection ' , 
4745			hiddenKeys : connectionInfo . hiddenKeys , 
4846			logger, 
4947		} ) ; 
5048
5149		try  { 
5250			logger . clear ( ) ; 
53- 
5451			log . info ( getSystemInfo ( connectionInfo . appVersion ) ) ; 
5552			log . info ( connectionInfo ,  'connectionInfo' ) ; 
5653
54+ 			const  docDbClientInstance  =  await  getDocDbClientInstance ( { 
55+ 				connectionInfo : { 
56+ 					...connectionInfo , 
57+ 					...parseHost ( connectionInfo . host ,  log ) , 
58+ 				} , 
59+ 				logger : log , 
60+ 			} ) ; 
61+ 
62+ 			log . info ( 'Getting cluster information' ) ; 
63+ 
64+ 			try  { 
65+ 				const  cluster  =  await  docDbClientInstance . getCluster ( ) ; 
66+ 				if  ( ! cluster )  { 
67+ 					return  cb ( null ,  "Cluster doesn't exist in the chosen region." ) ; 
68+ 				} 
69+ 			}  catch  ( err )  { 
70+ 				return  cb ( null ,  err ) ; 
71+ 			} 
72+ 
73+ 			log . info ( 'Cluster information retrieved successfully' ) ; 
74+ 
75+ 			cb ( ) ; 
76+ 		}  catch  ( error )  { 
77+ 			log . error ( error ) ; 
78+ 
79+ 			return  cb ( { 
80+ 				message : error . message , 
81+ 				stack : error . stack , 
82+ 			} ) ; 
83+ 		} 
84+ 	} , 
85+ 
86+ 	async  getDbCollectionsNames ( connectionInfo ,  logger ,  cb ,  app )  { 
87+ 		const  sshService  =  app . require ( '@hackolade/ssh-service' ) ; 
88+ 
89+ 		const  log  =  createLogger ( { 
90+ 			title : 'Retrieving databases and collections information' , 
91+ 			hiddenKeys : connectionInfo . hiddenKeys , 
92+ 			logger, 
93+ 		} ) ; 
94+ 
95+ 		try  { 
5796			await  getDocDbClientInstance ( { 
5897				connectionInfo : { 
5998					...connectionInfo , 
0 commit comments