@infrascan/aws-ecs-scanner
Version:
Infrascan scanner definition for AWS ECS
257 lines (227 loc) • 6.03 kB
TypeScript
import { PlacementStrategy, PlacementConstraint, SchedulingStrategy, LoadBalancer } from '@aws-sdk/client-ecs';
import { KVPair } from '@infrascan/shared-types';
interface Platform {
family?: string;
version?: string;
}
interface CapacityProviderStrategy {
weight?: number;
base?: number;
capacityProvider?: string;
}
interface Attachment {
id?: string;
type?: string;
status?: string;
details?: KVPair[];
}
interface LogConfiguration {
cloudwatchLogGroupName?: string;
cloudwatchEncryptionEnabled?: boolean;
s3BucketName?: string;
s3EncryptionEnabled?: boolean;
s3KeyPrefix?: string;
}
interface ExecuteCommandConfiguration {
kmsKeyId?: string;
logging?: string;
logConfiguration?: LogConfiguration;
}
interface ClusterStorageConfiguration {
kmsKeyId?: string;
fargateEphemeralStorageKmsKeyId?: string;
}
interface Cluster {
executeCommandConfiguration?: ExecuteCommandConfiguration;
managedStorageConfiguration?: ClusterStorageConfiguration;
registeredContainerInstancesCount?: number;
runningTasksCount?: number;
pendingTasksCount?: number;
activeServicesCount?: number;
statistics?: KVPair[];
settings?: KVPair[];
capacityProviders?: string[];
defaultCapacityProviderStrategy?: CapacityProviderStrategy[];
attachments?: Attachment[];
attachmentStatus?: string;
serviceConnectDefaults?: {
namespace?: string;
};
status?: string;
}
interface Alarms {
name?: string[];
enable?: boolean;
rollback?: boolean;
}
interface CircuitBreaker {
enable?: boolean;
rollback?: boolean;
}
interface Rollout {
maximumHealthyPct?: number;
minimumHealthyPct?: number;
}
interface Controller {
type?: string;
}
interface Deployments {
alarms?: Alarms;
circuitBreaker?: CircuitBreaker;
rollout?: Rollout;
controller?: Controller;
}
interface ServiceRegistry {
registryArn?: string;
port?: number;
containerName?: string;
containerPort?: number;
}
interface Service {
serviceRegistries?: ServiceRegistry[];
status?: string;
launchType?: string;
capacityProviderStrategy?: CapacityProviderStrategy[];
taskDefinition?: string;
desiredCount?: number;
runningCount?: number;
pendingCount?: number;
placement?: {
strategy?: PlacementStrategy[];
constraints?: PlacementConstraint[];
};
schedulingStrategy?: Lowercase<SchedulingStrategy>;
loadBalancers?: LoadBalancer[];
}
// Network related interfaces
interface NetworkBinding {
bindIP?: string;
containerPort?: number;
hostPort?: number;
protocol?: string;
containerPortRange?: string;
hostPortRange?: string;
}
interface NetworkInterface {
attachmentId?: string;
privateIpv4Address?: string;
ipv6Address?: string;
}
// Agent and resource related interfaces
interface ManagedAgent {
lastStartedAt?: string | Date;
name?: string;
reason?: string;
lastStatus?: string;
}
interface ResourceRequirement {
value?: string;
type?: string;
}
interface InferenceAccelerator {
deviceName?: string;
deviceType?: string;
}
interface EphemeralStorage {
sizeInGiB?: number;
}
interface FargateEphemeralStorage extends EphemeralStorage {
kmsKeyId?: string;
}
// Environment configurations
interface EnvironmentFile {
value?: string;
type?: string;
}
interface Attribute {
name?: string;
value?: string;
targetType?: string;
targetId?: string;
}
// Container configurations
interface ContainerOverride {
name?: string;
command?: string[];
environment?: KVPair[];
environmentFiles?: EnvironmentFile[];
cpu?: number;
memory?: number;
memoryReservation?: number;
resourceRequirements?: ResourceRequirement[];
}
interface TaskOverrides {
containerOverrides?: ContainerOverride[];
cpu?: string;
inferenceAcceleratorOverrides?: InferenceAccelerator[];
executionRoleArn?: string;
memory?: string;
taskRoleArn?: string;
ephemeralStorage?: EphemeralStorage;
}
interface Container {
containerArn?: string;
taskArn?: string;
name?: string;
image?: string;
imageDigest?: string;
runtimeId?: string;
lastStatus?: string;
exitCode?: number;
reason?: string;
networkBindings?: NetworkBinding[];
networkInterfaces?: NetworkInterface[];
healthStatus?: "HEALTHY" | string;
managedAgents?: ManagedAgent[];
cpu?: string;
memory?: string;
memoryReservation?: string;
gpuIds?: string[];
}
// Main Task interface
interface ECSTask {
version?: number;
attachments?: Attachment[];
attributes?: Attribute[];
capacityProviderName?: string;
clusterArn?: string;
connectivity?: string;
connectivityAt?: string | Date;
containerInstanceArn?: string;
containers?: Container[];
cpu?: string;
createdAt?: string;
desiredStatus?: string;
enableExecuteCommand?: boolean;
executionStoppedAt?: string | Date;
group?: string;
healthStatus?: "HEALTHY" | string;
inferenceAccelerators?: InferenceAccelerator[];
lastStatus?: string;
launchType?: "EC2" | "FARGATE" | string;
memory?: string;
overrides?: TaskOverrides;
platformVersion?: string;
platformFamily?: string;
pullStartedAt?: string | Date;
pullStoppedAt?: string | Date;
startedAt?: string | Date;
startedBy?: string;
stopCode?: string;
stoppedAt?: string | Date;
stoppedReason?: string;
stoppingAt?: string | Date;
tags?: KVPair[];
taskArn?: string;
taskDefinitionArn?: string;
ephemeralStorage?: EphemeralStorage;
fargateEphemeralStorage?: FargateEphemeralStorage;
}
interface ECS {
platform?: Platform;
cluster?: Cluster;
deployments?: Deployments;
service?: Service;
task?: ECSTask;
}
export type { Alarms, Attachment, Attribute, CapacityProviderStrategy, CircuitBreaker, Cluster, ClusterStorageConfiguration, Container, ContainerOverride, Controller, Deployments, ECS, ECSTask, EnvironmentFile, EphemeralStorage, ExecuteCommandConfiguration, FargateEphemeralStorage, InferenceAccelerator, LogConfiguration, ManagedAgent, NetworkBinding, NetworkInterface, Platform, ResourceRequirement, Rollout, Service, ServiceRegistry, TaskOverrides };