in src/cloud-sql-instance.ts [74:125]
instanceInfo: await resolveInstanceName(
options.instanceConnectionName,
options.domainName
),
});
await instance.refresh();
return instance;
}
private readonly ipType: IpAddressTypes;
private readonly authType: AuthTypes;
private readonly sqlAdminFetcher: Fetcher;
private readonly limitRateInterval: number;
private establishedConnection: boolean = false;
// The ongoing refresh promise is referenced by the `next` property
private next?: Promise<RefreshResult>;
private scheduledRefreshID?: ReturnType<typeof setTimeout> | null = undefined;
private checkDomainID?: ReturnType<typeof setInterval> | null = undefined;
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
private throttle?: any;
private closed = false;
private failoverPeriod: number;
private sockets = new Set<DestroyableSocket>();
public readonly instanceInfo: InstanceConnectionInfo;
public ephemeralCert?: SslCert;
public host?: string;
public port = 3307;
public privateKey?: string;
public serverCaCert?: SslCert;
public serverCaMode = '';
public dnsName = '';
constructor({
options,
instanceInfo,
}: {
options: CloudSQLInstanceOptions;
instanceInfo: InstanceConnectionInfo;
}) {
this.instanceInfo = instanceInfo;
this.authType = options.authType || AuthTypes.PASSWORD;
this.ipType = options.ipType || IpAddressTypes.PUBLIC;
this.limitRateInterval = options.limitRateInterval || 30 * 1000; // 30 seconds
this.sqlAdminFetcher = options.sqlAdminFetcher;
this.failoverPeriod = options.failoverPeriod || 30 * 1000; // 30 seconds
}
// p-throttle library has to be initialized in an async scope in order to
// use dynamic import so that it's also compatible with CommonJS
private async initializeRateLimiter() {
if (this.throttle) {