feat: ElastiCache

This commit is contained in:
Zakaria
2026-10-05 16:03:05 -04:00
parent c0d3e5f402
commit c86b4554c0
27 changed files with 2454 additions and 5 deletions
@@ -0,0 +1,15 @@
import {describe, expect, test} from 'bun:test'
import {awsElastiCacheSchema} from './elasticacheSchema'
describe('awsElastiCacheSchema', () => {
test('describes the generic ElastiCache management form and capabilities', () => {
const schema = awsElastiCacheSchema()
expect(schema).toMatchObject({cloud: 'aws', service: 'elasticache', actions: ['list', 'create', 'delete', 'inspect']})
expect(schema.fields.map((field) => field.name)).toEqual([
'kind', 'id', 'description', 'engine', 'nodeType', 'port', 'clusterMode', 'numNodeGroups', 'replicasPerNodeGroup', 'numCacheNodes',
])
expect(schema.fields.find((field) => field.name === 'engine')?.options?.map(({value}) => value)).toEqual(['redis', 'valkey', 'memcached'])
expect(schema.capabilities?.resourceActions?.every(({status}) => status === 'available')).toBe(true)
})
})
@@ -0,0 +1,57 @@
import type {CapabilitySchema, FieldSchema, ResourceActionName, ServiceSchema} from './types'
const resourceActions: CapabilitySchema<ResourceActionName>[] = [
{name: 'list', label: 'List caches', enabled: true, status: 'available', runtimeRequired: true},
{name: 'create', label: 'Create cache', enabled: true, status: 'available', runtimeRequired: true},
{name: 'delete', label: 'Delete cache', enabled: true, status: 'available', runtimeRequired: true},
{name: 'inspect', label: 'Inspect cache', enabled: true, status: 'available', runtimeRequired: true},
]
const fields: FieldSchema[] = [
{
name: 'kind', label: 'Resource type', type: 'select', required: true, defaultValue: 'replication-group', options: [
{label: 'Replication group', value: 'replication-group'},
{label: 'Cache cluster', value: 'cache-cluster'},
],
},
{name: 'id', label: 'Identifier', type: 'text', required: true, validation: {minLength: 1, maxLength: 40, message: 'Use a 1-40 character ElastiCache identifier.'}},
{name: 'description', label: 'Description', type: 'text', required: false, requiredWhen: {field: 'kind', equals: 'replication-group'}},
{
name: 'engine', label: 'Engine', type: 'select', required: true, defaultValue: 'redis', options: [
{label: 'Redis', value: 'redis'},
{label: 'Valkey', value: 'valkey'},
{label: 'Memcached', value: 'memcached'},
],
},
{name: 'nodeType', label: 'Node type', type: 'text', required: true, defaultValue: 'cache.t3.micro'},
{name: 'port', label: 'Port', type: 'text', required: false, description: 'Optional TCP port, from 1 through 65535.'},
{
name: 'clusterMode', label: 'Cluster mode topology', type: 'select', required: false, defaultValue: 'disabled', visibleWhen: {field: 'kind', values: ['replication-group']}, options: [
{label: 'Disabled: one node group', value: 'disabled'},
{label: 'Enabled: multiple node groups', value: 'enabled'},
],
},
{name: 'numNodeGroups', label: 'Node groups', type: 'text', required: false, defaultValue: '2', visibleWhen: {field: 'clusterMode', values: ['enabled']}},
{name: 'replicasPerNodeGroup', label: 'Replicas per node group', type: 'text', required: false, defaultValue: '0', visibleWhen: {field: 'clusterMode', values: ['enabled']}},
{name: 'numCacheNodes', label: 'Cache nodes', type: 'text', required: false, defaultValue: '1', visibleWhen: {field: 'kind', values: ['cache-cluster']}},
]
export function awsElastiCacheSchema(): ServiceSchema {
return {
cloud: 'aws',
service: 'elasticache',
displayName: 'Amazon ElastiCache',
fields,
actions: ['list', 'create', 'delete', 'inspect'],
capabilities: {resourceActions},
filters: [{name: 'search', label: 'Search', type: 'text', required: false}],
columns: [
{name: 'name', label: 'Identifier'},
{name: 'type', label: 'Type'},
{name: 'status', label: 'Status', format: 'badge'},
{name: 'engine', label: 'Engine'},
{name: 'nodeType', label: 'Node type', path: 'metadata.nodeType'},
{name: 'endpoint', label: 'Endpoint', path: 'metadata.endpoint'},
],
}
}
@@ -130,6 +130,12 @@ export const SERVICE_CATALOG = {
group: 'Databases',
order: 20,
},
elasticache: {
displayName: 'ElastiCache',
iconKey: 'database',
group: 'Databases',
order: 30,
},
networking: {displayName: 'Networking', iconKey: 'networking', group: 'Networking', order: 10},
workflows: {
displayName: 'Workflows',