import tls from 'node:tls'; import { IpAddressTypes } from './ip-addresses'; import { InstanceConnectionInfo } from './instance-connection-info'; import { InstanceMetadata } from './sqladmin-fetcher'; import { SslCert } from './ssl-cert'; import { AuthTypes } from './auth-types'; import { SocketOptions } from './socket'; import { attachPostgresSocket, buildPostgresStartupPacket, buildTerminatePacket, parsePostgresStartupPacket, PostgresSocket, WritableSocket } from './postgres-socket'; export { attachPostgresSocket, buildPostgresStartupPacket, buildTerminatePacket, parsePostgresStartupPacket, PostgresSocket, }; export declare const DEFAULT_SERVER_PROXY_PORT = 3307; export declare const DEFAULT_CONNECT_TIMEOUT_MS: number; type EventFn = () => void; type DestroyableSocket = WritableSocket & { destroy: (error?: Error) => void; once: (name: string, handler: EventFn) => void; }; interface Fetcher { getInstanceMetadata({ projectId, regionId, instanceId, }: InstanceConnectionInfo): Promise; getEphemeralCertificate(instanceConnectionInfo: InstanceConnectionInfo, publicKey: string, authType: AuthTypes): Promise; resolveConnectSettings(region: string, dnsName: string): Promise; } interface CloudSQLInstanceOptions { authType: AuthTypes; instanceConnectionName?: string; domainName?: string; ipType: IpAddressTypes; limitRateInterval?: number; sqlAdminFetcher: Fetcher; failoverPeriod?: number; dialFunc?: (opts: SocketOptions, onSecureConnect?: () => void) => tls.TLSSocket | Promise; } interface RefreshResult { ephemeralCert?: SslCert; host: string; privateKey?: string; serverCaCert?: SslCert; } export declare class CloudSQLInstance { static getCloudSQLInstance(options: CloudSQLInstanceOptions): Promise; private readonly ipType; private readonly authType; private readonly sqlAdminFetcher; private readonly limitRateInterval; private establishedConnection; private next?; private scheduledRefreshID?; private checkDomainID?; private throttle?; private closed; private failoverPeriod; private sockets; private iamPrincipals; private readonly activeProbeAborts; private readonly dialFunc?; databaseVersion?: string; readonly instanceInfo: InstanceConnectionInfo; ephemeralCert?: SslCert; host?: string; port: number; privateKey?: string; serverCaCert?: SslCert; serverCaMode: string; dnsName: string; constructor({ options, instanceInfo, }: { options: CloudSQLInstanceOptions; instanceInfo?: InstanceConnectionInfo; }); private initializeRateLimiter; forceRefresh(): Promise; refresh(): Promise; private performRefresh; /** * Resolves ordered, deduplicated host IP targets from domainName A-records * with fallback to the metadata IP selected for this instance's ipType. */ private resolveHostTargets; recordIamPrincipal(user: string, database: string): void; private resolveProbeTargets; private probeTarget; private probePrincipal; private probeConnection; private isValid; private updateValues; private scheduleRefresh; cancelRefresh(): void; setEstablishedConnection(): void; close(): void; isClosed(): boolean; checkDomainChanged(): Promise; private isNonTransient; addSocket(socket: DestroyableSocket): void; } //# sourceMappingURL=cloud-sql-instance.d.ts.map