import { EventEmitter } from 'events'; import { RegExTree } from './regex'; import { BigipConfObj, ConfigFile, Explosion, License, Stats, TmosApp, AppsFilterOptions, AppSummary } from './models'; import XmlStats from './xmlStats'; export { AppsFilterOptions, AppSummary }; /** * Class to consume bigip configs -> parse apps + gather stats * */ export default class BigipConfig extends EventEmitter { /** * incoming config files array * ex. [{filename:'config/bigip.conf',size:12345,content:'...'},{...}] */ configFiles: ConfigFile[]; /** * tmos config as nested json objects * - consolidated parant object keys like ltm/apm/sys/... */ configObject: BigipConfObj; /** * tmos version of the config file */ tmosVersion: string | undefined; /** * hostname of the source device */ hostname: string | undefined; /** * input file type (.conf/.ucs/.qkview/.tar.gz) */ inputFileType: string; /** * tmos version specific regex tree for abstracting applications */ rx: RegExTree | undefined; /** * corkscrew processing stats object */ stats: Stats; /** * stats information extracted from qkview xml files */ xmlStats: XmlStats; /** * default profile settings */ defaultProfileBase: ConfigFile; /** * default low (system) profile settings */ defaultLowProfileBase: ConfigFile; /** * bigip license file */ license: License; /** * tmos file store files, which include certs/keys/external_monitors/... */ fileStore: ConfigFile[]; constructor(); /** * Load and parse TMOS configuration from a string * * @param configText - Raw TMOS configuration text * @param fileName - Optional filename for reference (default: 'string-input.conf') * @returns Parse time in milliseconds * * @example * ```typescript * const bigip = new BigipConfig(); * await bigip.loadParseString(tmosConfigText); * const apps = await bigip.apps(); * ``` */ loadParseString(configText: string, fileName?: string): Promise; /** * Load and parse TMOS configuration from a file * * @param file bigip .conf/ucs/qkview/mini_ucs.tar.gz */ loadParseAsync(file: string): Promise; /** * Parse config file using universal parser */ parseConf(conf: ConfigFile): Promise; /** * Count objects in parsed config (recursive) */ private countParsedObjects; parseExtras(files: ConfigFile[]): Promise; /** * parses config file for tmos version, sets tmos version specific regex tree used to parse applications * @param x config-file object */ setTmosVersion(x: ConfigFile): Promise; /** * List all unique partitions found in the configuration * * @returns Array of partition names * * @example * ```typescript * const partitions = bigip.listPartitions(); * // ['Common', 'Tenant1', 'Tenant2'] * ``` */ listPartitions(): string[]; /** * List all virtual servers (apps) in the configuration * * @param partition - Optional: filter by partition name * @returns Array of virtual server full paths * * @example * ```typescript * // List all apps * const allApps = bigip.listApps(); * // ['/Common/app1_vs', '/Common/app2_vs', '/Tenant1/app3_vs'] * * // List apps in specific partition * const tenant1Apps = bigip.listApps('Tenant1'); * // ['/Tenant1/app3_vs'] * ``` */ listApps(partition?: string): string[]; /** * Get summary information for apps (lightweight listing) * * @param partition - Optional: filter by partition name * @returns Array of app summaries */ listAppsSummary(partition?: string): AppSummary[]; /** * Return list of application names (legacy method) * * @return array of app names * @example ['/Common/app1_80t_vs', '/tenant1/app4_t443_vs'] */ appList(): Promise; /** * returns all details from processing */ explode(): Promise; /** * Get processing logs */ logs(): Promise; digGslb(fqdn?: string): Promise; /** * Extract LTM applications with optional filtering * * @param options - Filter options (partition, partitions, apps, or single app name for backward compat) * @returns Array of extracted applications * * @example * ```typescript * // Extract all apps * const allApps = await bigip.apps(); * * // Extract apps from specific partition * const tenant1Apps = await bigip.apps({ partition: 'Tenant1' }); * * // Extract apps from multiple partitions * const multiApps = await bigip.apps({ partitions: ['Tenant1', 'Tenant2'] }); * * // Extract specific apps by name * const specificApps = await bigip.apps({ * apps: ['/Common/app1_vs', '/Tenant1/app3_vs'] * }); * * // Legacy: single app by name (backward compatible) * const singleApp = await bigip.apps('/Common/app1_vs'); * ``` */ apps(options?: string | AppsFilterOptions): Promise; }