feat: fully functioning ALB

This commit is contained in:
Zakaria
2026-09-26 16:14:24 -04:00
parent 093afb9b2b
commit 8470b8d17a
44 changed files with 2076 additions and 132 deletions
@@ -0,0 +1,92 @@
import type {ItemActionName} from './childCollections'
import type {CapabilitySchema, FieldSchema, ServiceSchema, TableColumnSchema} from './types'
import {ELB_NAME_PATTERN} from './loadBalancingSchema'
const targetGroupColumns: TableColumnSchema[] = [
{name: 'name', label: 'Name'},
{name: 'protocol', label: 'Protocol', path: 'metadata.protocol', format: 'badge'},
{name: 'port', label: 'Port', path: 'metadata.port'},
{name: 'targetType', label: 'Target Type', path: 'metadata.targetType'},
{name: 'vpcId', label: 'VPC', path: 'metadata.vpcId', format: 'code', emptyText: '—'},
{name: 'loadBalancerArns', label: 'Attached LBs', path: 'metadata.loadBalancerArns', format: 'list', emptyText: '—'},
]
const targetGroupFilters: FieldSchema[] = [{name: 'search', label: 'Search', type: 'text', required: false}]
const targetHealthActions: CapabilitySchema<ItemActionName>[] = [
{name: 'list', label: 'Describe target health', enabled: true, status: 'available', runtimeRequired: true},
{name: 'put', label: 'Register target', enabled: true, status: 'available', runtimeRequired: true},
{name: 'delete', label: 'Deregister target', enabled: true, status: 'available', runtimeRequired: true},
]
const TARGET_GROUP_PROTOCOLS = ['HTTP', 'HTTPS', 'TCP', 'TLS', 'UDP', 'TCP_UDP', 'GENEVE']
const TARGET_TYPES = ['instance', 'ip', 'lambda', 'alb']
const HEALTH_CHECK_PROTOCOLS = ['HTTP', 'HTTPS', 'TCP', 'TLS', 'UDP', 'TCP_UDP', 'GENEVE']
export function awsTargetGroupsSchema(): ServiceSchema {
return {
cloud: 'aws',
service: 'targetgroups',
displayName: 'AWS ELB Target Groups',
fields: [
{
name: 'name',
label: 'Target Group Name',
type: 'text',
required: true,
group: 'Required',
validation: {
pattern: ELB_NAME_PATTERN,
minLength: 1,
maxLength: 32,
message: 'Up to 32 characters: letters, digits and hyphens, not starting or ending with a hyphen.',
},
},
{
name: 'protocol',
label: 'Protocol',
type: 'select',
required: true,
group: 'Required',
options: TARGET_GROUP_PROTOCOLS.map((value) => ({label: value, value})),
},
{
name: 'port',
label: 'Port',
type: 'text',
required: true,
group: 'Required',
validation: {pattern: '^[1-9][0-9]{0,4}$', message: 'Enter a port from 1 to 65535.'},
},
{
name: 'targetType',
label: 'Target Type',
type: 'select',
required: false,
description: 'Defaults to instance.',
options: TARGET_TYPES.map((value) => ({label: value, value})),
},
{name: 'vpcId', label: 'VPC ID', type: 'text', required: false},
{
name: 'healthCheckProtocol',
label: 'Health Check Protocol',
type: 'select',
required: false,
options: HEALTH_CHECK_PROTOCOLS.map((value) => ({label: value, value})),
},
{name: 'healthCheckPath', label: 'Health Check Path', type: 'text', required: false},
],
actions: ['list', 'create', 'delete', 'inspect'],
capabilities: {
resourceActions: [
{name: 'list', label: 'List target groups', enabled: true, status: 'available', runtimeRequired: true},
{name: 'inspect', label: 'Inspect', enabled: true, status: 'available', runtimeRequired: true},
{name: 'create', label: 'Create target group', enabled: true, status: 'available', runtimeRequired: true},
{name: 'delete', label: 'Delete', enabled: true, status: 'available', runtimeRequired: true},
],
itemActions: targetHealthActions,
},
filters: targetGroupFilters,
columns: targetGroupColumns,
}
}