v2. BigtableTableAdminClient
Service for creating, configuring, and deleting Cloud Bigtable tables.
Provides access to the table schemas only, not the data stored within the tables.
Constructor
BigtableTableAdminClient
new BigtableTableAdminClient(options)
Construct an instance of BigtableTableAdminClient.
Parameter |
|||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Optional object The configuration object. See the subsequent parameters for more details. Values in
|
Properties
port
The port for this API service.
scopes
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
The DNS address for this API service.
Methods
checkConsistency
checkConsistency(request, options, callback) returns Promise
This is a private alpha release of Cloud Bigtable replication. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
Checks replication consistency based on a consistency token, that is, if replication has caught up based on the conditions specified in the token and the check request.
Parameter |
|||||||
---|---|---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||
callback |
Optional function(nullable Error, nullable Object) The function which will be called with the result of the API call. The second parameter to the callback is an object representing CheckConsistencyResponse. |
- Returns
-
Promise
- The promise which resolves to an array. The first element of the array is an object representing CheckConsistencyResponse. The promise has a method named "cancel" which cancels the ongoing API call.
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
var formattedName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]');
var consistencyToken = '';
var request = {
name: formattedName,
consistencyToken: consistencyToken,
};
client.checkConsistency(request)
.then(responses => {
var response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
clusterPath
clusterPath(project, instance, cluster) returns String
Return a fully-qualified cluster resource name string.
Parameter |
|
---|---|
project |
String |
instance |
String |
cluster |
String |
- Returns
-
String
createTable
createTable(request, options, callback) returns Promise
Creates a new table in the specified instance. The table can be created with a full set of initial column families, specified in the request.
Parameter |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||||||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||
callback |
Optional function(nullable Error, nullable Object) The function which will be called with the result of the API call. The second parameter to the callback is an object representing Table. |
- Returns
-
Promise
- The promise which resolves to an array. The first element of the array is an object representing Table. The promise has a method named "cancel" which cancels the ongoing API call.
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
var formattedParent = client.instancePath('[PROJECT]', '[INSTANCE]');
var tableId = '';
var table = {};
var request = {
parent: formattedParent,
tableId: tableId,
table: table,
};
client.createTable(request)
.then(responses => {
var response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
createTableFromSnapshot
createTableFromSnapshot(request, options, callback) returns Promise
This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
Creates a new table from the specified snapshot. The target table must not exist. The snapshot and the table must be in the same instance.
Parameter |
|||||||||
---|---|---|---|---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
callback |
Optional function(nullable Error, nullable Object) The function which will be called with the result of the API call. The second parameter to the callback is a gax.Operation object. |
- Returns
-
Promise
- The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
var formattedParent = client.instancePath('[PROJECT]', '[INSTANCE]');
var tableId = '';
var sourceSnapshot = '';
var request = {
parent: formattedParent,
tableId: tableId,
sourceSnapshot: sourceSnapshot,
};
// Handle the operation using the promise pattern.
client.createTableFromSnapshot(request)
.then(responses => {
var operation = responses[0];
var initialApiResponse = responses[1];
// Operation#promise starts polling for the completion of the LRO.
return operation.promise();
})
.then(responses => {
// The final result of the operation.
var result = responses[0];
// The metadata value of the completed operation.
var metadata = responses[1];
// The response of the api call returning the complete operation.
var finalApiResponse = responses[2];
})
.catch(err => {
console.error(err);
});
var formattedParent = client.instancePath('[PROJECT]', '[INSTANCE]');
var tableId = '';
var sourceSnapshot = '';
var request = {
parent: formattedParent,
tableId: tableId,
sourceSnapshot: sourceSnapshot,
};
// Handle the operation using the event emitter pattern.
client.createTableFromSnapshot(request)
.then(responses => {
var operation = responses[0];
var initialApiResponse = responses[1];
// Adding a listener for the "complete" event starts polling for the
// completion of the operation.
operation.on('complete', (result, metadata, finalApiResponse) => {
// doSomethingWith(result);
});
// Adding a listener for the "progress" event causes the callback to be
// called on any change in metadata when the operation is polled.
operation.on('progress', (metadata, apiResponse) => {
// doSomethingWith(metadata)
});
// Adding a listener for the "error" event handles any errors found during polling.
operation.on('error', err => {
// throw(err);
});
})
.catch(err => {
console.error(err);
});
deleteSnapshot
deleteSnapshot(request, options, callback) returns Promise
This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
Permanently deletes the specified snapshot.
Parameter |
|||||
---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||
callback |
Optional function(nullable Error) The function which will be called with the result of the API call. |
- Returns
-
Promise
- The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
var formattedName = client.snapshotPath('[PROJECT]', '[INSTANCE]', '[CLUSTER]', '[SNAPSHOT]');
client.deleteSnapshot({name: formattedName}).catch(err => {
console.error(err);
});
deleteTable
deleteTable(request, options, callback) returns Promise
Permanently deletes a specified table and all of its data.
Parameter |
|||||
---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||
callback |
Optional function(nullable Error) The function which will be called with the result of the API call. |
- Returns
-
Promise
- The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
var formattedName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]');
client.deleteTable({name: formattedName}).catch(err => {
console.error(err);
});
dropRowRange
dropRowRange(request, options, callback) returns Promise
Permanently drop/delete a row range from a specified table. The request can specify whether to delete all rows in a table, or only those that match a particular prefix.
Parameter |
|||||||||
---|---|---|---|---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
callback |
Optional function(nullable Error) The function which will be called with the result of the API call. |
- Returns
-
Promise
- The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
var formattedName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]');
client.dropRowRange({name: formattedName}).catch(err => {
console.error(err);
});
generateConsistencyToken
generateConsistencyToken(request, options, callback) returns Promise
This is a private alpha release of Cloud Bigtable replication. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
Generates a consistency token for a Table, which can be used in CheckConsistency to check whether mutations to the table that finished before this call started have been replicated. The tokens will be available for 90 days.
Parameter |
|||||
---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||
callback |
Optional function(nullable Error, nullable Object) The function which will be called with the result of the API call. The second parameter to the callback is an object representing GenerateConsistencyTokenResponse. |
- Returns
-
Promise
- The promise which resolves to an array. The first element of the array is an object representing GenerateConsistencyTokenResponse. The promise has a method named "cancel" which cancels the ongoing API call.
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
var formattedName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]');
client.generateConsistencyToken({name: formattedName})
.then(responses => {
var response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
getProjectId
getProjectId(callback)
Return the project ID used by this class.
Parameter |
|
---|---|
callback |
function(Error, string) the callback to be called with the current project Id. |
getSnapshot
getSnapshot(request, options, callback) returns Promise
This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
Gets metadata information about the specified snapshot.
Parameter |
|||||
---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||
callback |
Optional function(nullable Error, nullable Object) The function which will be called with the result of the API call. The second parameter to the callback is an object representing Snapshot. |
- Returns
-
Promise
- The promise which resolves to an array. The first element of the array is an object representing Snapshot. The promise has a method named "cancel" which cancels the ongoing API call.
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
var formattedName = client.snapshotPath('[PROJECT]', '[INSTANCE]', '[CLUSTER]', '[SNAPSHOT]');
client.getSnapshot({name: formattedName})
.then(responses => {
var response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
getTable
getTable(request, options, callback) returns Promise
Gets metadata information about the specified table.
Parameter |
|||||||
---|---|---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||
callback |
Optional function(nullable Error, nullable Object) The function which will be called with the result of the API call. The second parameter to the callback is an object representing Table. |
- Returns
-
Promise
- The promise which resolves to an array. The first element of the array is an object representing Table. The promise has a method named "cancel" which cancels the ongoing API call.
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
var formattedName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]');
client.getTable({name: formattedName})
.then(responses => {
var response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
instancePath
instancePath(project, instance) returns String
Return a fully-qualified instance resource name string.
Parameter |
|
---|---|
project |
String |
instance |
String |
- Returns
-
String
listSnapshots
listSnapshots(request, options, callback) returns Promise
This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
Lists all snapshots associated with the specified cluster.
Parameter |
|||||||
---|---|---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||
callback |
Optional function(nullable Error, nullable Array, nullable Object, nullable Object) The function which will be called with the result of the API call. The second parameter to the callback is Array of Snapshot. When autoPaginate: false is specified through options, it contains the result in a single response. If the response indicates the next page exists, the third parameter is set to be used for the next request object. The fourth parameter keeps the raw response object of an object representing ListSnapshotsResponse. |
- Returns
-
Promise
-
The promise which resolves to an array. The first element of the array is Array of Snapshot.
When autoPaginate: false is specified through options, the array has three elements. The first element is Array of Snapshot in a single response. The second element is the next request object if the response indicates the next page exists, or null. The third element is an object representing ListSnapshotsResponse.
The promise has a method named "cancel" which cancels the ongoing API call.
-
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
// Iterate over all elements.
var formattedParent = client.clusterPath('[PROJECT]', '[INSTANCE]', '[CLUSTER]');
client.listSnapshots({parent: formattedParent})
.then(responses => {
var resources = responses[0];
for (let i = 0; i < resources.length; i += 1) {
// doThingsWith(resources[i])
}
})
.catch(err => {
console.error(err);
});
// Or obtain the paged response.
var formattedParent = client.clusterPath('[PROJECT]', '[INSTANCE]', '[CLUSTER]');
var options = {autoPaginate: false};
var callback = responses => {
// The actual resources in a response.
var resources = responses[0];
// The next request if the response shows that there are more responses.
var nextRequest = responses[1];
// The actual response object, if necessary.
// var rawResponse = responses[2];
for (let i = 0; i < resources.length; i += 1) {
// doThingsWith(resources[i]);
}
if (nextRequest) {
// Fetch the next page.
return client.listSnapshots(nextRequest, options).then(callback);
}
}
client.listSnapshots({parent: formattedParent}, options)
.then(callback)
.catch(err => {
console.error(err);
});
listSnapshotsStream
listSnapshotsStream(request, options) returns Stream
Equivalent to listSnapshots, but returns a NodeJS Stream object.
This fetches the paged responses for listSnapshots continuously and invokes the callback registered for 'data' event for each element in the responses.
The returned object has 'end' method when no more elements are required.
autoPaginate option will be ignored.
Parameter |
|||||||
---|---|---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
- See also
- https://nodejs.org/api/stream.html
- Returns
-
Stream
An object stream which emits an object representing Snapshot on 'data' event.
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
var formattedParent = client.clusterPath('[PROJECT]', '[INSTANCE]', '[CLUSTER]');
client.listSnapshotsStream({parent: formattedParent})
.on('data', element => {
// doThingsWith(element)
}).on('error', err => {
console.log(err);
});
listTables
listTables(request, options, callback) returns Promise
Lists all tables served from a specified instance.
Parameter |
|||||||
---|---|---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||
callback |
Optional function(nullable Error, nullable Array, nullable Object, nullable Object) The function which will be called with the result of the API call. The second parameter to the callback is Array of Table. When autoPaginate: false is specified through options, it contains the result in a single response. If the response indicates the next page exists, the third parameter is set to be used for the next request object. The fourth parameter keeps the raw response object of an object representing ListTablesResponse. |
- Returns
-
Promise
-
The promise which resolves to an array. The first element of the array is Array of Table.
When autoPaginate: false is specified through options, the array has three elements. The first element is Array of Table in a single response. The second element is the next request object if the response indicates the next page exists, or null. The third element is an object representing ListTablesResponse.
The promise has a method named "cancel" which cancels the ongoing API call.
-
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
// Iterate over all elements.
var formattedParent = client.instancePath('[PROJECT]', '[INSTANCE]');
client.listTables({parent: formattedParent})
.then(responses => {
var resources = responses[0];
for (let i = 0; i < resources.length; i += 1) {
// doThingsWith(resources[i])
}
})
.catch(err => {
console.error(err);
});
// Or obtain the paged response.
var formattedParent = client.instancePath('[PROJECT]', '[INSTANCE]');
var options = {autoPaginate: false};
var callback = responses => {
// The actual resources in a response.
var resources = responses[0];
// The next request if the response shows that there are more responses.
var nextRequest = responses[1];
// The actual response object, if necessary.
// var rawResponse = responses[2];
for (let i = 0; i < resources.length; i += 1) {
// doThingsWith(resources[i]);
}
if (nextRequest) {
// Fetch the next page.
return client.listTables(nextRequest, options).then(callback);
}
}
client.listTables({parent: formattedParent}, options)
.then(callback)
.catch(err => {
console.error(err);
});
listTablesStream
listTablesStream(request, options) returns Stream
Equivalent to listTables, but returns a NodeJS Stream object.
This fetches the paged responses for listTables continuously and invokes the callback registered for 'data' event for each element in the responses.
The returned object has 'end' method when no more elements are required.
autoPaginate option will be ignored.
Parameter |
|||||||
---|---|---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
- See also
- https://nodejs.org/api/stream.html
- Returns
-
Stream
An object stream which emits an object representing Table on 'data' event.
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
var formattedParent = client.instancePath('[PROJECT]', '[INSTANCE]');
client.listTablesStream({parent: formattedParent})
.on('data', element => {
// doThingsWith(element)
}).on('error', err => {
console.log(err);
});
matchClusterFromClusterName
matchClusterFromClusterName(clusterName) returns String
Parse the clusterName from a cluster resource.
Parameter |
|
---|---|
clusterName |
String A fully-qualified path representing a cluster resources. |
- Returns
-
String
- A string representing the cluster.
matchClusterFromSnapshotName
matchClusterFromSnapshotName(snapshotName) returns String
Parse the snapshotName from a snapshot resource.
Parameter |
|
---|---|
snapshotName |
String A fully-qualified path representing a snapshot resources. |
- Returns
-
String
- A string representing the cluster.
matchInstanceFromClusterName
matchInstanceFromClusterName(clusterName) returns String
Parse the clusterName from a cluster resource.
Parameter |
|
---|---|
clusterName |
String A fully-qualified path representing a cluster resources. |
- Returns
-
String
- A string representing the instance.
matchInstanceFromInstanceName
matchInstanceFromInstanceName(instanceName) returns String
Parse the instanceName from a instance resource.
Parameter |
|
---|---|
instanceName |
String A fully-qualified path representing a instance resources. |
- Returns
-
String
- A string representing the instance.
matchInstanceFromSnapshotName
matchInstanceFromSnapshotName(snapshotName) returns String
Parse the snapshotName from a snapshot resource.
Parameter |
|
---|---|
snapshotName |
String A fully-qualified path representing a snapshot resources. |
- Returns
-
String
- A string representing the instance.
matchInstanceFromTableName
matchInstanceFromTableName(tableName) returns String
Parse the tableName from a table resource.
Parameter |
|
---|---|
tableName |
String A fully-qualified path representing a table resources. |
- Returns
-
String
- A string representing the instance.
matchProjectFromClusterName
matchProjectFromClusterName(clusterName) returns String
Parse the clusterName from a cluster resource.
Parameter |
|
---|---|
clusterName |
String A fully-qualified path representing a cluster resources. |
- Returns
-
String
- A string representing the project.
matchProjectFromInstanceName
matchProjectFromInstanceName(instanceName) returns String
Parse the instanceName from a instance resource.
Parameter |
|
---|---|
instanceName |
String A fully-qualified path representing a instance resources. |
- Returns
-
String
- A string representing the project.
matchProjectFromSnapshotName
matchProjectFromSnapshotName(snapshotName) returns String
Parse the snapshotName from a snapshot resource.
Parameter |
|
---|---|
snapshotName |
String A fully-qualified path representing a snapshot resources. |
- Returns
-
String
- A string representing the project.
matchProjectFromTableName
matchProjectFromTableName(tableName) returns String
Parse the tableName from a table resource.
Parameter |
|
---|---|
tableName |
String A fully-qualified path representing a table resources. |
- Returns
-
String
- A string representing the project.
matchSnapshotFromSnapshotName
matchSnapshotFromSnapshotName(snapshotName) returns String
Parse the snapshotName from a snapshot resource.
Parameter |
|
---|---|
snapshotName |
String A fully-qualified path representing a snapshot resources. |
- Returns
-
String
- A string representing the snapshot.
matchTableFromTableName
matchTableFromTableName(tableName) returns String
Parse the tableName from a table resource.
Parameter |
|
---|---|
tableName |
String A fully-qualified path representing a table resources. |
- Returns
-
String
- A string representing the table.
modifyColumnFamilies
modifyColumnFamilies(request, options, callback) returns Promise
Performs a series of column family modifications on the specified table. Either all or none of the modifications will occur before this method returns, but data requests received prior to that point may see a table where only some modifications have taken effect.
Parameter |
|||||||
---|---|---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||
callback |
Optional function(nullable Error, nullable Object) The function which will be called with the result of the API call. The second parameter to the callback is an object representing Table. |
- Returns
-
Promise
- The promise which resolves to an array. The first element of the array is an object representing Table. The promise has a method named "cancel" which cancels the ongoing API call.
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
var formattedName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]');
var modifications = [];
var request = {
name: formattedName,
modifications: modifications,
};
client.modifyColumnFamilies(request)
.then(responses => {
var response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
snapshotPath
snapshotPath(project, instance, cluster, snapshot) returns String
Return a fully-qualified snapshot resource name string.
Parameter |
|
---|---|
project |
String |
instance |
String |
cluster |
String |
snapshot |
String |
- Returns
-
String
snapshotTable
snapshotTable(request, options, callback) returns Promise
This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
Creates a new snapshot in the specified cluster from the specified source table. The cluster and the table must be in the same instance.
Parameter |
|||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object The request object that will be sent. Values in
|
||||||||||||
options |
Optional Object Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||
callback |
Optional function(nullable Error, nullable Object) The function which will be called with the result of the API call. The second parameter to the callback is a gax.Operation object. |
- Returns
-
Promise
- The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.
Example
const admin = require('admin.v2');
var client = new admin.v2.BigtableTableAdminClient({
// optional auth parameters.
});
var formattedName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]');
var cluster = '';
var snapshotId = '';
var description = '';
var request = {
name: formattedName,
cluster: cluster,
snapshotId: snapshotId,
description: description,
};
// Handle the operation using the promise pattern.
client.snapshotTable(request)
.then(responses => {
var operation = responses[0];
var initialApiResponse = responses[1];
// Operation#promise starts polling for the completion of the LRO.
return operation.promise();
})
.then(responses => {
// The final result of the operation.
var result = responses[0];
// The metadata value of the completed operation.
var metadata = responses[1];
// The response of the api call returning the complete operation.
var finalApiResponse = responses[2];
})
.catch(err => {
console.error(err);
});
var formattedName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]');
var cluster = '';
var snapshotId = '';
var description = '';
var request = {
name: formattedName,
cluster: cluster,
snapshotId: snapshotId,
description: description,
};
// Handle the operation using the event emitter pattern.
client.snapshotTable(request)
.then(responses => {
var operation = responses[0];
var initialApiResponse = responses[1];
// Adding a listener for the "complete" event starts polling for the
// completion of the operation.
operation.on('complete', (result, metadata, finalApiResponse) => {
// doSomethingWith(result);
});
// Adding a listener for the "progress" event causes the callback to be
// called on any change in metadata when the operation is polled.
operation.on('progress', (metadata, apiResponse) => {
// doSomethingWith(metadata)
});
// Adding a listener for the "error" event handles any errors found during polling.
operation.on('error', err => {
// throw(err);
});
})
.catch(err => {
console.error(err);
});
tablePath
tablePath(project, instance, table) returns String
Return a fully-qualified table resource name string.
Parameter |
|
---|---|
project |
String |
instance |
String |
table |
String |
- Returns
-
String