Constructor
new DatastoreAdminClient(optionsopt)
Construct an instance of DatastoreAdminClient.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
The configuration object. The options accepted by the constructor are described in detail in this document. The common options are: Properties
|
Members
apiEndpoint
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
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
(async) checkCreateIndexProgress(name) → {Promise}
Check the status of the long running operation returned by createIndex().
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
| Type | Description |
|---|---|
| Promise |
|
Example
const decodedOperation = await checkCreateIndexProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);
(async) checkDeleteIndexProgress(name) → {Promise}
Check the status of the long running operation returned by deleteIndex().
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
| Type | Description |
|---|---|
| Promise |
|
Example
const decodedOperation = await checkDeleteIndexProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);
(async) checkExportEntitiesProgress(name) → {Promise}
Check the status of the long running operation returned by exportEntities().
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
| Type | Description |
|---|---|
| Promise |
|
Example
const decodedOperation = await checkExportEntitiesProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);
(async) checkImportEntitiesProgress(name) → {Promise}
Check the status of the long running operation returned by importEntities().
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
| Type | Description |
|---|---|
| Promise |
|
Example
const decodedOperation = await checkImportEntitiesProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);
close() → {Promise}
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Returns:
| Type | Description |
|---|---|
| Promise |
A promise that resolves when the client is closed. |
createIndex(request, optionsopt) → {Promise}
Creates the specified index.
A newly created index's initial state is CREATING. On completion of the
returned google.longrunning.Operation, the state will be READY.
If the index already exists, the call will return an ALREADY_EXISTS
status.
During index creation, the process could result in an error, in which
case the index will move to the ERROR state. The process can be recovered
by fixing the data that caused the error, removing the index with
delete, then
re-creating the index with [create]
[google.datastore.admin.v1.DatastoreAdmin.CreateIndex].
Indexes with a single property cannot be created.
Parameters:
| Name | Type | Attributes | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
| Type | Description |
|---|---|
| Promise |
|
Example
const [operation] = await client.createIndex(request);
const [response] = await operation.promise();
deleteIndex(request, optionsopt) → {Promise}
Deletes an existing index.
An index can only be deleted if it is in a READY or ERROR state. On
successful execution of the request, the index will be in a DELETING
state. And on completion of the
returned google.longrunning.Operation, the index will be removed.
During index deletion, the process could result in an error, in which
case the index will move to the ERROR state. The process can be recovered
by fixing the data that caused the error, followed by calling
delete again.
Parameters:
| Name | Type | Attributes | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
| Type | Description |
|---|---|
| Promise |
|
Example
const [operation] = await client.deleteIndex(request);
const [response] = await operation.promise();
exportEntities(request, optionsopt) → {Promise}
Exports a copy of all or a subset of entities from Google Cloud Datastore to another storage system, such as Google Cloud Storage. Recent updates to entities may not be reflected in the export. The export occurs in the background and its progress can be monitored and managed via the Operation resource that is created. The output of an export may only be used once the associated operation is done. If an export operation is cancelled before completion it may leave partial data behind in Google Cloud Storage.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
| Type | Description |
|---|---|
| Promise |
|
Example
const [operation] = await client.exportEntities(request);
const [response] = await operation.promise();
getIndex(request, optionsopt) → {Promise}
Gets an index.
Parameters:
| Name | Type | Attributes | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
| Type | Description |
|---|---|
| Promise |
|
getProjectId() → {Promise}
Return the project ID used by this class.
Returns:
| Type | Description |
|---|---|
| Promise |
A promise that resolves to string containing the project ID. |
importEntities(request, optionsopt) → {Promise}
Imports entities into Google Cloud Datastore. Existing entities with the same key are overwritten. The import occurs in the background and its progress can be monitored and managed via the Operation resource that is created. If an ImportEntities operation is cancelled, it is possible that a subset of the data has already been imported to Cloud Datastore.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
| Type | Description |
|---|---|
| Promise |
|
Example
const [operation] = await client.importEntities(request);
const [response] = await operation.promise();
initialize() → {Promise}
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Returns:
| Type | Description |
|---|---|
| Promise |
A promise that resolves to an authenticated service stub. |
listIndexes(request, optionsopt) → {Promise}
Lists the indexes that match the specified filters. Datastore uses an eventually consistent query to fetch the list of indexes and may occasionally return stale results.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
| Type | Description |
|---|---|
| Promise |
|
listIndexesAsync(request, optionsopt) → {Object}
Equivalent to listIndexes, but returns an iterable object.
for-await-of syntax is used with the iterable to get response elements on-demand.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
| Type | Description |
|---|---|
| Object |
An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Index. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
Example
const iterable = client.listIndexesAsync(request);
for await (const response of iterable) {
// process response
}
listIndexesStream(request, optionsopt) → {Stream}
Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
| Type | Description |
|---|---|
| Stream |
An object stream which emits an object representing Index on 'data' event.
The client library will perform auto-pagination by default: it will call the API as many
times as needed. Note that it can affect your quota.
We recommend using |