feat: ElastiCache
This commit is contained in:
@@ -25,4 +25,11 @@ describe('dataExplorerPath', () => {
|
||||
test('does not expose unsupported RDS engines as SQL explorers', () => {
|
||||
expect(dataExplorerKind(rdsInstance('mariadb'))).toBeUndefined()
|
||||
})
|
||||
|
||||
test('enables the Redis explorer only for Redis and Valkey ElastiCache resources', () => {
|
||||
const cache = (engine: string): CloudResource => ({...rdsInstance(engine), service: 'elasticache', type: 'replication-group'})
|
||||
expect(dataExplorerKind(cache('redis'))).toBe('redis')
|
||||
expect(dataExplorerPath({...cache('valkey'), type: 'cache-cluster'})).toBe('/cloud-explorer/aws/elasticache/orders-db/data')
|
||||
expect(dataExplorerKind(cache('memcached'))).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import type {CloudResource} from '@/types/resource'
|
||||
|
||||
export function dataExplorerKind(resource: CloudResource): 'dynamodb' | 'cosmos' | 'sql' | undefined {
|
||||
export function dataExplorerKind(resource: CloudResource): 'dynamodb' | 'cosmos' | 'sql' | 'redis' | undefined {
|
||||
if (resource.cloud === 'aws' && resource.service === 'nosql' && resource.type === 'dynamodb-table') return 'dynamodb'
|
||||
if (resource.cloud === 'azure' && resource.service === 'nosql' && resource.type === 'cosmos-database') return 'cosmos'
|
||||
if (resource.cloud === 'azure' && resource.service === 'database' &&
|
||||
(resource.type === 'sql-server' || resource.type === 'postgres-flexible-server')) return 'sql'
|
||||
if (resource.cloud === 'aws' && resource.service === 'database' && resource.type === 'db-instance' &&
|
||||
(resource.engine === 'postgres' || resource.engine === 'mysql')) return 'sql'
|
||||
if (resource.cloud === 'aws' && resource.service === 'elasticache' &&
|
||||
(resource.type === 'replication-group' || resource.type === 'cache-cluster') &&
|
||||
(resource.engine === 'redis' || resource.engine === 'valkey')) return 'redis'
|
||||
}
|
||||
|
||||
export function dataExplorerPath(resource: CloudResource): string | undefined {
|
||||
|
||||
Reference in New Issue
Block a user