import { getExplorerCache } from '@/config/services' ; import { IExplorer } from '@/services/datastores/base/datastore' ; import { DatastoreType } from '@/typings/enums' ; import { IClusterDefinition } from '@/typings/typings' ; import { Request } from 'express' ; import { verifyUserCanAccessCluster } from './acl-utils' ; import { getCluster , getEnv , getRegion } from './app-utils' ; param req param datastoreType param clusterName param createExplorerCb export function getExplorerForDatastore ( req , datastoreType , clusterName , createExplorerCb ) { const region = getRegion ( req . app ) ; const env = getEnv ( req . app ) ; const cluster = getCluster ( req . app , datastoreType , clusterName ) ; req . datastoreType = datastoreType ; req . cluster = cluster ; verifyUserCanAccessCluster ( req . user , req . cluster ) ; const explorerCache = getExplorerCache ( ) ; return explorerCache . getExplorer ( datastoreType , clusterName , region , env , createExplorerCb ) ; }