Google Cloud Datastore Admin API
The Datastore Admin API provides several admin services for Cloud Datastore.
----------------------------------------------------------------------------- ## Concepts
Project, namespace, kind, and entity as defined in the Google Cloud Datastore API.
Operation: An Operation represents work being performed in the background.
EntityFilter: Allows specifying a subset of entities in a project. This is specified as a combination of kinds and namespaces (either or both of which may be all).
----------------------------------------------------------------------------- ## Services
# Export/Import
The Export/Import service provides the ability to copy all or a subset of entities to/from Google Cloud Storage.
Exported data may be imported into Cloud Datastore for any Google Cloud Platform project. It is not restricted to the export source project. It is possible to export from one project and then import into another.
Exported data can also be loaded into Google BigQuery for analysis.
Exports and imports are performed asynchronously. An Operation resource is created for each export/import. The state (including any errors encountered) of the export/import may be queried via the Operation resource.
# Index
The index service manages Cloud Datastore composite indexes.
Index creation and deletion are performed asynchronously. An Operation resource is created for each such asynchronous operation. The state of the operation (including any errors encountered) may be queried via the Operation resource.
# Operation
The Operations collection provides a record of actions performed for the specified project (including any operations in progress). Operations are not created directly but through calls on other collections or resources.
An operation that is not yet done may be cancelled. The request to cancel is asynchronous and the operation may continue to run for some time after the request to cancel is made.
An operation that is done may be deleted so that it is no longer listed as part of the Operation collection.
ListOperations returns all pending operations, but not completed operations.
Operations are created by service DatastoreAdmin, but are accessed via service google.longrunning.Operations. v1
Package
@google-cloud/datastoreConstructors
(constructor)(opts)
constructor
(
opts
?:
ClientOptions
);
Construct an instance of DatastoreAdminClient.
opts
ClientOptions
Properties
apiEndpoint
static
get
apiEndpoint
()
:
string
;
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
string
auth
auth
:
gax
.
GoogleAuth
;
gax. GoogleAuth
datastoreAdminStub
datastoreAdminStub
?:
Promise
< {
[
name
:
string
]
:
Function
;
}>;
Promise
<{
[name: string]: Function
;
}>
descriptors
descriptors
:
Descriptors
;
Descriptors
innerApiCalls
innerApiCalls
:
{
[
name
:
string
]
:
Function
;
};
{
[name: string]: Function
;
}
operationsClient
operationsClient
:
gax
.
OperationsClient
;
gax. OperationsClient
port
static
get
port
()
:
number
;
The port for this API service.
number
scopes
static
get
scopes
()
:
string
[];
The scopes needed to make gRPC calls for every method defined in this service.
string[]
servicePath
static
get
servicePath
()
:
string
;
The DNS address for this API service.
string
warn
warn
:
(
code
:
string
,
message
:
string
,
warnType
?:
string
)
=
>
void
;
(code: string, message: string, warnType?: string) => void
Methods
checkCreateIndexProgress(name)
checkCreateIndexProgress
(
name
:
string
)
:
Promise<LROperation<protos
.
google
.
datastore
.
admin
.
v1
.
Index
,
protos
.
google
.
datastore
.
admin
.
v1
.
IndexOperationMetadata
>> ;
Check the status of the long running operation returned by createIndex()
.
name
string
The operation name that will be passed.
Promise
< LROperation
<protos. google.datastore.admin.v1.Index
, protos. google.datastore.admin.v1.IndexOperationMetadata
>>
{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.
const decodedOperation = await checkCreateIndexProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);
checkDeleteIndexProgress(name)
checkDeleteIndexProgress
(
name
:
string
)
:
Promise<LROperation<protos
.
google
.
datastore
.
admin
.
v1
.
Index
,
protos
.
google
.
datastore
.
admin
.
v1
.
IndexOperationMetadata
>> ;
Check the status of the long running operation returned by deleteIndex()
.
name
string
The operation name that will be passed.
Promise
< LROperation
<protos. google.datastore.admin.v1.Index
, protos. google.datastore.admin.v1.IndexOperationMetadata
>>
{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.
const decodedOperation = await checkDeleteIndexProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);
checkExportEntitiesProgress(name)
checkExportEntitiesProgress
(
name
:
string
)
:
Promise<LROperation<protos
.
google
.
datastore
.
admin
.
v1
.
ExportEntitiesResponse
,
protos
.
google
.
datastore
.
admin
.
v1
.
ExportEntitiesMetadata
>> ;
Check the status of the long running operation returned by exportEntities()
.
name
string
The operation name that will be passed.
Promise
< LROperation
<protos. google.datastore.admin.v1.ExportEntitiesResponse
, protos. google.datastore.admin.v1.ExportEntitiesMetadata
>>
{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.
const decodedOperation = await checkExportEntitiesProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);
checkImportEntitiesProgress(name)
checkImportEntitiesProgress
(
name
:
string
)
:
Promise<LROperation<protos
.
google
.
protobuf
.
Empty
,
protos
.
google
.
datastore
.
admin
.
v1
.
ImportEntitiesMetadata
>> ;
Check the status of the long running operation returned by importEntities()
.
name
string
The operation name that will be passed.
Promise
< LROperation
<protos. google.protobuf.Empty
, protos. google.datastore.admin.v1.ImportEntitiesMetadata
>>
{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.
const decodedOperation = await checkImportEntitiesProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);
close()
close
()
:
Promise<void>
;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Promise
<void>
{Promise} A promise that resolves when the client is closed.
createIndex(request, options)
createIndex
(
request
?:
protos
.
google
.
datastore
.
admin
.
v1
.
ICreateIndexRequest
,
options
?:
CallOptions
)
:
Promise
< [
LROperation<protos
.
google
.
datastore
.
admin
.
v1
.
IIndex
,
protos
.
google
.
datastore
.
admin
.
v1
.
IIndexOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
undefined
,
{}
|
undefined
]>;
request
protos. google.datastore.admin.v1.ICreateIndexRequest
options
CallOptions
Promise
<[ LROperation
<protos. google.datastore.admin.v1.IIndex
, protos. google.datastore.admin.v1.IIndexOperationMetadata
>, protos. google.longrunning.IOperation
| undefined, {} | undefined]>
createIndex(request, options, callback)
createIndex
(
request
:
protos
.
google
.
datastore
.
admin
.
v1
.
ICreateIndexRequest
,
options
:
CallOptions
,
callback
:
Callback<LROperation<protos
.
google
.
datastore
.
admin
.
v1
.
IIndex
,
protos
.
google
.
datastore
.
admin
.
v1
.
IIndexOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
protos. google.datastore.admin.v1.ICreateIndexRequest
options
CallOptions
callback
Callback
< LROperation
<protos. google.datastore.admin.v1.IIndex
, protos. google.datastore.admin.v1.IIndexOperationMetadata
>, protos. google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
createIndex(request, callback)
createIndex
(
request
:
protos
.
google
.
datastore
.
admin
.
v1
.
ICreateIndexRequest
,
callback
:
Callback<LROperation<protos
.
google
.
datastore
.
admin
.
v1
.
IIndex
,
protos
.
google
.
datastore
.
admin
.
v1
.
IIndexOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
protos. google.datastore.admin.v1.ICreateIndexRequest
callback
Callback
< LROperation
<protos. google.datastore.admin.v1.IIndex
, protos. google.datastore.admin.v1.IIndexOperationMetadata
>, protos. google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
deleteIndex(request, options)
deleteIndex
(
request
?:
protos
.
google
.
datastore
.
admin
.
v1
.
IDeleteIndexRequest
,
options
?:
CallOptions
)
:
Promise
< [
LROperation<protos
.
google
.
datastore
.
admin
.
v1
.
IIndex
,
protos
.
google
.
datastore
.
admin
.
v1
.
IIndexOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
undefined
,
{}
|
undefined
]>;
request
protos. google.datastore.admin.v1.IDeleteIndexRequest
options
CallOptions
Promise
<[ LROperation
<protos. google.datastore.admin.v1.IIndex
, protos. google.datastore.admin.v1.IIndexOperationMetadata
>, protos. google.longrunning.IOperation
| undefined, {} | undefined]>
deleteIndex(request, options, callback)
deleteIndex
(
request
:
protos
.
google
.
datastore
.
admin
.
v1
.
IDeleteIndexRequest
,
options
:
CallOptions
,
callback
:
Callback<LROperation<protos
.
google
.
datastore
.
admin
.
v1
.
IIndex
,
protos
.
google
.
datastore
.
admin
.
v1
.
IIndexOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
protos. google.datastore.admin.v1.IDeleteIndexRequest
options
CallOptions
callback
Callback
< LROperation
<protos. google.datastore.admin.v1.IIndex
, protos. google.datastore.admin.v1.IIndexOperationMetadata
>, protos. google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
deleteIndex(request, callback)
deleteIndex
(
request
:
protos
.
google
.
datastore
.
admin
.
v1
.
IDeleteIndexRequest
,
callback
:
Callback<LROperation<protos
.
google
.
datastore
.
admin
.
v1
.
IIndex
,
protos
.
google
.
datastore
.
admin
.
v1
.
IIndexOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
protos. google.datastore.admin.v1.IDeleteIndexRequest
callback
Callback
< LROperation
<protos. google.datastore.admin.v1.IIndex
, protos. google.datastore.admin.v1.IIndexOperationMetadata
>, protos. google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
exportEntities(request, options)
exportEntities
(
request
?:
protos
.
google
.
datastore
.
admin
.
v1
.
IExportEntitiesRequest
,
options
?:
CallOptions
)
:
Promise
< [
LROperation<protos
.
google
.
datastore
.
admin
.
v1
.
IExportEntitiesResponse
,
protos
.
google
.
datastore
.
admin
.
v1
.
IExportEntitiesMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
undefined
,
{}
|
undefined
]>;
request
protos. google.datastore.admin.v1.IExportEntitiesRequest
options
CallOptions
Promise
<[ LROperation
<protos. google.datastore.admin.v1.IExportEntitiesResponse
, protos. google.datastore.admin.v1.IExportEntitiesMetadata
>, protos. google.longrunning.IOperation
| undefined, {} | undefined]>
exportEntities(request, options, callback)
exportEntities
(
request
:
protos
.
google
.
datastore
.
admin
.
v1
.
IExportEntitiesRequest
,
options
:
CallOptions
,
callback
:
Callback<LROperation<protos
.
google
.
datastore
.
admin
.
v1
.
IExportEntitiesResponse
,
protos
.
google
.
datastore
.
admin
.
v1
.
IExportEntitiesMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
protos. google.datastore.admin.v1.IExportEntitiesRequest
options
CallOptions
callback
Callback
< LROperation
<protos. google.datastore.admin.v1.IExportEntitiesResponse
, protos. google.datastore.admin.v1.IExportEntitiesMetadata
>, protos. google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
exportEntities(request, callback)
exportEntities
(
request
:
protos
.
google
.
datastore
.
admin
.
v1
.
IExportEntitiesRequest
,
callback
:
Callback<LROperation<protos
.
google
.
datastore
.
admin
.
v1
.
IExportEntitiesResponse
,
protos
.
google
.
datastore
.
admin
.
v1
.
IExportEntitiesMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
protos. google.datastore.admin.v1.IExportEntitiesRequest
callback
Callback
< LROperation
<protos. google.datastore.admin.v1.IExportEntitiesResponse
, protos. google.datastore.admin.v1.IExportEntitiesMetadata
>, protos. google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
getIndex(request, options)
getIndex
(
request
?:
protos
.
google
.
datastore
.
admin
.
v1
.
IGetIndexRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
datastore
.
admin
.
v1
.
IIndex
,
protos
.
google
.
datastore
.
admin
.
v1
.
IGetIndexRequest
|
undefined
,
{}
|
undefined
]>;
request
protos. google.datastore.admin.v1.IGetIndexRequest
options
CallOptions
Promise
<[protos. google.datastore.admin.v1.IIndex
, protos. google.datastore.admin.v1.IGetIndexRequest
| undefined, {} | undefined]>
getIndex(request, options, callback)
getIndex
(
request
:
protos
.
google
.
datastore
.
admin
.
v1
.
IGetIndexRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
datastore
.
admin
.
v1
.
IIndex
,
protos
.
google
.
datastore
.
admin
.
v1
.
IGetIndexRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
protos. google.datastore.admin.v1.IGetIndexRequest
options
CallOptions
callback
Callback
<protos. google.datastore.admin.v1.IIndex
, protos. google.datastore.admin.v1.IGetIndexRequest
| null | undefined, {} | null | undefined>
void
getIndex(request, callback)
getIndex
(
request
:
protos
.
google
.
datastore
.
admin
.
v1
.
IGetIndexRequest
,
callback
:
Callback<protos
.
google
.
datastore
.
admin
.
v1
.
IIndex
,
protos
.
google
.
datastore
.
admin
.
v1
.
IGetIndexRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
protos. google.datastore.admin.v1.IGetIndexRequest
callback
Callback
<protos. google.datastore.admin.v1.IIndex
, protos. google.datastore.admin.v1.IGetIndexRequest
| null | undefined, {} | null | undefined>
void
getProjectId()
getProjectId
()
:
Promise<string>
;
Promise
<string>
getProjectId(callback)
getProjectId
(
callback
:
Callback<string
,
undefined
,
undefined
> )
:
void
;
callback
Callback
<string, undefined, undefined>
void
importEntities(request, options)
importEntities
(
request
?:
protos
.
google
.
datastore
.
admin
.
v1
.
IImportEntitiesRequest
,
options
?:
CallOptions
)
:
Promise
< [
LROperation<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
datastore
.
admin
.
v1
.
IImportEntitiesMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
undefined
,
{}
|
undefined
]>;
request
protos. google.datastore.admin.v1.IImportEntitiesRequest
options
CallOptions
Promise
<[ LROperation
<protos. google.protobuf.IEmpty
, protos. google.datastore.admin.v1.IImportEntitiesMetadata
>, protos. google.longrunning.IOperation
| undefined, {} | undefined]>
importEntities(request, options, callback)
importEntities
(
request
:
protos
.
google
.
datastore
.
admin
.
v1
.
IImportEntitiesRequest
,
options
:
CallOptions
,
callback
:
Callback<LROperation<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
datastore
.
admin
.
v1
.
IImportEntitiesMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
protos. google.datastore.admin.v1.IImportEntitiesRequest
options
CallOptions
callback
Callback
< LROperation
<protos. google.protobuf.IEmpty
, protos. google.datastore.admin.v1.IImportEntitiesMetadata
>, protos. google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
importEntities(request, callback)
importEntities
(
request
:
protos
.
google
.
datastore
.
admin
.
v1
.
IImportEntitiesRequest
,
callback
:
Callback<LROperation<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
datastore
.
admin
.
v1
.
IImportEntitiesMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
protos. google.datastore.admin.v1.IImportEntitiesRequest
callback
Callback
< LROperation
<protos. google.protobuf.IEmpty
, protos. google.datastore.admin.v1.IImportEntitiesMetadata
>, protos. google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
initialize()
initialize
()
:
Promise
< {
[
name
:
string
]
:
Function
;
}>;
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.
Promise
<{
[name: string]: Function
;
}>
{Promise} A promise that resolves to an authenticated service stub.
listIndexes(request, options)
listIndexes
(
request
?:
protos
.
google
.
datastore
.
admin
.
v1
.
IListIndexesRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
datastore
.
admin
.
v1
.
IIndex
[],
protos
.
google
.
datastore
.
admin
.
v1
.
IListIndexesRequest
|
null
,
protos
.
google
.
datastore
.
admin
.
v1
.
IListIndexesResponse
]>;
request
protos. google.datastore.admin.v1.IListIndexesRequest
options
CallOptions
Promise
<[protos. google.datastore.admin.v1.IIndex
[], protos. google.datastore.admin.v1.IListIndexesRequest
| null, protos. google.datastore.admin.v1.IListIndexesResponse
]>
listIndexes(request, options, callback)
listIndexes
(
request
:
protos
.
google
.
datastore
.
admin
.
v1
.
IListIndexesRequest
,
options
:
CallOptions
,
callback
:
PaginationCallback<protos
.
google
.
datastore
.
admin
.
v1
.
IListIndexesRequest
,
protos
.
google
.
datastore
.
admin
.
v1
.
IListIndexesResponse
|
null
|
undefined
,
protos
.
google
.
datastore
.
admin
.
v1
.
IIndex
> )
:
void
;
request
protos. google.datastore.admin.v1.IListIndexesRequest
options
CallOptions
callback
PaginationCallback
<protos. google.datastore.admin.v1.IListIndexesRequest
, protos. google.datastore.admin.v1.IListIndexesResponse
| null | undefined, protos. google.datastore.admin.v1.IIndex
>
void
listIndexes(request, callback)
listIndexes
(
request
:
protos
.
google
.
datastore
.
admin
.
v1
.
IListIndexesRequest
,
callback
:
PaginationCallback<protos
.
google
.
datastore
.
admin
.
v1
.
IListIndexesRequest
,
protos
.
google
.
datastore
.
admin
.
v1
.
IListIndexesResponse
|
null
|
undefined
,
protos
.
google
.
datastore
.
admin
.
v1
.
IIndex
> )
:
void
;
request
protos. google.datastore.admin.v1.IListIndexesRequest
callback
PaginationCallback
<protos. google.datastore.admin.v1.IListIndexesRequest
, protos. google.datastore.admin.v1.IListIndexesResponse
| null | undefined, protos. google.datastore.admin.v1.IIndex
>
void
listIndexesAsync(request, options)
listIndexesAsync
(
request
?:
protos
.
google
.
datastore
.
admin
.
v1
.
IListIndexesRequest
,
options
?:
CallOptions
)
:
AsyncIterable<protos
.
google
.
datastore
.
admin
.
v1
.
IIndex
> ;
Equivalent to listIndexes
, but returns an iterable object.
for
- await
- of
syntax is used with the iterable to get response elements on-demand.
request
protos. google.datastore.admin.v1.IListIndexesRequest
The request object that will be sent.
options
AsyncIterable
<protos. google.datastore.admin.v1.IIndex
>
{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.
const iterable = client.listIndexesAsync(request);
for await (const response of iterable) {
// process response
}
listIndexesStream(request, options)
listIndexesStream
(
request
?:
protos
.
google
.
datastore
.
admin
.
v1
.
IListIndexesRequest
,
options
?:
CallOptions
)
:
Transform
;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
request
protos. google.datastore.admin.v1.IListIndexesRequest
The request object that will be sent.
options
Transform
{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 listIndexesAsync()
method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.