import type { AwsCredentialIdentity } from '@aws-sdk/types'; import { awsRegionIds } from './definitions/supported-regions'; import { type AwsSupportedResources, type AllSupportedAwsServices, AwsResourceDescriptionMap } from './definitions/supported-services'; export type AwsRegionId = (typeof awsRegionIds)[number]; export type AwsResourcesList = { [arn: string]: T extends keyof AwsResourceDescriptionMap ? AwsResourceDescriptionMap[T] : AwsResourceDescriptionMap[keyof AwsResourceDescriptionMap]; }; export type Tags = Record; export type AwsTags = Record; export type AwsCredentials = AwsCredentialIdentity | undefined; export interface RateLimiter { throttle(fn: () => Promise): Promise; pause(): void; resume(): void; abort(): void; readonly queueSize: number; readonly isPaused: boolean; readonly rate: number; } export type AwsRegionalScanFunction = (credentials: AwsCredentials, rateLimiter: RateLimiter, region: string) => Promise>; export type AwsGlobalScanFunction = (credentials: AwsCredentials, rateLimiter: RateLimiter) => Promise>; export type AwsScannerFunction = AwsRegionalScanFunction | AwsGlobalScanFunction; export type AwsScannerError = { service: string; message: string; region?: string; }; export type AwsScannerResult = { results: Results; errors: AwsScannerError[]; }; /** * A hook that can be used to perform actions at different stages of the scanner lifecycle. * * The `onStart` hook is called before the scanner starts scanning resources in a service. * The `onComplete` hook is called after the scanner has finished scanning resources in a service. * The `onError` hook is called if an error occurs during the scanner's operation. */ export interface AwsScannerLifecycleHook { onStart?: (service: T, region?: string) => void; onComplete?: (resources: T extends AwsSupportedResources ? AwsResourcesList : {}, service: T, region?: string) => void; onError?: (error: Error, service: T, region?: string) => void; } export type AwsScanner = () => Promise>; export interface Config { regions: string[]; profile: string | undefined; output: string; compressed: boolean; raw: boolean; 'open-output-dir': boolean; 'call-rate-rps': number; 'regional-only': boolean; } export type BaseContainer = {}> = { name: string; children: { resources: string[]; } & AdditionalChildren; }; export type AccountContainer = BaseContainer<{ regions: string[]; }>; export type RegionContainer = BaseContainer<{ vpcs: string[]; availabilityZones: string[]; }>; export type VpcContainer = BaseContainer<{ subnets: string[]; securityGroups: string[]; }>; export type AvailabilityZoneContainer = BaseContainer<{ subnets: string[]; securityGroups: string[]; }>; export type SecurityGroupContainer = BaseContainer; export type SubnetContainer = BaseContainer & { type: 'public' | 'private'; }; export type ConnectionType = 'TBD'; export interface AwsProcessedData { resources: { [arn: string]: { name: string; type: string; tags: { [key: string]: string | undefined; }; }; }; connections: { from: string; to: string; type: ConnectionType; }[]; containers: { accounts: { [accountId: string]: AccountContainer; }; regions: { [regionId: string]: RegionContainer; }; vpcs: { [arn: string]: VpcContainer; }; availabilityZones: { [arn: string]: AvailabilityZoneContainer; }; securityGroups: { [arn: string]: SecurityGroupContainer; }; subnets: { [arn: string]: SubnetContainer; }; }; tags: { [key: string]: string[]; }; } interface AwsScanJobMetadata { account: string; regions: string[]; startedAt: string; finishedAt: string; } /** * 💡 * The standard schema is what Miro expects from the discovered cloud data. * This schema supports versioning, so any changes made to it should result in a version bump. * * A JSON schema generator creates the JSON schema based on this TypeScript type in schemas/* folder * You can find it in `scripts/generate-json-schema.ts`. */ /** * Miro's Standard Schema for AWS resources. */ export interface AwsStandardSchema { provider: 'aws'; docVersion: '0.1.5'; resources: AwsResourceDescriptionMap[keyof AwsResourceDescriptionMap]; tags: AwsTags; errors: AwsScannerError[]; metadata?: AwsScanJobMetadata; } export interface AwsCliAppOutput extends AwsStandardSchema { processed?: AwsProcessedData; } export {}; //# sourceMappingURL=types.d.ts.map