UNPKG

@google-cloud/bigtable

Version:
156 lines (155 loc) 6.42 kB
import { Cluster } from './cluster'; import { Bigtable } from '.'; import { Instance } from './instance'; import { CallOptions } from 'google-gax'; import { google } from '../protos/protos'; import { ServiceError } from 'google-gax'; export interface AppProfileOptions { /** * The routing policy for all read/write requests which use this app profile. * This can be either the string 'any' or a cluster of an instance. This * value is required when creating the app profile and optional when setting * the metadata. */ routing?: 'any' | Cluster | Set<Cluster> | Set<string>; /** * Whether or not CheckAndMutateRow and ReadModifyWriteRow requests are * allowed by this app profile. It is unsafe to send these requests to the * same table/row/column in multiple clusters. This is only used when the * routing value is a cluster. */ allowTransactionalWrites?: boolean; /** * The long form description of the use case for this AppProfile. */ description?: string; /** * Request configuration options, outlined here: * https://googleapis.github.io/gax-nodejs/global.html#CallOptions. */ gaxOptions?: CallOptions; /** * Whether to ignore safety checks when creating the app profile. */ ignoreWarnings?: boolean; } export interface DeleteAppProfileOptions { /** * Request configuration options, outlined here: * https://googleapis.github.io/gax-nodejs/global.html#CallOptions */ gaxOptions?: CallOptions; /** * Whether to ignore safety checks when deleting the app profile. */ ignoreWarnings?: boolean; } export type CreateAppProfileCallback = (err: ServiceError | null, appProfile?: AppProfile, apiResponse?: google.bigtable.admin.v2.IAppProfile) => void; export type CreateAppProfileResponse = [ AppProfile, google.bigtable.admin.v2.IAppProfile ]; export type DeleteAppProfileCallback = (err: ServiceError | null, apiResponse?: google.protobuf.Empty) => void; export type DeleteAppProfileResponse = [google.protobuf.Empty]; export type AppProfileExistsCallback = (err: ServiceError | null, exists?: boolean) => void; export type AppProfileExistsResponse = [boolean]; export type GetAppProfileMetadataCallback = (err: ServiceError | null, metadata?: google.bigtable.admin.v2.IAppProfile, apiResponse?: google.bigtable.admin.v2.IAppProfile) => void; export type GetAppProfileMetadataResponse = [ google.bigtable.admin.v2.IAppProfile, google.bigtable.admin.v2.IAppProfile ]; export type GetAppProfileCallback = (err: ServiceError | null, appProfile?: AppProfile, apiResponse?: google.bigtable.admin.v2.IAppProfile) => void; export type GetAppProfileResponse = [ AppProfile, google.bigtable.admin.v2.IAppProfile ]; export type GetAppProfilesCallback = (err: ServiceError | null, appProfiles?: AppProfile[], apiResponse?: google.bigtable.admin.v2.IAppProfile[]) => void; export type GetAppProfilesResponse = [ AppProfile[], google.bigtable.admin.v2.IAppProfile[] ]; export type SetAppProfileMetadataCallback = (err: ServiceError | null, apiResponse?: google.protobuf.Empty) => void; export type SetAppProfileMetadataResponse = [google.protobuf.Empty]; /** * Create an app profile object to interact with your app profile. * * @class * @param {Instance} instance The parent instance of this app profile. * @param {string} name Name of the app profile. * * @example * ``` * const {Bigtable} = require('@google-cloud/bigtable'); * const bigtable = new Bigtable(); * const instance = bigtable.instance('my-instance'); * const appProfile = instance.appProfile('my-app-profile'); * ``` */ export declare class AppProfile { bigtable: Bigtable; instance: Instance; name: string; id: string; metadata?: google.bigtable.admin.v2.IAppProfile; constructor(instance: Instance, id: string); /** * Formats a app profile options object into proto format. * * @private * * @param {object} options The options object. * @returns {object} * * @example * ``` * // Any cluster routing: * Family.formatAppProfile_({ * routing: 'any', * description: 'My App Profile', * }); * // { * // multiClusterRoutingUseAny: {}, * // description: 'My App Profile', * // } * * // Single cluster routing: * const cluster = myInstance.cluster('my-cluster'); * Family.formatAppProfile_({ * routing: cluster, * allowTransactionalWrites: true, * description: 'My App Profile', * }); * // { * // singleClusterRouting: { * // clusterId: 'my-cluster', * // allowTransactionalWrites: true, * // }, * // description: 'My App Profile', * // } * ``` */ static formatAppProfile_(options: AppProfileOptions): google.bigtable.admin.v2.IAppProfile; create(options: AppProfileOptions): Promise<CreateAppProfileResponse>; create(options: AppProfileOptions, callback: CreateAppProfileCallback): void; create(callback: CreateAppProfileCallback): void; delete(options?: DeleteAppProfileOptions): Promise<DeleteAppProfileResponse>; delete(options: DeleteAppProfileOptions, callback: DeleteAppProfileCallback): void; delete(callback: DeleteAppProfileCallback): void; exists(options?: CallOptions): Promise<AppProfileExistsResponse>; exists(options: CallOptions, callback: AppProfileExistsCallback): void; exists(callback: AppProfileExistsCallback): void; get(options?: CallOptions): Promise<GetAppProfileResponse>; get(options: CallOptions, callback: GetAppProfileCallback): void; get(callback: GetAppProfileCallback): void; getMetadata(options?: CallOptions): Promise<GetAppProfileMetadataResponse>; getMetadata(options: CallOptions, callback: GetAppProfileMetadataCallback): void; getMetadata(callback: GetAppProfileMetadataCallback): void; setMetadata(metadata: AppProfileOptions, options?: CallOptions): Promise<SetAppProfileMetadataResponse>; setMetadata(metadata: AppProfileOptions, options: CallOptions, callback: SetAppProfileMetadataCallback): void; setMetadata(metadata: AppProfileOptions, callback: SetAppProfileMetadataCallback): void; } /** * Reference to the {@link AppProfile} class. * @name module:@google-cloud/bigtable.AppProfile * @see AppProfile */