UNPKG

19.6 kBTypeScriptView Raw
1/// <reference types="node" />
2import * as gax from 'google-gax';
3import { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback } from 'google-gax';
4import { Transform } from 'stream';
5import * as protos from '../../protos/protos';
6/**
7 * Google Cloud Datastore Admin API
8 *
9 *
10 * The Datastore Admin API provides several admin services for Cloud Datastore.
11 *
12 * -----------------------------------------------------------------------------
13 * ## Concepts
14 *
15 * Project, namespace, kind, and entity as defined in the Google Cloud Datastore
16 * API.
17 *
18 * Operation: An Operation represents work being performed in the background.
19 *
20 * EntityFilter: Allows specifying a subset of entities in a project. This is
21 * specified as a combination of kinds and namespaces (either or both of which
22 * may be all).
23 *
24 * -----------------------------------------------------------------------------
25 * ## Services
26 *
27 * # Export/Import
28 *
29 * The Export/Import service provides the ability to copy all or a subset of
30 * entities to/from Google Cloud Storage.
31 *
32 * Exported data may be imported into Cloud Datastore for any Google Cloud
33 * Platform project. It is not restricted to the export source project. It is
34 * possible to export from one project and then import into another.
35 *
36 * Exported data can also be loaded into Google BigQuery for analysis.
37 *
38 * Exports and imports are performed asynchronously. An Operation resource is
39 * created for each export/import. The state (including any errors encountered)
40 * of the export/import may be queried via the Operation resource.
41 *
42 * # Index
43 *
44 * The index service manages Cloud Datastore composite indexes.
45 *
46 * Index creation and deletion are performed asynchronously.
47 * An Operation resource is created for each such asynchronous operation.
48 * The state of the operation (including any errors encountered)
49 * may be queried via the Operation resource.
50 *
51 * # Operation
52 *
53 * The Operations collection provides a record of actions performed for the
54 * specified project (including any operations in progress). Operations are not
55 * created directly but through calls on other collections or resources.
56 *
57 * An operation that is not yet done may be cancelled. The request to cancel is
58 * asynchronous and the operation may continue to run for some time after the
59 * request to cancel is made.
60 *
61 * An operation that is done may be deleted so that it is no longer listed as
62 * part of the Operation collection.
63 *
64 * ListOperations returns all pending operations, but not completed operations.
65 *
66 * Operations are created by service DatastoreAdmin,
67 * but are accessed via service google.longrunning.Operations.
68 * @class
69 * @memberof v1
70 */
71export declare class DatastoreAdminClient {
72 private _terminated;
73 private _opts;
74 private _providedCustomServicePath;
75 private _gaxModule;
76 private _gaxGrpc;
77 private _protos;
78 private _defaults;
79 auth: gax.GoogleAuth;
80 descriptors: Descriptors;
81 warn: (code: string, message: string, warnType?: string) => void;
82 innerApiCalls: {
83 [name: string]: Function;
84 };
85 operationsClient: gax.OperationsClient;
86 datastoreAdminStub?: Promise<{
87 [name: string]: Function;
88 }>;
89 /**
90 * Construct an instance of DatastoreAdminClient.
91 *
92 * @param {object} [options] - The configuration object.
93 * The options accepted by the constructor are described in detail
94 * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
95 * The common options are:
96 * @param {object} [options.credentials] - Credentials object.
97 * @param {string} [options.credentials.client_email]
98 * @param {string} [options.credentials.private_key]
99 * @param {string} [options.email] - Account email address. Required when
100 * using a .pem or .p12 keyFilename.
101 * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
102 * .p12 key downloaded from the Google Developers Console. If you provide
103 * a path to a JSON file, the projectId option below is not necessary.
104 * NOTE: .pem and .p12 require you to specify options.email as well.
105 * @param {number} [options.port] - The port on which to connect to
106 * the remote host.
107 * @param {string} [options.projectId] - The project ID from the Google
108 * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
109 * the environment variable GCLOUD_PROJECT for your project ID. If your
110 * app is running in an environment which supports
111 * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
112 * your project ID will be detected automatically.
113 * @param {string} [options.apiEndpoint] - The domain name of the
114 * API remote host.
115 * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
116 * Follows the structure of {@link gapicConfig}.
117 * @param {boolean} [options.fallback] - Use HTTP fallback mode.
118 * In fallback mode, a special browser-compatible transport implementation is used
119 * instead of gRPC transport. In browser context (if the `window` object is defined)
120 * the fallback mode is enabled automatically; set `options.fallback` to `false`
121 * if you need to override this behavior.
122 */
123 constructor(opts?: ClientOptions);
124 /**
125 * Initialize the client.
126 * Performs asynchronous operations (such as authentication) and prepares the client.
127 * This function will be called automatically when any class method is called for the
128 * first time, but if you need to initialize it before calling an actual method,
129 * feel free to call initialize() directly.
130 *
131 * You can await on this method if you want to make sure the client is initialized.
132 *
133 * @returns {Promise} A promise that resolves to an authenticated service stub.
134 */
135 initialize(): Promise<{
136 [name: string]: Function;
137 }>;
138 /**
139 * The DNS address for this API service.
140 * @returns {string} The DNS address for this service.
141 */
142 static get servicePath(): string;
143 /**
144 * The DNS address for this API service - same as servicePath(),
145 * exists for compatibility reasons.
146 * @returns {string} The DNS address for this service.
147 */
148 static get apiEndpoint(): string;
149 /**
150 * The port for this API service.
151 * @returns {number} The default port for this service.
152 */
153 static get port(): number;
154 /**
155 * The scopes needed to make gRPC calls for every method defined
156 * in this service.
157 * @returns {string[]} List of default scopes.
158 */
159 static get scopes(): string[];
160 getProjectId(): Promise<string>;
161 getProjectId(callback: Callback<string, undefined, undefined>): void;
162 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]>;
163 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;
164 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;
165 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]>;
166 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;
167 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;
168 /**
169 * Check the status of the long running operation returned by `exportEntities()`.
170 * @param {String} name
171 * The operation name that will be passed.
172 * @returns {Promise} - The promise which resolves to an object.
173 * The decoded operation object has result and metadata field to get information from.
174 * Please see the
175 * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
176 * for more details and examples.
177 * @example
178 * ```
179 * const decodedOperation = await checkExportEntitiesProgress(name);
180 * console.log(decodedOperation.result);
181 * console.log(decodedOperation.done);
182 * console.log(decodedOperation.metadata);
183 * ```
184 */
185 checkExportEntitiesProgress(name: string): Promise<LROperation<protos.google.datastore.admin.v1.ExportEntitiesResponse, protos.google.datastore.admin.v1.ExportEntitiesMetadata>>;
186 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]>;
187 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;
188 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;
189 /**
190 * Check the status of the long running operation returned by `importEntities()`.
191 * @param {String} name
192 * The operation name that will be passed.
193 * @returns {Promise} - The promise which resolves to an object.
194 * The decoded operation object has result and metadata field to get information from.
195 * Please see the
196 * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
197 * for more details and examples.
198 * @example
199 * ```
200 * const decodedOperation = await checkImportEntitiesProgress(name);
201 * console.log(decodedOperation.result);
202 * console.log(decodedOperation.done);
203 * console.log(decodedOperation.metadata);
204 * ```
205 */
206 checkImportEntitiesProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.datastore.admin.v1.ImportEntitiesMetadata>>;
207 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]>;
208 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;
209 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;
210 /**
211 * Check the status of the long running operation returned by `createIndex()`.
212 * @param {String} name
213 * The operation name that will be passed.
214 * @returns {Promise} - The promise which resolves to an object.
215 * The decoded operation object has result and metadata field to get information from.
216 * Please see the
217 * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
218 * for more details and examples.
219 * @example
220 * ```
221 * const decodedOperation = await checkCreateIndexProgress(name);
222 * console.log(decodedOperation.result);
223 * console.log(decodedOperation.done);
224 * console.log(decodedOperation.metadata);
225 * ```
226 */
227 checkCreateIndexProgress(name: string): Promise<LROperation<protos.google.datastore.admin.v1.Index, protos.google.datastore.admin.v1.IndexOperationMetadata>>;
228 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]>;
229 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;
230 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;
231 /**
232 * Check the status of the long running operation returned by `deleteIndex()`.
233 * @param {String} name
234 * The operation name that will be passed.
235 * @returns {Promise} - The promise which resolves to an object.
236 * The decoded operation object has result and metadata field to get information from.
237 * Please see the
238 * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
239 * for more details and examples.
240 * @example
241 * ```
242 * const decodedOperation = await checkDeleteIndexProgress(name);
243 * console.log(decodedOperation.result);
244 * console.log(decodedOperation.done);
245 * console.log(decodedOperation.metadata);
246 * ```
247 */
248 checkDeleteIndexProgress(name: string): Promise<LROperation<protos.google.datastore.admin.v1.Index, protos.google.datastore.admin.v1.IndexOperationMetadata>>;
249 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]>;
250 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;
251 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;
252 /**
253 * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object.
254 * @param {Object} request
255 * The request object that will be sent.
256 * @param {string} request.projectId
257 * Project ID against which to make the request.
258 * @param {string} request.filter
259 * @param {number} request.pageSize
260 * The maximum number of items to return. If zero, then all results will be
261 * returned.
262 * @param {string} request.pageToken
263 * The next_page_token value returned from a previous List request, if any.
264 * @param {object} [options]
265 * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
266 * @returns {Stream}
267 * An object stream which emits an object representing [Index]{@link google.datastore.admin.v1.Index} on 'data' event.
268 * The client library will perform auto-pagination by default: it will call the API as many
269 * times as needed. Note that it can affect your quota.
270 * We recommend using `listIndexesAsync()`
271 * method described below for async iteration which you can stop as needed.
272 * Please see the
273 * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
274 * for more details and examples.
275 */
276 listIndexesStream(request?: protos.google.datastore.admin.v1.IListIndexesRequest, options?: CallOptions): Transform;
277 /**
278 * Equivalent to `listIndexes`, but returns an iterable object.
279 *
280 * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
281 * @param {Object} request
282 * The request object that will be sent.
283 * @param {string} request.projectId
284 * Project ID against which to make the request.
285 * @param {string} request.filter
286 * @param {number} request.pageSize
287 * The maximum number of items to return. If zero, then all results will be
288 * returned.
289 * @param {string} request.pageToken
290 * The next_page_token value returned from a previous List request, if any.
291 * @param {object} [options]
292 * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
293 * @returns {Object}
294 * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
295 * When you iterate the returned iterable, each element will be an object representing
296 * [Index]{@link google.datastore.admin.v1.Index}. The API will be called under the hood as needed, once per the page,
297 * so you can stop the iteration when you don't need more results.
298 * Please see the
299 * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
300 * for more details and examples.
301 * @example
302 * ```
303 * const iterable = client.listIndexesAsync(request);
304 * for await (const response of iterable) {
305 * // process response
306 * }
307 * ```
308 */
309 listIndexesAsync(request?: protos.google.datastore.admin.v1.IListIndexesRequest, options?: CallOptions): AsyncIterable<protos.google.datastore.admin.v1.IIndex>;
310 /**
311 * Terminate the gRPC channel and close the client.
312 *
313 * The client will no longer be usable and all future behavior is undefined.
314 * @returns {Promise} A promise that resolves when the client is closed.
315 */
316 close(): Promise<void>;
317}