@testcontainers/gcloud
Version:
GCloud module for Testcontainers
48 lines (47 loc) • 1.66 kB
TypeScript
import type { Spanner } from "@google-cloud/spanner";
import type { IInstance } from "@google-cloud/spanner/build/src/instance";
import type { StartedSpannerEmulatorContainer } from "./spanner-emulator-container";
/**
* Helper class that encapsulates all Spanner client interactions against the emulator.
* Clients and configs are lazily instantiated.
*/
export declare class SpannerEmulatorHelper {
private readonly emulator;
private clientInstance?;
private instanceAdminClientInstance?;
private databaseAdminClientInstance?;
private instanceConfigValue?;
constructor(emulator: StartedSpannerEmulatorContainer);
/**
* Lazily get or create the Spanner client.
*/
client(): Promise<Spanner>;
/**
* Lazily get or create the InstanceAdminClient.
*/
private instanceAdminClient;
/**
* Lazily get or create the DatabaseAdminClient.
*/
private databaseAdminClient;
/**
* Lazily compute the instanceConfig path.
*/
instanceConfig(): Promise<string>;
/**
* Creates a new Spanner instance in the emulator.
*/
createInstance(instanceId: string, options?: IInstance): Promise<unknown>;
/**
* Deletes an existing Spanner instance in the emulator.
*/
deleteInstance(instanceId: string): Promise<void>;
/**
* Creates a new database under the specified instance in the emulator.
*/
createDatabase(instanceId: string, databaseId: string): Promise<unknown>;
/**
* Deletes a database under the specified instance in the emulator.
*/
deleteDatabase(instanceId: string, databaseId: string): Promise<void>;
}