/// import * as SDK from "aws-sdk"; import { CloudTrail } from "./CloudTrail"; declare global { interface Array { equals(array: T[]): boolean; has(elem: T): boolean; contains(array: T[]): any; accounts(): string[]; regions(account: string): AWS.Region[]; get(account: string, region: AWS.Region): AWS.Resource[]; filterByKind(kind: AWS.Resource.Kind): T[]; } } export declare namespace AWS { type Tag = { Key?: string; Value?: string; }; namespace Region { type Code = "ap-east-1" | "ap-northeast-1" | "ap-northeast-2" | "ap-south-1" | "ap-southeast-1" | "ap-southeast-2" | "ca-central-1" | "eu-central-1" | "eu-north-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "me-south-1" | "sa-east-1" | "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2"; type Name = "Asia Pacific (Hong Kong)" | "Asia Pacific (Tokyo)" | "Asia Pacific (Seoul)" | "Asia Pacific (Mumbai)" | "Asia Pacific (Singapore)" | "Asia Pacific (Sydney)" | "Canada (Central)" | "EU (Frankfurt)" | "EU (Stockholm)" | "EU (Ireland)" | "EU (London)" | "EU (Paris)" | "Middle East (Bahrain)" | "South America (Sao Paulo)" | "US East (N. Virginia)" | "US East (Ohio)" | "US West (N. California)" | "US West (Oregon)"; } class Region { private static readonly map; code: Region.Code; name: Region.Name; constructor(code: string); static Exception: { new (code: string, message: string): { name: string; message: string; stack?: string | undefined; }; captureStackTrace(targetObject: Object, constructorOpt?: Function | undefined): void; prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; stackTraceLimit: number; }; static UnknownName: { new (code: string): { name: string; message: string; stack?: string | undefined; }; captureStackTrace(targetObject: Object, constructorOpt?: Function | undefined): void; prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; stackTraceLimit: number; }; } const regions: Region[]; function region(region: string): void; namespace Child { class Resource { resource: AWS.Resource; attributes: Resource.Attributes; constructor(resource: AWS.Resource, attributes?: Resource.Attributes); hasAttributes(): boolean; stringify(): string; } namespace Resource { type Attributes = { [key: string]: any; }; } } abstract class Resource { account: string; region: Region; id: string; uid: Resource.UID; tags: AWS.Tag[]; session: AWS.Session; private _parents; private _children; private _costs; private _events; kind: Resource.Kind; static uid(session: AWS.Session, kind: Resource.Kind, id: string): string; protected constructor(session: AWS.Session, kind: Resource.Kind, id?: string, tags?: AWS.Tag[]); get events(): CloudTrail.Event[]; set events(events: CloudTrail.Event[]); setCosts(costs: AWS.Resource.Costs, year: number): void; getCosts(year: number): Resource.Costs | undefined; getChildAttributes(resource: AWS.Resource): Promise; hasParents(): boolean; hasSingleParent(): boolean; hasChildren(): Promise; children(): Promise; parents(): Resource[]; ancestors(): Resource[]; isAncestorOf(resources: Resource[]): boolean; preferredParent(parents: AWS.Resource[]): AWS.Resource | undefined; protected abstract updateChildren(): Promise; protected updatePreferredParent(parents: AWS.Resource[]): AWS.Resource | undefined; addChild(child: Child.Resource): void; addChildren(children: Child.Resource[]): void; private addParent; stringify(): string; } class Resources { private static _map; static get all(): Resource[]; static resource(uid: Resource.UID): Resource | undefined; static resources(session: AWS.Session, kind: Resource.Kind, ids: string[]): { resources: T[]; ids: string[]; }; static add(resource: T): T; } namespace Resource { type UID = string; type Kind = "CloudFormation.Stack" | "CloudFormation.Stack.Resource" | "CloudWatch.LogGroup" | "CloudWatch.LogGroup.Subscription" | "CUR.Report" | "EBS.Snapshot" | "EBS.FastRestoreSnapshot" | "EBS.Volume" | "EC2.Instance" | "EC2.Instance.GPU" | "EC2.AutoScalingGroup" | "SSM.InventoryEntry" | "EKS.Cluster" | "EKS.Cluster.Namespace" | "EKS.Cluster.Namespace.Pod" | "ECS.Cluster" | "ECS.Task.Definition" | "ECS.Cluster.Service" | "Elasticache.Cluster" | "Elasticache.Cluster.Node" | "Elasticsearch.Domain" | "ELB.LoadBalancer" | "ELB.LoadBalancer.Listener" | "ELB.TargetGroup" | "Glue.Database" | "Glue.Database.Table" | "IAM.Policy" | "Lambda.Func" | "Lambda.Func.Layer" | "Lambda.Func.Alias" | "Lambda.DeploymentPackage" | "RDS.Instance" | "RDS.Cluster" | "S3.Bucket" | "S3.Bucket.LifeCycleConfiguration" | "VPC.Endpoint" | "VPC.Subnet" | "VPC.AvailabilityZone" | "VPC" | "VPC.Gateway.NAT" | "Route53.HostedZone" | "Route53.Record" | "DynamoDB.Table"; class ARN { partition: string; service: string; region: AWS.Region; account: string; type: string; id: string; constructor(account: string, region: string, service: string, id: string, type?: string, partition?: string); hasType(): boolean; } namespace ARN { function parse(string: any): ARN; } class Cost { type: string; rate: number; usage: number; amount: number; startDate: Date | undefined; endDate: Date | undefined; constructor(type: string, rate: number, usage: number, amount: number, startDate?: Date, endDate?: Date); get interval(): number | undefined; } class Costs { private _costs; constructor(costs: Resource.Cost[]); get entries(): Resource.Cost[]; get types(): string[]; filterByTypes(types: string[]): Costs; get startDate(): Date; get endDate(): Date; get interval(): number; get totalCost(): number; get totalUsage(): number; } } class Metric { startDate: Date; endDate: Date; private _resource; size: number; stats: Metric.Stat[]; average: number | undefined; sum: number; period: number; get resource(): Resource; isUnder(threshold: number): boolean; isOver(threshold: number): boolean; constructor(resource: Resource, startDate: Date, endDate: Date, stats: Metric.Stat[], period: number); } namespace Metric { type Dimension = { Name: string; Value: string; }; type Class = new (resource: Resource, startDate: Date, endDate: Date, stats: Metric.Stat[], period: number) => M; type Stat = { samples: number; value: number; timestamp?: Date; unit?: string; }; function getStats(dataPoints: SDK.CloudWatch.Datapoints, statistic: string): Metric.Stat[]; function create(session: AWS.Session, MetricClass: Metric.Class, resource: Resource, metric: string, statistic: string, period: number, days: number, namespace?: string, dimensions?: Dimension[]): Promise; } abstract class Session { readonly region: Region; readonly account: string; protected constructor(account: string, region: Region); abstract client(type: (new (params: SDK.DataPipeline.ClientConfiguration) => T)): T; abstract hasSessionToken(): boolean; abstract refresh(): Promise; } class LocalSession extends Session { constructor(region: Region); hasSessionToken(): boolean; refresh(): Promise; client(type: (new (params: SDK.DataPipeline.ClientConfiguration) => T)): T; } class RemoteSession extends Session { readonly profile: string; readonly credentials: SDK.Credentials; constructor(account: string, region: Region, profile: string, accessKeyId: string, secretAccessKey: string, sessionToken?: string); private static setProfile; hasSessionToken(): boolean; refresh(): Promise; client(type: (new (params: SDK.DataPipeline.ClientConfiguration) => T)): T; static init(account: string, region: Region, profile: string, role?: string): Promise; static Exception: { new (region: Region, account: string, role: string, message: string): { name: string; message: string; stack?: string | undefined; }; captureStackTrace(targetObject: Object, constructorOpt?: Function | undefined): void; prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; stackTraceLimit: number; }; static NoCredentialsReturned: { new (region: Region, account: string, role: string, params: SDK.STS.AssumeRoleRequest): { name: string; message: string; stack?: string | undefined; }; captureStackTrace(targetObject: Object, constructorOpt?: Function | undefined): void; prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; stackTraceLimit: number; }; } namespace ESW { const rootAccount = "572481847476"; const CoPowerUserP2Role: string; const accounts: string[]; } }