import { getClient } from '@/services/BaseService' ; import { handleServiceError } from '@/utils/service-utils' ; import { ICassMetricsKeyspaceUsage , ICassMetricsTableUsage , } from '@cassandratypes/cassandra' ; export async function getClusterKeyspacesMetrics ( cluster ) { try { const result = await getClient ( ) . get ( `/REST/datastores/cassandra/clusters/${ cluster }/metrics/keyspaces` ) ; return result . data ; } catch ( err ) { throw handleServiceError ( err ) ; } } export async function getKeyspaceTableMetrics ( cluster , keyspace , range , step ) { try { const result = await getClient ( ) . get ( `/REST/datastores/cassandra/clusters/${ cluster }/metrics/keyspaces/${ keyspace }/tables?range=${ range }&step=${ step }` ) ; return result . data ; } catch ( err ) { throw handleServiceError ( err ) ; } } export async function getTableMetrics ( cluster , keyspace , table , range , step ) { try { const result = await getClient ( ) . get ( `/REST/datastores/cassandra/clusters/${ cluster }/metrics/keyspaces/${ keyspace }/tables/${ table }?range=${ range }&step=${ step }` ) ; return result . data ; } catch ( err ) { throw handleServiceError ( err ) ; } }