Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: generated/googleapis/lib/spanner/v1.dart

Issue 2734843002: Api-roll 46: 2017-03-06 (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « generated/googleapis/lib/sourcerepo/v1.dart ('k') | generated/googleapis/lib/storage/v1.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // This is a generated file (see the discoveryapis_generator project).
2
3 library googleapis.spanner.v1;
4
5 import 'dart:core' as core;
6 import 'dart:async' as async;
7 import 'dart:convert' as convert;
8
9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons;
10 import 'package:http/http.dart' as http;
11
12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show
13 ApiRequestError, DetailedApiRequestError;
14
15 const core.String USER_AGENT = 'dart-api-client spanner/v1';
16
17 /**
18 * Cloud Spanner is a managed, mission-critical, globally consistent and
19 * scalable relational database service.
20 */
21 class SpannerApi {
22 /** View and manage your data across Google Cloud Platform services */
23 static const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platf orm";
24
25
26 final commons.ApiRequester _requester;
27
28 ProjectsResourceApi get projects => new ProjectsResourceApi(_requester);
29
30 SpannerApi(http.Client client, {core.String rootUrl: "https://spanner.googleap is.com/", core.String servicePath: ""}) :
31 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A GENT);
32 }
33
34
35 class ProjectsResourceApi {
36 final commons.ApiRequester _requester;
37
38 ProjectsInstanceConfigsResourceApi get instanceConfigs => new ProjectsInstance ConfigsResourceApi(_requester);
39 ProjectsInstancesResourceApi get instances => new ProjectsInstancesResourceApi (_requester);
40
41 ProjectsResourceApi(commons.ApiRequester client) :
42 _requester = client;
43 }
44
45
46 class ProjectsInstanceConfigsResourceApi {
47 final commons.ApiRequester _requester;
48
49 ProjectsInstanceConfigsResourceApi(commons.ApiRequester client) :
50 _requester = client;
51
52 /**
53 * Gets information about a particular instance configuration.
54 *
55 * Request parameters:
56 *
57 * [name] - Required. The name of the requested instance configuration. Values
58 * are of
59 * the form `projects/<project>/instanceConfigs/<config>`.
60 * Value must have pattern "^projects/[^/]+/instanceConfigs/[^/]+$".
61 *
62 * Completes with a [InstanceConfig].
63 *
64 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
65 * error.
66 *
67 * If the used [http.Client] completes with an error when making a REST call,
68 * this method will complete with the same error.
69 */
70 async.Future<InstanceConfig> get(core.String name) {
71 var _url = null;
72 var _queryParams = new core.Map();
73 var _uploadMedia = null;
74 var _uploadOptions = null;
75 var _downloadOptions = commons.DownloadOptions.Metadata;
76 var _body = null;
77
78 if (name == null) {
79 throw new core.ArgumentError("Parameter name is required.");
80 }
81
82 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name');
83
84 var _response = _requester.request(_url,
85 "GET",
86 body: _body,
87 queryParams: _queryParams,
88 uploadOptions: _uploadOptions,
89 uploadMedia: _uploadMedia,
90 downloadOptions: _downloadOptions);
91 return _response.then((data) => new InstanceConfig.fromJson(data));
92 }
93
94 /**
95 * Lists the supported instance configurations for a given project.
96 *
97 * Request parameters:
98 *
99 * [parent] - Required. The name of the project for which a list of supported
100 * instance
101 * configurations is requested. Values are of the form
102 * `projects/<project>`.
103 * Value must have pattern "^projects/[^/]+$".
104 *
105 * [pageToken] - If non-empty, `page_token` should contain a
106 * next_page_token
107 * from a previous ListInstanceConfigsResponse.
108 *
109 * [pageSize] - Number of instance configurations to be returned in the
110 * response. If 0 or
111 * less, defaults to the server's maximum allowed page size.
112 *
113 * Completes with a [ListInstanceConfigsResponse].
114 *
115 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
116 * error.
117 *
118 * If the used [http.Client] completes with an error when making a REST call,
119 * this method will complete with the same error.
120 */
121 async.Future<ListInstanceConfigsResponse> list(core.String parent, {core.Strin g pageToken, core.int pageSize}) {
122 var _url = null;
123 var _queryParams = new core.Map();
124 var _uploadMedia = null;
125 var _uploadOptions = null;
126 var _downloadOptions = commons.DownloadOptions.Metadata;
127 var _body = null;
128
129 if (parent == null) {
130 throw new core.ArgumentError("Parameter parent is required.");
131 }
132 if (pageToken != null) {
133 _queryParams["pageToken"] = [pageToken];
134 }
135 if (pageSize != null) {
136 _queryParams["pageSize"] = ["${pageSize}"];
137 }
138
139 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$parent') + '/instance Configs';
140
141 var _response = _requester.request(_url,
142 "GET",
143 body: _body,
144 queryParams: _queryParams,
145 uploadOptions: _uploadOptions,
146 uploadMedia: _uploadMedia,
147 downloadOptions: _downloadOptions);
148 return _response.then((data) => new ListInstanceConfigsResponse.fromJson(dat a));
149 }
150
151 }
152
153
154 class ProjectsInstancesResourceApi {
155 final commons.ApiRequester _requester;
156
157 ProjectsInstancesDatabasesResourceApi get databases => new ProjectsInstancesDa tabasesResourceApi(_requester);
158 ProjectsInstancesOperationsResourceApi get operations => new ProjectsInstances OperationsResourceApi(_requester);
159
160 ProjectsInstancesResourceApi(commons.ApiRequester client) :
161 _requester = client;
162
163 /**
164 * Creates an instance and begins preparing it to begin serving. The
165 * returned long-running operation
166 * can be used to track the progress of preparing the new
167 * instance. The instance name is assigned by the caller. If the
168 * named instance already exists, `CreateInstance` returns
169 * `ALREADY_EXISTS`.
170 *
171 * Immediately upon completion of this request:
172 *
173 * * The instance is readable via the API, with all requested attributes
174 * but no allocated resources. Its state is `CREATING`.
175 *
176 * Until completion of the returned operation:
177 *
178 * * Cancelling the operation renders the instance immediately unreadable
179 * via the API.
180 * * The instance can be deleted.
181 * * All other attempts to modify the instance are rejected.
182 *
183 * Upon completion of the returned operation:
184 *
185 * * Billing for all successfully-allocated resources begins (some types
186 * may have lower than the requested levels).
187 * * Databases can be created in the instance.
188 * * The instance's allocated resource levels are readable via the API.
189 * * The instance's state becomes `READY`.
190 *
191 * The returned long-running operation will
192 * have a name of the format `<instance_name>/operations/<operation_id>` and
193 * can be used to track creation of the instance. The
194 * metadata field type is
195 * CreateInstanceMetadata.
196 * The response field type is
197 * Instance, if successful.
198 *
199 * [request] - The metadata request object.
200 *
201 * Request parameters:
202 *
203 * [parent] - Required. The name of the project in which to create the
204 * instance. Values
205 * are of the form `projects/<project>`.
206 * Value must have pattern "^projects/[^/]+$".
207 *
208 * Completes with a [Operation].
209 *
210 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
211 * error.
212 *
213 * If the used [http.Client] completes with an error when making a REST call,
214 * this method will complete with the same error.
215 */
216 async.Future<Operation> create(CreateInstanceRequest request, core.String pare nt) {
217 var _url = null;
218 var _queryParams = new core.Map();
219 var _uploadMedia = null;
220 var _uploadOptions = null;
221 var _downloadOptions = commons.DownloadOptions.Metadata;
222 var _body = null;
223
224 if (request != null) {
225 _body = convert.JSON.encode((request).toJson());
226 }
227 if (parent == null) {
228 throw new core.ArgumentError("Parameter parent is required.");
229 }
230
231 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$parent') + '/instance s';
232
233 var _response = _requester.request(_url,
234 "POST",
235 body: _body,
236 queryParams: _queryParams,
237 uploadOptions: _uploadOptions,
238 uploadMedia: _uploadMedia,
239 downloadOptions: _downloadOptions);
240 return _response.then((data) => new Operation.fromJson(data));
241 }
242
243 /**
244 * Deletes an instance.
245 *
246 * Immediately upon completion of the request:
247 *
248 * * Billing ceases for all of the instance's reserved resources.
249 *
250 * Soon afterward:
251 *
252 * * The instance and *all of its databases* immediately and
253 * irrevocably disappear from the API. All data in the databases
254 * is permanently deleted.
255 *
256 * Request parameters:
257 *
258 * [name] - Required. The name of the instance to be deleted. Values are of
259 * the form
260 * `projects/<project>/instances/<instance>`
261 * Value must have pattern "^projects/[^/]+/instances/[^/]+$".
262 *
263 * Completes with a [Empty].
264 *
265 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
266 * error.
267 *
268 * If the used [http.Client] completes with an error when making a REST call,
269 * this method will complete with the same error.
270 */
271 async.Future<Empty> delete(core.String name) {
272 var _url = null;
273 var _queryParams = new core.Map();
274 var _uploadMedia = null;
275 var _uploadOptions = null;
276 var _downloadOptions = commons.DownloadOptions.Metadata;
277 var _body = null;
278
279 if (name == null) {
280 throw new core.ArgumentError("Parameter name is required.");
281 }
282
283 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name');
284
285 var _response = _requester.request(_url,
286 "DELETE",
287 body: _body,
288 queryParams: _queryParams,
289 uploadOptions: _uploadOptions,
290 uploadMedia: _uploadMedia,
291 downloadOptions: _downloadOptions);
292 return _response.then((data) => new Empty.fromJson(data));
293 }
294
295 /**
296 * Gets information about a particular instance.
297 *
298 * Request parameters:
299 *
300 * [name] - Required. The name of the requested instance. Values are of the
301 * form
302 * `projects/<project>/instances/<instance>`.
303 * Value must have pattern "^projects/[^/]+/instances/[^/]+$".
304 *
305 * Completes with a [Instance].
306 *
307 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
308 * error.
309 *
310 * If the used [http.Client] completes with an error when making a REST call,
311 * this method will complete with the same error.
312 */
313 async.Future<Instance> get(core.String name) {
314 var _url = null;
315 var _queryParams = new core.Map();
316 var _uploadMedia = null;
317 var _uploadOptions = null;
318 var _downloadOptions = commons.DownloadOptions.Metadata;
319 var _body = null;
320
321 if (name == null) {
322 throw new core.ArgumentError("Parameter name is required.");
323 }
324
325 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name');
326
327 var _response = _requester.request(_url,
328 "GET",
329 body: _body,
330 queryParams: _queryParams,
331 uploadOptions: _uploadOptions,
332 uploadMedia: _uploadMedia,
333 downloadOptions: _downloadOptions);
334 return _response.then((data) => new Instance.fromJson(data));
335 }
336
337 /**
338 * Gets the access control policy for an instance resource. Returns an empty
339 * policy if an instance exists but does not have a policy set.
340 *
341 * Authorization requires `spanner.instances.getIamPolicy` on
342 * resource.
343 *
344 * [request] - The metadata request object.
345 *
346 * Request parameters:
347 *
348 * [resource] - REQUIRED: The Cloud Spanner resource for which the policy is
349 * being retrieved. The format is `projects/<project ID>/instances/<instance
350 * ID>` for instance resources and `projects/<project ID>/instances/<instance
351 * ID>/databases/<database ID>` for database resources.
352 * Value must have pattern "^projects/[^/]+/instances/[^/]+$".
353 *
354 * Completes with a [Policy].
355 *
356 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
357 * error.
358 *
359 * If the used [http.Client] completes with an error when making a REST call,
360 * this method will complete with the same error.
361 */
362 async.Future<Policy> getIamPolicy(GetIamPolicyRequest request, core.String res ource) {
363 var _url = null;
364 var _queryParams = new core.Map();
365 var _uploadMedia = null;
366 var _uploadOptions = null;
367 var _downloadOptions = commons.DownloadOptions.Metadata;
368 var _body = null;
369
370 if (request != null) {
371 _body = convert.JSON.encode((request).toJson());
372 }
373 if (resource == null) {
374 throw new core.ArgumentError("Parameter resource is required.");
375 }
376
377 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$resource') + ':getIam Policy';
378
379 var _response = _requester.request(_url,
380 "POST",
381 body: _body,
382 queryParams: _queryParams,
383 uploadOptions: _uploadOptions,
384 uploadMedia: _uploadMedia,
385 downloadOptions: _downloadOptions);
386 return _response.then((data) => new Policy.fromJson(data));
387 }
388
389 /**
390 * Lists all instances in the given project.
391 *
392 * Request parameters:
393 *
394 * [parent] - Required. The name of the project for which a list of instances
395 * is
396 * requested. Values are of the form `projects/<project>`.
397 * Value must have pattern "^projects/[^/]+$".
398 *
399 * [pageToken] - If non-empty, `page_token` should contain a
400 * next_page_token from a
401 * previous ListInstancesResponse.
402 *
403 * [pageSize] - Number of instances to be returned in the response. If 0 or
404 * less, defaults
405 * to the server's maximum allowed page size.
406 *
407 * [filter] - An expression for filtering the results of the request. Filter
408 * rules are
409 * case insensitive. The fields eligible for filtering are:
410 *
411 * * name
412 * * display_name
413 * * labels.key where key is the name of a label
414 *
415 * Some examples of using filters are:
416 *
417 * * name:* --> The instance has a name.
418 * * name:Howl --> The instance's name contains the string "howl".
419 * * name:HOWL --> Equivalent to above.
420 * * NAME:howl --> Equivalent to above.
421 * * labels.env:* --> The instance has the label "env".
422 * * labels.env:dev --> The instance has the label "env" and the value of
423 * the label contains the string "dev".
424 * * name:howl labels.env:dev --> The instance's name contains "howl" and
425 * it has the label "env" with its value
426 * containing "dev".
427 *
428 * Completes with a [ListInstancesResponse].
429 *
430 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
431 * error.
432 *
433 * If the used [http.Client] completes with an error when making a REST call,
434 * this method will complete with the same error.
435 */
436 async.Future<ListInstancesResponse> list(core.String parent, {core.String page Token, core.int pageSize, core.String filter}) {
437 var _url = null;
438 var _queryParams = new core.Map();
439 var _uploadMedia = null;
440 var _uploadOptions = null;
441 var _downloadOptions = commons.DownloadOptions.Metadata;
442 var _body = null;
443
444 if (parent == null) {
445 throw new core.ArgumentError("Parameter parent is required.");
446 }
447 if (pageToken != null) {
448 _queryParams["pageToken"] = [pageToken];
449 }
450 if (pageSize != null) {
451 _queryParams["pageSize"] = ["${pageSize}"];
452 }
453 if (filter != null) {
454 _queryParams["filter"] = [filter];
455 }
456
457 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$parent') + '/instance s';
458
459 var _response = _requester.request(_url,
460 "GET",
461 body: _body,
462 queryParams: _queryParams,
463 uploadOptions: _uploadOptions,
464 uploadMedia: _uploadMedia,
465 downloadOptions: _downloadOptions);
466 return _response.then((data) => new ListInstancesResponse.fromJson(data));
467 }
468
469 /**
470 * Updates an instance, and begins allocating or releasing resources
471 * as requested. The returned long-running
472 * operation can be used to track the
473 * progress of updating the instance. If the named instance does not
474 * exist, returns `NOT_FOUND`.
475 *
476 * Immediately upon completion of this request:
477 *
478 * * For resource types for which a decrease in the instance's allocation
479 * has been requested, billing is based on the newly-requested level.
480 *
481 * Until completion of the returned operation:
482 *
483 * * Cancelling the operation sets its metadata's
484 * cancel_time, and begins
485 * restoring resources to their pre-request values. The operation
486 * is guaranteed to succeed at undoing all resource changes,
487 * after which point it terminates with a `CANCELLED` status.
488 * * All other attempts to modify the instance are rejected.
489 * * Reading the instance via the API continues to give the pre-request
490 * resource levels.
491 *
492 * Upon completion of the returned operation:
493 *
494 * * Billing begins for all successfully-allocated resources (some types
495 * may have lower than the requested levels).
496 * * All newly-reserved resources are available for serving the instance's
497 * tables.
498 * * The instance's new resource levels are readable via the API.
499 *
500 * The returned long-running operation will
501 * have a name of the format `<instance_name>/operations/<operation_id>` and
502 * can be used to track the instance modification. The
503 * metadata field type is
504 * UpdateInstanceMetadata.
505 * The response field type is
506 * Instance, if successful.
507 *
508 * Authorization requires `spanner.instances.update` permission on
509 * resource name.
510 *
511 * [request] - The metadata request object.
512 *
513 * Request parameters:
514 *
515 * [name] - Required. A unique identifier for the instance, which cannot be
516 * changed
517 * after the instance is created. Values are of the form
518 * `projects/<project>/instances/a-z*[a-z0-9]`. The final
519 * segment of the name must be between 6 and 30 characters in length.
520 * Value must have pattern "^projects/[^/]+/instances/[^/]+$".
521 *
522 * Completes with a [Operation].
523 *
524 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
525 * error.
526 *
527 * If the used [http.Client] completes with an error when making a REST call,
528 * this method will complete with the same error.
529 */
530 async.Future<Operation> patch(UpdateInstanceRequest request, core.String name) {
531 var _url = null;
532 var _queryParams = new core.Map();
533 var _uploadMedia = null;
534 var _uploadOptions = null;
535 var _downloadOptions = commons.DownloadOptions.Metadata;
536 var _body = null;
537
538 if (request != null) {
539 _body = convert.JSON.encode((request).toJson());
540 }
541 if (name == null) {
542 throw new core.ArgumentError("Parameter name is required.");
543 }
544
545 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name');
546
547 var _response = _requester.request(_url,
548 "PATCH",
549 body: _body,
550 queryParams: _queryParams,
551 uploadOptions: _uploadOptions,
552 uploadMedia: _uploadMedia,
553 downloadOptions: _downloadOptions);
554 return _response.then((data) => new Operation.fromJson(data));
555 }
556
557 /**
558 * Sets the access control policy on an instance resource. Replaces any
559 * existing policy.
560 *
561 * Authorization requires `spanner.instances.setIamPolicy` on
562 * resource.
563 *
564 * [request] - The metadata request object.
565 *
566 * Request parameters:
567 *
568 * [resource] - REQUIRED: The Cloud Spanner resource for which the policy is
569 * being set. The format is `projects/<project ID>/instances/<instance ID>`
570 * for instance resources and `projects/<project ID>/instances/<instance
571 * ID>/databases/<database ID>` for databases resources.
572 * Value must have pattern "^projects/[^/]+/instances/[^/]+$".
573 *
574 * Completes with a [Policy].
575 *
576 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
577 * error.
578 *
579 * If the used [http.Client] completes with an error when making a REST call,
580 * this method will complete with the same error.
581 */
582 async.Future<Policy> setIamPolicy(SetIamPolicyRequest request, core.String res ource) {
583 var _url = null;
584 var _queryParams = new core.Map();
585 var _uploadMedia = null;
586 var _uploadOptions = null;
587 var _downloadOptions = commons.DownloadOptions.Metadata;
588 var _body = null;
589
590 if (request != null) {
591 _body = convert.JSON.encode((request).toJson());
592 }
593 if (resource == null) {
594 throw new core.ArgumentError("Parameter resource is required.");
595 }
596
597 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$resource') + ':setIam Policy';
598
599 var _response = _requester.request(_url,
600 "POST",
601 body: _body,
602 queryParams: _queryParams,
603 uploadOptions: _uploadOptions,
604 uploadMedia: _uploadMedia,
605 downloadOptions: _downloadOptions);
606 return _response.then((data) => new Policy.fromJson(data));
607 }
608
609 /**
610 * Returns permissions that the caller has on the specified instance resource.
611 *
612 * Attempting this RPC on a non-existent Cloud Spanner instance resource will
613 * result in a NOT_FOUND error if the user has `spanner.instances.list`
614 * permission on the containing Google Cloud Project. Otherwise returns an
615 * empty set of permissions.
616 *
617 * [request] - The metadata request object.
618 *
619 * Request parameters:
620 *
621 * [resource] - REQUIRED: The Cloud Spanner resource for which permissions are
622 * being tested. The format is `projects/<project ID>/instances/<instance ID>`
623 * for instance resources and `projects/<project ID>/instances/<instance
624 * ID>/databases/<database ID>` for database resources.
625 * Value must have pattern "^projects/[^/]+/instances/[^/]+$".
626 *
627 * Completes with a [TestIamPermissionsResponse].
628 *
629 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
630 * error.
631 *
632 * If the used [http.Client] completes with an error when making a REST call,
633 * this method will complete with the same error.
634 */
635 async.Future<TestIamPermissionsResponse> testIamPermissions(TestIamPermissions Request request, core.String resource) {
636 var _url = null;
637 var _queryParams = new core.Map();
638 var _uploadMedia = null;
639 var _uploadOptions = null;
640 var _downloadOptions = commons.DownloadOptions.Metadata;
641 var _body = null;
642
643 if (request != null) {
644 _body = convert.JSON.encode((request).toJson());
645 }
646 if (resource == null) {
647 throw new core.ArgumentError("Parameter resource is required.");
648 }
649
650 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$resource') + ':testIa mPermissions';
651
652 var _response = _requester.request(_url,
653 "POST",
654 body: _body,
655 queryParams: _queryParams,
656 uploadOptions: _uploadOptions,
657 uploadMedia: _uploadMedia,
658 downloadOptions: _downloadOptions);
659 return _response.then((data) => new TestIamPermissionsResponse.fromJson(data ));
660 }
661
662 }
663
664
665 class ProjectsInstancesDatabasesResourceApi {
666 final commons.ApiRequester _requester;
667
668 ProjectsInstancesDatabasesOperationsResourceApi get operations => new Projects InstancesDatabasesOperationsResourceApi(_requester);
669 ProjectsInstancesDatabasesSessionsResourceApi get sessions => new ProjectsInst ancesDatabasesSessionsResourceApi(_requester);
670
671 ProjectsInstancesDatabasesResourceApi(commons.ApiRequester client) :
672 _requester = client;
673
674 /**
675 * Creates a new Cloud Spanner database and starts to prepare it for serving.
676 * The returned long-running operation will
677 * have a name of the format `<database_name>/operations/<operation_id>` and
678 * can be used to track preparation of the database. The
679 * metadata field type is
680 * CreateDatabaseMetadata. The
681 * response field type is
682 * Database, if successful.
683 *
684 * [request] - The metadata request object.
685 *
686 * Request parameters:
687 *
688 * [parent] - Required. The name of the instance that will serve the new
689 * database.
690 * Values are of the form `projects/<project>/instances/<instance>`.
691 * Value must have pattern "^projects/[^/]+/instances/[^/]+$".
692 *
693 * Completes with a [Operation].
694 *
695 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
696 * error.
697 *
698 * If the used [http.Client] completes with an error when making a REST call,
699 * this method will complete with the same error.
700 */
701 async.Future<Operation> create(CreateDatabaseRequest request, core.String pare nt) {
702 var _url = null;
703 var _queryParams = new core.Map();
704 var _uploadMedia = null;
705 var _uploadOptions = null;
706 var _downloadOptions = commons.DownloadOptions.Metadata;
707 var _body = null;
708
709 if (request != null) {
710 _body = convert.JSON.encode((request).toJson());
711 }
712 if (parent == null) {
713 throw new core.ArgumentError("Parameter parent is required.");
714 }
715
716 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$parent') + '/database s';
717
718 var _response = _requester.request(_url,
719 "POST",
720 body: _body,
721 queryParams: _queryParams,
722 uploadOptions: _uploadOptions,
723 uploadMedia: _uploadMedia,
724 downloadOptions: _downloadOptions);
725 return _response.then((data) => new Operation.fromJson(data));
726 }
727
728 /**
729 * Drops (aka deletes) a Cloud Spanner database.
730 *
731 * Request parameters:
732 *
733 * [database] - Required. The database to be dropped.
734 * Value must have pattern "^projects/[^/]+/instances/[^/]+/databases/[^/]+$".
735 *
736 * Completes with a [Empty].
737 *
738 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
739 * error.
740 *
741 * If the used [http.Client] completes with an error when making a REST call,
742 * this method will complete with the same error.
743 */
744 async.Future<Empty> dropDatabase(core.String database) {
745 var _url = null;
746 var _queryParams = new core.Map();
747 var _uploadMedia = null;
748 var _uploadOptions = null;
749 var _downloadOptions = commons.DownloadOptions.Metadata;
750 var _body = null;
751
752 if (database == null) {
753 throw new core.ArgumentError("Parameter database is required.");
754 }
755
756 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$database');
757
758 var _response = _requester.request(_url,
759 "DELETE",
760 body: _body,
761 queryParams: _queryParams,
762 uploadOptions: _uploadOptions,
763 uploadMedia: _uploadMedia,
764 downloadOptions: _downloadOptions);
765 return _response.then((data) => new Empty.fromJson(data));
766 }
767
768 /**
769 * Gets the state of a Cloud Spanner database.
770 *
771 * Request parameters:
772 *
773 * [name] - Required. The name of the requested database. Values are of the
774 * form
775 * `projects/<project>/instances/<instance>/databases/<database>`.
776 * Value must have pattern "^projects/[^/]+/instances/[^/]+/databases/[^/]+$".
777 *
778 * Completes with a [Database].
779 *
780 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
781 * error.
782 *
783 * If the used [http.Client] completes with an error when making a REST call,
784 * this method will complete with the same error.
785 */
786 async.Future<Database> get(core.String name) {
787 var _url = null;
788 var _queryParams = new core.Map();
789 var _uploadMedia = null;
790 var _uploadOptions = null;
791 var _downloadOptions = commons.DownloadOptions.Metadata;
792 var _body = null;
793
794 if (name == null) {
795 throw new core.ArgumentError("Parameter name is required.");
796 }
797
798 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name');
799
800 var _response = _requester.request(_url,
801 "GET",
802 body: _body,
803 queryParams: _queryParams,
804 uploadOptions: _uploadOptions,
805 uploadMedia: _uploadMedia,
806 downloadOptions: _downloadOptions);
807 return _response.then((data) => new Database.fromJson(data));
808 }
809
810 /**
811 * Returns the schema of a Cloud Spanner database as a list of formatted
812 * DDL statements. This method does not show pending schema updates, those may
813 * be queried using the Operations API.
814 *
815 * Request parameters:
816 *
817 * [database] - Required. The database whose schema we wish to get.
818 * Value must have pattern "^projects/[^/]+/instances/[^/]+/databases/[^/]+$".
819 *
820 * Completes with a [GetDatabaseDdlResponse].
821 *
822 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
823 * error.
824 *
825 * If the used [http.Client] completes with an error when making a REST call,
826 * this method will complete with the same error.
827 */
828 async.Future<GetDatabaseDdlResponse> getDdl(core.String database) {
829 var _url = null;
830 var _queryParams = new core.Map();
831 var _uploadMedia = null;
832 var _uploadOptions = null;
833 var _downloadOptions = commons.DownloadOptions.Metadata;
834 var _body = null;
835
836 if (database == null) {
837 throw new core.ArgumentError("Parameter database is required.");
838 }
839
840 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$database') + '/ddl';
841
842 var _response = _requester.request(_url,
843 "GET",
844 body: _body,
845 queryParams: _queryParams,
846 uploadOptions: _uploadOptions,
847 uploadMedia: _uploadMedia,
848 downloadOptions: _downloadOptions);
849 return _response.then((data) => new GetDatabaseDdlResponse.fromJson(data));
850 }
851
852 /**
853 * Gets the access control policy for a database resource. Returns an empty
854 * policy if a database exists but does not have a policy set.
855 *
856 * Authorization requires `spanner.databases.getIamPolicy` permission on
857 * resource.
858 *
859 * [request] - The metadata request object.
860 *
861 * Request parameters:
862 *
863 * [resource] - REQUIRED: The Cloud Spanner resource for which the policy is
864 * being retrieved. The format is `projects/<project ID>/instances/<instance
865 * ID>` for instance resources and `projects/<project ID>/instances/<instance
866 * ID>/databases/<database ID>` for database resources.
867 * Value must have pattern "^projects/[^/]+/instances/[^/]+/databases/[^/]+$".
868 *
869 * Completes with a [Policy].
870 *
871 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
872 * error.
873 *
874 * If the used [http.Client] completes with an error when making a REST call,
875 * this method will complete with the same error.
876 */
877 async.Future<Policy> getIamPolicy(GetIamPolicyRequest request, core.String res ource) {
878 var _url = null;
879 var _queryParams = new core.Map();
880 var _uploadMedia = null;
881 var _uploadOptions = null;
882 var _downloadOptions = commons.DownloadOptions.Metadata;
883 var _body = null;
884
885 if (request != null) {
886 _body = convert.JSON.encode((request).toJson());
887 }
888 if (resource == null) {
889 throw new core.ArgumentError("Parameter resource is required.");
890 }
891
892 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$resource') + ':getIam Policy';
893
894 var _response = _requester.request(_url,
895 "POST",
896 body: _body,
897 queryParams: _queryParams,
898 uploadOptions: _uploadOptions,
899 uploadMedia: _uploadMedia,
900 downloadOptions: _downloadOptions);
901 return _response.then((data) => new Policy.fromJson(data));
902 }
903
904 /**
905 * Lists Cloud Spanner databases.
906 *
907 * Request parameters:
908 *
909 * [parent] - Required. The instance whose databases should be listed.
910 * Values are of the form `projects/<project>/instances/<instance>`.
911 * Value must have pattern "^projects/[^/]+/instances/[^/]+$".
912 *
913 * [pageToken] - If non-empty, `page_token` should contain a
914 * next_page_token from a
915 * previous ListDatabasesResponse.
916 *
917 * [pageSize] - Number of databases to be returned in the response. If 0 or
918 * less,
919 * defaults to the server's maximum allowed page size.
920 *
921 * Completes with a [ListDatabasesResponse].
922 *
923 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
924 * error.
925 *
926 * If the used [http.Client] completes with an error when making a REST call,
927 * this method will complete with the same error.
928 */
929 async.Future<ListDatabasesResponse> list(core.String parent, {core.String page Token, core.int pageSize}) {
930 var _url = null;
931 var _queryParams = new core.Map();
932 var _uploadMedia = null;
933 var _uploadOptions = null;
934 var _downloadOptions = commons.DownloadOptions.Metadata;
935 var _body = null;
936
937 if (parent == null) {
938 throw new core.ArgumentError("Parameter parent is required.");
939 }
940 if (pageToken != null) {
941 _queryParams["pageToken"] = [pageToken];
942 }
943 if (pageSize != null) {
944 _queryParams["pageSize"] = ["${pageSize}"];
945 }
946
947 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$parent') + '/database s';
948
949 var _response = _requester.request(_url,
950 "GET",
951 body: _body,
952 queryParams: _queryParams,
953 uploadOptions: _uploadOptions,
954 uploadMedia: _uploadMedia,
955 downloadOptions: _downloadOptions);
956 return _response.then((data) => new ListDatabasesResponse.fromJson(data));
957 }
958
959 /**
960 * Sets the access control policy on a database resource. Replaces any
961 * existing policy.
962 *
963 * Authorization requires `spanner.databases.setIamPolicy` permission on
964 * resource.
965 *
966 * [request] - The metadata request object.
967 *
968 * Request parameters:
969 *
970 * [resource] - REQUIRED: The Cloud Spanner resource for which the policy is
971 * being set. The format is `projects/<project ID>/instances/<instance ID>`
972 * for instance resources and `projects/<project ID>/instances/<instance
973 * ID>/databases/<database ID>` for databases resources.
974 * Value must have pattern "^projects/[^/]+/instances/[^/]+/databases/[^/]+$".
975 *
976 * Completes with a [Policy].
977 *
978 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
979 * error.
980 *
981 * If the used [http.Client] completes with an error when making a REST call,
982 * this method will complete with the same error.
983 */
984 async.Future<Policy> setIamPolicy(SetIamPolicyRequest request, core.String res ource) {
985 var _url = null;
986 var _queryParams = new core.Map();
987 var _uploadMedia = null;
988 var _uploadOptions = null;
989 var _downloadOptions = commons.DownloadOptions.Metadata;
990 var _body = null;
991
992 if (request != null) {
993 _body = convert.JSON.encode((request).toJson());
994 }
995 if (resource == null) {
996 throw new core.ArgumentError("Parameter resource is required.");
997 }
998
999 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$resource') + ':setIam Policy';
1000
1001 var _response = _requester.request(_url,
1002 "POST",
1003 body: _body,
1004 queryParams: _queryParams,
1005 uploadOptions: _uploadOptions,
1006 uploadMedia: _uploadMedia,
1007 downloadOptions: _downloadOptions);
1008 return _response.then((data) => new Policy.fromJson(data));
1009 }
1010
1011 /**
1012 * Returns permissions that the caller has on the specified database resource.
1013 *
1014 * Attempting this RPC on a non-existent Cloud Spanner database will result in
1015 * a NOT_FOUND error if the user has `spanner.databases.list` permission on
1016 * the containing Cloud Spanner instance. Otherwise returns an empty set of
1017 * permissions.
1018 *
1019 * [request] - The metadata request object.
1020 *
1021 * Request parameters:
1022 *
1023 * [resource] - REQUIRED: The Cloud Spanner resource for which permissions are
1024 * being tested. The format is `projects/<project ID>/instances/<instance ID>`
1025 * for instance resources and `projects/<project ID>/instances/<instance
1026 * ID>/databases/<database ID>` for database resources.
1027 * Value must have pattern "^projects/[^/]+/instances/[^/]+/databases/[^/]+$".
1028 *
1029 * Completes with a [TestIamPermissionsResponse].
1030 *
1031 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1032 * error.
1033 *
1034 * If the used [http.Client] completes with an error when making a REST call,
1035 * this method will complete with the same error.
1036 */
1037 async.Future<TestIamPermissionsResponse> testIamPermissions(TestIamPermissions Request request, core.String resource) {
1038 var _url = null;
1039 var _queryParams = new core.Map();
1040 var _uploadMedia = null;
1041 var _uploadOptions = null;
1042 var _downloadOptions = commons.DownloadOptions.Metadata;
1043 var _body = null;
1044
1045 if (request != null) {
1046 _body = convert.JSON.encode((request).toJson());
1047 }
1048 if (resource == null) {
1049 throw new core.ArgumentError("Parameter resource is required.");
1050 }
1051
1052 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$resource') + ':testIa mPermissions';
1053
1054 var _response = _requester.request(_url,
1055 "POST",
1056 body: _body,
1057 queryParams: _queryParams,
1058 uploadOptions: _uploadOptions,
1059 uploadMedia: _uploadMedia,
1060 downloadOptions: _downloadOptions);
1061 return _response.then((data) => new TestIamPermissionsResponse.fromJson(data ));
1062 }
1063
1064 /**
1065 * Updates the schema of a Cloud Spanner database by
1066 * creating/altering/dropping tables, columns, indexes, etc. The returned
1067 * long-running operation will have a name of
1068 * the format `<database_name>/operations/<operation_id>` and can be used to
1069 * track execution of the schema change(s). The
1070 * metadata field type is
1071 * UpdateDatabaseDdlMetadata. The operation has no response.
1072 *
1073 * [request] - The metadata request object.
1074 *
1075 * Request parameters:
1076 *
1077 * [database] - Required. The database to update.
1078 * Value must have pattern "^projects/[^/]+/instances/[^/]+/databases/[^/]+$".
1079 *
1080 * Completes with a [Operation].
1081 *
1082 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1083 * error.
1084 *
1085 * If the used [http.Client] completes with an error when making a REST call,
1086 * this method will complete with the same error.
1087 */
1088 async.Future<Operation> updateDdl(UpdateDatabaseDdlRequest request, core.Strin g database) {
1089 var _url = null;
1090 var _queryParams = new core.Map();
1091 var _uploadMedia = null;
1092 var _uploadOptions = null;
1093 var _downloadOptions = commons.DownloadOptions.Metadata;
1094 var _body = null;
1095
1096 if (request != null) {
1097 _body = convert.JSON.encode((request).toJson());
1098 }
1099 if (database == null) {
1100 throw new core.ArgumentError("Parameter database is required.");
1101 }
1102
1103 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$database') + '/ddl';
1104
1105 var _response = _requester.request(_url,
1106 "PATCH",
1107 body: _body,
1108 queryParams: _queryParams,
1109 uploadOptions: _uploadOptions,
1110 uploadMedia: _uploadMedia,
1111 downloadOptions: _downloadOptions);
1112 return _response.then((data) => new Operation.fromJson(data));
1113 }
1114
1115 }
1116
1117
1118 class ProjectsInstancesDatabasesOperationsResourceApi {
1119 final commons.ApiRequester _requester;
1120
1121 ProjectsInstancesDatabasesOperationsResourceApi(commons.ApiRequester client) :
1122 _requester = client;
1123
1124 /**
1125 * Starts asynchronous cancellation on a long-running operation. The server
1126 * makes a best effort to cancel the operation, but success is not
1127 * guaranteed. If the server doesn't support this method, it returns
1128 * `google.rpc.Code.UNIMPLEMENTED`. Clients can use
1129 * Operations.GetOperation or
1130 * other methods to check whether the cancellation succeeded or whether the
1131 * operation completed despite cancellation. On successful cancellation,
1132 * the operation is not deleted; instead, it becomes an operation with
1133 * an Operation.error value with a google.rpc.Status.code of 1,
1134 * corresponding to `Code.CANCELLED`.
1135 *
1136 * Request parameters:
1137 *
1138 * [name] - The name of the operation resource to be cancelled.
1139 * Value must have pattern
1140 * "^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations/[^/]+$".
1141 *
1142 * Completes with a [Empty].
1143 *
1144 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1145 * error.
1146 *
1147 * If the used [http.Client] completes with an error when making a REST call,
1148 * this method will complete with the same error.
1149 */
1150 async.Future<Empty> cancel(core.String name) {
1151 var _url = null;
1152 var _queryParams = new core.Map();
1153 var _uploadMedia = null;
1154 var _uploadOptions = null;
1155 var _downloadOptions = commons.DownloadOptions.Metadata;
1156 var _body = null;
1157
1158 if (name == null) {
1159 throw new core.ArgumentError("Parameter name is required.");
1160 }
1161
1162 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name') + ':cancel';
1163
1164 var _response = _requester.request(_url,
1165 "POST",
1166 body: _body,
1167 queryParams: _queryParams,
1168 uploadOptions: _uploadOptions,
1169 uploadMedia: _uploadMedia,
1170 downloadOptions: _downloadOptions);
1171 return _response.then((data) => new Empty.fromJson(data));
1172 }
1173
1174 /**
1175 * Deletes a long-running operation. This method indicates that the client is
1176 * no longer interested in the operation result. It does not cancel the
1177 * operation. If the server doesn't support this method, it returns
1178 * `google.rpc.Code.UNIMPLEMENTED`.
1179 *
1180 * Request parameters:
1181 *
1182 * [name] - The name of the operation resource to be deleted.
1183 * Value must have pattern
1184 * "^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations/[^/]+$".
1185 *
1186 * Completes with a [Empty].
1187 *
1188 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1189 * error.
1190 *
1191 * If the used [http.Client] completes with an error when making a REST call,
1192 * this method will complete with the same error.
1193 */
1194 async.Future<Empty> delete(core.String name) {
1195 var _url = null;
1196 var _queryParams = new core.Map();
1197 var _uploadMedia = null;
1198 var _uploadOptions = null;
1199 var _downloadOptions = commons.DownloadOptions.Metadata;
1200 var _body = null;
1201
1202 if (name == null) {
1203 throw new core.ArgumentError("Parameter name is required.");
1204 }
1205
1206 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name');
1207
1208 var _response = _requester.request(_url,
1209 "DELETE",
1210 body: _body,
1211 queryParams: _queryParams,
1212 uploadOptions: _uploadOptions,
1213 uploadMedia: _uploadMedia,
1214 downloadOptions: _downloadOptions);
1215 return _response.then((data) => new Empty.fromJson(data));
1216 }
1217
1218 /**
1219 * Gets the latest state of a long-running operation. Clients can use this
1220 * method to poll the operation result at intervals as recommended by the API
1221 * service.
1222 *
1223 * Request parameters:
1224 *
1225 * [name] - The name of the operation resource.
1226 * Value must have pattern
1227 * "^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations/[^/]+$".
1228 *
1229 * Completes with a [Operation].
1230 *
1231 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1232 * error.
1233 *
1234 * If the used [http.Client] completes with an error when making a REST call,
1235 * this method will complete with the same error.
1236 */
1237 async.Future<Operation> get(core.String name) {
1238 var _url = null;
1239 var _queryParams = new core.Map();
1240 var _uploadMedia = null;
1241 var _uploadOptions = null;
1242 var _downloadOptions = commons.DownloadOptions.Metadata;
1243 var _body = null;
1244
1245 if (name == null) {
1246 throw new core.ArgumentError("Parameter name is required.");
1247 }
1248
1249 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name');
1250
1251 var _response = _requester.request(_url,
1252 "GET",
1253 body: _body,
1254 queryParams: _queryParams,
1255 uploadOptions: _uploadOptions,
1256 uploadMedia: _uploadMedia,
1257 downloadOptions: _downloadOptions);
1258 return _response.then((data) => new Operation.fromJson(data));
1259 }
1260
1261 /**
1262 * Lists operations that match the specified filter in the request. If the
1263 * server doesn't support this method, it returns `UNIMPLEMENTED`.
1264 *
1265 * NOTE: the `name` binding below allows API services to override the binding
1266 * to use different resource name schemes, such as `users / * /operations`.
1267 *
1268 * Request parameters:
1269 *
1270 * [name] - The name of the operation collection.
1271 * Value must have pattern
1272 * "^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations$".
1273 *
1274 * [filter] - The standard list filter.
1275 *
1276 * [pageToken] - The standard list page token.
1277 *
1278 * [pageSize] - The standard list page size.
1279 *
1280 * Completes with a [ListOperationsResponse].
1281 *
1282 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1283 * error.
1284 *
1285 * If the used [http.Client] completes with an error when making a REST call,
1286 * this method will complete with the same error.
1287 */
1288 async.Future<ListOperationsResponse> list(core.String name, {core.String filte r, core.String pageToken, core.int pageSize}) {
1289 var _url = null;
1290 var _queryParams = new core.Map();
1291 var _uploadMedia = null;
1292 var _uploadOptions = null;
1293 var _downloadOptions = commons.DownloadOptions.Metadata;
1294 var _body = null;
1295
1296 if (name == null) {
1297 throw new core.ArgumentError("Parameter name is required.");
1298 }
1299 if (filter != null) {
1300 _queryParams["filter"] = [filter];
1301 }
1302 if (pageToken != null) {
1303 _queryParams["pageToken"] = [pageToken];
1304 }
1305 if (pageSize != null) {
1306 _queryParams["pageSize"] = ["${pageSize}"];
1307 }
1308
1309 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name');
1310
1311 var _response = _requester.request(_url,
1312 "GET",
1313 body: _body,
1314 queryParams: _queryParams,
1315 uploadOptions: _uploadOptions,
1316 uploadMedia: _uploadMedia,
1317 downloadOptions: _downloadOptions);
1318 return _response.then((data) => new ListOperationsResponse.fromJson(data));
1319 }
1320
1321 }
1322
1323
1324 class ProjectsInstancesDatabasesSessionsResourceApi {
1325 final commons.ApiRequester _requester;
1326
1327 ProjectsInstancesDatabasesSessionsResourceApi(commons.ApiRequester client) :
1328 _requester = client;
1329
1330 /**
1331 * Begins a new transaction. This step can often be skipped:
1332 * Read, ExecuteSql and
1333 * Commit can begin a new transaction as a
1334 * side-effect.
1335 *
1336 * [request] - The metadata request object.
1337 *
1338 * Request parameters:
1339 *
1340 * [session] - Required. The session in which the transaction runs.
1341 * Value must have pattern
1342 * "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$".
1343 *
1344 * Completes with a [Transaction].
1345 *
1346 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1347 * error.
1348 *
1349 * If the used [http.Client] completes with an error when making a REST call,
1350 * this method will complete with the same error.
1351 */
1352 async.Future<Transaction> beginTransaction(BeginTransactionRequest request, co re.String session) {
1353 var _url = null;
1354 var _queryParams = new core.Map();
1355 var _uploadMedia = null;
1356 var _uploadOptions = null;
1357 var _downloadOptions = commons.DownloadOptions.Metadata;
1358 var _body = null;
1359
1360 if (request != null) {
1361 _body = convert.JSON.encode((request).toJson());
1362 }
1363 if (session == null) {
1364 throw new core.ArgumentError("Parameter session is required.");
1365 }
1366
1367 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$session') + ':beginTr ansaction';
1368
1369 var _response = _requester.request(_url,
1370 "POST",
1371 body: _body,
1372 queryParams: _queryParams,
1373 uploadOptions: _uploadOptions,
1374 uploadMedia: _uploadMedia,
1375 downloadOptions: _downloadOptions);
1376 return _response.then((data) => new Transaction.fromJson(data));
1377 }
1378
1379 /**
1380 * Commits a transaction. The request includes the mutations to be
1381 * applied to rows in the database.
1382 *
1383 * `Commit` might return an `ABORTED` error. This can occur at any time;
1384 * commonly, the cause is conflicts with concurrent
1385 * transactions. However, it can also happen for a variety of other
1386 * reasons. If `Commit` returns `ABORTED`, the caller should re-attempt
1387 * the transaction from the beginning, re-using the same session.
1388 *
1389 * [request] - The metadata request object.
1390 *
1391 * Request parameters:
1392 *
1393 * [session] - Required. The session in which the transaction to be committed
1394 * is running.
1395 * Value must have pattern
1396 * "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$".
1397 *
1398 * Completes with a [CommitResponse].
1399 *
1400 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1401 * error.
1402 *
1403 * If the used [http.Client] completes with an error when making a REST call,
1404 * this method will complete with the same error.
1405 */
1406 async.Future<CommitResponse> commit(CommitRequest request, core.String session ) {
1407 var _url = null;
1408 var _queryParams = new core.Map();
1409 var _uploadMedia = null;
1410 var _uploadOptions = null;
1411 var _downloadOptions = commons.DownloadOptions.Metadata;
1412 var _body = null;
1413
1414 if (request != null) {
1415 _body = convert.JSON.encode((request).toJson());
1416 }
1417 if (session == null) {
1418 throw new core.ArgumentError("Parameter session is required.");
1419 }
1420
1421 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$session') + ':commit' ;
1422
1423 var _response = _requester.request(_url,
1424 "POST",
1425 body: _body,
1426 queryParams: _queryParams,
1427 uploadOptions: _uploadOptions,
1428 uploadMedia: _uploadMedia,
1429 downloadOptions: _downloadOptions);
1430 return _response.then((data) => new CommitResponse.fromJson(data));
1431 }
1432
1433 /**
1434 * Creates a new session. A session can be used to perform
1435 * transactions that read and/or modify data in a Cloud Spanner database.
1436 * Sessions are meant to be reused for many consecutive
1437 * transactions.
1438 *
1439 * Sessions can only execute one transaction at a time. To execute
1440 * multiple concurrent read-write/write-only transactions, create
1441 * multiple sessions. Note that standalone reads and queries use a
1442 * transaction internally, and count toward the one transaction
1443 * limit.
1444 *
1445 * Cloud Spanner limits the number of sessions that can exist at any given
1446 * time; thus, it is a good idea to delete idle and/or unneeded sessions.
1447 * Aside from explicit deletes, Cloud Spanner can delete sessions for
1448 * which no operations are sent for more than an hour, or due to
1449 * internal errors. If a session is deleted, requests to it
1450 * return `NOT_FOUND`.
1451 *
1452 * Idle sessions can be kept alive by sending a trivial SQL query
1453 * periodically, e.g., `"SELECT 1"`.
1454 *
1455 * Request parameters:
1456 *
1457 * [database] - Required. The database in which the new session is created.
1458 * Value must have pattern "^projects/[^/]+/instances/[^/]+/databases/[^/]+$".
1459 *
1460 * Completes with a [Session].
1461 *
1462 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1463 * error.
1464 *
1465 * If the used [http.Client] completes with an error when making a REST call,
1466 * this method will complete with the same error.
1467 */
1468 async.Future<Session> create(core.String database) {
1469 var _url = null;
1470 var _queryParams = new core.Map();
1471 var _uploadMedia = null;
1472 var _uploadOptions = null;
1473 var _downloadOptions = commons.DownloadOptions.Metadata;
1474 var _body = null;
1475
1476 if (database == null) {
1477 throw new core.ArgumentError("Parameter database is required.");
1478 }
1479
1480 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$database') + '/sessio ns';
1481
1482 var _response = _requester.request(_url,
1483 "POST",
1484 body: _body,
1485 queryParams: _queryParams,
1486 uploadOptions: _uploadOptions,
1487 uploadMedia: _uploadMedia,
1488 downloadOptions: _downloadOptions);
1489 return _response.then((data) => new Session.fromJson(data));
1490 }
1491
1492 /**
1493 * Ends a session, releasing server resources associated with it.
1494 *
1495 * Request parameters:
1496 *
1497 * [name] - Required. The name of the session to delete.
1498 * Value must have pattern
1499 * "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$".
1500 *
1501 * Completes with a [Empty].
1502 *
1503 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1504 * error.
1505 *
1506 * If the used [http.Client] completes with an error when making a REST call,
1507 * this method will complete with the same error.
1508 */
1509 async.Future<Empty> delete(core.String name) {
1510 var _url = null;
1511 var _queryParams = new core.Map();
1512 var _uploadMedia = null;
1513 var _uploadOptions = null;
1514 var _downloadOptions = commons.DownloadOptions.Metadata;
1515 var _body = null;
1516
1517 if (name == null) {
1518 throw new core.ArgumentError("Parameter name is required.");
1519 }
1520
1521 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name');
1522
1523 var _response = _requester.request(_url,
1524 "DELETE",
1525 body: _body,
1526 queryParams: _queryParams,
1527 uploadOptions: _uploadOptions,
1528 uploadMedia: _uploadMedia,
1529 downloadOptions: _downloadOptions);
1530 return _response.then((data) => new Empty.fromJson(data));
1531 }
1532
1533 /**
1534 * Executes an SQL query, returning all rows in a single reply. This
1535 * method cannot be used to return a result set larger than 10 MiB;
1536 * if the query yields more data than that, the query fails with
1537 * a `FAILED_PRECONDITION` error.
1538 *
1539 * Queries inside read-write transactions might return `ABORTED`. If
1540 * this occurs, the application should restart the transaction from
1541 * the beginning. See Transaction for more details.
1542 *
1543 * Larger result sets can be fetched in streaming fashion by calling
1544 * ExecuteStreamingSql instead.
1545 *
1546 * [request] - The metadata request object.
1547 *
1548 * Request parameters:
1549 *
1550 * [session] - Required. The session in which the SQL query should be
1551 * performed.
1552 * Value must have pattern
1553 * "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$".
1554 *
1555 * Completes with a [ResultSet].
1556 *
1557 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1558 * error.
1559 *
1560 * If the used [http.Client] completes with an error when making a REST call,
1561 * this method will complete with the same error.
1562 */
1563 async.Future<ResultSet> executeSql(ExecuteSqlRequest request, core.String sess ion) {
1564 var _url = null;
1565 var _queryParams = new core.Map();
1566 var _uploadMedia = null;
1567 var _uploadOptions = null;
1568 var _downloadOptions = commons.DownloadOptions.Metadata;
1569 var _body = null;
1570
1571 if (request != null) {
1572 _body = convert.JSON.encode((request).toJson());
1573 }
1574 if (session == null) {
1575 throw new core.ArgumentError("Parameter session is required.");
1576 }
1577
1578 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$session') + ':execute Sql';
1579
1580 var _response = _requester.request(_url,
1581 "POST",
1582 body: _body,
1583 queryParams: _queryParams,
1584 uploadOptions: _uploadOptions,
1585 uploadMedia: _uploadMedia,
1586 downloadOptions: _downloadOptions);
1587 return _response.then((data) => new ResultSet.fromJson(data));
1588 }
1589
1590 /**
1591 * Like ExecuteSql, except returns the result
1592 * set as a stream. Unlike ExecuteSql, there
1593 * is no limit on the size of the returned result set. However, no
1594 * individual row in the result set can exceed 100 MiB, and no
1595 * column value can exceed 10 MiB.
1596 *
1597 * [request] - The metadata request object.
1598 *
1599 * Request parameters:
1600 *
1601 * [session] - Required. The session in which the SQL query should be
1602 * performed.
1603 * Value must have pattern
1604 * "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$".
1605 *
1606 * Completes with a [PartialResultSet].
1607 *
1608 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1609 * error.
1610 *
1611 * If the used [http.Client] completes with an error when making a REST call,
1612 * this method will complete with the same error.
1613 */
1614 async.Future<PartialResultSet> executeStreamingSql(ExecuteSqlRequest request, core.String session) {
1615 var _url = null;
1616 var _queryParams = new core.Map();
1617 var _uploadMedia = null;
1618 var _uploadOptions = null;
1619 var _downloadOptions = commons.DownloadOptions.Metadata;
1620 var _body = null;
1621
1622 if (request != null) {
1623 _body = convert.JSON.encode((request).toJson());
1624 }
1625 if (session == null) {
1626 throw new core.ArgumentError("Parameter session is required.");
1627 }
1628
1629 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$session') + ':execute StreamingSql';
1630
1631 var _response = _requester.request(_url,
1632 "POST",
1633 body: _body,
1634 queryParams: _queryParams,
1635 uploadOptions: _uploadOptions,
1636 uploadMedia: _uploadMedia,
1637 downloadOptions: _downloadOptions);
1638 return _response.then((data) => new PartialResultSet.fromJson(data));
1639 }
1640
1641 /**
1642 * Gets a session. Returns `NOT_FOUND` if the session does not exist.
1643 * This is mainly useful for determining whether a session is still
1644 * alive.
1645 *
1646 * Request parameters:
1647 *
1648 * [name] - Required. The name of the session to retrieve.
1649 * Value must have pattern
1650 * "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$".
1651 *
1652 * Completes with a [Session].
1653 *
1654 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1655 * error.
1656 *
1657 * If the used [http.Client] completes with an error when making a REST call,
1658 * this method will complete with the same error.
1659 */
1660 async.Future<Session> get(core.String name) {
1661 var _url = null;
1662 var _queryParams = new core.Map();
1663 var _uploadMedia = null;
1664 var _uploadOptions = null;
1665 var _downloadOptions = commons.DownloadOptions.Metadata;
1666 var _body = null;
1667
1668 if (name == null) {
1669 throw new core.ArgumentError("Parameter name is required.");
1670 }
1671
1672 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name');
1673
1674 var _response = _requester.request(_url,
1675 "GET",
1676 body: _body,
1677 queryParams: _queryParams,
1678 uploadOptions: _uploadOptions,
1679 uploadMedia: _uploadMedia,
1680 downloadOptions: _downloadOptions);
1681 return _response.then((data) => new Session.fromJson(data));
1682 }
1683
1684 /**
1685 * Reads rows from the database using key lookups and scans, as a
1686 * simple key/value style alternative to
1687 * ExecuteSql. This method cannot be used to
1688 * return a result set larger than 10 MiB; if the read matches more
1689 * data than that, the read fails with a `FAILED_PRECONDITION`
1690 * error.
1691 *
1692 * Reads inside read-write transactions might return `ABORTED`. If
1693 * this occurs, the application should restart the transaction from
1694 * the beginning. See Transaction for more details.
1695 *
1696 * Larger result sets can be yielded in streaming fashion by calling
1697 * StreamingRead instead.
1698 *
1699 * [request] - The metadata request object.
1700 *
1701 * Request parameters:
1702 *
1703 * [session] - Required. The session in which the read should be performed.
1704 * Value must have pattern
1705 * "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$".
1706 *
1707 * Completes with a [ResultSet].
1708 *
1709 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1710 * error.
1711 *
1712 * If the used [http.Client] completes with an error when making a REST call,
1713 * this method will complete with the same error.
1714 */
1715 async.Future<ResultSet> read(ReadRequest request, core.String session) {
1716 var _url = null;
1717 var _queryParams = new core.Map();
1718 var _uploadMedia = null;
1719 var _uploadOptions = null;
1720 var _downloadOptions = commons.DownloadOptions.Metadata;
1721 var _body = null;
1722
1723 if (request != null) {
1724 _body = convert.JSON.encode((request).toJson());
1725 }
1726 if (session == null) {
1727 throw new core.ArgumentError("Parameter session is required.");
1728 }
1729
1730 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$session') + ':read';
1731
1732 var _response = _requester.request(_url,
1733 "POST",
1734 body: _body,
1735 queryParams: _queryParams,
1736 uploadOptions: _uploadOptions,
1737 uploadMedia: _uploadMedia,
1738 downloadOptions: _downloadOptions);
1739 return _response.then((data) => new ResultSet.fromJson(data));
1740 }
1741
1742 /**
1743 * Rolls back a transaction, releasing any locks it holds. It is a good
1744 * idea to call this for any transaction that includes one or more
1745 * Read or ExecuteSql requests and
1746 * ultimately decides not to commit.
1747 *
1748 * `Rollback` returns `OK` if it successfully aborts the transaction, the
1749 * transaction was already aborted, or the transaction is not
1750 * found. `Rollback` never returns `ABORTED`.
1751 *
1752 * [request] - The metadata request object.
1753 *
1754 * Request parameters:
1755 *
1756 * [session] - Required. The session in which the transaction to roll back is
1757 * running.
1758 * Value must have pattern
1759 * "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$".
1760 *
1761 * Completes with a [Empty].
1762 *
1763 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1764 * error.
1765 *
1766 * If the used [http.Client] completes with an error when making a REST call,
1767 * this method will complete with the same error.
1768 */
1769 async.Future<Empty> rollback(RollbackRequest request, core.String session) {
1770 var _url = null;
1771 var _queryParams = new core.Map();
1772 var _uploadMedia = null;
1773 var _uploadOptions = null;
1774 var _downloadOptions = commons.DownloadOptions.Metadata;
1775 var _body = null;
1776
1777 if (request != null) {
1778 _body = convert.JSON.encode((request).toJson());
1779 }
1780 if (session == null) {
1781 throw new core.ArgumentError("Parameter session is required.");
1782 }
1783
1784 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$session') + ':rollbac k';
1785
1786 var _response = _requester.request(_url,
1787 "POST",
1788 body: _body,
1789 queryParams: _queryParams,
1790 uploadOptions: _uploadOptions,
1791 uploadMedia: _uploadMedia,
1792 downloadOptions: _downloadOptions);
1793 return _response.then((data) => new Empty.fromJson(data));
1794 }
1795
1796 /**
1797 * Like Read, except returns the result set as a
1798 * stream. Unlike Read, there is no limit on the
1799 * size of the returned result set. However, no individual row in
1800 * the result set can exceed 100 MiB, and no column value can exceed
1801 * 10 MiB.
1802 *
1803 * [request] - The metadata request object.
1804 *
1805 * Request parameters:
1806 *
1807 * [session] - Required. The session in which the read should be performed.
1808 * Value must have pattern
1809 * "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$".
1810 *
1811 * Completes with a [PartialResultSet].
1812 *
1813 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1814 * error.
1815 *
1816 * If the used [http.Client] completes with an error when making a REST call,
1817 * this method will complete with the same error.
1818 */
1819 async.Future<PartialResultSet> streamingRead(ReadRequest request, core.String session) {
1820 var _url = null;
1821 var _queryParams = new core.Map();
1822 var _uploadMedia = null;
1823 var _uploadOptions = null;
1824 var _downloadOptions = commons.DownloadOptions.Metadata;
1825 var _body = null;
1826
1827 if (request != null) {
1828 _body = convert.JSON.encode((request).toJson());
1829 }
1830 if (session == null) {
1831 throw new core.ArgumentError("Parameter session is required.");
1832 }
1833
1834 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$session') + ':streami ngRead';
1835
1836 var _response = _requester.request(_url,
1837 "POST",
1838 body: _body,
1839 queryParams: _queryParams,
1840 uploadOptions: _uploadOptions,
1841 uploadMedia: _uploadMedia,
1842 downloadOptions: _downloadOptions);
1843 return _response.then((data) => new PartialResultSet.fromJson(data));
1844 }
1845
1846 }
1847
1848
1849 class ProjectsInstancesOperationsResourceApi {
1850 final commons.ApiRequester _requester;
1851
1852 ProjectsInstancesOperationsResourceApi(commons.ApiRequester client) :
1853 _requester = client;
1854
1855 /**
1856 * Starts asynchronous cancellation on a long-running operation. The server
1857 * makes a best effort to cancel the operation, but success is not
1858 * guaranteed. If the server doesn't support this method, it returns
1859 * `google.rpc.Code.UNIMPLEMENTED`. Clients can use
1860 * Operations.GetOperation or
1861 * other methods to check whether the cancellation succeeded or whether the
1862 * operation completed despite cancellation. On successful cancellation,
1863 * the operation is not deleted; instead, it becomes an operation with
1864 * an Operation.error value with a google.rpc.Status.code of 1,
1865 * corresponding to `Code.CANCELLED`.
1866 *
1867 * Request parameters:
1868 *
1869 * [name] - The name of the operation resource to be cancelled.
1870 * Value must have pattern
1871 * "^projects/[^/]+/instances/[^/]+/operations/[^/]+$".
1872 *
1873 * Completes with a [Empty].
1874 *
1875 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1876 * error.
1877 *
1878 * If the used [http.Client] completes with an error when making a REST call,
1879 * this method will complete with the same error.
1880 */
1881 async.Future<Empty> cancel(core.String name) {
1882 var _url = null;
1883 var _queryParams = new core.Map();
1884 var _uploadMedia = null;
1885 var _uploadOptions = null;
1886 var _downloadOptions = commons.DownloadOptions.Metadata;
1887 var _body = null;
1888
1889 if (name == null) {
1890 throw new core.ArgumentError("Parameter name is required.");
1891 }
1892
1893 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name') + ':cancel';
1894
1895 var _response = _requester.request(_url,
1896 "POST",
1897 body: _body,
1898 queryParams: _queryParams,
1899 uploadOptions: _uploadOptions,
1900 uploadMedia: _uploadMedia,
1901 downloadOptions: _downloadOptions);
1902 return _response.then((data) => new Empty.fromJson(data));
1903 }
1904
1905 /**
1906 * Deletes a long-running operation. This method indicates that the client is
1907 * no longer interested in the operation result. It does not cancel the
1908 * operation. If the server doesn't support this method, it returns
1909 * `google.rpc.Code.UNIMPLEMENTED`.
1910 *
1911 * Request parameters:
1912 *
1913 * [name] - The name of the operation resource to be deleted.
1914 * Value must have pattern
1915 * "^projects/[^/]+/instances/[^/]+/operations/[^/]+$".
1916 *
1917 * Completes with a [Empty].
1918 *
1919 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1920 * error.
1921 *
1922 * If the used [http.Client] completes with an error when making a REST call,
1923 * this method will complete with the same error.
1924 */
1925 async.Future<Empty> delete(core.String name) {
1926 var _url = null;
1927 var _queryParams = new core.Map();
1928 var _uploadMedia = null;
1929 var _uploadOptions = null;
1930 var _downloadOptions = commons.DownloadOptions.Metadata;
1931 var _body = null;
1932
1933 if (name == null) {
1934 throw new core.ArgumentError("Parameter name is required.");
1935 }
1936
1937 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name');
1938
1939 var _response = _requester.request(_url,
1940 "DELETE",
1941 body: _body,
1942 queryParams: _queryParams,
1943 uploadOptions: _uploadOptions,
1944 uploadMedia: _uploadMedia,
1945 downloadOptions: _downloadOptions);
1946 return _response.then((data) => new Empty.fromJson(data));
1947 }
1948
1949 /**
1950 * Gets the latest state of a long-running operation. Clients can use this
1951 * method to poll the operation result at intervals as recommended by the API
1952 * service.
1953 *
1954 * Request parameters:
1955 *
1956 * [name] - The name of the operation resource.
1957 * Value must have pattern
1958 * "^projects/[^/]+/instances/[^/]+/operations/[^/]+$".
1959 *
1960 * Completes with a [Operation].
1961 *
1962 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
1963 * error.
1964 *
1965 * If the used [http.Client] completes with an error when making a REST call,
1966 * this method will complete with the same error.
1967 */
1968 async.Future<Operation> get(core.String name) {
1969 var _url = null;
1970 var _queryParams = new core.Map();
1971 var _uploadMedia = null;
1972 var _uploadOptions = null;
1973 var _downloadOptions = commons.DownloadOptions.Metadata;
1974 var _body = null;
1975
1976 if (name == null) {
1977 throw new core.ArgumentError("Parameter name is required.");
1978 }
1979
1980 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name');
1981
1982 var _response = _requester.request(_url,
1983 "GET",
1984 body: _body,
1985 queryParams: _queryParams,
1986 uploadOptions: _uploadOptions,
1987 uploadMedia: _uploadMedia,
1988 downloadOptions: _downloadOptions);
1989 return _response.then((data) => new Operation.fromJson(data));
1990 }
1991
1992 /**
1993 * Lists operations that match the specified filter in the request. If the
1994 * server doesn't support this method, it returns `UNIMPLEMENTED`.
1995 *
1996 * NOTE: the `name` binding below allows API services to override the binding
1997 * to use different resource name schemes, such as `users / * /operations`.
1998 *
1999 * Request parameters:
2000 *
2001 * [name] - The name of the operation collection.
2002 * Value must have pattern "^projects/[^/]+/instances/[^/]+/operations$".
2003 *
2004 * [pageToken] - The standard list page token.
2005 *
2006 * [pageSize] - The standard list page size.
2007 *
2008 * [filter] - The standard list filter.
2009 *
2010 * Completes with a [ListOperationsResponse].
2011 *
2012 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
2013 * error.
2014 *
2015 * If the used [http.Client] completes with an error when making a REST call,
2016 * this method will complete with the same error.
2017 */
2018 async.Future<ListOperationsResponse> list(core.String name, {core.String pageT oken, core.int pageSize, core.String filter}) {
2019 var _url = null;
2020 var _queryParams = new core.Map();
2021 var _uploadMedia = null;
2022 var _uploadOptions = null;
2023 var _downloadOptions = commons.DownloadOptions.Metadata;
2024 var _body = null;
2025
2026 if (name == null) {
2027 throw new core.ArgumentError("Parameter name is required.");
2028 }
2029 if (pageToken != null) {
2030 _queryParams["pageToken"] = [pageToken];
2031 }
2032 if (pageSize != null) {
2033 _queryParams["pageSize"] = ["${pageSize}"];
2034 }
2035 if (filter != null) {
2036 _queryParams["filter"] = [filter];
2037 }
2038
2039 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name');
2040
2041 var _response = _requester.request(_url,
2042 "GET",
2043 body: _body,
2044 queryParams: _queryParams,
2045 uploadOptions: _uploadOptions,
2046 uploadMedia: _uploadMedia,
2047 downloadOptions: _downloadOptions);
2048 return _response.then((data) => new ListOperationsResponse.fromJson(data));
2049 }
2050
2051 }
2052
2053
2054
2055 /**
2056 * Specifies the audit configuration for a service.
2057 * It consists of which permission types are logged, and what identities, if
2058 * any, are exempted from logging.
2059 * An AuditConifg must have one or more AuditLogConfigs.
2060 */
2061 class AuditConfig {
2062 /**
2063 * The configuration for logging of each type of permission.
2064 * Next ID: 4
2065 */
2066 core.List<AuditLogConfig> auditLogConfigs;
2067 /**
2068 * Specifies the identities that are exempted from "data access" audit
2069 * logging for the `service` specified above.
2070 * Follows the same format of Binding.members.
2071 * This field is deprecated in favor of per-permission-type exemptions.
2072 */
2073 core.List<core.String> exemptedMembers;
2074 /**
2075 * Specifies a service that will be enabled for audit logging.
2076 * For example, `resourcemanager`, `storage`, `compute`.
2077 * `allServices` is a special value that covers all services.
2078 */
2079 core.String service;
2080
2081 AuditConfig();
2082
2083 AuditConfig.fromJson(core.Map _json) {
2084 if (_json.containsKey("auditLogConfigs")) {
2085 auditLogConfigs = _json["auditLogConfigs"].map((value) => new AuditLogConf ig.fromJson(value)).toList();
2086 }
2087 if (_json.containsKey("exemptedMembers")) {
2088 exemptedMembers = _json["exemptedMembers"];
2089 }
2090 if (_json.containsKey("service")) {
2091 service = _json["service"];
2092 }
2093 }
2094
2095 core.Map toJson() {
2096 var _json = new core.Map();
2097 if (auditLogConfigs != null) {
2098 _json["auditLogConfigs"] = auditLogConfigs.map((value) => (value).toJson() ).toList();
2099 }
2100 if (exemptedMembers != null) {
2101 _json["exemptedMembers"] = exemptedMembers;
2102 }
2103 if (service != null) {
2104 _json["service"] = service;
2105 }
2106 return _json;
2107 }
2108 }
2109
2110 /**
2111 * Provides the configuration for logging a type of permissions.
2112 * Example:
2113 *
2114 * {
2115 * "audit_log_configs": [
2116 * {
2117 * "log_type": "DATA_READ",
2118 * "exempted_members": [
2119 * "user:foo@gmail.com"
2120 * ]
2121 * },
2122 * {
2123 * "log_type": "DATA_WRITE",
2124 * }
2125 * ]
2126 * }
2127 *
2128 * This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting
2129 * foo@gmail.com from DATA_READ logging.
2130 */
2131 class AuditLogConfig {
2132 /**
2133 * Specifies the identities that do not cause logging for this type of
2134 * permission.
2135 * Follows the same format of Binding.members.
2136 */
2137 core.List<core.String> exemptedMembers;
2138 /**
2139 * The log type that this config enables.
2140 * Possible string values are:
2141 * - "LOG_TYPE_UNSPECIFIED" : Default case. Should never be this.
2142 * - "ADMIN_READ" : Admin reads. Example: CloudIAM getIamPolicy
2143 * - "DATA_WRITE" : Data writes. Example: CloudSQL Users create
2144 * - "DATA_READ" : Data reads. Example: CloudSQL Users list
2145 */
2146 core.String logType;
2147
2148 AuditLogConfig();
2149
2150 AuditLogConfig.fromJson(core.Map _json) {
2151 if (_json.containsKey("exemptedMembers")) {
2152 exemptedMembers = _json["exemptedMembers"];
2153 }
2154 if (_json.containsKey("logType")) {
2155 logType = _json["logType"];
2156 }
2157 }
2158
2159 core.Map toJson() {
2160 var _json = new core.Map();
2161 if (exemptedMembers != null) {
2162 _json["exemptedMembers"] = exemptedMembers;
2163 }
2164 if (logType != null) {
2165 _json["logType"] = logType;
2166 }
2167 return _json;
2168 }
2169 }
2170
2171 /** The request for BeginTransaction. */
2172 class BeginTransactionRequest {
2173 /** Required. Options for the new transaction. */
2174 TransactionOptions options;
2175
2176 BeginTransactionRequest();
2177
2178 BeginTransactionRequest.fromJson(core.Map _json) {
2179 if (_json.containsKey("options")) {
2180 options = new TransactionOptions.fromJson(_json["options"]);
2181 }
2182 }
2183
2184 core.Map toJson() {
2185 var _json = new core.Map();
2186 if (options != null) {
2187 _json["options"] = (options).toJson();
2188 }
2189 return _json;
2190 }
2191 }
2192
2193 /** Associates `members` with a `role`. */
2194 class Binding {
2195 /**
2196 * Specifies the identities requesting access for a Cloud Platform resource.
2197 * `members` can have the following values:
2198 *
2199 * * `allUsers`: A special identifier that represents anyone who is
2200 * on the internet; with or without a Google account.
2201 *
2202 * * `allAuthenticatedUsers`: A special identifier that represents anyone
2203 * who is authenticated with a Google account or a service account.
2204 *
2205 * * `user:{emailid}`: An email address that represents a specific Google
2206 * account. For example, `alice@gmail.com` or `joe@example.com`.
2207 *
2208 *
2209 * * `serviceAccount:{emailid}`: An email address that represents a service
2210 * account. For example, `my-other-app@appspot.gserviceaccount.com`.
2211 *
2212 * * `group:{emailid}`: An email address that represents a Google group.
2213 * For example, `admins@example.com`.
2214 *
2215 * * `domain:{domain}`: A Google Apps domain name that represents all the
2216 * users of that domain. For example, `google.com` or `example.com`.
2217 */
2218 core.List<core.String> members;
2219 /**
2220 * Role that is assigned to `members`.
2221 * For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
2222 * Required
2223 */
2224 core.String role;
2225
2226 Binding();
2227
2228 Binding.fromJson(core.Map _json) {
2229 if (_json.containsKey("members")) {
2230 members = _json["members"];
2231 }
2232 if (_json.containsKey("role")) {
2233 role = _json["role"];
2234 }
2235 }
2236
2237 core.Map toJson() {
2238 var _json = new core.Map();
2239 if (members != null) {
2240 _json["members"] = members;
2241 }
2242 if (role != null) {
2243 _json["role"] = role;
2244 }
2245 return _json;
2246 }
2247 }
2248
2249 /**
2250 * Metadata associated with a parent-child relationship appearing in a
2251 * PlanNode.
2252 */
2253 class ChildLink {
2254 /** The node to which the link points. */
2255 core.int childIndex;
2256 /**
2257 * The type of the link. For example, in Hash Joins this could be used to
2258 * distinguish between the build child and the probe child, or in the case
2259 * of the child being an output variable, to represent the tag associated
2260 * with the output variable.
2261 */
2262 core.String type;
2263 /**
2264 * Only present if the child node is SCALAR and corresponds
2265 * to an output variable of the parent node. The field carries the name of
2266 * the output variable.
2267 * For example, a `TableScan` operator that reads rows from a table will
2268 * have child links to the `SCALAR` nodes representing the output variables
2269 * created for each column that is read by the operator. The corresponding
2270 * `variable` fields will be set to the variable names assigned to the
2271 * columns.
2272 */
2273 core.String variable;
2274
2275 ChildLink();
2276
2277 ChildLink.fromJson(core.Map _json) {
2278 if (_json.containsKey("childIndex")) {
2279 childIndex = _json["childIndex"];
2280 }
2281 if (_json.containsKey("type")) {
2282 type = _json["type"];
2283 }
2284 if (_json.containsKey("variable")) {
2285 variable = _json["variable"];
2286 }
2287 }
2288
2289 core.Map toJson() {
2290 var _json = new core.Map();
2291 if (childIndex != null) {
2292 _json["childIndex"] = childIndex;
2293 }
2294 if (type != null) {
2295 _json["type"] = type;
2296 }
2297 if (variable != null) {
2298 _json["variable"] = variable;
2299 }
2300 return _json;
2301 }
2302 }
2303
2304 /** Write a Cloud Audit log */
2305 class CloudAuditOptions {
2306
2307 CloudAuditOptions();
2308
2309 CloudAuditOptions.fromJson(core.Map _json) {
2310 }
2311
2312 core.Map toJson() {
2313 var _json = new core.Map();
2314 return _json;
2315 }
2316 }
2317
2318 /** The request for Commit. */
2319 class CommitRequest {
2320 /**
2321 * The mutations to be executed when this transaction commits. All
2322 * mutations are applied atomically, in the order they appear in
2323 * this list.
2324 */
2325 core.List<Mutation> mutations;
2326 /**
2327 * Execute mutations in a temporary transaction. Note that unlike
2328 * commit of a previously-started transaction, commit with a
2329 * temporary transaction is non-idempotent. That is, if the
2330 * `CommitRequest` is sent to Cloud Spanner more than once (for
2331 * instance, due to retries in the application, or in the
2332 * transport library), it is possible that the mutations are
2333 * executed more than once. If this is undesirable, use
2334 * BeginTransaction and
2335 * Commit instead.
2336 */
2337 TransactionOptions singleUseTransaction;
2338 /** Commit a previously-started transaction. */
2339 core.String transactionId;
2340 core.List<core.int> get transactionIdAsBytes {
2341 return convert.BASE64.decode(transactionId);
2342 }
2343
2344 void set transactionIdAsBytes(core.List<core.int> _bytes) {
2345 transactionId = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAl l("+", "-");
2346 }
2347
2348 CommitRequest();
2349
2350 CommitRequest.fromJson(core.Map _json) {
2351 if (_json.containsKey("mutations")) {
2352 mutations = _json["mutations"].map((value) => new Mutation.fromJson(value) ).toList();
2353 }
2354 if (_json.containsKey("singleUseTransaction")) {
2355 singleUseTransaction = new TransactionOptions.fromJson(_json["singleUseTra nsaction"]);
2356 }
2357 if (_json.containsKey("transactionId")) {
2358 transactionId = _json["transactionId"];
2359 }
2360 }
2361
2362 core.Map toJson() {
2363 var _json = new core.Map();
2364 if (mutations != null) {
2365 _json["mutations"] = mutations.map((value) => (value).toJson()).toList();
2366 }
2367 if (singleUseTransaction != null) {
2368 _json["singleUseTransaction"] = (singleUseTransaction).toJson();
2369 }
2370 if (transactionId != null) {
2371 _json["transactionId"] = transactionId;
2372 }
2373 return _json;
2374 }
2375 }
2376
2377 /** The response for Commit. */
2378 class CommitResponse {
2379 /** The Cloud Spanner timestamp at which the transaction committed. */
2380 core.String commitTimestamp;
2381
2382 CommitResponse();
2383
2384 CommitResponse.fromJson(core.Map _json) {
2385 if (_json.containsKey("commitTimestamp")) {
2386 commitTimestamp = _json["commitTimestamp"];
2387 }
2388 }
2389
2390 core.Map toJson() {
2391 var _json = new core.Map();
2392 if (commitTimestamp != null) {
2393 _json["commitTimestamp"] = commitTimestamp;
2394 }
2395 return _json;
2396 }
2397 }
2398
2399 /** A condition to be met. */
2400 class Condition {
2401 /**
2402 * Trusted attributes supplied by the IAM system.
2403 * Possible string values are:
2404 * - "NO_ATTR" : Default non-attribute.
2405 * - "AUTHORITY" : Either principal or (if present) authority selector.
2406 * - "ATTRIBUTION" : The principal (even if an authority selector is present),
2407 * which
2408 * must only be used for attribution, not authorization.
2409 * - "SECURITY_REALM" : Any of the security realms in the IAMContext
2410 * (go/security-realms).
2411 * When used with IN, the condition indicates "any of the request's realms
2412 * match one of the given values; with NOT_IN, "none of the realms match
2413 * any of the given values". It is not permitted to grant access based on
2414 * the *absence* of a realm, so realm conditions can only be used in
2415 * a "positive" context (e.g., ALLOW/IN or DENY/NOT_IN).
2416 */
2417 core.String iam;
2418 /**
2419 * An operator to apply the subject with.
2420 * Possible string values are:
2421 * - "NO_OP" : Default no-op.
2422 * - "EQUALS" : DEPRECATED. Use IN instead.
2423 * - "NOT_EQUALS" : DEPRECATED. Use NOT_IN instead.
2424 * - "IN" : Set-inclusion check.
2425 * - "NOT_IN" : Set-exclusion check.
2426 * - "DISCHARGED" : Subject is discharged
2427 */
2428 core.String op;
2429 /** Trusted attributes discharged by the service. */
2430 core.String svc;
2431 /**
2432 * Trusted attributes supplied by any service that owns resources and uses
2433 * the IAM system for access control.
2434 * Possible string values are:
2435 * - "NO_ATTR" : Default non-attribute type
2436 * - "REGION" : Region of the resource
2437 * - "SERVICE" : Service name
2438 * - "NAME" : Resource name
2439 * - "IP" : IP address of the caller
2440 */
2441 core.String sys;
2442 /** DEPRECATED. Use 'values' instead. */
2443 core.String value;
2444 /** The objects of the condition. This is mutually exclusive with 'value'. */
2445 core.List<core.String> values;
2446
2447 Condition();
2448
2449 Condition.fromJson(core.Map _json) {
2450 if (_json.containsKey("iam")) {
2451 iam = _json["iam"];
2452 }
2453 if (_json.containsKey("op")) {
2454 op = _json["op"];
2455 }
2456 if (_json.containsKey("svc")) {
2457 svc = _json["svc"];
2458 }
2459 if (_json.containsKey("sys")) {
2460 sys = _json["sys"];
2461 }
2462 if (_json.containsKey("value")) {
2463 value = _json["value"];
2464 }
2465 if (_json.containsKey("values")) {
2466 values = _json["values"];
2467 }
2468 }
2469
2470 core.Map toJson() {
2471 var _json = new core.Map();
2472 if (iam != null) {
2473 _json["iam"] = iam;
2474 }
2475 if (op != null) {
2476 _json["op"] = op;
2477 }
2478 if (svc != null) {
2479 _json["svc"] = svc;
2480 }
2481 if (sys != null) {
2482 _json["sys"] = sys;
2483 }
2484 if (value != null) {
2485 _json["value"] = value;
2486 }
2487 if (values != null) {
2488 _json["values"] = values;
2489 }
2490 return _json;
2491 }
2492 }
2493
2494 /** Options for counters */
2495 class CounterOptions {
2496 /** The field value to attribute. */
2497 core.String field;
2498 /** The metric to update. */
2499 core.String metric;
2500
2501 CounterOptions();
2502
2503 CounterOptions.fromJson(core.Map _json) {
2504 if (_json.containsKey("field")) {
2505 field = _json["field"];
2506 }
2507 if (_json.containsKey("metric")) {
2508 metric = _json["metric"];
2509 }
2510 }
2511
2512 core.Map toJson() {
2513 var _json = new core.Map();
2514 if (field != null) {
2515 _json["field"] = field;
2516 }
2517 if (metric != null) {
2518 _json["metric"] = metric;
2519 }
2520 return _json;
2521 }
2522 }
2523
2524 /**
2525 * Metadata type for the operation returned by
2526 * CreateDatabase.
2527 */
2528 class CreateDatabaseMetadata {
2529 /** The database being created. */
2530 core.String database;
2531
2532 CreateDatabaseMetadata();
2533
2534 CreateDatabaseMetadata.fromJson(core.Map _json) {
2535 if (_json.containsKey("database")) {
2536 database = _json["database"];
2537 }
2538 }
2539
2540 core.Map toJson() {
2541 var _json = new core.Map();
2542 if (database != null) {
2543 _json["database"] = database;
2544 }
2545 return _json;
2546 }
2547 }
2548
2549 /** The request for CreateDatabase. */
2550 class CreateDatabaseRequest {
2551 /**
2552 * Required. A `CREATE DATABASE` statement, which specifies the ID of the
2553 * new database. The database ID must conform to the regular expression
2554 * `a-z*[a-z0-9]` and be between 2 and 30 characters in length.
2555 */
2556 core.String createStatement;
2557 /**
2558 * An optional list of DDL statements to run inside the newly created
2559 * database. Statements can create tables, indexes, etc. These
2560 * statements execute atomically with the creation of the database:
2561 * if there is an error in any statement, the database is not created.
2562 */
2563 core.List<core.String> extraStatements;
2564
2565 CreateDatabaseRequest();
2566
2567 CreateDatabaseRequest.fromJson(core.Map _json) {
2568 if (_json.containsKey("createStatement")) {
2569 createStatement = _json["createStatement"];
2570 }
2571 if (_json.containsKey("extraStatements")) {
2572 extraStatements = _json["extraStatements"];
2573 }
2574 }
2575
2576 core.Map toJson() {
2577 var _json = new core.Map();
2578 if (createStatement != null) {
2579 _json["createStatement"] = createStatement;
2580 }
2581 if (extraStatements != null) {
2582 _json["extraStatements"] = extraStatements;
2583 }
2584 return _json;
2585 }
2586 }
2587
2588 /**
2589 * Metadata type for the operation returned by
2590 * CreateInstance.
2591 */
2592 class CreateInstanceMetadata {
2593 /**
2594 * The time at which this operation was cancelled. If set, this operation is
2595 * in the process of undoing itself (which is guaranteed to succeed) and
2596 * cannot be cancelled again.
2597 */
2598 core.String cancelTime;
2599 /** The time at which this operation failed or was completed successfully. */
2600 core.String endTime;
2601 /** The instance being created. */
2602 Instance instance;
2603 /**
2604 * The time at which the
2605 * CreateInstance request was
2606 * received.
2607 */
2608 core.String startTime;
2609
2610 CreateInstanceMetadata();
2611
2612 CreateInstanceMetadata.fromJson(core.Map _json) {
2613 if (_json.containsKey("cancelTime")) {
2614 cancelTime = _json["cancelTime"];
2615 }
2616 if (_json.containsKey("endTime")) {
2617 endTime = _json["endTime"];
2618 }
2619 if (_json.containsKey("instance")) {
2620 instance = new Instance.fromJson(_json["instance"]);
2621 }
2622 if (_json.containsKey("startTime")) {
2623 startTime = _json["startTime"];
2624 }
2625 }
2626
2627 core.Map toJson() {
2628 var _json = new core.Map();
2629 if (cancelTime != null) {
2630 _json["cancelTime"] = cancelTime;
2631 }
2632 if (endTime != null) {
2633 _json["endTime"] = endTime;
2634 }
2635 if (instance != null) {
2636 _json["instance"] = (instance).toJson();
2637 }
2638 if (startTime != null) {
2639 _json["startTime"] = startTime;
2640 }
2641 return _json;
2642 }
2643 }
2644
2645 /** The request for CreateInstance. */
2646 class CreateInstanceRequest {
2647 /**
2648 * Required. The instance to create. The name may be omitted, but if
2649 * specified must be `<parent>/instances/<instance_id>`.
2650 */
2651 Instance instance;
2652 /**
2653 * Required. The ID of the instance to create. Valid identifiers are of the
2654 * form `a-z*[a-z0-9]` and must be between 6 and 30 characters in
2655 * length.
2656 */
2657 core.String instanceId;
2658
2659 CreateInstanceRequest();
2660
2661 CreateInstanceRequest.fromJson(core.Map _json) {
2662 if (_json.containsKey("instance")) {
2663 instance = new Instance.fromJson(_json["instance"]);
2664 }
2665 if (_json.containsKey("instanceId")) {
2666 instanceId = _json["instanceId"];
2667 }
2668 }
2669
2670 core.Map toJson() {
2671 var _json = new core.Map();
2672 if (instance != null) {
2673 _json["instance"] = (instance).toJson();
2674 }
2675 if (instanceId != null) {
2676 _json["instanceId"] = instanceId;
2677 }
2678 return _json;
2679 }
2680 }
2681
2682 /** Write a Data Access (Gin) log */
2683 class DataAccessOptions {
2684
2685 DataAccessOptions();
2686
2687 DataAccessOptions.fromJson(core.Map _json) {
2688 }
2689
2690 core.Map toJson() {
2691 var _json = new core.Map();
2692 return _json;
2693 }
2694 }
2695
2696 /** A Cloud Spanner database. */
2697 class Database {
2698 /**
2699 * Required. The name of the database. Values are of the form
2700 * `projects/<project>/instances/<instance>/databases/<database>`,
2701 * where `<database>` is as specified in the `CREATE DATABASE`
2702 * statement. This name can be passed to other API methods to
2703 * identify the database.
2704 */
2705 core.String name;
2706 /**
2707 * Output only. The current database state.
2708 * Possible string values are:
2709 * - "STATE_UNSPECIFIED" : Not specified.
2710 * - "CREATING" : The database is still being created. Operations on the
2711 * database may fail
2712 * with `FAILED_PRECONDITION` in this state.
2713 * - "READY" : The database is fully created and ready for use.
2714 */
2715 core.String state;
2716
2717 Database();
2718
2719 Database.fromJson(core.Map _json) {
2720 if (_json.containsKey("name")) {
2721 name = _json["name"];
2722 }
2723 if (_json.containsKey("state")) {
2724 state = _json["state"];
2725 }
2726 }
2727
2728 core.Map toJson() {
2729 var _json = new core.Map();
2730 if (name != null) {
2731 _json["name"] = name;
2732 }
2733 if (state != null) {
2734 _json["state"] = state;
2735 }
2736 return _json;
2737 }
2738 }
2739
2740 /** Arguments to delete operations. */
2741 class Delete {
2742 /** Required. The primary keys of the rows within table to delete. */
2743 KeySet keySet;
2744 /** Required. The table whose rows will be deleted. */
2745 core.String table;
2746
2747 Delete();
2748
2749 Delete.fromJson(core.Map _json) {
2750 if (_json.containsKey("keySet")) {
2751 keySet = new KeySet.fromJson(_json["keySet"]);
2752 }
2753 if (_json.containsKey("table")) {
2754 table = _json["table"];
2755 }
2756 }
2757
2758 core.Map toJson() {
2759 var _json = new core.Map();
2760 if (keySet != null) {
2761 _json["keySet"] = (keySet).toJson();
2762 }
2763 if (table != null) {
2764 _json["table"] = table;
2765 }
2766 return _json;
2767 }
2768 }
2769
2770 /**
2771 * A generic empty message that you can re-use to avoid defining duplicated
2772 * empty messages in your APIs. A typical example is to use it as the request
2773 * or the response type of an API method. For instance:
2774 *
2775 * service Foo {
2776 * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
2777 * }
2778 *
2779 * The JSON representation for `Empty` is empty JSON object `{}`.
2780 */
2781 class Empty {
2782
2783 Empty();
2784
2785 Empty.fromJson(core.Map _json) {
2786 }
2787
2788 core.Map toJson() {
2789 var _json = new core.Map();
2790 return _json;
2791 }
2792 }
2793
2794 /**
2795 * The request for ExecuteSql and
2796 * ExecuteStreamingSql.
2797 */
2798 class ExecuteSqlRequest {
2799 /**
2800 * It is not always possible for Cloud Spanner to infer the right SQL type
2801 * from a JSON value. For example, values of type `BYTES` and values
2802 * of type `STRING` both appear in params as JSON strings.
2803 *
2804 * In these cases, `param_types` can be used to specify the exact
2805 * SQL type for some or all of the SQL query parameters. See the
2806 * definition of Type for more information
2807 * about SQL types.
2808 */
2809 core.Map<core.String, Type> paramTypes;
2810 /**
2811 * The SQL query string can contain parameter placeholders. A parameter
2812 * placeholder consists of `'@'` followed by the parameter
2813 * name. Parameter names consist of any combination of letters,
2814 * numbers, and underscores.
2815 *
2816 * Parameters can appear anywhere that a literal value is expected. The same
2817 * parameter name can be used more than once, for example:
2818 * `"WHERE id > @msg_id AND id < @msg_id + 100"`
2819 *
2820 * It is an error to execute an SQL query with unbound parameters.
2821 *
2822 * Parameter values are specified using `params`, which is a JSON
2823 * object whose keys are parameter names, and whose values are the
2824 * corresponding parameter values.
2825 *
2826 * The values for Object must be JSON objects. It can consist of `num`,
2827 * `String`, `bool` and `null` as well as `Map` and `List` values.
2828 */
2829 core.Map<core.String, core.Object> params;
2830 /**
2831 * Used to control the amount of debugging information returned in
2832 * ResultSetStats.
2833 * Possible string values are:
2834 * - "NORMAL" : The default mode where only the query result, without any
2835 * information
2836 * about the query plan is returned.
2837 * - "PLAN" : This mode returns only the query plan, without any result rows
2838 * or
2839 * execution statistics information.
2840 * - "PROFILE" : This mode returns both the query plan and the execution
2841 * statistics along
2842 * with the result rows.
2843 */
2844 core.String queryMode;
2845 /**
2846 * If this request is resuming a previously interrupted SQL query
2847 * execution, `resume_token` should be copied from the last
2848 * PartialResultSet yielded before the interruption. Doing this
2849 * enables the new SQL query execution to resume where the last one left
2850 * off. The rest of the request parameters must exactly match the
2851 * request that yielded this token.
2852 */
2853 core.String resumeToken;
2854 core.List<core.int> get resumeTokenAsBytes {
2855 return convert.BASE64.decode(resumeToken);
2856 }
2857
2858 void set resumeTokenAsBytes(core.List<core.int> _bytes) {
2859 resumeToken = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll( "+", "-");
2860 }
2861 /** Required. The SQL query string. */
2862 core.String sql;
2863 /**
2864 * The transaction to use. If none is provided, the default is a
2865 * temporary read-only transaction with strong concurrency.
2866 */
2867 TransactionSelector transaction;
2868
2869 ExecuteSqlRequest();
2870
2871 ExecuteSqlRequest.fromJson(core.Map _json) {
2872 if (_json.containsKey("paramTypes")) {
2873 paramTypes = commons.mapMap(_json["paramTypes"], (item) => new Type.fromJs on(item));
2874 }
2875 if (_json.containsKey("params")) {
2876 params = _json["params"];
2877 }
2878 if (_json.containsKey("queryMode")) {
2879 queryMode = _json["queryMode"];
2880 }
2881 if (_json.containsKey("resumeToken")) {
2882 resumeToken = _json["resumeToken"];
2883 }
2884 if (_json.containsKey("sql")) {
2885 sql = _json["sql"];
2886 }
2887 if (_json.containsKey("transaction")) {
2888 transaction = new TransactionSelector.fromJson(_json["transaction"]);
2889 }
2890 }
2891
2892 core.Map toJson() {
2893 var _json = new core.Map();
2894 if (paramTypes != null) {
2895 _json["paramTypes"] = commons.mapMap(paramTypes, (item) => (item).toJson() );
2896 }
2897 if (params != null) {
2898 _json["params"] = params;
2899 }
2900 if (queryMode != null) {
2901 _json["queryMode"] = queryMode;
2902 }
2903 if (resumeToken != null) {
2904 _json["resumeToken"] = resumeToken;
2905 }
2906 if (sql != null) {
2907 _json["sql"] = sql;
2908 }
2909 if (transaction != null) {
2910 _json["transaction"] = (transaction).toJson();
2911 }
2912 return _json;
2913 }
2914 }
2915
2916 /** Message representing a single field of a struct. */
2917 class Field {
2918 /**
2919 * The name of the field. For reads, this is the column name. For
2920 * SQL queries, it is the column alias (e.g., `"Word"` in the
2921 * query `"SELECT 'hello' AS Word"`), or the column name (e.g.,
2922 * `"ColName"` in the query `"SELECT ColName FROM Table"`). Some
2923 * columns might have an empty name (e.g., !"SELECT
2924 * UPPER(ColName)"`). Note that a query result can contain
2925 * multiple fields with the same name.
2926 */
2927 core.String name;
2928 /** The type of the field. */
2929 Type type;
2930
2931 Field();
2932
2933 Field.fromJson(core.Map _json) {
2934 if (_json.containsKey("name")) {
2935 name = _json["name"];
2936 }
2937 if (_json.containsKey("type")) {
2938 type = new Type.fromJson(_json["type"]);
2939 }
2940 }
2941
2942 core.Map toJson() {
2943 var _json = new core.Map();
2944 if (name != null) {
2945 _json["name"] = name;
2946 }
2947 if (type != null) {
2948 _json["type"] = (type).toJson();
2949 }
2950 return _json;
2951 }
2952 }
2953
2954 /** The response for GetDatabaseDdl. */
2955 class GetDatabaseDdlResponse {
2956 /**
2957 * A list of formatted DDL statements defining the schema of the database
2958 * specified in the request.
2959 */
2960 core.List<core.String> statements;
2961
2962 GetDatabaseDdlResponse();
2963
2964 GetDatabaseDdlResponse.fromJson(core.Map _json) {
2965 if (_json.containsKey("statements")) {
2966 statements = _json["statements"];
2967 }
2968 }
2969
2970 core.Map toJson() {
2971 var _json = new core.Map();
2972 if (statements != null) {
2973 _json["statements"] = statements;
2974 }
2975 return _json;
2976 }
2977 }
2978
2979 /** Request message for `GetIamPolicy` method. */
2980 class GetIamPolicyRequest {
2981
2982 GetIamPolicyRequest();
2983
2984 GetIamPolicyRequest.fromJson(core.Map _json) {
2985 }
2986
2987 core.Map toJson() {
2988 var _json = new core.Map();
2989 return _json;
2990 }
2991 }
2992
2993 /**
2994 * An isolated set of Cloud Spanner resources on which databases can be hosted.
2995 */
2996 class Instance {
2997 /**
2998 * Required. The name of the instance's configuration. Values are of the form
2999 * `projects/<project>/instanceConfigs/<configuration>`. See
3000 * also InstanceConfig and
3001 * ListInstanceConfigs.
3002 */
3003 core.String config;
3004 /**
3005 * Required. The descriptive name for this instance as it appears in UIs.
3006 * Must be unique per project and between 4 and 30 characters in length.
3007 */
3008 core.String displayName;
3009 /**
3010 * Cloud Labels are a flexible and lightweight mechanism for organizing cloud
3011 * resources into groups that reflect a customer's organizational needs and
3012 * deployment strategies. Cloud Labels can be used to filter collections of
3013 * resources. They can be used to control how resource metrics are aggregated.
3014 * And they can be used as arguments to policy management rules (e.g. route,
3015 * firewall, load balancing, etc.).
3016 *
3017 * * Label keys must be between 1 and 63 characters long and must conform to
3018 * the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.
3019 * * Label values must be between 0 and 63 characters long and must conform
3020 * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
3021 * * No more than 64 labels can be associated with a given resource.
3022 *
3023 * See https://goo.gl/xmQnxf for more information on and examples of labels.
3024 *
3025 * If you plan to use labels in your own code, please note that additional
3026 * characters may be allowed in the future. And so you are advised to use an
3027 * internal label representation, such as JSON, which doesn't rely upon
3028 * specific characters being disallowed. For example, representing labels
3029 * as the string: name + "_" + value would prove problematic if we were to
3030 * allow "_" in a future release.
3031 */
3032 core.Map<core.String, core.String> labels;
3033 /**
3034 * Required. A unique identifier for the instance, which cannot be changed
3035 * after the instance is created. Values are of the form
3036 * `projects/<project>/instances/a-z*[a-z0-9]`. The final
3037 * segment of the name must be between 6 and 30 characters in length.
3038 */
3039 core.String name;
3040 /** Required. The number of nodes allocated to this instance. */
3041 core.int nodeCount;
3042 /**
3043 * Output only. The current instance state. For
3044 * CreateInstance, the state must be
3045 * either omitted or set to `CREATING`. For
3046 * UpdateInstance, the state must be
3047 * either omitted or set to `READY`.
3048 * Possible string values are:
3049 * - "STATE_UNSPECIFIED" : Not specified.
3050 * - "CREATING" : The instance is still being created. Resources may not be
3051 * available yet, and operations such as database creation may not
3052 * work.
3053 * - "READY" : The instance is fully created and ready to do work such as
3054 * creating databases.
3055 */
3056 core.String state;
3057
3058 Instance();
3059
3060 Instance.fromJson(core.Map _json) {
3061 if (_json.containsKey("config")) {
3062 config = _json["config"];
3063 }
3064 if (_json.containsKey("displayName")) {
3065 displayName = _json["displayName"];
3066 }
3067 if (_json.containsKey("labels")) {
3068 labels = _json["labels"];
3069 }
3070 if (_json.containsKey("name")) {
3071 name = _json["name"];
3072 }
3073 if (_json.containsKey("nodeCount")) {
3074 nodeCount = _json["nodeCount"];
3075 }
3076 if (_json.containsKey("state")) {
3077 state = _json["state"];
3078 }
3079 }
3080
3081 core.Map toJson() {
3082 var _json = new core.Map();
3083 if (config != null) {
3084 _json["config"] = config;
3085 }
3086 if (displayName != null) {
3087 _json["displayName"] = displayName;
3088 }
3089 if (labels != null) {
3090 _json["labels"] = labels;
3091 }
3092 if (name != null) {
3093 _json["name"] = name;
3094 }
3095 if (nodeCount != null) {
3096 _json["nodeCount"] = nodeCount;
3097 }
3098 if (state != null) {
3099 _json["state"] = state;
3100 }
3101 return _json;
3102 }
3103 }
3104
3105 /**
3106 * A possible configuration for a Cloud Spanner instance. Configurations
3107 * define the geographic placement of nodes and their replication.
3108 */
3109 class InstanceConfig {
3110 /** The name of this instance configuration as it appears in UIs. */
3111 core.String displayName;
3112 /**
3113 * A unique identifier for the instance configuration. Values
3114 * are of the form
3115 * `projects/<project>/instanceConfigs/a-z*`
3116 */
3117 core.String name;
3118
3119 InstanceConfig();
3120
3121 InstanceConfig.fromJson(core.Map _json) {
3122 if (_json.containsKey("displayName")) {
3123 displayName = _json["displayName"];
3124 }
3125 if (_json.containsKey("name")) {
3126 name = _json["name"];
3127 }
3128 }
3129
3130 core.Map toJson() {
3131 var _json = new core.Map();
3132 if (displayName != null) {
3133 _json["displayName"] = displayName;
3134 }
3135 if (name != null) {
3136 _json["name"] = name;
3137 }
3138 return _json;
3139 }
3140 }
3141
3142 /**
3143 * KeyRange represents a range of rows in a table or index.
3144 *
3145 * A range has a start key and an end key. These keys can be open or
3146 * closed, indicating if the range includes rows with that key.
3147 *
3148 * Keys are represented by lists, where the ith value in the list
3149 * corresponds to the ith component of the table or index primary key.
3150 * Individual values are encoded as described here.
3151 *
3152 * For example, consider the following table definition:
3153 *
3154 * CREATE TABLE UserEvents (
3155 * UserName STRING(MAX),
3156 * EventDate STRING(10)
3157 * ) PRIMARY KEY(UserName, EventDate);
3158 *
3159 * The following keys name rows in this table:
3160 *
3161 * "Bob", "2014-09-23"
3162 *
3163 * Since the `UserEvents` table's `PRIMARY KEY` clause names two
3164 * columns, each `UserEvents` key has two elements; the first is the
3165 * `UserName`, and the second is the `EventDate`.
3166 *
3167 * Key ranges with multiple components are interpreted
3168 * lexicographically by component using the table or index key's declared
3169 * sort order. For example, the following range returns all events for
3170 * user `"Bob"` that occurred in the year 2015:
3171 *
3172 * "start_closed": ["Bob", "2015-01-01"]
3173 * "end_closed": ["Bob", "2015-12-31"]
3174 *
3175 * Start and end keys can omit trailing key components. This affects the
3176 * inclusion and exclusion of rows that exactly match the provided key
3177 * components: if the key is closed, then rows that exactly match the
3178 * provided components are included; if the key is open, then rows
3179 * that exactly match are not included.
3180 *
3181 * For example, the following range includes all events for `"Bob"` that
3182 * occurred during and after the year 2000:
3183 *
3184 * "start_closed": ["Bob", "2000-01-01"]
3185 * "end_closed": ["Bob"]
3186 *
3187 * The next example retrieves all events for `"Bob"`:
3188 *
3189 * "start_closed": ["Bob"]
3190 * "end_closed": ["Bob"]
3191 *
3192 * To retrieve events before the year 2000:
3193 *
3194 * "start_closed": ["Bob"]
3195 * "end_open": ["Bob", "2000-01-01"]
3196 *
3197 * The following range includes all rows in the table:
3198 *
3199 * "start_closed": []
3200 * "end_closed": []
3201 *
3202 * This range returns all users whose `UserName` begins with any
3203 * character from A to C:
3204 *
3205 * "start_closed": ["A"]
3206 * "end_open": ["D"]
3207 *
3208 * This range returns all users whose `UserName` begins with B:
3209 *
3210 * "start_closed": ["B"]
3211 * "end_open": ["C"]
3212 *
3213 * Key ranges honor column sort order. For example, suppose a table is
3214 * defined as follows:
3215 *
3216 * CREATE TABLE DescendingSortedTable {
3217 * Key INT64,
3218 * ...
3219 * ) PRIMARY KEY(Key DESC);
3220 *
3221 * The following range retrieves all rows with key values between 1
3222 * and 100 inclusive:
3223 *
3224 * "start_closed": ["100"]
3225 * "end_closed": ["1"]
3226 *
3227 * Note that 100 is passed as the start, and 1 is passed as the end,
3228 * because `Key` is a descending column in the schema.
3229 */
3230 class KeyRange {
3231 /**
3232 * If the end is closed, then the range includes all rows whose
3233 * first `len(end_closed)` key columns exactly match `end_closed`.
3234 *
3235 * The values for Object must be JSON objects. It can consist of `num`,
3236 * `String`, `bool` and `null` as well as `Map` and `List` values.
3237 */
3238 core.List<core.Object> endClosed;
3239 /**
3240 * If the end is open, then the range excludes rows whose first
3241 * `len(end_open)` key columns exactly match `end_open`.
3242 *
3243 * The values for Object must be JSON objects. It can consist of `num`,
3244 * `String`, `bool` and `null` as well as `Map` and `List` values.
3245 */
3246 core.List<core.Object> endOpen;
3247 /**
3248 * If the start is closed, then the range includes all rows whose
3249 * first `len(start_closed)` key columns exactly match `start_closed`.
3250 *
3251 * The values for Object must be JSON objects. It can consist of `num`,
3252 * `String`, `bool` and `null` as well as `Map` and `List` values.
3253 */
3254 core.List<core.Object> startClosed;
3255 /**
3256 * If the start is open, then the range excludes rows whose first
3257 * `len(start_open)` key columns exactly match `start_open`.
3258 *
3259 * The values for Object must be JSON objects. It can consist of `num`,
3260 * `String`, `bool` and `null` as well as `Map` and `List` values.
3261 */
3262 core.List<core.Object> startOpen;
3263
3264 KeyRange();
3265
3266 KeyRange.fromJson(core.Map _json) {
3267 if (_json.containsKey("endClosed")) {
3268 endClosed = _json["endClosed"];
3269 }
3270 if (_json.containsKey("endOpen")) {
3271 endOpen = _json["endOpen"];
3272 }
3273 if (_json.containsKey("startClosed")) {
3274 startClosed = _json["startClosed"];
3275 }
3276 if (_json.containsKey("startOpen")) {
3277 startOpen = _json["startOpen"];
3278 }
3279 }
3280
3281 core.Map toJson() {
3282 var _json = new core.Map();
3283 if (endClosed != null) {
3284 _json["endClosed"] = endClosed;
3285 }
3286 if (endOpen != null) {
3287 _json["endOpen"] = endOpen;
3288 }
3289 if (startClosed != null) {
3290 _json["startClosed"] = startClosed;
3291 }
3292 if (startOpen != null) {
3293 _json["startOpen"] = startOpen;
3294 }
3295 return _json;
3296 }
3297 }
3298
3299 /**
3300 * `KeySet` defines a collection of Cloud Spanner keys and/or key ranges. All
3301 * the keys are expected to be in the same table or index. The keys need
3302 * not be sorted in any particular way.
3303 *
3304 * If the same key is specified multiple times in the set (for example
3305 * if two ranges, two keys, or a key and a range overlap), Cloud Spanner
3306 * behaves as if the key were only specified once.
3307 */
3308 class KeySet {
3309 /**
3310 * For convenience `all` can be set to `true` to indicate that this
3311 * `KeySet` matches all keys in the table or index. Note that any keys
3312 * specified in `keys` or `ranges` are only yielded once.
3313 */
3314 core.bool all;
3315 /**
3316 * A list of specific keys. Entries in `keys` should have exactly as
3317 * many elements as there are columns in the primary or index key
3318 * with which this `KeySet` is used. Individual key values are
3319 * encoded as described here.
3320 *
3321 * The values for Object must be JSON objects. It can consist of `num`,
3322 * `String`, `bool` and `null` as well as `Map` and `List` values.
3323 */
3324 core.List<core.List<core.Object>> keys;
3325 /**
3326 * A list of key ranges. See KeyRange for more information about
3327 * key range specifications.
3328 */
3329 core.List<KeyRange> ranges;
3330
3331 KeySet();
3332
3333 KeySet.fromJson(core.Map _json) {
3334 if (_json.containsKey("all")) {
3335 all = _json["all"];
3336 }
3337 if (_json.containsKey("keys")) {
3338 keys = _json["keys"];
3339 }
3340 if (_json.containsKey("ranges")) {
3341 ranges = _json["ranges"].map((value) => new KeyRange.fromJson(value)).toLi st();
3342 }
3343 }
3344
3345 core.Map toJson() {
3346 var _json = new core.Map();
3347 if (all != null) {
3348 _json["all"] = all;
3349 }
3350 if (keys != null) {
3351 _json["keys"] = keys;
3352 }
3353 if (ranges != null) {
3354 _json["ranges"] = ranges.map((value) => (value).toJson()).toList();
3355 }
3356 return _json;
3357 }
3358 }
3359
3360 /** The response for ListDatabases. */
3361 class ListDatabasesResponse {
3362 /** Databases that matched the request. */
3363 core.List<Database> databases;
3364 /**
3365 * `next_page_token` can be sent in a subsequent
3366 * ListDatabases call to fetch more
3367 * of the matching databases.
3368 */
3369 core.String nextPageToken;
3370
3371 ListDatabasesResponse();
3372
3373 ListDatabasesResponse.fromJson(core.Map _json) {
3374 if (_json.containsKey("databases")) {
3375 databases = _json["databases"].map((value) => new Database.fromJson(value) ).toList();
3376 }
3377 if (_json.containsKey("nextPageToken")) {
3378 nextPageToken = _json["nextPageToken"];
3379 }
3380 }
3381
3382 core.Map toJson() {
3383 var _json = new core.Map();
3384 if (databases != null) {
3385 _json["databases"] = databases.map((value) => (value).toJson()).toList();
3386 }
3387 if (nextPageToken != null) {
3388 _json["nextPageToken"] = nextPageToken;
3389 }
3390 return _json;
3391 }
3392 }
3393
3394 /** The response for ListInstanceConfigs. */
3395 class ListInstanceConfigsResponse {
3396 /** The list of requested instance configurations. */
3397 core.List<InstanceConfig> instanceConfigs;
3398 /**
3399 * `next_page_token` can be sent in a subsequent
3400 * ListInstanceConfigs call to
3401 * fetch more of the matching instance configurations.
3402 */
3403 core.String nextPageToken;
3404
3405 ListInstanceConfigsResponse();
3406
3407 ListInstanceConfigsResponse.fromJson(core.Map _json) {
3408 if (_json.containsKey("instanceConfigs")) {
3409 instanceConfigs = _json["instanceConfigs"].map((value) => new InstanceConf ig.fromJson(value)).toList();
3410 }
3411 if (_json.containsKey("nextPageToken")) {
3412 nextPageToken = _json["nextPageToken"];
3413 }
3414 }
3415
3416 core.Map toJson() {
3417 var _json = new core.Map();
3418 if (instanceConfigs != null) {
3419 _json["instanceConfigs"] = instanceConfigs.map((value) => (value).toJson() ).toList();
3420 }
3421 if (nextPageToken != null) {
3422 _json["nextPageToken"] = nextPageToken;
3423 }
3424 return _json;
3425 }
3426 }
3427
3428 /** The response for ListInstances. */
3429 class ListInstancesResponse {
3430 /** The list of requested instances. */
3431 core.List<Instance> instances;
3432 /**
3433 * `next_page_token` can be sent in a subsequent
3434 * ListInstances call to fetch more
3435 * of the matching instances.
3436 */
3437 core.String nextPageToken;
3438
3439 ListInstancesResponse();
3440
3441 ListInstancesResponse.fromJson(core.Map _json) {
3442 if (_json.containsKey("instances")) {
3443 instances = _json["instances"].map((value) => new Instance.fromJson(value) ).toList();
3444 }
3445 if (_json.containsKey("nextPageToken")) {
3446 nextPageToken = _json["nextPageToken"];
3447 }
3448 }
3449
3450 core.Map toJson() {
3451 var _json = new core.Map();
3452 if (instances != null) {
3453 _json["instances"] = instances.map((value) => (value).toJson()).toList();
3454 }
3455 if (nextPageToken != null) {
3456 _json["nextPageToken"] = nextPageToken;
3457 }
3458 return _json;
3459 }
3460 }
3461
3462 /** The response message for Operations.ListOperations. */
3463 class ListOperationsResponse {
3464 /** The standard List next-page token. */
3465 core.String nextPageToken;
3466 /** A list of operations that matches the specified filter in the request. */
3467 core.List<Operation> operations;
3468
3469 ListOperationsResponse();
3470
3471 ListOperationsResponse.fromJson(core.Map _json) {
3472 if (_json.containsKey("nextPageToken")) {
3473 nextPageToken = _json["nextPageToken"];
3474 }
3475 if (_json.containsKey("operations")) {
3476 operations = _json["operations"].map((value) => new Operation.fromJson(val ue)).toList();
3477 }
3478 }
3479
3480 core.Map toJson() {
3481 var _json = new core.Map();
3482 if (nextPageToken != null) {
3483 _json["nextPageToken"] = nextPageToken;
3484 }
3485 if (operations != null) {
3486 _json["operations"] = operations.map((value) => (value).toJson()).toList() ;
3487 }
3488 return _json;
3489 }
3490 }
3491
3492 /**
3493 * Specifies what kind of log the caller must write
3494 * Increment a streamz counter with the specified metric and field names.
3495 *
3496 * Metric names should start with a '/', generally be lowercase-only,
3497 * and end in "_count". Field names should not contain an initial slash.
3498 * The actual exported metric names will have "/iam/policy" prepended.
3499 *
3500 * Field names correspond to IAM request parameters and field values are
3501 * their respective values.
3502 *
3503 * At present the only supported field names are
3504 * - "iam_principal", corresponding to IAMContext.principal;
3505 * - "" (empty string), resulting in one aggretated counter with no field.
3506 *
3507 * Examples:
3508 * counter { metric: "/debug_access_count" field: "iam_principal" }
3509 * ==> increment counter /iam/policy/backend_debug_access_count
3510 * {iam_principal=[value of IAMContext.principal]}
3511 *
3512 * At this time we do not support:
3513 * * multiple field names (though this may be supported in the future)
3514 * * decrementing the counter
3515 * * incrementing it by anything other than 1
3516 */
3517 class LogConfig {
3518 /** Cloud audit options. */
3519 CloudAuditOptions cloudAudit;
3520 /** Counter options. */
3521 CounterOptions counter;
3522 /** Data access options. */
3523 DataAccessOptions dataAccess;
3524
3525 LogConfig();
3526
3527 LogConfig.fromJson(core.Map _json) {
3528 if (_json.containsKey("cloudAudit")) {
3529 cloudAudit = new CloudAuditOptions.fromJson(_json["cloudAudit"]);
3530 }
3531 if (_json.containsKey("counter")) {
3532 counter = new CounterOptions.fromJson(_json["counter"]);
3533 }
3534 if (_json.containsKey("dataAccess")) {
3535 dataAccess = new DataAccessOptions.fromJson(_json["dataAccess"]);
3536 }
3537 }
3538
3539 core.Map toJson() {
3540 var _json = new core.Map();
3541 if (cloudAudit != null) {
3542 _json["cloudAudit"] = (cloudAudit).toJson();
3543 }
3544 if (counter != null) {
3545 _json["counter"] = (counter).toJson();
3546 }
3547 if (dataAccess != null) {
3548 _json["dataAccess"] = (dataAccess).toJson();
3549 }
3550 return _json;
3551 }
3552 }
3553
3554 /**
3555 * A modification to one or more Cloud Spanner rows. Mutations can be
3556 * applied to a Cloud Spanner database by sending them in a
3557 * Commit call.
3558 */
3559 class Mutation {
3560 /**
3561 * Delete rows from a table. Succeeds whether or not the named
3562 * rows were present.
3563 */
3564 Delete delete;
3565 /**
3566 * Insert new rows in a table. If any of the rows already exist,
3567 * the write or transaction fails with error `ALREADY_EXISTS`.
3568 */
3569 Write insert;
3570 /**
3571 * Like insert, except that if the row already exists, then
3572 * its column values are overwritten with the ones provided. Any
3573 * column values not explicitly written are preserved.
3574 */
3575 Write insertOrUpdate;
3576 /**
3577 * Like insert, except that if the row already exists, it is
3578 * deleted, and the column values provided are inserted
3579 * instead. Unlike insert_or_update, this means any values not
3580 * explicitly written become `NULL`.
3581 */
3582 Write replace;
3583 /**
3584 * Update existing rows in a table. If any of the rows does not
3585 * already exist, the transaction fails with error `NOT_FOUND`.
3586 */
3587 Write update;
3588
3589 Mutation();
3590
3591 Mutation.fromJson(core.Map _json) {
3592 if (_json.containsKey("delete")) {
3593 delete = new Delete.fromJson(_json["delete"]);
3594 }
3595 if (_json.containsKey("insert")) {
3596 insert = new Write.fromJson(_json["insert"]);
3597 }
3598 if (_json.containsKey("insertOrUpdate")) {
3599 insertOrUpdate = new Write.fromJson(_json["insertOrUpdate"]);
3600 }
3601 if (_json.containsKey("replace")) {
3602 replace = new Write.fromJson(_json["replace"]);
3603 }
3604 if (_json.containsKey("update")) {
3605 update = new Write.fromJson(_json["update"]);
3606 }
3607 }
3608
3609 core.Map toJson() {
3610 var _json = new core.Map();
3611 if (delete != null) {
3612 _json["delete"] = (delete).toJson();
3613 }
3614 if (insert != null) {
3615 _json["insert"] = (insert).toJson();
3616 }
3617 if (insertOrUpdate != null) {
3618 _json["insertOrUpdate"] = (insertOrUpdate).toJson();
3619 }
3620 if (replace != null) {
3621 _json["replace"] = (replace).toJson();
3622 }
3623 if (update != null) {
3624 _json["update"] = (update).toJson();
3625 }
3626 return _json;
3627 }
3628 }
3629
3630 /**
3631 * This resource represents a long-running operation that is the result of a
3632 * network API call.
3633 */
3634 class Operation {
3635 /**
3636 * If the value is `false`, it means the operation is still in progress.
3637 * If true, the operation is completed, and either `error` or `response` is
3638 * available.
3639 */
3640 core.bool done;
3641 /** The error result of the operation in case of failure or cancellation. */
3642 Status error;
3643 /**
3644 * Service-specific metadata associated with the operation. It typically
3645 * contains progress information and common metadata such as create time.
3646 * Some services might not provide such metadata. Any method that returns a
3647 * long-running operation should document the metadata type, if any.
3648 *
3649 * The values for Object must be JSON objects. It can consist of `num`,
3650 * `String`, `bool` and `null` as well as `Map` and `List` values.
3651 */
3652 core.Map<core.String, core.Object> metadata;
3653 /**
3654 * The server-assigned name, which is only unique within the same service that
3655 * originally returns it. If you use the default HTTP mapping, the
3656 * `name` should have the format of `operations/some/unique/name`.
3657 */
3658 core.String name;
3659 /**
3660 * The normal response of the operation in case of success. If the original
3661 * method returns no data on success, such as `Delete`, the response is
3662 * `google.protobuf.Empty`. If the original method is standard
3663 * `Get`/`Create`/`Update`, the response should be the resource. For other
3664 * methods, the response should have the type `XxxResponse`, where `Xxx`
3665 * is the original method name. For example, if the original method name
3666 * is `TakeSnapshot()`, the inferred response type is
3667 * `TakeSnapshotResponse`.
3668 *
3669 * The values for Object must be JSON objects. It can consist of `num`,
3670 * `String`, `bool` and `null` as well as `Map` and `List` values.
3671 */
3672 core.Map<core.String, core.Object> response;
3673
3674 Operation();
3675
3676 Operation.fromJson(core.Map _json) {
3677 if (_json.containsKey("done")) {
3678 done = _json["done"];
3679 }
3680 if (_json.containsKey("error")) {
3681 error = new Status.fromJson(_json["error"]);
3682 }
3683 if (_json.containsKey("metadata")) {
3684 metadata = _json["metadata"];
3685 }
3686 if (_json.containsKey("name")) {
3687 name = _json["name"];
3688 }
3689 if (_json.containsKey("response")) {
3690 response = _json["response"];
3691 }
3692 }
3693
3694 core.Map toJson() {
3695 var _json = new core.Map();
3696 if (done != null) {
3697 _json["done"] = done;
3698 }
3699 if (error != null) {
3700 _json["error"] = (error).toJson();
3701 }
3702 if (metadata != null) {
3703 _json["metadata"] = metadata;
3704 }
3705 if (name != null) {
3706 _json["name"] = name;
3707 }
3708 if (response != null) {
3709 _json["response"] = response;
3710 }
3711 return _json;
3712 }
3713 }
3714
3715 /**
3716 * Partial results from a streaming read or SQL query. Streaming reads and
3717 * SQL queries better tolerate large result sets, large rows, and large
3718 * values, but are a little trickier to consume.
3719 */
3720 class PartialResultSet {
3721 /**
3722 * If true, then the final value in values is chunked, and must
3723 * be combined with more values from subsequent `PartialResultSet`s
3724 * to obtain a complete field value.
3725 */
3726 core.bool chunkedValue;
3727 /**
3728 * Metadata about the result set, such as row type information.
3729 * Only present in the first response.
3730 */
3731 ResultSetMetadata metadata;
3732 /**
3733 * Streaming calls might be interrupted for a variety of reasons, such
3734 * as TCP connection loss. If this occurs, the stream of results can
3735 * be resumed by re-sending the original request and including
3736 * `resume_token`. Note that executing any other transaction in the
3737 * same session invalidates the token.
3738 */
3739 core.String resumeToken;
3740 core.List<core.int> get resumeTokenAsBytes {
3741 return convert.BASE64.decode(resumeToken);
3742 }
3743
3744 void set resumeTokenAsBytes(core.List<core.int> _bytes) {
3745 resumeToken = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll( "+", "-");
3746 }
3747 /**
3748 * Query plan and execution statistics for the query that produced this
3749 * streaming result set. These can be requested by setting
3750 * ExecuteSqlRequest.query_mode and are sent
3751 * only once with the last response in the stream.
3752 */
3753 ResultSetStats stats;
3754 /**
3755 * A streamed result set consists of a stream of values, which might
3756 * be split into many `PartialResultSet` messages to accommodate
3757 * large rows and/or large values. Every N complete values defines a
3758 * row, where N is equal to the number of entries in
3759 * metadata.row_type.fields.
3760 *
3761 * Most values are encoded based on type as described
3762 * here.
3763 *
3764 * It is possible that the last value in values is "chunked",
3765 * meaning that the rest of the value is sent in subsequent
3766 * `PartialResultSet`(s). This is denoted by the chunked_value
3767 * field. Two or more chunked values can be merged to form a
3768 * complete value as follows:
3769 *
3770 * * `bool/number/null`: cannot be chunked
3771 * * `string`: concatenate the strings
3772 * * `list`: concatenate the lists. If the last element in a list is a
3773 * `string`, `list`, or `object`, merge it with the first element in
3774 * the next list by applying these rules recursively.
3775 * * `object`: concatenate the (field name, field value) pairs. If a
3776 * field name is duplicated, then apply these rules recursively
3777 * to merge the field values.
3778 *
3779 * Some examples of merging:
3780 *
3781 * # Strings are concatenated.
3782 * "foo", "bar" => "foobar"
3783 *
3784 * # Lists of non-strings are concatenated.
3785 * [2, 3], [4] => [2, 3, 4]
3786 *
3787 * # Lists are concatenated, but the last and first elements are merged
3788 * # because they are strings.
3789 * ["a", "b"], ["c", "d"] => ["a", "bc", "d"]
3790 *
3791 * # Lists are concatenated, but the last and first elements are merged
3792 * # because they are lists. Recursively, the last and first elements
3793 * # of the inner lists are merged because they are strings.
3794 * ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"]
3795 *
3796 * # Non-overlapping object fields are combined.
3797 * {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"}
3798 *
3799 * # Overlapping object fields are merged.
3800 * {"a": "1"}, {"a": "2"} => {"a": "12"}
3801 *
3802 * # Examples of merging objects containing lists of strings.
3803 * {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]}
3804 *
3805 * For a more complete example, suppose a streaming SQL query is
3806 * yielding a result set whose rows contain a single string
3807 * field. The following `PartialResultSet`s might be yielded:
3808 *
3809 * {
3810 * "metadata": { ... }
3811 * "values": ["Hello", "W"]
3812 * "chunked_value": true
3813 * "resume_token": "Af65..."
3814 * }
3815 * {
3816 * "values": ["orl"]
3817 * "chunked_value": true
3818 * "resume_token": "Bqp2..."
3819 * }
3820 * {
3821 * "values": ["d"]
3822 * "resume_token": "Zx1B..."
3823 * }
3824 *
3825 * This sequence of `PartialResultSet`s encodes two rows, one
3826 * containing the field value `"Hello"`, and a second containing the
3827 * field value `"World" = "W" + "orl" + "d"`.
3828 *
3829 * The values for Object must be JSON objects. It can consist of `num`,
3830 * `String`, `bool` and `null` as well as `Map` and `List` values.
3831 */
3832 core.List<core.Object> values;
3833
3834 PartialResultSet();
3835
3836 PartialResultSet.fromJson(core.Map _json) {
3837 if (_json.containsKey("chunkedValue")) {
3838 chunkedValue = _json["chunkedValue"];
3839 }
3840 if (_json.containsKey("metadata")) {
3841 metadata = new ResultSetMetadata.fromJson(_json["metadata"]);
3842 }
3843 if (_json.containsKey("resumeToken")) {
3844 resumeToken = _json["resumeToken"];
3845 }
3846 if (_json.containsKey("stats")) {
3847 stats = new ResultSetStats.fromJson(_json["stats"]);
3848 }
3849 if (_json.containsKey("values")) {
3850 values = _json["values"];
3851 }
3852 }
3853
3854 core.Map toJson() {
3855 var _json = new core.Map();
3856 if (chunkedValue != null) {
3857 _json["chunkedValue"] = chunkedValue;
3858 }
3859 if (metadata != null) {
3860 _json["metadata"] = (metadata).toJson();
3861 }
3862 if (resumeToken != null) {
3863 _json["resumeToken"] = resumeToken;
3864 }
3865 if (stats != null) {
3866 _json["stats"] = (stats).toJson();
3867 }
3868 if (values != null) {
3869 _json["values"] = values;
3870 }
3871 return _json;
3872 }
3873 }
3874
3875 /** Node information for nodes appearing in a QueryPlan.plan_nodes. */
3876 class PlanNode {
3877 /** List of child node `index`es and their relationship to this parent. */
3878 core.List<ChildLink> childLinks;
3879 /** The display name for the node. */
3880 core.String displayName;
3881 /**
3882 * The execution statistics associated with the node, contained in a group of
3883 * key-value pairs. Only present if the plan was returned as a result of a
3884 * profile query. For example, number of executions, number of rows/time per
3885 * execution etc.
3886 *
3887 * The values for Object must be JSON objects. It can consist of `num`,
3888 * `String`, `bool` and `null` as well as `Map` and `List` values.
3889 */
3890 core.Map<core.String, core.Object> executionStats;
3891 /** The `PlanNode`'s index in node list. */
3892 core.int index;
3893 /**
3894 * Used to determine the type of node. May be needed for visualizing
3895 * different kinds of nodes differently. For example, If the node is a
3896 * SCALAR node, it will have a condensed representation
3897 * which can be used to directly embed a description of the node in its
3898 * parent.
3899 * Possible string values are:
3900 * - "KIND_UNSPECIFIED" : Not specified.
3901 * - "RELATIONAL" : Denotes a Relational operator node in the expression tree.
3902 * Relational
3903 * operators represent iterative processing of rows during query execution.
3904 * For example, a `TableScan` operation that reads rows from a table.
3905 * - "SCALAR" : Denotes a Scalar node in the expression tree. Scalar nodes
3906 * represent
3907 * non-iterable entities in the query plan. For example, constants or
3908 * arithmetic operators appearing inside predicate expressions or references
3909 * to column names.
3910 */
3911 core.String kind;
3912 /**
3913 * Attributes relevant to the node contained in a group of key-value pairs.
3914 * For example, a Parameter Reference node could have the following
3915 * information in its metadata:
3916 *
3917 * {
3918 * "parameter_reference": "param1",
3919 * "parameter_type": "array"
3920 * }
3921 *
3922 * The values for Object must be JSON objects. It can consist of `num`,
3923 * `String`, `bool` and `null` as well as `Map` and `List` values.
3924 */
3925 core.Map<core.String, core.Object> metadata;
3926 /** Condensed representation for SCALAR nodes. */
3927 ShortRepresentation shortRepresentation;
3928
3929 PlanNode();
3930
3931 PlanNode.fromJson(core.Map _json) {
3932 if (_json.containsKey("childLinks")) {
3933 childLinks = _json["childLinks"].map((value) => new ChildLink.fromJson(val ue)).toList();
3934 }
3935 if (_json.containsKey("displayName")) {
3936 displayName = _json["displayName"];
3937 }
3938 if (_json.containsKey("executionStats")) {
3939 executionStats = _json["executionStats"];
3940 }
3941 if (_json.containsKey("index")) {
3942 index = _json["index"];
3943 }
3944 if (_json.containsKey("kind")) {
3945 kind = _json["kind"];
3946 }
3947 if (_json.containsKey("metadata")) {
3948 metadata = _json["metadata"];
3949 }
3950 if (_json.containsKey("shortRepresentation")) {
3951 shortRepresentation = new ShortRepresentation.fromJson(_json["shortReprese ntation"]);
3952 }
3953 }
3954
3955 core.Map toJson() {
3956 var _json = new core.Map();
3957 if (childLinks != null) {
3958 _json["childLinks"] = childLinks.map((value) => (value).toJson()).toList() ;
3959 }
3960 if (displayName != null) {
3961 _json["displayName"] = displayName;
3962 }
3963 if (executionStats != null) {
3964 _json["executionStats"] = executionStats;
3965 }
3966 if (index != null) {
3967 _json["index"] = index;
3968 }
3969 if (kind != null) {
3970 _json["kind"] = kind;
3971 }
3972 if (metadata != null) {
3973 _json["metadata"] = metadata;
3974 }
3975 if (shortRepresentation != null) {
3976 _json["shortRepresentation"] = (shortRepresentation).toJson();
3977 }
3978 return _json;
3979 }
3980 }
3981
3982 /**
3983 * Defines an Identity and Access Management (IAM) policy. It is used to
3984 * specify access control policies for Cloud Platform resources.
3985 *
3986 *
3987 * A `Policy` consists of a list of `bindings`. A `Binding` binds a list of
3988 * `members` to a `role`, where the members can be user accounts, Google groups,
3989 * Google domains, and service accounts. A `role` is a named list of permissions
3990 * defined by IAM.
3991 *
3992 * **Example**
3993 *
3994 * {
3995 * "bindings": [
3996 * {
3997 * "role": "roles/owner",
3998 * "members": [
3999 * "user:mike@example.com",
4000 * "group:admins@example.com",
4001 * "domain:google.com",
4002 * "serviceAccount:my-other-app@appspot.gserviceaccount.com",
4003 * ]
4004 * },
4005 * {
4006 * "role": "roles/viewer",
4007 * "members": ["user:sean@example.com"]
4008 * }
4009 * ]
4010 * }
4011 *
4012 * For a description of IAM and its features, see the
4013 * [IAM developer's guide](https://cloud.google.com/iam).
4014 */
4015 class Policy {
4016 /** Specifies cloud audit logging configuration for this policy. */
4017 core.List<AuditConfig> auditConfigs;
4018 /**
4019 * Associates a list of `members` to a `role`.
4020 * Multiple `bindings` must not be specified for the same `role`.
4021 * `bindings` with no members will result in an error.
4022 */
4023 core.List<Binding> bindings;
4024 /**
4025 * `etag` is used for optimistic concurrency control as a way to help
4026 * prevent simultaneous updates of a policy from overwriting each other.
4027 * It is strongly suggested that systems make use of the `etag` in the
4028 * read-modify-write cycle to perform policy updates in order to avoid race
4029 * conditions: An `etag` is returned in the response to `getIamPolicy`, and
4030 * systems are expected to put that etag in the request to `setIamPolicy` to
4031 * ensure that their change will be applied to the same version of the policy.
4032 *
4033 * If no `etag` is provided in the call to `setIamPolicy`, then the existing
4034 * policy is overwritten blindly.
4035 */
4036 core.String etag;
4037 core.List<core.int> get etagAsBytes {
4038 return convert.BASE64.decode(etag);
4039 }
4040
4041 void set etagAsBytes(core.List<core.int> _bytes) {
4042 etag = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+", "- ");
4043 }
4044 core.bool iamOwned;
4045 /**
4046 * If more than one rule is specified, the rules are applied in the following
4047 * manner:
4048 * - All matching LOG rules are always applied.
4049 * - If any DENY/DENY_WITH_LOG rule matches, permission is denied.
4050 * Logging will be applied if one or more matching rule requires logging.
4051 * - Otherwise, if any ALLOW/ALLOW_WITH_LOG rule matches, permission is
4052 * granted.
4053 * Logging will be applied if one or more matching rule requires logging.
4054 * - Otherwise, if no rule applies, permission is denied.
4055 */
4056 core.List<Rule> rules;
4057 /** Version of the `Policy`. The default version is 0. */
4058 core.int version;
4059
4060 Policy();
4061
4062 Policy.fromJson(core.Map _json) {
4063 if (_json.containsKey("auditConfigs")) {
4064 auditConfigs = _json["auditConfigs"].map((value) => new AuditConfig.fromJs on(value)).toList();
4065 }
4066 if (_json.containsKey("bindings")) {
4067 bindings = _json["bindings"].map((value) => new Binding.fromJson(value)).t oList();
4068 }
4069 if (_json.containsKey("etag")) {
4070 etag = _json["etag"];
4071 }
4072 if (_json.containsKey("iamOwned")) {
4073 iamOwned = _json["iamOwned"];
4074 }
4075 if (_json.containsKey("rules")) {
4076 rules = _json["rules"].map((value) => new Rule.fromJson(value)).toList();
4077 }
4078 if (_json.containsKey("version")) {
4079 version = _json["version"];
4080 }
4081 }
4082
4083 core.Map toJson() {
4084 var _json = new core.Map();
4085 if (auditConfigs != null) {
4086 _json["auditConfigs"] = auditConfigs.map((value) => (value).toJson()).toLi st();
4087 }
4088 if (bindings != null) {
4089 _json["bindings"] = bindings.map((value) => (value).toJson()).toList();
4090 }
4091 if (etag != null) {
4092 _json["etag"] = etag;
4093 }
4094 if (iamOwned != null) {
4095 _json["iamOwned"] = iamOwned;
4096 }
4097 if (rules != null) {
4098 _json["rules"] = rules.map((value) => (value).toJson()).toList();
4099 }
4100 if (version != null) {
4101 _json["version"] = version;
4102 }
4103 return _json;
4104 }
4105 }
4106
4107 /** Contains an ordered list of nodes appearing in the query plan. */
4108 class QueryPlan {
4109 /**
4110 * The nodes in the query plan. Plan nodes are returned in pre-order starting
4111 * with the plan root. Each PlanNode's `id` corresponds to its index in
4112 * `plan_nodes`.
4113 */
4114 core.List<PlanNode> planNodes;
4115
4116 QueryPlan();
4117
4118 QueryPlan.fromJson(core.Map _json) {
4119 if (_json.containsKey("planNodes")) {
4120 planNodes = _json["planNodes"].map((value) => new PlanNode.fromJson(value) ).toList();
4121 }
4122 }
4123
4124 core.Map toJson() {
4125 var _json = new core.Map();
4126 if (planNodes != null) {
4127 _json["planNodes"] = planNodes.map((value) => (value).toJson()).toList();
4128 }
4129 return _json;
4130 }
4131 }
4132
4133 /** Options for read-only transactions. */
4134 class ReadOnly {
4135 /**
4136 * Executes all reads at a timestamp that is `exact_staleness`
4137 * old. The timestamp is chosen soon after the read is started.
4138 *
4139 * Guarantees that all writes that have committed more than the
4140 * specified number of seconds ago are visible. Because Cloud Spanner
4141 * chooses the exact timestamp, this mode works even if the client's
4142 * local clock is substantially skewed from Cloud Spanner commit
4143 * timestamps.
4144 *
4145 * Useful for reading at nearby replicas without the distributed
4146 * timestamp negotiation overhead of `max_staleness`.
4147 */
4148 core.String exactStaleness;
4149 /**
4150 * Read data at a timestamp >= `NOW - max_staleness`
4151 * seconds. Guarantees that all writes that have committed more
4152 * than the specified number of seconds ago are visible. Because
4153 * Cloud Spanner chooses the exact timestamp, this mode works even if
4154 * the client's local clock is substantially skewed from Cloud Spanner
4155 * commit timestamps.
4156 *
4157 * Useful for reading the freshest data available at a nearby
4158 * replica, while bounding the possible staleness if the local
4159 * replica has fallen behind.
4160 *
4161 * Note that this option can only be used in single-use
4162 * transactions.
4163 */
4164 core.String maxStaleness;
4165 /**
4166 * Executes all reads at a timestamp >= `min_read_timestamp`.
4167 *
4168 * This is useful for requesting fresher data than some previous
4169 * read, or data that is fresh enough to observe the effects of some
4170 * previously committed transaction whose timestamp is known.
4171 *
4172 * Note that this option can only be used in single-use transactions.
4173 */
4174 core.String minReadTimestamp;
4175 /**
4176 * Executes all reads at the given timestamp. Unlike other modes,
4177 * reads at a specific timestamp are repeatable; the same read at
4178 * the same timestamp always returns the same data. If the
4179 * timestamp is in the future, the read will block until the
4180 * specified timestamp, modulo the read's deadline.
4181 *
4182 * Useful for large scale consistent reads such as mapreduces, or
4183 * for coordinating many reads against a consistent snapshot of the
4184 * data.
4185 */
4186 core.String readTimestamp;
4187 /**
4188 * If true, the Cloud Spanner-selected read timestamp is included in
4189 * the Transaction message that describes the transaction.
4190 */
4191 core.bool returnReadTimestamp;
4192 /**
4193 * Read at a timestamp where all previously committed transactions
4194 * are visible.
4195 */
4196 core.bool strong;
4197
4198 ReadOnly();
4199
4200 ReadOnly.fromJson(core.Map _json) {
4201 if (_json.containsKey("exactStaleness")) {
4202 exactStaleness = _json["exactStaleness"];
4203 }
4204 if (_json.containsKey("maxStaleness")) {
4205 maxStaleness = _json["maxStaleness"];
4206 }
4207 if (_json.containsKey("minReadTimestamp")) {
4208 minReadTimestamp = _json["minReadTimestamp"];
4209 }
4210 if (_json.containsKey("readTimestamp")) {
4211 readTimestamp = _json["readTimestamp"];
4212 }
4213 if (_json.containsKey("returnReadTimestamp")) {
4214 returnReadTimestamp = _json["returnReadTimestamp"];
4215 }
4216 if (_json.containsKey("strong")) {
4217 strong = _json["strong"];
4218 }
4219 }
4220
4221 core.Map toJson() {
4222 var _json = new core.Map();
4223 if (exactStaleness != null) {
4224 _json["exactStaleness"] = exactStaleness;
4225 }
4226 if (maxStaleness != null) {
4227 _json["maxStaleness"] = maxStaleness;
4228 }
4229 if (minReadTimestamp != null) {
4230 _json["minReadTimestamp"] = minReadTimestamp;
4231 }
4232 if (readTimestamp != null) {
4233 _json["readTimestamp"] = readTimestamp;
4234 }
4235 if (returnReadTimestamp != null) {
4236 _json["returnReadTimestamp"] = returnReadTimestamp;
4237 }
4238 if (strong != null) {
4239 _json["strong"] = strong;
4240 }
4241 return _json;
4242 }
4243 }
4244
4245 /**
4246 * The request for Read and
4247 * StreamingRead.
4248 */
4249 class ReadRequest {
4250 /**
4251 * The columns of table to be returned for each row matching
4252 * this request.
4253 */
4254 core.List<core.String> columns;
4255 /**
4256 * If non-empty, the name of an index on table. This index is
4257 * used instead of the table primary key when interpreting key_set
4258 * and sorting result rows. See key_set for further information.
4259 */
4260 core.String index;
4261 /**
4262 * Required. `key_set` identifies the rows to be yielded. `key_set` names the
4263 * primary keys of the rows in table to be yielded, unless index
4264 * is present. If index is present, then key_set instead names
4265 * index keys in index.
4266 *
4267 * Rows are yielded in table primary key order (if index is empty)
4268 * or index key order (if index is non-empty).
4269 *
4270 * It is not an error for the `key_set` to name rows that do not
4271 * exist in the database. Read yields nothing for nonexistent rows.
4272 */
4273 KeySet keySet;
4274 /**
4275 * If greater than zero, only the first `limit` rows are yielded. If `limit`
4276 * is zero, the default is no limit.
4277 */
4278 core.String limit;
4279 /**
4280 * If this request is resuming a previously interrupted read,
4281 * `resume_token` should be copied from the last
4282 * PartialResultSet yielded before the interruption. Doing this
4283 * enables the new read to resume where the last read left off. The
4284 * rest of the request parameters must exactly match the request
4285 * that yielded this token.
4286 */
4287 core.String resumeToken;
4288 core.List<core.int> get resumeTokenAsBytes {
4289 return convert.BASE64.decode(resumeToken);
4290 }
4291
4292 void set resumeTokenAsBytes(core.List<core.int> _bytes) {
4293 resumeToken = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll( "+", "-");
4294 }
4295 /** Required. The name of the table in the database to be read. */
4296 core.String table;
4297 /**
4298 * The transaction to use. If none is provided, the default is a
4299 * temporary read-only transaction with strong concurrency.
4300 */
4301 TransactionSelector transaction;
4302
4303 ReadRequest();
4304
4305 ReadRequest.fromJson(core.Map _json) {
4306 if (_json.containsKey("columns")) {
4307 columns = _json["columns"];
4308 }
4309 if (_json.containsKey("index")) {
4310 index = _json["index"];
4311 }
4312 if (_json.containsKey("keySet")) {
4313 keySet = new KeySet.fromJson(_json["keySet"]);
4314 }
4315 if (_json.containsKey("limit")) {
4316 limit = _json["limit"];
4317 }
4318 if (_json.containsKey("resumeToken")) {
4319 resumeToken = _json["resumeToken"];
4320 }
4321 if (_json.containsKey("table")) {
4322 table = _json["table"];
4323 }
4324 if (_json.containsKey("transaction")) {
4325 transaction = new TransactionSelector.fromJson(_json["transaction"]);
4326 }
4327 }
4328
4329 core.Map toJson() {
4330 var _json = new core.Map();
4331 if (columns != null) {
4332 _json["columns"] = columns;
4333 }
4334 if (index != null) {
4335 _json["index"] = index;
4336 }
4337 if (keySet != null) {
4338 _json["keySet"] = (keySet).toJson();
4339 }
4340 if (limit != null) {
4341 _json["limit"] = limit;
4342 }
4343 if (resumeToken != null) {
4344 _json["resumeToken"] = resumeToken;
4345 }
4346 if (table != null) {
4347 _json["table"] = table;
4348 }
4349 if (transaction != null) {
4350 _json["transaction"] = (transaction).toJson();
4351 }
4352 return _json;
4353 }
4354 }
4355
4356 /** Options for read-write transactions. */
4357 class ReadWrite {
4358
4359 ReadWrite();
4360
4361 ReadWrite.fromJson(core.Map _json) {
4362 }
4363
4364 core.Map toJson() {
4365 var _json = new core.Map();
4366 return _json;
4367 }
4368 }
4369
4370 /**
4371 * Results from Read or
4372 * ExecuteSql.
4373 */
4374 class ResultSet {
4375 /** Metadata about the result set, such as row type information. */
4376 ResultSetMetadata metadata;
4377 /**
4378 * Each element in `rows` is a row whose format is defined by
4379 * metadata.row_type. The ith element
4380 * in each row matches the ith field in
4381 * metadata.row_type. Elements are
4382 * encoded based on type as described
4383 * here.
4384 *
4385 * The values for Object must be JSON objects. It can consist of `num`,
4386 * `String`, `bool` and `null` as well as `Map` and `List` values.
4387 */
4388 core.List<core.List<core.Object>> rows;
4389 /**
4390 * Query plan and execution statistics for the query that produced this
4391 * result set. These can be requested by setting
4392 * ExecuteSqlRequest.query_mode.
4393 */
4394 ResultSetStats stats;
4395
4396 ResultSet();
4397
4398 ResultSet.fromJson(core.Map _json) {
4399 if (_json.containsKey("metadata")) {
4400 metadata = new ResultSetMetadata.fromJson(_json["metadata"]);
4401 }
4402 if (_json.containsKey("rows")) {
4403 rows = _json["rows"];
4404 }
4405 if (_json.containsKey("stats")) {
4406 stats = new ResultSetStats.fromJson(_json["stats"]);
4407 }
4408 }
4409
4410 core.Map toJson() {
4411 var _json = new core.Map();
4412 if (metadata != null) {
4413 _json["metadata"] = (metadata).toJson();
4414 }
4415 if (rows != null) {
4416 _json["rows"] = rows;
4417 }
4418 if (stats != null) {
4419 _json["stats"] = (stats).toJson();
4420 }
4421 return _json;
4422 }
4423 }
4424
4425 /** Metadata about a ResultSet or PartialResultSet. */
4426 class ResultSetMetadata {
4427 /**
4428 * Indicates the field names and types for the rows in the result
4429 * set. For example, a SQL query like `"SELECT UserId, UserName FROM
4430 * Users"` could return a `row_type` value like:
4431 *
4432 * "fields": [
4433 * { "name": "UserId", "type": { "code": "INT64" } },
4434 * { "name": "UserName", "type": { "code": "STRING" } },
4435 * ]
4436 */
4437 StructType rowType;
4438 /**
4439 * If the read or SQL query began a transaction as a side-effect, the
4440 * information about the new transaction is yielded here.
4441 */
4442 Transaction transaction;
4443
4444 ResultSetMetadata();
4445
4446 ResultSetMetadata.fromJson(core.Map _json) {
4447 if (_json.containsKey("rowType")) {
4448 rowType = new StructType.fromJson(_json["rowType"]);
4449 }
4450 if (_json.containsKey("transaction")) {
4451 transaction = new Transaction.fromJson(_json["transaction"]);
4452 }
4453 }
4454
4455 core.Map toJson() {
4456 var _json = new core.Map();
4457 if (rowType != null) {
4458 _json["rowType"] = (rowType).toJson();
4459 }
4460 if (transaction != null) {
4461 _json["transaction"] = (transaction).toJson();
4462 }
4463 return _json;
4464 }
4465 }
4466
4467 /** Additional statistics about a ResultSet or PartialResultSet. */
4468 class ResultSetStats {
4469 /** QueryPlan for the query associated with this result. */
4470 QueryPlan queryPlan;
4471 /**
4472 * Aggregated statistics from the execution of the query. Only present when
4473 * the query is profiled. For example, a query could return the statistics as
4474 * follows:
4475 *
4476 * {
4477 * "rows_returned": "3",
4478 * "elapsed_time": "1.22 secs",
4479 * "cpu_time": "1.19 secs"
4480 * }
4481 *
4482 * The values for Object must be JSON objects. It can consist of `num`,
4483 * `String`, `bool` and `null` as well as `Map` and `List` values.
4484 */
4485 core.Map<core.String, core.Object> queryStats;
4486
4487 ResultSetStats();
4488
4489 ResultSetStats.fromJson(core.Map _json) {
4490 if (_json.containsKey("queryPlan")) {
4491 queryPlan = new QueryPlan.fromJson(_json["queryPlan"]);
4492 }
4493 if (_json.containsKey("queryStats")) {
4494 queryStats = _json["queryStats"];
4495 }
4496 }
4497
4498 core.Map toJson() {
4499 var _json = new core.Map();
4500 if (queryPlan != null) {
4501 _json["queryPlan"] = (queryPlan).toJson();
4502 }
4503 if (queryStats != null) {
4504 _json["queryStats"] = queryStats;
4505 }
4506 return _json;
4507 }
4508 }
4509
4510 /** The request for Rollback. */
4511 class RollbackRequest {
4512 /** Required. The transaction to roll back. */
4513 core.String transactionId;
4514 core.List<core.int> get transactionIdAsBytes {
4515 return convert.BASE64.decode(transactionId);
4516 }
4517
4518 void set transactionIdAsBytes(core.List<core.int> _bytes) {
4519 transactionId = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAl l("+", "-");
4520 }
4521
4522 RollbackRequest();
4523
4524 RollbackRequest.fromJson(core.Map _json) {
4525 if (_json.containsKey("transactionId")) {
4526 transactionId = _json["transactionId"];
4527 }
4528 }
4529
4530 core.Map toJson() {
4531 var _json = new core.Map();
4532 if (transactionId != null) {
4533 _json["transactionId"] = transactionId;
4534 }
4535 return _json;
4536 }
4537 }
4538
4539 /** A rule to be applied in a Policy. */
4540 class Rule {
4541 /**
4542 * Required
4543 * Possible string values are:
4544 * - "NO_ACTION" : Default no action.
4545 * - "ALLOW" : Matching 'Entries' grant access.
4546 * - "ALLOW_WITH_LOG" : Matching 'Entries' grant access and the caller
4547 * promises to log
4548 * the request per the returned log_configs.
4549 * - "DENY" : Matching 'Entries' deny access.
4550 * - "DENY_WITH_LOG" : Matching 'Entries' deny access and the caller promises
4551 * to log
4552 * the request per the returned log_configs.
4553 * - "LOG" : Matching 'Entries' tell IAM.Check callers to generate logs.
4554 */
4555 core.String action;
4556 /** Additional restrictions that must be met */
4557 core.List<Condition> conditions;
4558 /** Human-readable description of the rule. */
4559 core.String description;
4560 /**
4561 * If one or more 'in' clauses are specified, the rule matches if
4562 * the PRINCIPAL/AUTHORITY_SELECTOR is in at least one of these entries.
4563 */
4564 core.List<core.String> in_;
4565 /**
4566 * The config returned to callers of tech.iam.IAM.CheckPolicy for any entries
4567 * that match the LOG action.
4568 */
4569 core.List<LogConfig> logConfig;
4570 /**
4571 * If one or more 'not_in' clauses are specified, the rule matches
4572 * if the PRINCIPAL/AUTHORITY_SELECTOR is in none of the entries.
4573 * The format for in and not_in entries is the same as for members in a
4574 * Binding (see google/iam/v1/policy.proto).
4575 */
4576 core.List<core.String> notIn;
4577 /**
4578 * A permission is a string of form '<service>.<resource type>.<verb>'
4579 * (e.g., 'storage.buckets.list'). A value of '*' matches all permissions,
4580 * and a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs.
4581 */
4582 core.List<core.String> permissions;
4583
4584 Rule();
4585
4586 Rule.fromJson(core.Map _json) {
4587 if (_json.containsKey("action")) {
4588 action = _json["action"];
4589 }
4590 if (_json.containsKey("conditions")) {
4591 conditions = _json["conditions"].map((value) => new Condition.fromJson(val ue)).toList();
4592 }
4593 if (_json.containsKey("description")) {
4594 description = _json["description"];
4595 }
4596 if (_json.containsKey("in")) {
4597 in_ = _json["in"];
4598 }
4599 if (_json.containsKey("logConfig")) {
4600 logConfig = _json["logConfig"].map((value) => new LogConfig.fromJson(value )).toList();
4601 }
4602 if (_json.containsKey("notIn")) {
4603 notIn = _json["notIn"];
4604 }
4605 if (_json.containsKey("permissions")) {
4606 permissions = _json["permissions"];
4607 }
4608 }
4609
4610 core.Map toJson() {
4611 var _json = new core.Map();
4612 if (action != null) {
4613 _json["action"] = action;
4614 }
4615 if (conditions != null) {
4616 _json["conditions"] = conditions.map((value) => (value).toJson()).toList() ;
4617 }
4618 if (description != null) {
4619 _json["description"] = description;
4620 }
4621 if (in_ != null) {
4622 _json["in"] = in_;
4623 }
4624 if (logConfig != null) {
4625 _json["logConfig"] = logConfig.map((value) => (value).toJson()).toList();
4626 }
4627 if (notIn != null) {
4628 _json["notIn"] = notIn;
4629 }
4630 if (permissions != null) {
4631 _json["permissions"] = permissions;
4632 }
4633 return _json;
4634 }
4635 }
4636
4637 /** A session in the Cloud Spanner API. */
4638 class Session {
4639 /** Required. The name of the session. */
4640 core.String name;
4641
4642 Session();
4643
4644 Session.fromJson(core.Map _json) {
4645 if (_json.containsKey("name")) {
4646 name = _json["name"];
4647 }
4648 }
4649
4650 core.Map toJson() {
4651 var _json = new core.Map();
4652 if (name != null) {
4653 _json["name"] = name;
4654 }
4655 return _json;
4656 }
4657 }
4658
4659 /** Request message for `SetIamPolicy` method. */
4660 class SetIamPolicyRequest {
4661 /**
4662 * REQUIRED: The complete policy to be applied to the `resource`. The size of
4663 * the policy is limited to a few 10s of KB. An empty policy is a
4664 * valid policy but certain Cloud Platform services (such as Projects)
4665 * might reject them.
4666 */
4667 Policy policy;
4668 /**
4669 * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
4670 * the fields in the mask will be modified. If no mask is provided, a default
4671 * mask is used:
4672 * paths: "bindings, etag"
4673 * This field is only used by Cloud IAM.
4674 */
4675 core.String updateMask;
4676
4677 SetIamPolicyRequest();
4678
4679 SetIamPolicyRequest.fromJson(core.Map _json) {
4680 if (_json.containsKey("policy")) {
4681 policy = new Policy.fromJson(_json["policy"]);
4682 }
4683 if (_json.containsKey("updateMask")) {
4684 updateMask = _json["updateMask"];
4685 }
4686 }
4687
4688 core.Map toJson() {
4689 var _json = new core.Map();
4690 if (policy != null) {
4691 _json["policy"] = (policy).toJson();
4692 }
4693 if (updateMask != null) {
4694 _json["updateMask"] = updateMask;
4695 }
4696 return _json;
4697 }
4698 }
4699
4700 /**
4701 * Condensed representation of a node and its subtree. Only present for
4702 * `SCALAR` PlanNode(s).
4703 */
4704 class ShortRepresentation {
4705 /** A string representation of the expression subtree rooted at this node. */
4706 core.String description;
4707 /**
4708 * A mapping of (subquery variable name) -> (subquery node id) for cases
4709 * where the `description` string of this node references a `SCALAR`
4710 * subquery contained in the expression subtree rooted at this node. The
4711 * referenced `SCALAR` subquery may not necessarily be a direct child of
4712 * this node.
4713 */
4714 core.Map<core.String, core.int> subqueries;
4715
4716 ShortRepresentation();
4717
4718 ShortRepresentation.fromJson(core.Map _json) {
4719 if (_json.containsKey("description")) {
4720 description = _json["description"];
4721 }
4722 if (_json.containsKey("subqueries")) {
4723 subqueries = _json["subqueries"];
4724 }
4725 }
4726
4727 core.Map toJson() {
4728 var _json = new core.Map();
4729 if (description != null) {
4730 _json["description"] = description;
4731 }
4732 if (subqueries != null) {
4733 _json["subqueries"] = subqueries;
4734 }
4735 return _json;
4736 }
4737 }
4738
4739 /**
4740 * The `Status` type defines a logical error model that is suitable for
4741 * different
4742 * programming environments, including REST APIs and RPC APIs. It is used by
4743 * [gRPC](https://github.com/grpc). The error model is designed to be:
4744 *
4745 * - Simple to use and understand for most users
4746 * - Flexible enough to meet unexpected needs
4747 *
4748 * # Overview
4749 *
4750 * The `Status` message contains three pieces of data: error code, error
4751 * message,
4752 * and error details. The error code should be an enum value of
4753 * google.rpc.Code, but it may accept additional error codes if needed. The
4754 * error message should be a developer-facing English message that helps
4755 * developers *understand* and *resolve* the error. If a localized user-facing
4756 * error message is needed, put the localized message in the error details or
4757 * localize it in the client. The optional error details may contain arbitrary
4758 * information about the error. There is a predefined set of error detail types
4759 * in the package `google.rpc` which can be used for common error conditions.
4760 *
4761 * # Language mapping
4762 *
4763 * The `Status` message is the logical representation of the error model, but it
4764 * is not necessarily the actual wire format. When the `Status` message is
4765 * exposed in different client libraries and different wire protocols, it can be
4766 * mapped differently. For example, it will likely be mapped to some exceptions
4767 * in Java, but more likely mapped to some error codes in C.
4768 *
4769 * # Other uses
4770 *
4771 * The error model and the `Status` message can be used in a variety of
4772 * environments, either with or without APIs, to provide a
4773 * consistent developer experience across different environments.
4774 *
4775 * Example uses of this error model include:
4776 *
4777 * - Partial errors. If a service needs to return partial errors to the client,
4778 * it may embed the `Status` in the normal response to indicate the partial
4779 * errors.
4780 *
4781 * - Workflow errors. A typical workflow has multiple steps. Each step may
4782 * have a `Status` message for error reporting purpose.
4783 *
4784 * - Batch operations. If a client uses batch request and batch response, the
4785 * `Status` message should be used directly inside batch response, one for
4786 * each error sub-response.
4787 *
4788 * - Asynchronous operations. If an API call embeds asynchronous operation
4789 * results in its response, the status of those operations should be
4790 * represented directly using the `Status` message.
4791 *
4792 * - Logging. If some API errors are stored in logs, the message `Status` could
4793 * be used directly after any stripping needed for security/privacy reasons.
4794 */
4795 class Status {
4796 /** The status code, which should be an enum value of google.rpc.Code. */
4797 core.int code;
4798 /**
4799 * A list of messages that carry the error details. There will be a
4800 * common set of message types for APIs to use.
4801 *
4802 * The values for Object must be JSON objects. It can consist of `num`,
4803 * `String`, `bool` and `null` as well as `Map` and `List` values.
4804 */
4805 core.List<core.Map<core.String, core.Object>> details;
4806 /**
4807 * A developer-facing error message, which should be in English. Any
4808 * user-facing error message should be localized and sent in the
4809 * google.rpc.Status.details field, or localized by the client.
4810 */
4811 core.String message;
4812
4813 Status();
4814
4815 Status.fromJson(core.Map _json) {
4816 if (_json.containsKey("code")) {
4817 code = _json["code"];
4818 }
4819 if (_json.containsKey("details")) {
4820 details = _json["details"];
4821 }
4822 if (_json.containsKey("message")) {
4823 message = _json["message"];
4824 }
4825 }
4826
4827 core.Map toJson() {
4828 var _json = new core.Map();
4829 if (code != null) {
4830 _json["code"] = code;
4831 }
4832 if (details != null) {
4833 _json["details"] = details;
4834 }
4835 if (message != null) {
4836 _json["message"] = message;
4837 }
4838 return _json;
4839 }
4840 }
4841
4842 /** `StructType` defines the fields of a STRUCT type. */
4843 class StructType {
4844 /**
4845 * The list of fields that make up this struct. Order is
4846 * significant, because values of this struct type are represented as
4847 * lists, where the order of field values matches the order of
4848 * fields in the StructType. In turn, the order of fields
4849 * matches the order of columns in a read request, or the order of
4850 * fields in the `SELECT` clause of a query.
4851 */
4852 core.List<Field> fields;
4853
4854 StructType();
4855
4856 StructType.fromJson(core.Map _json) {
4857 if (_json.containsKey("fields")) {
4858 fields = _json["fields"].map((value) => new Field.fromJson(value)).toList( );
4859 }
4860 }
4861
4862 core.Map toJson() {
4863 var _json = new core.Map();
4864 if (fields != null) {
4865 _json["fields"] = fields.map((value) => (value).toJson()).toList();
4866 }
4867 return _json;
4868 }
4869 }
4870
4871 /** Request message for `TestIamPermissions` method. */
4872 class TestIamPermissionsRequest {
4873 /**
4874 * REQUIRED: The set of permissions to check for 'resource'.
4875 * Permissions with wildcards (such as '*', 'spanner.*',
4876 * 'spanner.instances.*') are not allowed.
4877 */
4878 core.List<core.String> permissions;
4879
4880 TestIamPermissionsRequest();
4881
4882 TestIamPermissionsRequest.fromJson(core.Map _json) {
4883 if (_json.containsKey("permissions")) {
4884 permissions = _json["permissions"];
4885 }
4886 }
4887
4888 core.Map toJson() {
4889 var _json = new core.Map();
4890 if (permissions != null) {
4891 _json["permissions"] = permissions;
4892 }
4893 return _json;
4894 }
4895 }
4896
4897 /** Response message for `TestIamPermissions` method. */
4898 class TestIamPermissionsResponse {
4899 /**
4900 * A subset of `TestPermissionsRequest.permissions` that the caller is
4901 * allowed.
4902 */
4903 core.List<core.String> permissions;
4904
4905 TestIamPermissionsResponse();
4906
4907 TestIamPermissionsResponse.fromJson(core.Map _json) {
4908 if (_json.containsKey("permissions")) {
4909 permissions = _json["permissions"];
4910 }
4911 }
4912
4913 core.Map toJson() {
4914 var _json = new core.Map();
4915 if (permissions != null) {
4916 _json["permissions"] = permissions;
4917 }
4918 return _json;
4919 }
4920 }
4921
4922 /** A transaction. */
4923 class Transaction {
4924 /**
4925 * `id` may be used to identify the transaction in subsequent
4926 * Read,
4927 * ExecuteSql,
4928 * Commit, or
4929 * Rollback calls.
4930 *
4931 * Single-use read-only transactions do not have IDs, because
4932 * single-use transactions do not support multiple requests.
4933 */
4934 core.String id;
4935 core.List<core.int> get idAsBytes {
4936 return convert.BASE64.decode(id);
4937 }
4938
4939 void set idAsBytes(core.List<core.int> _bytes) {
4940 id = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+", "-") ;
4941 }
4942 /**
4943 * For snapshot read-only transactions, the read timestamp chosen
4944 * for the transaction. Not returned by default: see
4945 * TransactionOptions.ReadOnly.return_read_timestamp.
4946 */
4947 core.String readTimestamp;
4948
4949 Transaction();
4950
4951 Transaction.fromJson(core.Map _json) {
4952 if (_json.containsKey("id")) {
4953 id = _json["id"];
4954 }
4955 if (_json.containsKey("readTimestamp")) {
4956 readTimestamp = _json["readTimestamp"];
4957 }
4958 }
4959
4960 core.Map toJson() {
4961 var _json = new core.Map();
4962 if (id != null) {
4963 _json["id"] = id;
4964 }
4965 if (readTimestamp != null) {
4966 _json["readTimestamp"] = readTimestamp;
4967 }
4968 return _json;
4969 }
4970 }
4971
4972 /**
4973 * # Transactions
4974 *
4975 *
4976 * Each session can have at most one active transaction at a time. After the
4977 * active transaction is completed, the session can immediately be
4978 * re-used for the next transaction. It is not necessary to create a
4979 * new session for each transaction.
4980 *
4981 * # Transaction Modes
4982 *
4983 * Cloud Spanner supports two transaction modes:
4984 *
4985 * 1. Locking read-write. This type of transaction is the only way
4986 * to write data into Cloud Spanner. These transactions rely on
4987 * pessimistic locking and, if necessary, two-phase commit.
4988 * Locking read-write transactions may abort, requiring the
4989 * application to retry.
4990 *
4991 * 2. Snapshot read-only. This transaction type provides guaranteed
4992 * consistency across several reads, but does not allow
4993 * writes. Snapshot read-only transactions can be configured to
4994 * read at timestamps in the past. Snapshot read-only
4995 * transactions do not need to be committed.
4996 *
4997 * For transactions that only read, snapshot read-only transactions
4998 * provide simpler semantics and are almost always faster. In
4999 * particular, read-only transactions do not take locks, so they do
5000 * not conflict with read-write transactions. As a consequence of not
5001 * taking locks, they also do not abort, so retry loops are not needed.
5002 *
5003 * Transactions may only read/write data in a single database. They
5004 * may, however, read/write data in different tables within that
5005 * database.
5006 *
5007 * ## Locking Read-Write Transactions
5008 *
5009 * Locking transactions may be used to atomically read-modify-write
5010 * data anywhere in a database. This type of transaction is externally
5011 * consistent.
5012 *
5013 * Clients should attempt to minimize the amount of time a transaction
5014 * is active. Faster transactions commit with higher probability
5015 * and cause less contention. Cloud Spanner attempts to keep read locks
5016 * active as long as the transaction continues to do reads, and the
5017 * transaction has not been terminated by
5018 * Commit or
5019 * Rollback. Long periods of
5020 * inactivity at the client may cause Cloud Spanner to release a
5021 * transaction's locks and abort it.
5022 *
5023 * Reads performed within a transaction acquire locks on the data
5024 * being read. Writes can only be done at commit time, after all reads
5025 * have been completed.
5026 * Conceptually, a read-write transaction consists of zero or more
5027 * reads or SQL queries followed by
5028 * Commit. At any time before
5029 * Commit, the client can send a
5030 * Rollback request to abort the
5031 * transaction.
5032 *
5033 * ### Semantics
5034 *
5035 * Cloud Spanner can commit the transaction if all read locks it acquired
5036 * are still valid at commit time, and it is able to acquire write
5037 * locks for all writes. Cloud Spanner can abort the transaction for any
5038 * reason. If a commit attempt returns `ABORTED`, Cloud Spanner guarantees
5039 * that the transaction has not modified any user data in Cloud Spanner.
5040 *
5041 * Unless the transaction commits, Cloud Spanner makes no guarantees about
5042 * how long the transaction's locks were held for. It is an error to
5043 * use Cloud Spanner locks for any sort of mutual exclusion other than
5044 * between Cloud Spanner transactions themselves.
5045 *
5046 * ### Retrying Aborted Transactions
5047 *
5048 * When a transaction aborts, the application can choose to retry the
5049 * whole transaction again. To maximize the chances of successfully
5050 * committing the retry, the client should execute the retry in the
5051 * same session as the original attempt. The original session's lock
5052 * priority increases with each consecutive abort, meaning that each
5053 * attempt has a slightly better chance of success than the previous.
5054 *
5055 * Under some circumstances (e.g., many transactions attempting to
5056 * modify the same row(s)), a transaction can abort many times in a
5057 * short period before successfully committing. Thus, it is not a good
5058 * idea to cap the number of retries a transaction can attempt;
5059 * instead, it is better to limit the total amount of wall time spent
5060 * retrying.
5061 *
5062 * ### Idle Transactions
5063 *
5064 * A transaction is considered idle if it has no outstanding reads or
5065 * SQL queries and has not started a read or SQL query within the last 10
5066 * seconds. Idle transactions can be aborted by Cloud Spanner so that they
5067 * don't hold on to locks indefinitely. In that case, the commit will
5068 * fail with error `ABORTED`.
5069 *
5070 * If this behavior is undesirable, periodically executing a simple
5071 * SQL query in the transaction (e.g., `SELECT 1`) prevents the
5072 * transaction from becoming idle.
5073 *
5074 * ## Snapshot Read-Only Transactions
5075 *
5076 * Snapshot read-only transactions provides a simpler method than
5077 * locking read-write transactions for doing several consistent
5078 * reads. However, this type of transaction does not support writes.
5079 *
5080 * Snapshot transactions do not take locks. Instead, they work by
5081 * choosing a Cloud Spanner timestamp, then executing all reads at that
5082 * timestamp. Since they do not acquire locks, they do not block
5083 * concurrent read-write transactions.
5084 *
5085 * Unlike locking read-write transactions, snapshot read-only
5086 * transactions never abort. They can fail if the chosen read
5087 * timestamp is garbage collected; however, the default garbage
5088 * collection policy is generous enough that most applications do not
5089 * need to worry about this in practice.
5090 *
5091 * Snapshot read-only transactions do not need to call
5092 * Commit or
5093 * Rollback (and in fact are not
5094 * permitted to do so).
5095 *
5096 * To execute a snapshot transaction, the client specifies a timestamp
5097 * bound, which tells Cloud Spanner how to choose a read timestamp.
5098 *
5099 * The types of timestamp bound are:
5100 *
5101 * - Strong (the default).
5102 * - Bounded staleness.
5103 * - Exact staleness.
5104 *
5105 * If the Cloud Spanner database to be read is geographically distributed,
5106 * stale read-only transactions can execute more quickly than strong
5107 * or read-write transaction, because they are able to execute far
5108 * from the leader replica.
5109 *
5110 * Each type of timestamp bound is discussed in detail below.
5111 *
5112 * ### Strong
5113 *
5114 * Strong reads are guaranteed to see the effects of all transactions
5115 * that have committed before the start of the read. Furthermore, all
5116 * rows yielded by a single read are consistent with each other -- if
5117 * any part of the read observes a transaction, all parts of the read
5118 * see the transaction.
5119 *
5120 * Strong reads are not repeatable: two consecutive strong read-only
5121 * transactions might return inconsistent results if there are
5122 * concurrent writes. If consistency across reads is required, the
5123 * reads should be executed within a transaction or at an exact read
5124 * timestamp.
5125 *
5126 * See TransactionOptions.ReadOnly.strong.
5127 *
5128 * ### Exact Staleness
5129 *
5130 * These timestamp bounds execute reads at a user-specified
5131 * timestamp. Reads at a timestamp are guaranteed to see a consistent
5132 * prefix of the global transaction history: they observe
5133 * modifications done by all transactions with a commit timestamp <=
5134 * the read timestamp, and observe none of the modifications done by
5135 * transactions with a larger commit timestamp. They will block until
5136 * all conflicting transactions that may be assigned commit timestamps
5137 * <= the read timestamp have finished.
5138 *
5139 * The timestamp can either be expressed as an absolute Cloud Spanner commit
5140 * timestamp or a staleness relative to the current time.
5141 *
5142 * These modes do not require a "negotiation phase" to pick a
5143 * timestamp. As a result, they execute slightly faster than the
5144 * equivalent boundedly stale concurrency modes. On the other hand,
5145 * boundedly stale reads usually return fresher results.
5146 *
5147 * See TransactionOptions.ReadOnly.read_timestamp and
5148 * TransactionOptions.ReadOnly.exact_staleness.
5149 *
5150 * ### Bounded Staleness
5151 *
5152 * Bounded staleness modes allow Cloud Spanner to pick the read timestamp,
5153 * subject to a user-provided staleness bound. Cloud Spanner chooses the
5154 * newest timestamp within the staleness bound that allows execution
5155 * of the reads at the closest available replica without blocking.
5156 *
5157 * All rows yielded are consistent with each other -- if any part of
5158 * the read observes a transaction, all parts of the read see the
5159 * transaction. Boundedly stale reads are not repeatable: two stale
5160 * reads, even if they use the same staleness bound, can execute at
5161 * different timestamps and thus return inconsistent results.
5162 *
5163 * Boundedly stale reads execute in two phases: the first phase
5164 * negotiates a timestamp among all replicas needed to serve the
5165 * read. In the second phase, reads are executed at the negotiated
5166 * timestamp.
5167 *
5168 * As a result of the two phase execution, bounded staleness reads are
5169 * usually a little slower than comparable exact staleness
5170 * reads. However, they are typically able to return fresher
5171 * results, and are more likely to execute at the closest replica.
5172 *
5173 * Because the timestamp negotiation requires up-front knowledge of
5174 * which rows will be read, it can only be used with single-use
5175 * read-only transactions.
5176 *
5177 * See TransactionOptions.ReadOnly.max_staleness and
5178 * TransactionOptions.ReadOnly.min_read_timestamp.
5179 *
5180 * ### Old Read Timestamps and Garbage Collection
5181 *
5182 * Cloud Spanner continuously garbage collects deleted and overwritten data
5183 * in the background to reclaim storage space. This process is known
5184 * as "version GC". By default, version GC reclaims versions after they
5185 * are one hour old. Because of this, Cloud Spanner cannot perform reads
5186 * at read timestamps more than one hour in the past. This
5187 * restriction also applies to in-progress reads and/or SQL queries whose
5188 * timestamp become too old while executing. Reads and SQL queries with
5189 * too-old read timestamps fail with the error `FAILED_PRECONDITION`.
5190 */
5191 class TransactionOptions {
5192 /**
5193 * Transaction will not write.
5194 *
5195 * Authorization to begin a read-only transaction requires
5196 * `spanner.databases.beginReadOnlyTransaction` permission
5197 * on the `session` resource.
5198 */
5199 ReadOnly readOnly;
5200 /**
5201 * Transaction may write.
5202 *
5203 * Authorization to begin a read-write transaction requires
5204 * `spanner.databases.beginOrRollbackReadWriteTransaction` permission
5205 * on the `session` resource.
5206 */
5207 ReadWrite readWrite;
5208
5209 TransactionOptions();
5210
5211 TransactionOptions.fromJson(core.Map _json) {
5212 if (_json.containsKey("readOnly")) {
5213 readOnly = new ReadOnly.fromJson(_json["readOnly"]);
5214 }
5215 if (_json.containsKey("readWrite")) {
5216 readWrite = new ReadWrite.fromJson(_json["readWrite"]);
5217 }
5218 }
5219
5220 core.Map toJson() {
5221 var _json = new core.Map();
5222 if (readOnly != null) {
5223 _json["readOnly"] = (readOnly).toJson();
5224 }
5225 if (readWrite != null) {
5226 _json["readWrite"] = (readWrite).toJson();
5227 }
5228 return _json;
5229 }
5230 }
5231
5232 /**
5233 * This message is used to select the transaction in which a
5234 * Read or
5235 * ExecuteSql call runs.
5236 *
5237 * See TransactionOptions for more information about transactions.
5238 */
5239 class TransactionSelector {
5240 /**
5241 * Begin a new transaction and execute this read or SQL query in
5242 * it. The transaction ID of the new transaction is returned in
5243 * ResultSetMetadata.transaction, which is a Transaction.
5244 */
5245 TransactionOptions begin;
5246 /** Execute the read or SQL query in a previously-started transaction. */
5247 core.String id;
5248 core.List<core.int> get idAsBytes {
5249 return convert.BASE64.decode(id);
5250 }
5251
5252 void set idAsBytes(core.List<core.int> _bytes) {
5253 id = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+", "-") ;
5254 }
5255 /**
5256 * Execute the read or SQL query in a temporary transaction.
5257 * This is the most efficient way to execute a transaction that
5258 * consists of a single SQL query.
5259 */
5260 TransactionOptions singleUse;
5261
5262 TransactionSelector();
5263
5264 TransactionSelector.fromJson(core.Map _json) {
5265 if (_json.containsKey("begin")) {
5266 begin = new TransactionOptions.fromJson(_json["begin"]);
5267 }
5268 if (_json.containsKey("id")) {
5269 id = _json["id"];
5270 }
5271 if (_json.containsKey("singleUse")) {
5272 singleUse = new TransactionOptions.fromJson(_json["singleUse"]);
5273 }
5274 }
5275
5276 core.Map toJson() {
5277 var _json = new core.Map();
5278 if (begin != null) {
5279 _json["begin"] = (begin).toJson();
5280 }
5281 if (id != null) {
5282 _json["id"] = id;
5283 }
5284 if (singleUse != null) {
5285 _json["singleUse"] = (singleUse).toJson();
5286 }
5287 return _json;
5288 }
5289 }
5290
5291 /**
5292 * `Type` indicates the type of a Cloud Spanner value, as might be stored in a
5293 * table cell or returned from an SQL query.
5294 */
5295 class Type {
5296 /**
5297 * If code == ARRAY, then `array_element_type`
5298 * is the type of the array elements.
5299 */
5300 Type arrayElementType;
5301 /**
5302 * Required. The TypeCode for this type.
5303 * Possible string values are:
5304 * - "TYPE_CODE_UNSPECIFIED" : Not specified.
5305 * - "BOOL" : Encoded as JSON `true` or `false`.
5306 * - "INT64" : Encoded as `string`, in decimal format.
5307 * - "FLOAT64" : Encoded as `number`, or the strings `"NaN"`, `"Infinity"`, or
5308 * `"-Infinity"`.
5309 * - "TIMESTAMP" : Encoded as `string` in RFC 3339 timestamp format. The time
5310 * zone
5311 * must be present, and must be `"Z"`.
5312 * - "DATE" : Encoded as `string` in RFC 3339 date format.
5313 * - "STRING" : Encoded as `string`.
5314 * - "BYTES" : Encoded as a base64-encoded `string`, as described in RFC 4648,
5315 * section 4.
5316 * - "ARRAY" : Encoded as `list`, where the list elements are represented
5317 * according to array_element_type.
5318 * - "STRUCT" : Encoded as `list`, where list element `i` is represented
5319 * according
5320 * to [struct_type.fields[i]][google.spanner.v1.StructType.fields].
5321 */
5322 core.String code;
5323 /**
5324 * If code == STRUCT, then `struct_type`
5325 * provides type information for the struct's fields.
5326 */
5327 StructType structType;
5328
5329 Type();
5330
5331 Type.fromJson(core.Map _json) {
5332 if (_json.containsKey("arrayElementType")) {
5333 arrayElementType = new Type.fromJson(_json["arrayElementType"]);
5334 }
5335 if (_json.containsKey("code")) {
5336 code = _json["code"];
5337 }
5338 if (_json.containsKey("structType")) {
5339 structType = new StructType.fromJson(_json["structType"]);
5340 }
5341 }
5342
5343 core.Map toJson() {
5344 var _json = new core.Map();
5345 if (arrayElementType != null) {
5346 _json["arrayElementType"] = (arrayElementType).toJson();
5347 }
5348 if (code != null) {
5349 _json["code"] = code;
5350 }
5351 if (structType != null) {
5352 _json["structType"] = (structType).toJson();
5353 }
5354 return _json;
5355 }
5356 }
5357
5358 /**
5359 * Metadata type for the operation returned by
5360 * UpdateDatabaseDdl.
5361 */
5362 class UpdateDatabaseDdlMetadata {
5363 /**
5364 * Reports the commit timestamps of all statements that have
5365 * succeeded so far, where `commit_timestamps[i]` is the commit
5366 * timestamp for the statement `statements[i]`.
5367 */
5368 core.List<core.String> commitTimestamps;
5369 /** The database being modified. */
5370 core.String database;
5371 /**
5372 * For an update this list contains all the statements. For an
5373 * individual statement, this list contains only that statement.
5374 */
5375 core.List<core.String> statements;
5376
5377 UpdateDatabaseDdlMetadata();
5378
5379 UpdateDatabaseDdlMetadata.fromJson(core.Map _json) {
5380 if (_json.containsKey("commitTimestamps")) {
5381 commitTimestamps = _json["commitTimestamps"];
5382 }
5383 if (_json.containsKey("database")) {
5384 database = _json["database"];
5385 }
5386 if (_json.containsKey("statements")) {
5387 statements = _json["statements"];
5388 }
5389 }
5390
5391 core.Map toJson() {
5392 var _json = new core.Map();
5393 if (commitTimestamps != null) {
5394 _json["commitTimestamps"] = commitTimestamps;
5395 }
5396 if (database != null) {
5397 _json["database"] = database;
5398 }
5399 if (statements != null) {
5400 _json["statements"] = statements;
5401 }
5402 return _json;
5403 }
5404 }
5405
5406 /**
5407 * Enqueues the given DDL statements to be applied, in order but not
5408 * necessarily all at once, to the database schema at some point (or
5409 * points) in the future. The server checks that the statements
5410 * are executable (syntactically valid, name tables that exist, etc.)
5411 * before enqueueing them, but they may still fail upon
5412 * later execution (e.g., if a statement from another batch of
5413 * statements is applied first and it conflicts in some way, or if
5414 * there is some data-related problem like a `NULL` value in a column to
5415 * which `NOT NULL` would be added). If a statement fails, all
5416 * subsequent statements in the batch are automatically cancelled.
5417 *
5418 * Each batch of statements is assigned a name which can be used with
5419 * the Operations API to monitor
5420 * progress. See the
5421 * operation_id field for more
5422 * details.
5423 */
5424 class UpdateDatabaseDdlRequest {
5425 /**
5426 * If empty, the new update request is assigned an
5427 * automatically-generated operation ID. Otherwise, `operation_id`
5428 * is used to construct the name of the resulting
5429 * Operation.
5430 *
5431 * Specifying an explicit operation ID simplifies determining
5432 * whether the statements were executed in the event that the
5433 * UpdateDatabaseDdl call is replayed,
5434 * or the return value is otherwise lost: the database and
5435 * `operation_id` fields can be combined to form the
5436 * name of the resulting
5437 * longrunning.Operation: `<database>/operations/<operation_id>`.
5438 *
5439 * `operation_id` should be unique within the database, and must be
5440 * a valid identifier: `a-z*`. Note that
5441 * automatically-generated operation IDs always begin with an
5442 * underscore. If the named operation already exists,
5443 * UpdateDatabaseDdl returns
5444 * `ALREADY_EXISTS`.
5445 */
5446 core.String operationId;
5447 /** DDL statements to be applied to the database. */
5448 core.List<core.String> statements;
5449
5450 UpdateDatabaseDdlRequest();
5451
5452 UpdateDatabaseDdlRequest.fromJson(core.Map _json) {
5453 if (_json.containsKey("operationId")) {
5454 operationId = _json["operationId"];
5455 }
5456 if (_json.containsKey("statements")) {
5457 statements = _json["statements"];
5458 }
5459 }
5460
5461 core.Map toJson() {
5462 var _json = new core.Map();
5463 if (operationId != null) {
5464 _json["operationId"] = operationId;
5465 }
5466 if (statements != null) {
5467 _json["statements"] = statements;
5468 }
5469 return _json;
5470 }
5471 }
5472
5473 /**
5474 * Metadata type for the operation returned by
5475 * UpdateInstance.
5476 */
5477 class UpdateInstanceMetadata {
5478 /**
5479 * The time at which this operation was cancelled. If set, this operation is
5480 * in the process of undoing itself (which is guaranteed to succeed) and
5481 * cannot be cancelled again.
5482 */
5483 core.String cancelTime;
5484 /** The time at which this operation failed or was completed successfully. */
5485 core.String endTime;
5486 /** The desired end state of the update. */
5487 Instance instance;
5488 /**
5489 * The time at which UpdateInstance
5490 * request was received.
5491 */
5492 core.String startTime;
5493
5494 UpdateInstanceMetadata();
5495
5496 UpdateInstanceMetadata.fromJson(core.Map _json) {
5497 if (_json.containsKey("cancelTime")) {
5498 cancelTime = _json["cancelTime"];
5499 }
5500 if (_json.containsKey("endTime")) {
5501 endTime = _json["endTime"];
5502 }
5503 if (_json.containsKey("instance")) {
5504 instance = new Instance.fromJson(_json["instance"]);
5505 }
5506 if (_json.containsKey("startTime")) {
5507 startTime = _json["startTime"];
5508 }
5509 }
5510
5511 core.Map toJson() {
5512 var _json = new core.Map();
5513 if (cancelTime != null) {
5514 _json["cancelTime"] = cancelTime;
5515 }
5516 if (endTime != null) {
5517 _json["endTime"] = endTime;
5518 }
5519 if (instance != null) {
5520 _json["instance"] = (instance).toJson();
5521 }
5522 if (startTime != null) {
5523 _json["startTime"] = startTime;
5524 }
5525 return _json;
5526 }
5527 }
5528
5529 /** The request for UpdateInstance. */
5530 class UpdateInstanceRequest {
5531 /**
5532 * Required. A mask specifying which fields in
5533 * [][google.spanner.admin.instance.v1.UpdateInstanceRequest.instance] should
5534 * be updated.
5535 * The field mask must always be specified; this prevents any future fields in
5536 * [][google.spanner.admin.instance.v1.Instance] from being erased
5537 * accidentally by clients that do not know
5538 * about them.
5539 */
5540 core.String fieldMask;
5541 /**
5542 * Required. The instance to update, which must always include the instance
5543 * name. Otherwise, only fields mentioned in
5544 * [][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] need
5545 * be included.
5546 */
5547 Instance instance;
5548
5549 UpdateInstanceRequest();
5550
5551 UpdateInstanceRequest.fromJson(core.Map _json) {
5552 if (_json.containsKey("fieldMask")) {
5553 fieldMask = _json["fieldMask"];
5554 }
5555 if (_json.containsKey("instance")) {
5556 instance = new Instance.fromJson(_json["instance"]);
5557 }
5558 }
5559
5560 core.Map toJson() {
5561 var _json = new core.Map();
5562 if (fieldMask != null) {
5563 _json["fieldMask"] = fieldMask;
5564 }
5565 if (instance != null) {
5566 _json["instance"] = (instance).toJson();
5567 }
5568 return _json;
5569 }
5570 }
5571
5572 /**
5573 * Arguments to insert, update, insert_or_update, and
5574 * replace operations.
5575 */
5576 class Write {
5577 /**
5578 * The names of the columns in table to be written.
5579 *
5580 * The list of columns must contain enough columns to allow
5581 * Cloud Spanner to derive values for all primary key columns in the
5582 * row(s) to be modified.
5583 */
5584 core.List<core.String> columns;
5585 /** Required. The table whose rows will be written. */
5586 core.String table;
5587 /**
5588 * The values to be written. `values` can contain more than one
5589 * list of values. If it does, then multiple rows are written, one
5590 * for each entry in `values`. Each list in `values` must have
5591 * exactly as many entries as there are entries in columns
5592 * above. Sending multiple lists is equivalent to sending multiple
5593 * `Mutation`s, each containing one `values` entry and repeating
5594 * table and columns. Individual values in each list are
5595 * encoded as described here.
5596 *
5597 * The values for Object must be JSON objects. It can consist of `num`,
5598 * `String`, `bool` and `null` as well as `Map` and `List` values.
5599 */
5600 core.List<core.List<core.Object>> values;
5601
5602 Write();
5603
5604 Write.fromJson(core.Map _json) {
5605 if (_json.containsKey("columns")) {
5606 columns = _json["columns"];
5607 }
5608 if (_json.containsKey("table")) {
5609 table = _json["table"];
5610 }
5611 if (_json.containsKey("values")) {
5612 values = _json["values"];
5613 }
5614 }
5615
5616 core.Map toJson() {
5617 var _json = new core.Map();
5618 if (columns != null) {
5619 _json["columns"] = columns;
5620 }
5621 if (table != null) {
5622 _json["table"] = table;
5623 }
5624 if (values != null) {
5625 _json["values"] = values;
5626 }
5627 return _json;
5628 }
5629 }
OLDNEW
« no previous file with comments | « generated/googleapis/lib/sourcerepo/v1.dart ('k') | generated/googleapis/lib/storage/v1.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698