google-apis-spanner_v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2328 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module SpannerV1
23
+ # Cloud Spanner API
24
+ #
25
+ # Cloud Spanner is a managed, mission-critical, globally consistent and scalable
26
+ # relational database service.
27
+ #
28
+ # @example
29
+ # require 'google/apis/spanner_v1'
30
+ #
31
+ # Spanner = Google::Apis::SpannerV1 # Alias the module
32
+ # service = Spanner::SpannerService.new
33
+ #
34
+ # @see https://cloud.google.com/spanner/
35
+ class SpannerService < Google::Apis::Core::BaseService
36
+ # @return [String]
37
+ # API key. Your API key identifies your project and provides you with API access,
38
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
39
+ attr_accessor :key
40
+
41
+ # @return [String]
42
+ # Available to use for quota purposes for server-side applications. Can be any
43
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
44
+ attr_accessor :quota_user
45
+
46
+ def initialize
47
+ super('https://spanner.googleapis.com/', '',
48
+ client_name: 'google-apis-spanner_v1',
49
+ client_version: Google::Apis::SpannerV1::GEM_VERSION)
50
+ @batch_path = 'batch'
51
+ end
52
+
53
+ # Gets information about a particular instance configuration.
54
+ # @param [String] name
55
+ # Required. The name of the requested instance configuration. Values are of the
56
+ # form `projects//instanceConfigs/`.
57
+ # @param [String] fields
58
+ # Selector specifying which fields to include in a partial response.
59
+ # @param [String] quota_user
60
+ # Available to use for quota purposes for server-side applications. Can be any
61
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
62
+ # @param [Google::Apis::RequestOptions] options
63
+ # Request-specific options
64
+ #
65
+ # @yield [result, err] Result & error if block supplied
66
+ # @yieldparam result [Google::Apis::SpannerV1::InstanceConfig] parsed result object
67
+ # @yieldparam err [StandardError] error object if request failed
68
+ #
69
+ # @return [Google::Apis::SpannerV1::InstanceConfig]
70
+ #
71
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
72
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
73
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
74
+ def get_project_instance_config(name, fields: nil, quota_user: nil, options: nil, &block)
75
+ command = make_simple_command(:get, 'v1/{+name}', options)
76
+ command.response_representation = Google::Apis::SpannerV1::InstanceConfig::Representation
77
+ command.response_class = Google::Apis::SpannerV1::InstanceConfig
78
+ command.params['name'] = name unless name.nil?
79
+ command.query['fields'] = fields unless fields.nil?
80
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
81
+ execute_or_queue_command(command, &block)
82
+ end
83
+
84
+ # Lists the supported instance configurations for a given project.
85
+ # @param [String] parent
86
+ # Required. The name of the project for which a list of supported instance
87
+ # configurations is requested. Values are of the form `projects/`.
88
+ # @param [Fixnum] page_size
89
+ # Number of instance configurations to be returned in the response. If 0 or less,
90
+ # defaults to the server's maximum allowed page size.
91
+ # @param [String] page_token
92
+ # If non-empty, `page_token` should contain a next_page_token from a previous
93
+ # ListInstanceConfigsResponse.
94
+ # @param [String] fields
95
+ # Selector specifying which fields to include in a partial response.
96
+ # @param [String] quota_user
97
+ # Available to use for quota purposes for server-side applications. Can be any
98
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
99
+ # @param [Google::Apis::RequestOptions] options
100
+ # Request-specific options
101
+ #
102
+ # @yield [result, err] Result & error if block supplied
103
+ # @yieldparam result [Google::Apis::SpannerV1::ListInstanceConfigsResponse] parsed result object
104
+ # @yieldparam err [StandardError] error object if request failed
105
+ #
106
+ # @return [Google::Apis::SpannerV1::ListInstanceConfigsResponse]
107
+ #
108
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
109
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
110
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
111
+ def list_project_instance_configs(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
112
+ command = make_simple_command(:get, 'v1/{+parent}/instanceConfigs', options)
113
+ command.response_representation = Google::Apis::SpannerV1::ListInstanceConfigsResponse::Representation
114
+ command.response_class = Google::Apis::SpannerV1::ListInstanceConfigsResponse
115
+ command.params['parent'] = parent unless parent.nil?
116
+ command.query['pageSize'] = page_size unless page_size.nil?
117
+ command.query['pageToken'] = page_token unless page_token.nil?
118
+ command.query['fields'] = fields unless fields.nil?
119
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
120
+ execute_or_queue_command(command, &block)
121
+ end
122
+
123
+ # Creates an instance and begins preparing it to begin serving. The returned
124
+ # long-running operation can be used to track the progress of preparing the new
125
+ # instance. The instance name is assigned by the caller. If the named instance
126
+ # already exists, `CreateInstance` returns `ALREADY_EXISTS`. Immediately upon
127
+ # completion of this request: * The instance is readable via the API, with all
128
+ # requested attributes but no allocated resources. Its state is `CREATING`.
129
+ # Until completion of the returned operation: * Cancelling the operation renders
130
+ # the instance immediately unreadable via the API. * The instance can be deleted.
131
+ # * All other attempts to modify the instance are rejected. Upon completion of
132
+ # the returned operation: * Billing for all successfully-allocated resources
133
+ # begins (some types may have lower than the requested levels). * Databases can
134
+ # be created in the instance. * The instance's allocated resource levels are
135
+ # readable via the API. * The instance's state becomes `READY`. The returned
136
+ # long-running operation will have a name of the format `/operations/` and can
137
+ # be used to track creation of the instance. The metadata field type is
138
+ # CreateInstanceMetadata. The response field type is Instance, if successful.
139
+ # @param [String] parent
140
+ # Required. The name of the project in which to create the instance. Values are
141
+ # of the form `projects/`.
142
+ # @param [Google::Apis::SpannerV1::CreateInstanceRequest] create_instance_request_object
143
+ # @param [String] fields
144
+ # Selector specifying which fields to include in a partial response.
145
+ # @param [String] quota_user
146
+ # Available to use for quota purposes for server-side applications. Can be any
147
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
148
+ # @param [Google::Apis::RequestOptions] options
149
+ # Request-specific options
150
+ #
151
+ # @yield [result, err] Result & error if block supplied
152
+ # @yieldparam result [Google::Apis::SpannerV1::Operation] parsed result object
153
+ # @yieldparam err [StandardError] error object if request failed
154
+ #
155
+ # @return [Google::Apis::SpannerV1::Operation]
156
+ #
157
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
158
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
159
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
160
+ def create_instance(parent, create_instance_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
161
+ command = make_simple_command(:post, 'v1/{+parent}/instances', options)
162
+ command.request_representation = Google::Apis::SpannerV1::CreateInstanceRequest::Representation
163
+ command.request_object = create_instance_request_object
164
+ command.response_representation = Google::Apis::SpannerV1::Operation::Representation
165
+ command.response_class = Google::Apis::SpannerV1::Operation
166
+ command.params['parent'] = parent unless parent.nil?
167
+ command.query['fields'] = fields unless fields.nil?
168
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
169
+ execute_or_queue_command(command, &block)
170
+ end
171
+
172
+ # Deletes an instance. Immediately upon completion of the request: * Billing
173
+ # ceases for all of the instance's reserved resources. Soon afterward: * The
174
+ # instance and *all of its databases* immediately and irrevocably disappear from
175
+ # the API. All data in the databases is permanently deleted.
176
+ # @param [String] name
177
+ # Required. The name of the instance to be deleted. Values are of the form `
178
+ # projects//instances/`
179
+ # @param [String] fields
180
+ # Selector specifying which fields to include in a partial response.
181
+ # @param [String] quota_user
182
+ # Available to use for quota purposes for server-side applications. Can be any
183
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
184
+ # @param [Google::Apis::RequestOptions] options
185
+ # Request-specific options
186
+ #
187
+ # @yield [result, err] Result & error if block supplied
188
+ # @yieldparam result [Google::Apis::SpannerV1::Empty] parsed result object
189
+ # @yieldparam err [StandardError] error object if request failed
190
+ #
191
+ # @return [Google::Apis::SpannerV1::Empty]
192
+ #
193
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
194
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
195
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
196
+ def delete_project_instance(name, fields: nil, quota_user: nil, options: nil, &block)
197
+ command = make_simple_command(:delete, 'v1/{+name}', options)
198
+ command.response_representation = Google::Apis::SpannerV1::Empty::Representation
199
+ command.response_class = Google::Apis::SpannerV1::Empty
200
+ command.params['name'] = name unless name.nil?
201
+ command.query['fields'] = fields unless fields.nil?
202
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
203
+ execute_or_queue_command(command, &block)
204
+ end
205
+
206
+ # Gets information about a particular instance.
207
+ # @param [String] name
208
+ # Required. The name of the requested instance. Values are of the form `projects/
209
+ # /instances/`.
210
+ # @param [String] field_mask
211
+ # If field_mask is present, specifies the subset of Instance fields that should
212
+ # be returned. If absent, all Instance fields are returned.
213
+ # @param [String] fields
214
+ # Selector specifying which fields to include in a partial response.
215
+ # @param [String] quota_user
216
+ # Available to use for quota purposes for server-side applications. Can be any
217
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
218
+ # @param [Google::Apis::RequestOptions] options
219
+ # Request-specific options
220
+ #
221
+ # @yield [result, err] Result & error if block supplied
222
+ # @yieldparam result [Google::Apis::SpannerV1::Instance] parsed result object
223
+ # @yieldparam err [StandardError] error object if request failed
224
+ #
225
+ # @return [Google::Apis::SpannerV1::Instance]
226
+ #
227
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
228
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
229
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
230
+ def get_project_instance(name, field_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
231
+ command = make_simple_command(:get, 'v1/{+name}', options)
232
+ command.response_representation = Google::Apis::SpannerV1::Instance::Representation
233
+ command.response_class = Google::Apis::SpannerV1::Instance
234
+ command.params['name'] = name unless name.nil?
235
+ command.query['fieldMask'] = field_mask unless field_mask.nil?
236
+ command.query['fields'] = fields unless fields.nil?
237
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
238
+ execute_or_queue_command(command, &block)
239
+ end
240
+
241
+ # Gets the access control policy for an instance resource. Returns an empty
242
+ # policy if an instance exists but does not have a policy set. Authorization
243
+ # requires `spanner.instances.getIamPolicy` on resource.
244
+ # @param [String] resource
245
+ # REQUIRED: The Cloud Spanner resource for which the policy is being retrieved.
246
+ # The format is `projects//instances/` for instance resources and `projects//
247
+ # instances//databases/` for database resources.
248
+ # @param [Google::Apis::SpannerV1::GetIamPolicyRequest] get_iam_policy_request_object
249
+ # @param [String] fields
250
+ # Selector specifying which fields to include in a partial response.
251
+ # @param [String] quota_user
252
+ # Available to use for quota purposes for server-side applications. Can be any
253
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
254
+ # @param [Google::Apis::RequestOptions] options
255
+ # Request-specific options
256
+ #
257
+ # @yield [result, err] Result & error if block supplied
258
+ # @yieldparam result [Google::Apis::SpannerV1::Policy] parsed result object
259
+ # @yieldparam err [StandardError] error object if request failed
260
+ #
261
+ # @return [Google::Apis::SpannerV1::Policy]
262
+ #
263
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
264
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
265
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
266
+ def get_instance_iam_policy(resource, get_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
267
+ command = make_simple_command(:post, 'v1/{+resource}:getIamPolicy', options)
268
+ command.request_representation = Google::Apis::SpannerV1::GetIamPolicyRequest::Representation
269
+ command.request_object = get_iam_policy_request_object
270
+ command.response_representation = Google::Apis::SpannerV1::Policy::Representation
271
+ command.response_class = Google::Apis::SpannerV1::Policy
272
+ command.params['resource'] = resource unless resource.nil?
273
+ command.query['fields'] = fields unless fields.nil?
274
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
275
+ execute_or_queue_command(command, &block)
276
+ end
277
+
278
+ # Lists all instances in the given project.
279
+ # @param [String] parent
280
+ # Required. The name of the project for which a list of instances is requested.
281
+ # Values are of the form `projects/`.
282
+ # @param [String] filter
283
+ # An expression for filtering the results of the request. Filter rules are case
284
+ # insensitive. The fields eligible for filtering are: * `name` * `display_name` *
285
+ # `labels.key` where key is the name of a label Some examples of using filters
286
+ # are: * `name:*` --> The instance has a name. * `name:Howl` --> The instance's
287
+ # name contains the string "howl". * `name:HOWL` --> Equivalent to above. * `
288
+ # NAME:howl` --> Equivalent to above. * `labels.env:*` --> The instance has the
289
+ # label "env". * `labels.env:dev` --> The instance has the label "env" and the
290
+ # value of the label contains the string "dev". * `name:howl labels.env:dev` -->
291
+ # The instance's name contains "howl" and it has the label "env" with its value
292
+ # containing "dev".
293
+ # @param [Fixnum] page_size
294
+ # Number of instances to be returned in the response. If 0 or less, defaults to
295
+ # the server's maximum allowed page size.
296
+ # @param [String] page_token
297
+ # If non-empty, `page_token` should contain a next_page_token from a previous
298
+ # ListInstancesResponse.
299
+ # @param [String] fields
300
+ # Selector specifying which fields to include in a partial response.
301
+ # @param [String] quota_user
302
+ # Available to use for quota purposes for server-side applications. Can be any
303
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
304
+ # @param [Google::Apis::RequestOptions] options
305
+ # Request-specific options
306
+ #
307
+ # @yield [result, err] Result & error if block supplied
308
+ # @yieldparam result [Google::Apis::SpannerV1::ListInstancesResponse] parsed result object
309
+ # @yieldparam err [StandardError] error object if request failed
310
+ #
311
+ # @return [Google::Apis::SpannerV1::ListInstancesResponse]
312
+ #
313
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
314
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
315
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
316
+ def list_project_instances(parent, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
317
+ command = make_simple_command(:get, 'v1/{+parent}/instances', options)
318
+ command.response_representation = Google::Apis::SpannerV1::ListInstancesResponse::Representation
319
+ command.response_class = Google::Apis::SpannerV1::ListInstancesResponse
320
+ command.params['parent'] = parent unless parent.nil?
321
+ command.query['filter'] = filter unless filter.nil?
322
+ command.query['pageSize'] = page_size unless page_size.nil?
323
+ command.query['pageToken'] = page_token unless page_token.nil?
324
+ command.query['fields'] = fields unless fields.nil?
325
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
326
+ execute_or_queue_command(command, &block)
327
+ end
328
+
329
+ # Updates an instance, and begins allocating or releasing resources as requested.
330
+ # The returned long-running operation can be used to track the progress of
331
+ # updating the instance. If the named instance does not exist, returns `
332
+ # NOT_FOUND`. Immediately upon completion of this request: * For resource types
333
+ # for which a decrease in the instance's allocation has been requested, billing
334
+ # is based on the newly-requested level. Until completion of the returned
335
+ # operation: * Cancelling the operation sets its metadata's cancel_time, and
336
+ # begins restoring resources to their pre-request values. The operation is
337
+ # guaranteed to succeed at undoing all resource changes, after which point it
338
+ # terminates with a `CANCELLED` status. * All other attempts to modify the
339
+ # instance are rejected. * Reading the instance via the API continues to give
340
+ # the pre-request resource levels. Upon completion of the returned operation: *
341
+ # Billing begins for all successfully-allocated resources (some types may have
342
+ # lower than the requested levels). * All newly-reserved resources are available
343
+ # for serving the instance's tables. * The instance's new resource levels are
344
+ # readable via the API. The returned long-running operation will have a name of
345
+ # the format `/operations/` and can be used to track the instance modification.
346
+ # The metadata field type is UpdateInstanceMetadata. The response field type is
347
+ # Instance, if successful. Authorization requires `spanner.instances.update`
348
+ # permission on resource name.
349
+ # @param [String] name
350
+ # Required. A unique identifier for the instance, which cannot be changed after
351
+ # the instance is created. Values are of the form `projects//instances/a-z*[a-z0-
352
+ # 9]`. The final segment of the name must be between 2 and 64 characters in
353
+ # length.
354
+ # @param [Google::Apis::SpannerV1::UpdateInstanceRequest] update_instance_request_object
355
+ # @param [String] fields
356
+ # Selector specifying which fields to include in a partial response.
357
+ # @param [String] quota_user
358
+ # Available to use for quota purposes for server-side applications. Can be any
359
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
360
+ # @param [Google::Apis::RequestOptions] options
361
+ # Request-specific options
362
+ #
363
+ # @yield [result, err] Result & error if block supplied
364
+ # @yieldparam result [Google::Apis::SpannerV1::Operation] parsed result object
365
+ # @yieldparam err [StandardError] error object if request failed
366
+ #
367
+ # @return [Google::Apis::SpannerV1::Operation]
368
+ #
369
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
370
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
371
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
372
+ def patch_project_instance(name, update_instance_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
373
+ command = make_simple_command(:patch, 'v1/{+name}', options)
374
+ command.request_representation = Google::Apis::SpannerV1::UpdateInstanceRequest::Representation
375
+ command.request_object = update_instance_request_object
376
+ command.response_representation = Google::Apis::SpannerV1::Operation::Representation
377
+ command.response_class = Google::Apis::SpannerV1::Operation
378
+ command.params['name'] = name unless name.nil?
379
+ command.query['fields'] = fields unless fields.nil?
380
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
381
+ execute_or_queue_command(command, &block)
382
+ end
383
+
384
+ # Sets the access control policy on an instance resource. Replaces any existing
385
+ # policy. Authorization requires `spanner.instances.setIamPolicy` on resource.
386
+ # @param [String] resource
387
+ # REQUIRED: The Cloud Spanner resource for which the policy is being set. The
388
+ # format is `projects//instances/` for instance resources and `projects//
389
+ # instances//databases/` for databases resources.
390
+ # @param [Google::Apis::SpannerV1::SetIamPolicyRequest] set_iam_policy_request_object
391
+ # @param [String] fields
392
+ # Selector specifying which fields to include in a partial response.
393
+ # @param [String] quota_user
394
+ # Available to use for quota purposes for server-side applications. Can be any
395
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
396
+ # @param [Google::Apis::RequestOptions] options
397
+ # Request-specific options
398
+ #
399
+ # @yield [result, err] Result & error if block supplied
400
+ # @yieldparam result [Google::Apis::SpannerV1::Policy] parsed result object
401
+ # @yieldparam err [StandardError] error object if request failed
402
+ #
403
+ # @return [Google::Apis::SpannerV1::Policy]
404
+ #
405
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
406
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
407
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
408
+ def set_instance_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
409
+ command = make_simple_command(:post, 'v1/{+resource}:setIamPolicy', options)
410
+ command.request_representation = Google::Apis::SpannerV1::SetIamPolicyRequest::Representation
411
+ command.request_object = set_iam_policy_request_object
412
+ command.response_representation = Google::Apis::SpannerV1::Policy::Representation
413
+ command.response_class = Google::Apis::SpannerV1::Policy
414
+ command.params['resource'] = resource unless resource.nil?
415
+ command.query['fields'] = fields unless fields.nil?
416
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
417
+ execute_or_queue_command(command, &block)
418
+ end
419
+
420
+ # Returns permissions that the caller has on the specified instance resource.
421
+ # Attempting this RPC on a non-existent Cloud Spanner instance resource will
422
+ # result in a NOT_FOUND error if the user has `spanner.instances.list`
423
+ # permission on the containing Google Cloud Project. Otherwise returns an empty
424
+ # set of permissions.
425
+ # @param [String] resource
426
+ # REQUIRED: The Cloud Spanner resource for which permissions are being tested.
427
+ # The format is `projects//instances/` for instance resources and `projects//
428
+ # instances//databases/` for database resources.
429
+ # @param [Google::Apis::SpannerV1::TestIamPermissionsRequest] test_iam_permissions_request_object
430
+ # @param [String] fields
431
+ # Selector specifying which fields to include in a partial response.
432
+ # @param [String] quota_user
433
+ # Available to use for quota purposes for server-side applications. Can be any
434
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
435
+ # @param [Google::Apis::RequestOptions] options
436
+ # Request-specific options
437
+ #
438
+ # @yield [result, err] Result & error if block supplied
439
+ # @yieldparam result [Google::Apis::SpannerV1::TestIamPermissionsResponse] parsed result object
440
+ # @yieldparam err [StandardError] error object if request failed
441
+ #
442
+ # @return [Google::Apis::SpannerV1::TestIamPermissionsResponse]
443
+ #
444
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
445
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
446
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
447
+ def test_instance_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
448
+ command = make_simple_command(:post, 'v1/{+resource}:testIamPermissions', options)
449
+ command.request_representation = Google::Apis::SpannerV1::TestIamPermissionsRequest::Representation
450
+ command.request_object = test_iam_permissions_request_object
451
+ command.response_representation = Google::Apis::SpannerV1::TestIamPermissionsResponse::Representation
452
+ command.response_class = Google::Apis::SpannerV1::TestIamPermissionsResponse
453
+ command.params['resource'] = resource unless resource.nil?
454
+ command.query['fields'] = fields unless fields.nil?
455
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
456
+ execute_or_queue_command(command, &block)
457
+ end
458
+
459
+ # Lists the backup long-running operations in the given instance. A backup
460
+ # operation has a name of the form `projects//instances//backups//operations/`.
461
+ # The long-running operation metadata field type `metadata.type_url` describes
462
+ # the type of the metadata. Operations returned include those that have
463
+ # completed/failed/canceled within the last 7 days, and pending operations.
464
+ # Operations returned are ordered by `operation.metadata.value.progress.
465
+ # start_time` in descending order starting from the most recently started
466
+ # operation.
467
+ # @param [String] parent
468
+ # Required. The instance of the backup operations. Values are of the form `
469
+ # projects//instances/`.
470
+ # @param [String] filter
471
+ # An expression that filters the list of returned backup operations. A filter
472
+ # expression consists of a field name, a comparison operator, and a value for
473
+ # filtering. The value must be a string, a number, or a boolean. The comparison
474
+ # operator must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. Colon `:` is
475
+ # the contains operator. Filter rules are not case sensitive. The following
476
+ # fields in the operation are eligible for filtering: * `name` - The name of the
477
+ # long-running operation * `done` - False if the operation is in progress, else
478
+ # true. * `metadata.@type` - the type of metadata. For example, the type string
479
+ # for CreateBackupMetadata is `type.googleapis.com/google.spanner.admin.database.
480
+ # v1.CreateBackupMetadata`. * `metadata.` - any field in metadata.value. * `
481
+ # error` - Error associated with the long-running operation. * `response.@type` -
482
+ # the type of response. * `response.` - any field in response.value. You can
483
+ # combine multiple expressions by enclosing each expression in parentheses. By
484
+ # default, expressions are combined with AND logic, but you can specify AND, OR,
485
+ # and NOT logic explicitly. Here are a few examples: * `done:true` - The
486
+ # operation is complete. * `metadata.database:prod` - The database the backup
487
+ # was taken from has a name containing the string "prod". * `(metadata.@type=
488
+ # type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND`
489
+ # \ `(metadata.name:howl) AND` \ `(metadata.progress.start_time < \"2018-03-
490
+ # 28T14:50:00Z\") AND` \ `(error:*)` - Returns operations where: * The operation'
491
+ # s metadata type is CreateBackupMetadata. * The backup name contains the string
492
+ # "howl". * The operation started before 2018-03-28T14:50:00Z. * The operation
493
+ # resulted in an error.
494
+ # @param [Fixnum] page_size
495
+ # Number of operations to be returned in the response. If 0 or less, defaults to
496
+ # the server's maximum allowed page size.
497
+ # @param [String] page_token
498
+ # If non-empty, `page_token` should contain a next_page_token from a previous
499
+ # ListBackupOperationsResponse to the same `parent` and with the same `filter`.
500
+ # @param [String] fields
501
+ # Selector specifying which fields to include in a partial response.
502
+ # @param [String] quota_user
503
+ # Available to use for quota purposes for server-side applications. Can be any
504
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
505
+ # @param [Google::Apis::RequestOptions] options
506
+ # Request-specific options
507
+ #
508
+ # @yield [result, err] Result & error if block supplied
509
+ # @yieldparam result [Google::Apis::SpannerV1::ListBackupOperationsResponse] parsed result object
510
+ # @yieldparam err [StandardError] error object if request failed
511
+ #
512
+ # @return [Google::Apis::SpannerV1::ListBackupOperationsResponse]
513
+ #
514
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
515
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
516
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
517
+ def list_project_instance_backupoperations(parent, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
518
+ command = make_simple_command(:get, 'v1/{+parent}/backupOperations', options)
519
+ command.response_representation = Google::Apis::SpannerV1::ListBackupOperationsResponse::Representation
520
+ command.response_class = Google::Apis::SpannerV1::ListBackupOperationsResponse
521
+ command.params['parent'] = parent unless parent.nil?
522
+ command.query['filter'] = filter unless filter.nil?
523
+ command.query['pageSize'] = page_size unless page_size.nil?
524
+ command.query['pageToken'] = page_token unless page_token.nil?
525
+ command.query['fields'] = fields unless fields.nil?
526
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
527
+ execute_or_queue_command(command, &block)
528
+ end
529
+
530
+ # Starts creating a new Cloud Spanner Backup. The returned backup long-running
531
+ # operation will have a name of the format `projects//instances//backups//
532
+ # operations/` and can be used to track creation of the backup. The metadata
533
+ # field type is CreateBackupMetadata. The response field type is Backup, if
534
+ # successful. Cancelling the returned operation will stop the creation and
535
+ # delete the backup. There can be only one pending backup creation per database.
536
+ # Backup creation of different databases can run concurrently.
537
+ # @param [String] parent
538
+ # Required. The name of the instance in which the backup will be created. This
539
+ # must be the same instance that contains the database the backup will be
540
+ # created from. The backup will be stored in the location(s) specified in the
541
+ # instance configuration of this instance. Values are of the form `projects//
542
+ # instances/`.
543
+ # @param [Google::Apis::SpannerV1::Backup] backup_object
544
+ # @param [String] backup_id
545
+ # Required. The id of the backup to be created. The `backup_id` appended to `
546
+ # parent` forms the full backup name of the form `projects//instances//backups/`.
547
+ # @param [String] fields
548
+ # Selector specifying which fields to include in a partial response.
549
+ # @param [String] quota_user
550
+ # Available to use for quota purposes for server-side applications. Can be any
551
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
552
+ # @param [Google::Apis::RequestOptions] options
553
+ # Request-specific options
554
+ #
555
+ # @yield [result, err] Result & error if block supplied
556
+ # @yieldparam result [Google::Apis::SpannerV1::Operation] parsed result object
557
+ # @yieldparam err [StandardError] error object if request failed
558
+ #
559
+ # @return [Google::Apis::SpannerV1::Operation]
560
+ #
561
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
562
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
563
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
564
+ def create_project_instance_backup(parent, backup_object = nil, backup_id: nil, fields: nil, quota_user: nil, options: nil, &block)
565
+ command = make_simple_command(:post, 'v1/{+parent}/backups', options)
566
+ command.request_representation = Google::Apis::SpannerV1::Backup::Representation
567
+ command.request_object = backup_object
568
+ command.response_representation = Google::Apis::SpannerV1::Operation::Representation
569
+ command.response_class = Google::Apis::SpannerV1::Operation
570
+ command.params['parent'] = parent unless parent.nil?
571
+ command.query['backupId'] = backup_id unless backup_id.nil?
572
+ command.query['fields'] = fields unless fields.nil?
573
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
574
+ execute_or_queue_command(command, &block)
575
+ end
576
+
577
+ # Deletes a pending or completed Backup.
578
+ # @param [String] name
579
+ # Required. Name of the backup to delete. Values are of the form `projects//
580
+ # instances//backups/`.
581
+ # @param [String] fields
582
+ # Selector specifying which fields to include in a partial response.
583
+ # @param [String] quota_user
584
+ # Available to use for quota purposes for server-side applications. Can be any
585
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
586
+ # @param [Google::Apis::RequestOptions] options
587
+ # Request-specific options
588
+ #
589
+ # @yield [result, err] Result & error if block supplied
590
+ # @yieldparam result [Google::Apis::SpannerV1::Empty] parsed result object
591
+ # @yieldparam err [StandardError] error object if request failed
592
+ #
593
+ # @return [Google::Apis::SpannerV1::Empty]
594
+ #
595
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
596
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
597
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
598
+ def delete_project_instance_backup(name, fields: nil, quota_user: nil, options: nil, &block)
599
+ command = make_simple_command(:delete, 'v1/{+name}', options)
600
+ command.response_representation = Google::Apis::SpannerV1::Empty::Representation
601
+ command.response_class = Google::Apis::SpannerV1::Empty
602
+ command.params['name'] = name unless name.nil?
603
+ command.query['fields'] = fields unless fields.nil?
604
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
605
+ execute_or_queue_command(command, &block)
606
+ end
607
+
608
+ # Gets metadata on a pending or completed Backup.
609
+ # @param [String] name
610
+ # Required. Name of the backup. Values are of the form `projects//instances//
611
+ # backups/`.
612
+ # @param [String] fields
613
+ # Selector specifying which fields to include in a partial response.
614
+ # @param [String] quota_user
615
+ # Available to use for quota purposes for server-side applications. Can be any
616
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
617
+ # @param [Google::Apis::RequestOptions] options
618
+ # Request-specific options
619
+ #
620
+ # @yield [result, err] Result & error if block supplied
621
+ # @yieldparam result [Google::Apis::SpannerV1::Backup] parsed result object
622
+ # @yieldparam err [StandardError] error object if request failed
623
+ #
624
+ # @return [Google::Apis::SpannerV1::Backup]
625
+ #
626
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
627
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
628
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
629
+ def get_project_instance_backup(name, fields: nil, quota_user: nil, options: nil, &block)
630
+ command = make_simple_command(:get, 'v1/{+name}', options)
631
+ command.response_representation = Google::Apis::SpannerV1::Backup::Representation
632
+ command.response_class = Google::Apis::SpannerV1::Backup
633
+ command.params['name'] = name unless name.nil?
634
+ command.query['fields'] = fields unless fields.nil?
635
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
636
+ execute_or_queue_command(command, &block)
637
+ end
638
+
639
+ # Gets the access control policy for a database or backup resource. Returns an
640
+ # empty policy if a database or backup exists but does not have a policy set.
641
+ # Authorization requires `spanner.databases.getIamPolicy` permission on resource.
642
+ # For backups, authorization requires `spanner.backups.getIamPolicy` permission
643
+ # on resource.
644
+ # @param [String] resource
645
+ # REQUIRED: The Cloud Spanner resource for which the policy is being retrieved.
646
+ # The format is `projects//instances/` for instance resources and `projects//
647
+ # instances//databases/` for database resources.
648
+ # @param [Google::Apis::SpannerV1::GetIamPolicyRequest] get_iam_policy_request_object
649
+ # @param [String] fields
650
+ # Selector specifying which fields to include in a partial response.
651
+ # @param [String] quota_user
652
+ # Available to use for quota purposes for server-side applications. Can be any
653
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
654
+ # @param [Google::Apis::RequestOptions] options
655
+ # Request-specific options
656
+ #
657
+ # @yield [result, err] Result & error if block supplied
658
+ # @yieldparam result [Google::Apis::SpannerV1::Policy] parsed result object
659
+ # @yieldparam err [StandardError] error object if request failed
660
+ #
661
+ # @return [Google::Apis::SpannerV1::Policy]
662
+ #
663
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
664
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
665
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
666
+ def get_backup_iam_policy(resource, get_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
667
+ command = make_simple_command(:post, 'v1/{+resource}:getIamPolicy', options)
668
+ command.request_representation = Google::Apis::SpannerV1::GetIamPolicyRequest::Representation
669
+ command.request_object = get_iam_policy_request_object
670
+ command.response_representation = Google::Apis::SpannerV1::Policy::Representation
671
+ command.response_class = Google::Apis::SpannerV1::Policy
672
+ command.params['resource'] = resource unless resource.nil?
673
+ command.query['fields'] = fields unless fields.nil?
674
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
675
+ execute_or_queue_command(command, &block)
676
+ end
677
+
678
+ # Lists completed and pending backups. Backups returned are ordered by `
679
+ # create_time` in descending order, starting from the most recent `create_time`.
680
+ # @param [String] parent
681
+ # Required. The instance to list backups from. Values are of the form `projects//
682
+ # instances/`.
683
+ # @param [String] filter
684
+ # An expression that filters the list of returned backups. A filter expression
685
+ # consists of a field name, a comparison operator, and a value for filtering.
686
+ # The value must be a string, a number, or a boolean. The comparison operator
687
+ # must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. Colon `:` is the
688
+ # contains operator. Filter rules are not case sensitive. The following fields
689
+ # in the Backup are eligible for filtering: * `name` * `database` * `state` * `
690
+ # create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) * `
691
+ # expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) * `size_bytes`
692
+ # You can combine multiple expressions by enclosing each expression in
693
+ # parentheses. By default, expressions are combined with AND logic, but you can
694
+ # specify AND, OR, and NOT logic explicitly. Here are a few examples: * `name:
695
+ # Howl` - The backup's name contains the string "howl". * `database:prod` - The
696
+ # database's name contains the string "prod". * `state:CREATING` - The backup is
697
+ # pending creation. * `state:READY` - The backup is fully created and ready for
698
+ # use. * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")` - The backup
699
+ # name contains the string "howl" and `create_time` of the backup is before 2018-
700
+ # 03-28T14:50:00Z. * `expire_time < \"2018-03-28T14:50:00Z\"` - The backup `
701
+ # expire_time` is before 2018-03-28T14:50:00Z. * `size_bytes > 10000000000` -
702
+ # The backup's size is greater than 10GB
703
+ # @param [Fixnum] page_size
704
+ # Number of backups to be returned in the response. If 0 or less, defaults to
705
+ # the server's maximum allowed page size.
706
+ # @param [String] page_token
707
+ # If non-empty, `page_token` should contain a next_page_token from a previous
708
+ # ListBackupsResponse to the same `parent` and with the same `filter`.
709
+ # @param [String] fields
710
+ # Selector specifying which fields to include in a partial response.
711
+ # @param [String] quota_user
712
+ # Available to use for quota purposes for server-side applications. Can be any
713
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
714
+ # @param [Google::Apis::RequestOptions] options
715
+ # Request-specific options
716
+ #
717
+ # @yield [result, err] Result & error if block supplied
718
+ # @yieldparam result [Google::Apis::SpannerV1::ListBackupsResponse] parsed result object
719
+ # @yieldparam err [StandardError] error object if request failed
720
+ #
721
+ # @return [Google::Apis::SpannerV1::ListBackupsResponse]
722
+ #
723
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
724
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
725
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
726
+ def list_project_instance_backups(parent, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
727
+ command = make_simple_command(:get, 'v1/{+parent}/backups', options)
728
+ command.response_representation = Google::Apis::SpannerV1::ListBackupsResponse::Representation
729
+ command.response_class = Google::Apis::SpannerV1::ListBackupsResponse
730
+ command.params['parent'] = parent unless parent.nil?
731
+ command.query['filter'] = filter unless filter.nil?
732
+ command.query['pageSize'] = page_size unless page_size.nil?
733
+ command.query['pageToken'] = page_token unless page_token.nil?
734
+ command.query['fields'] = fields unless fields.nil?
735
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
736
+ execute_or_queue_command(command, &block)
737
+ end
738
+
739
+ # Updates a pending or completed Backup.
740
+ # @param [String] name
741
+ # Output only for the CreateBackup operation. Required for the UpdateBackup
742
+ # operation. A globally unique identifier for the backup which cannot be changed.
743
+ # Values are of the form `projects//instances//backups/a-z*[a-z0-9]` The final
744
+ # segment of the name must be between 2 and 60 characters in length. The backup
745
+ # is stored in the location(s) specified in the instance configuration of the
746
+ # instance containing the backup, identified by the prefix of the backup name of
747
+ # the form `projects//instances/`.
748
+ # @param [Google::Apis::SpannerV1::Backup] backup_object
749
+ # @param [String] update_mask
750
+ # Required. A mask specifying which fields (e.g. `expire_time`) in the Backup
751
+ # resource should be updated. This mask is relative to the Backup resource, not
752
+ # to the request message. The field mask must always be specified; this prevents
753
+ # any future fields from being erased accidentally by clients that do not know
754
+ # about them.
755
+ # @param [String] fields
756
+ # Selector specifying which fields to include in a partial response.
757
+ # @param [String] quota_user
758
+ # Available to use for quota purposes for server-side applications. Can be any
759
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
760
+ # @param [Google::Apis::RequestOptions] options
761
+ # Request-specific options
762
+ #
763
+ # @yield [result, err] Result & error if block supplied
764
+ # @yieldparam result [Google::Apis::SpannerV1::Backup] parsed result object
765
+ # @yieldparam err [StandardError] error object if request failed
766
+ #
767
+ # @return [Google::Apis::SpannerV1::Backup]
768
+ #
769
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
770
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
771
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
772
+ def patch_project_instance_backup(name, backup_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
773
+ command = make_simple_command(:patch, 'v1/{+name}', options)
774
+ command.request_representation = Google::Apis::SpannerV1::Backup::Representation
775
+ command.request_object = backup_object
776
+ command.response_representation = Google::Apis::SpannerV1::Backup::Representation
777
+ command.response_class = Google::Apis::SpannerV1::Backup
778
+ command.params['name'] = name unless name.nil?
779
+ command.query['updateMask'] = update_mask unless update_mask.nil?
780
+ command.query['fields'] = fields unless fields.nil?
781
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
782
+ execute_or_queue_command(command, &block)
783
+ end
784
+
785
+ # Sets the access control policy on a database or backup resource. Replaces any
786
+ # existing policy. Authorization requires `spanner.databases.setIamPolicy`
787
+ # permission on resource. For backups, authorization requires `spanner.backups.
788
+ # setIamPolicy` permission on resource.
789
+ # @param [String] resource
790
+ # REQUIRED: The Cloud Spanner resource for which the policy is being set. The
791
+ # format is `projects//instances/` for instance resources and `projects//
792
+ # instances//databases/` for databases resources.
793
+ # @param [Google::Apis::SpannerV1::SetIamPolicyRequest] set_iam_policy_request_object
794
+ # @param [String] fields
795
+ # Selector specifying which fields to include in a partial response.
796
+ # @param [String] quota_user
797
+ # Available to use for quota purposes for server-side applications. Can be any
798
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
799
+ # @param [Google::Apis::RequestOptions] options
800
+ # Request-specific options
801
+ #
802
+ # @yield [result, err] Result & error if block supplied
803
+ # @yieldparam result [Google::Apis::SpannerV1::Policy] parsed result object
804
+ # @yieldparam err [StandardError] error object if request failed
805
+ #
806
+ # @return [Google::Apis::SpannerV1::Policy]
807
+ #
808
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
809
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
810
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
811
+ def set_backup_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
812
+ command = make_simple_command(:post, 'v1/{+resource}:setIamPolicy', options)
813
+ command.request_representation = Google::Apis::SpannerV1::SetIamPolicyRequest::Representation
814
+ command.request_object = set_iam_policy_request_object
815
+ command.response_representation = Google::Apis::SpannerV1::Policy::Representation
816
+ command.response_class = Google::Apis::SpannerV1::Policy
817
+ command.params['resource'] = resource unless resource.nil?
818
+ command.query['fields'] = fields unless fields.nil?
819
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
820
+ execute_or_queue_command(command, &block)
821
+ end
822
+
823
+ # Returns permissions that the caller has on the specified database or backup
824
+ # resource. Attempting this RPC on a non-existent Cloud Spanner database will
825
+ # result in a NOT_FOUND error if the user has `spanner.databases.list`
826
+ # permission on the containing Cloud Spanner instance. Otherwise returns an
827
+ # empty set of permissions. Calling this method on a backup that does not exist
828
+ # will result in a NOT_FOUND error if the user has `spanner.backups.list`
829
+ # permission on the containing instance.
830
+ # @param [String] resource
831
+ # REQUIRED: The Cloud Spanner resource for which permissions are being tested.
832
+ # The format is `projects//instances/` for instance resources and `projects//
833
+ # instances//databases/` for database resources.
834
+ # @param [Google::Apis::SpannerV1::TestIamPermissionsRequest] test_iam_permissions_request_object
835
+ # @param [String] fields
836
+ # Selector specifying which fields to include in a partial response.
837
+ # @param [String] quota_user
838
+ # Available to use for quota purposes for server-side applications. Can be any
839
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
840
+ # @param [Google::Apis::RequestOptions] options
841
+ # Request-specific options
842
+ #
843
+ # @yield [result, err] Result & error if block supplied
844
+ # @yieldparam result [Google::Apis::SpannerV1::TestIamPermissionsResponse] parsed result object
845
+ # @yieldparam err [StandardError] error object if request failed
846
+ #
847
+ # @return [Google::Apis::SpannerV1::TestIamPermissionsResponse]
848
+ #
849
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
850
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
851
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
852
+ def test_backup_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
853
+ command = make_simple_command(:post, 'v1/{+resource}:testIamPermissions', options)
854
+ command.request_representation = Google::Apis::SpannerV1::TestIamPermissionsRequest::Representation
855
+ command.request_object = test_iam_permissions_request_object
856
+ command.response_representation = Google::Apis::SpannerV1::TestIamPermissionsResponse::Representation
857
+ command.response_class = Google::Apis::SpannerV1::TestIamPermissionsResponse
858
+ command.params['resource'] = resource unless resource.nil?
859
+ command.query['fields'] = fields unless fields.nil?
860
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
861
+ execute_or_queue_command(command, &block)
862
+ end
863
+
864
+ # Starts asynchronous cancellation on a long-running operation. The server makes
865
+ # a best effort to cancel the operation, but success is not guaranteed. If the
866
+ # server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
867
+ # Clients can use Operations.GetOperation or other methods to check whether the
868
+ # cancellation succeeded or whether the operation completed despite cancellation.
869
+ # On successful cancellation, the operation is not deleted; instead, it becomes
870
+ # an operation with an Operation.error value with a google.rpc.Status.code of 1,
871
+ # corresponding to `Code.CANCELLED`.
872
+ # @param [String] name
873
+ # The name of the operation resource to be cancelled.
874
+ # @param [String] fields
875
+ # Selector specifying which fields to include in a partial response.
876
+ # @param [String] quota_user
877
+ # Available to use for quota purposes for server-side applications. Can be any
878
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
879
+ # @param [Google::Apis::RequestOptions] options
880
+ # Request-specific options
881
+ #
882
+ # @yield [result, err] Result & error if block supplied
883
+ # @yieldparam result [Google::Apis::SpannerV1::Empty] parsed result object
884
+ # @yieldparam err [StandardError] error object if request failed
885
+ #
886
+ # @return [Google::Apis::SpannerV1::Empty]
887
+ #
888
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
889
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
890
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
891
+ def cancel_project_instance_backup_operation(name, fields: nil, quota_user: nil, options: nil, &block)
892
+ command = make_simple_command(:post, 'v1/{+name}:cancel', options)
893
+ command.response_representation = Google::Apis::SpannerV1::Empty::Representation
894
+ command.response_class = Google::Apis::SpannerV1::Empty
895
+ command.params['name'] = name unless name.nil?
896
+ command.query['fields'] = fields unless fields.nil?
897
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
898
+ execute_or_queue_command(command, &block)
899
+ end
900
+
901
+ # Deletes a long-running operation. This method indicates that the client is no
902
+ # longer interested in the operation result. It does not cancel the operation.
903
+ # If the server doesn't support this method, it returns `google.rpc.Code.
904
+ # UNIMPLEMENTED`.
905
+ # @param [String] name
906
+ # The name of the operation resource to be deleted.
907
+ # @param [String] fields
908
+ # Selector specifying which fields to include in a partial response.
909
+ # @param [String] quota_user
910
+ # Available to use for quota purposes for server-side applications. Can be any
911
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
912
+ # @param [Google::Apis::RequestOptions] options
913
+ # Request-specific options
914
+ #
915
+ # @yield [result, err] Result & error if block supplied
916
+ # @yieldparam result [Google::Apis::SpannerV1::Empty] parsed result object
917
+ # @yieldparam err [StandardError] error object if request failed
918
+ #
919
+ # @return [Google::Apis::SpannerV1::Empty]
920
+ #
921
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
922
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
923
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
924
+ def delete_project_instance_backup_operation(name, fields: nil, quota_user: nil, options: nil, &block)
925
+ command = make_simple_command(:delete, 'v1/{+name}', options)
926
+ command.response_representation = Google::Apis::SpannerV1::Empty::Representation
927
+ command.response_class = Google::Apis::SpannerV1::Empty
928
+ command.params['name'] = name unless name.nil?
929
+ command.query['fields'] = fields unless fields.nil?
930
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
931
+ execute_or_queue_command(command, &block)
932
+ end
933
+
934
+ # Gets the latest state of a long-running operation. Clients can use this method
935
+ # to poll the operation result at intervals as recommended by the API service.
936
+ # @param [String] name
937
+ # The name of the operation resource.
938
+ # @param [String] fields
939
+ # Selector specifying which fields to include in a partial response.
940
+ # @param [String] quota_user
941
+ # Available to use for quota purposes for server-side applications. Can be any
942
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
943
+ # @param [Google::Apis::RequestOptions] options
944
+ # Request-specific options
945
+ #
946
+ # @yield [result, err] Result & error if block supplied
947
+ # @yieldparam result [Google::Apis::SpannerV1::Operation] parsed result object
948
+ # @yieldparam err [StandardError] error object if request failed
949
+ #
950
+ # @return [Google::Apis::SpannerV1::Operation]
951
+ #
952
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
953
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
954
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
955
+ def get_project_instance_backup_operation(name, fields: nil, quota_user: nil, options: nil, &block)
956
+ command = make_simple_command(:get, 'v1/{+name}', options)
957
+ command.response_representation = Google::Apis::SpannerV1::Operation::Representation
958
+ command.response_class = Google::Apis::SpannerV1::Operation
959
+ command.params['name'] = name unless name.nil?
960
+ command.query['fields'] = fields unless fields.nil?
961
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
962
+ execute_or_queue_command(command, &block)
963
+ end
964
+
965
+ # Lists operations that match the specified filter in the request. If the server
966
+ # doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name`
967
+ # binding allows API services to override the binding to use different resource
968
+ # name schemes, such as `users/*/operations`. To override the binding, API
969
+ # services can add a binding such as `"/v1/`name=users/*`/operations"` to their
970
+ # service configuration. For backwards compatibility, the default name includes
971
+ # the operations collection id, however overriding users must ensure the name
972
+ # binding is the parent resource, without the operations collection id.
973
+ # @param [String] name
974
+ # The name of the operation's parent resource.
975
+ # @param [String] filter
976
+ # The standard list filter.
977
+ # @param [Fixnum] page_size
978
+ # The standard list page size.
979
+ # @param [String] page_token
980
+ # The standard list page token.
981
+ # @param [String] fields
982
+ # Selector specifying which fields to include in a partial response.
983
+ # @param [String] quota_user
984
+ # Available to use for quota purposes for server-side applications. Can be any
985
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
986
+ # @param [Google::Apis::RequestOptions] options
987
+ # Request-specific options
988
+ #
989
+ # @yield [result, err] Result & error if block supplied
990
+ # @yieldparam result [Google::Apis::SpannerV1::ListOperationsResponse] parsed result object
991
+ # @yieldparam err [StandardError] error object if request failed
992
+ #
993
+ # @return [Google::Apis::SpannerV1::ListOperationsResponse]
994
+ #
995
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
996
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
997
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
998
+ def list_project_instance_backup_operations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
999
+ command = make_simple_command(:get, 'v1/{+name}', options)
1000
+ command.response_representation = Google::Apis::SpannerV1::ListOperationsResponse::Representation
1001
+ command.response_class = Google::Apis::SpannerV1::ListOperationsResponse
1002
+ command.params['name'] = name unless name.nil?
1003
+ command.query['filter'] = filter unless filter.nil?
1004
+ command.query['pageSize'] = page_size unless page_size.nil?
1005
+ command.query['pageToken'] = page_token unless page_token.nil?
1006
+ command.query['fields'] = fields unless fields.nil?
1007
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1008
+ execute_or_queue_command(command, &block)
1009
+ end
1010
+
1011
+ # Lists database longrunning-operations. A database operation has a name of the
1012
+ # form `projects//instances//databases//operations/`. The long-running operation
1013
+ # metadata field type `metadata.type_url` describes the type of the metadata.
1014
+ # Operations returned include those that have completed/failed/canceled within
1015
+ # the last 7 days, and pending operations.
1016
+ # @param [String] parent
1017
+ # Required. The instance of the database operations. Values are of the form `
1018
+ # projects//instances/`.
1019
+ # @param [String] filter
1020
+ # An expression that filters the list of returned operations. A filter
1021
+ # expression consists of a field name, a comparison operator, and a value for
1022
+ # filtering. The value must be a string, a number, or a boolean. The comparison
1023
+ # operator must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. Colon `:` is
1024
+ # the contains operator. Filter rules are not case sensitive. The following
1025
+ # fields in the Operation are eligible for filtering: * `name` - The name of the
1026
+ # long-running operation * `done` - False if the operation is in progress, else
1027
+ # true. * `metadata.@type` - the type of metadata. For example, the type string
1028
+ # for RestoreDatabaseMetadata is `type.googleapis.com/google.spanner.admin.
1029
+ # database.v1.RestoreDatabaseMetadata`. * `metadata.` - any field in metadata.
1030
+ # value. * `error` - Error associated with the long-running operation. * `
1031
+ # response.@type` - the type of response. * `response.` - any field in response.
1032
+ # value. You can combine multiple expressions by enclosing each expression in
1033
+ # parentheses. By default, expressions are combined with AND logic. However, you
1034
+ # can specify AND, OR, and NOT logic explicitly. Here are a few examples: * `
1035
+ # done:true` - The operation is complete. * `(metadata.@type=type.googleapis.com/
1036
+ # google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \ `(metadata.
1037
+ # source_type:BACKUP) AND` \ `(metadata.backup_info.backup:backup_howl) AND` \ `(
1038
+ # metadata.name:restored_howl) AND` \ `(metadata.progress.start_time < \"2018-03-
1039
+ # 28T14:50:00Z\") AND` \ `(error:*)` - Return operations where: * The operation'
1040
+ # s metadata type is RestoreDatabaseMetadata. * The database is restored from a
1041
+ # backup. * The backup name contains "backup_howl". * The restored database's
1042
+ # name contains "restored_howl". * The operation started before 2018-03-28T14:50:
1043
+ # 00Z. * The operation resulted in an error.
1044
+ # @param [Fixnum] page_size
1045
+ # Number of operations to be returned in the response. If 0 or less, defaults to
1046
+ # the server's maximum allowed page size.
1047
+ # @param [String] page_token
1048
+ # If non-empty, `page_token` should contain a next_page_token from a previous
1049
+ # ListDatabaseOperationsResponse to the same `parent` and with the same `filter`.
1050
+ # @param [String] fields
1051
+ # Selector specifying which fields to include in a partial response.
1052
+ # @param [String] quota_user
1053
+ # Available to use for quota purposes for server-side applications. Can be any
1054
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1055
+ # @param [Google::Apis::RequestOptions] options
1056
+ # Request-specific options
1057
+ #
1058
+ # @yield [result, err] Result & error if block supplied
1059
+ # @yieldparam result [Google::Apis::SpannerV1::ListDatabaseOperationsResponse] parsed result object
1060
+ # @yieldparam err [StandardError] error object if request failed
1061
+ #
1062
+ # @return [Google::Apis::SpannerV1::ListDatabaseOperationsResponse]
1063
+ #
1064
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1065
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1066
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1067
+ def list_project_instance_databaseoperations(parent, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
1068
+ command = make_simple_command(:get, 'v1/{+parent}/databaseOperations', options)
1069
+ command.response_representation = Google::Apis::SpannerV1::ListDatabaseOperationsResponse::Representation
1070
+ command.response_class = Google::Apis::SpannerV1::ListDatabaseOperationsResponse
1071
+ command.params['parent'] = parent unless parent.nil?
1072
+ command.query['filter'] = filter unless filter.nil?
1073
+ command.query['pageSize'] = page_size unless page_size.nil?
1074
+ command.query['pageToken'] = page_token unless page_token.nil?
1075
+ command.query['fields'] = fields unless fields.nil?
1076
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1077
+ execute_or_queue_command(command, &block)
1078
+ end
1079
+
1080
+ # Creates a new Cloud Spanner database and starts to prepare it for serving. The
1081
+ # returned long-running operation will have a name of the format `/operations/`
1082
+ # and can be used to track preparation of the database. The metadata field type
1083
+ # is CreateDatabaseMetadata. The response field type is Database, if successful.
1084
+ # @param [String] parent
1085
+ # Required. The name of the instance that will serve the new database. Values
1086
+ # are of the form `projects//instances/`.
1087
+ # @param [Google::Apis::SpannerV1::CreateDatabaseRequest] create_database_request_object
1088
+ # @param [String] fields
1089
+ # Selector specifying which fields to include in a partial response.
1090
+ # @param [String] quota_user
1091
+ # Available to use for quota purposes for server-side applications. Can be any
1092
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1093
+ # @param [Google::Apis::RequestOptions] options
1094
+ # Request-specific options
1095
+ #
1096
+ # @yield [result, err] Result & error if block supplied
1097
+ # @yieldparam result [Google::Apis::SpannerV1::Operation] parsed result object
1098
+ # @yieldparam err [StandardError] error object if request failed
1099
+ #
1100
+ # @return [Google::Apis::SpannerV1::Operation]
1101
+ #
1102
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1103
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1104
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1105
+ def create_database(parent, create_database_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1106
+ command = make_simple_command(:post, 'v1/{+parent}/databases', options)
1107
+ command.request_representation = Google::Apis::SpannerV1::CreateDatabaseRequest::Representation
1108
+ command.request_object = create_database_request_object
1109
+ command.response_representation = Google::Apis::SpannerV1::Operation::Representation
1110
+ command.response_class = Google::Apis::SpannerV1::Operation
1111
+ command.params['parent'] = parent unless parent.nil?
1112
+ command.query['fields'] = fields unless fields.nil?
1113
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1114
+ execute_or_queue_command(command, &block)
1115
+ end
1116
+
1117
+ # Drops (aka deletes) a Cloud Spanner database. Completed backups for the
1118
+ # database will be retained according to their `expire_time`.
1119
+ # @param [String] database
1120
+ # Required. The database to be dropped.
1121
+ # @param [String] fields
1122
+ # Selector specifying which fields to include in a partial response.
1123
+ # @param [String] quota_user
1124
+ # Available to use for quota purposes for server-side applications. Can be any
1125
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1126
+ # @param [Google::Apis::RequestOptions] options
1127
+ # Request-specific options
1128
+ #
1129
+ # @yield [result, err] Result & error if block supplied
1130
+ # @yieldparam result [Google::Apis::SpannerV1::Empty] parsed result object
1131
+ # @yieldparam err [StandardError] error object if request failed
1132
+ #
1133
+ # @return [Google::Apis::SpannerV1::Empty]
1134
+ #
1135
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1136
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1137
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1138
+ def drop_project_instance_database_database(database, fields: nil, quota_user: nil, options: nil, &block)
1139
+ command = make_simple_command(:delete, 'v1/{+database}', options)
1140
+ command.response_representation = Google::Apis::SpannerV1::Empty::Representation
1141
+ command.response_class = Google::Apis::SpannerV1::Empty
1142
+ command.params['database'] = database unless database.nil?
1143
+ command.query['fields'] = fields unless fields.nil?
1144
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1145
+ execute_or_queue_command(command, &block)
1146
+ end
1147
+
1148
+ # Gets the state of a Cloud Spanner database.
1149
+ # @param [String] name
1150
+ # Required. The name of the requested database. Values are of the form `projects/
1151
+ # /instances//databases/`.
1152
+ # @param [String] fields
1153
+ # Selector specifying which fields to include in a partial response.
1154
+ # @param [String] quota_user
1155
+ # Available to use for quota purposes for server-side applications. Can be any
1156
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1157
+ # @param [Google::Apis::RequestOptions] options
1158
+ # Request-specific options
1159
+ #
1160
+ # @yield [result, err] Result & error if block supplied
1161
+ # @yieldparam result [Google::Apis::SpannerV1::Database] parsed result object
1162
+ # @yieldparam err [StandardError] error object if request failed
1163
+ #
1164
+ # @return [Google::Apis::SpannerV1::Database]
1165
+ #
1166
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1167
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1168
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1169
+ def get_project_instance_database(name, fields: nil, quota_user: nil, options: nil, &block)
1170
+ command = make_simple_command(:get, 'v1/{+name}', options)
1171
+ command.response_representation = Google::Apis::SpannerV1::Database::Representation
1172
+ command.response_class = Google::Apis::SpannerV1::Database
1173
+ command.params['name'] = name unless name.nil?
1174
+ command.query['fields'] = fields unless fields.nil?
1175
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1176
+ execute_or_queue_command(command, &block)
1177
+ end
1178
+
1179
+ # Returns the schema of a Cloud Spanner database as a list of formatted DDL
1180
+ # statements. This method does not show pending schema updates, those may be
1181
+ # queried using the Operations API.
1182
+ # @param [String] database
1183
+ # Required. The database whose schema we wish to get. Values are of the form `
1184
+ # projects//instances//databases/`
1185
+ # @param [String] fields
1186
+ # Selector specifying which fields to include in a partial response.
1187
+ # @param [String] quota_user
1188
+ # Available to use for quota purposes for server-side applications. Can be any
1189
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1190
+ # @param [Google::Apis::RequestOptions] options
1191
+ # Request-specific options
1192
+ #
1193
+ # @yield [result, err] Result & error if block supplied
1194
+ # @yieldparam result [Google::Apis::SpannerV1::GetDatabaseDdlResponse] parsed result object
1195
+ # @yieldparam err [StandardError] error object if request failed
1196
+ #
1197
+ # @return [Google::Apis::SpannerV1::GetDatabaseDdlResponse]
1198
+ #
1199
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1200
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1201
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1202
+ def get_project_instance_database_ddl(database, fields: nil, quota_user: nil, options: nil, &block)
1203
+ command = make_simple_command(:get, 'v1/{+database}/ddl', options)
1204
+ command.response_representation = Google::Apis::SpannerV1::GetDatabaseDdlResponse::Representation
1205
+ command.response_class = Google::Apis::SpannerV1::GetDatabaseDdlResponse
1206
+ command.params['database'] = database unless database.nil?
1207
+ command.query['fields'] = fields unless fields.nil?
1208
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1209
+ execute_or_queue_command(command, &block)
1210
+ end
1211
+
1212
+ # Gets the access control policy for a database or backup resource. Returns an
1213
+ # empty policy if a database or backup exists but does not have a policy set.
1214
+ # Authorization requires `spanner.databases.getIamPolicy` permission on resource.
1215
+ # For backups, authorization requires `spanner.backups.getIamPolicy` permission
1216
+ # on resource.
1217
+ # @param [String] resource
1218
+ # REQUIRED: The Cloud Spanner resource for which the policy is being retrieved.
1219
+ # The format is `projects//instances/` for instance resources and `projects//
1220
+ # instances//databases/` for database resources.
1221
+ # @param [Google::Apis::SpannerV1::GetIamPolicyRequest] get_iam_policy_request_object
1222
+ # @param [String] fields
1223
+ # Selector specifying which fields to include in a partial response.
1224
+ # @param [String] quota_user
1225
+ # Available to use for quota purposes for server-side applications. Can be any
1226
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1227
+ # @param [Google::Apis::RequestOptions] options
1228
+ # Request-specific options
1229
+ #
1230
+ # @yield [result, err] Result & error if block supplied
1231
+ # @yieldparam result [Google::Apis::SpannerV1::Policy] parsed result object
1232
+ # @yieldparam err [StandardError] error object if request failed
1233
+ #
1234
+ # @return [Google::Apis::SpannerV1::Policy]
1235
+ #
1236
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1237
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1238
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1239
+ def get_database_iam_policy(resource, get_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1240
+ command = make_simple_command(:post, 'v1/{+resource}:getIamPolicy', options)
1241
+ command.request_representation = Google::Apis::SpannerV1::GetIamPolicyRequest::Representation
1242
+ command.request_object = get_iam_policy_request_object
1243
+ command.response_representation = Google::Apis::SpannerV1::Policy::Representation
1244
+ command.response_class = Google::Apis::SpannerV1::Policy
1245
+ command.params['resource'] = resource unless resource.nil?
1246
+ command.query['fields'] = fields unless fields.nil?
1247
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1248
+ execute_or_queue_command(command, &block)
1249
+ end
1250
+
1251
+ # Lists Cloud Spanner databases.
1252
+ # @param [String] parent
1253
+ # Required. The instance whose databases should be listed. Values are of the
1254
+ # form `projects//instances/`.
1255
+ # @param [Fixnum] page_size
1256
+ # Number of databases to be returned in the response. If 0 or less, defaults to
1257
+ # the server's maximum allowed page size.
1258
+ # @param [String] page_token
1259
+ # If non-empty, `page_token` should contain a next_page_token from a previous
1260
+ # ListDatabasesResponse.
1261
+ # @param [String] fields
1262
+ # Selector specifying which fields to include in a partial response.
1263
+ # @param [String] quota_user
1264
+ # Available to use for quota purposes for server-side applications. Can be any
1265
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1266
+ # @param [Google::Apis::RequestOptions] options
1267
+ # Request-specific options
1268
+ #
1269
+ # @yield [result, err] Result & error if block supplied
1270
+ # @yieldparam result [Google::Apis::SpannerV1::ListDatabasesResponse] parsed result object
1271
+ # @yieldparam err [StandardError] error object if request failed
1272
+ #
1273
+ # @return [Google::Apis::SpannerV1::ListDatabasesResponse]
1274
+ #
1275
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1276
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1277
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1278
+ def list_project_instance_databases(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
1279
+ command = make_simple_command(:get, 'v1/{+parent}/databases', options)
1280
+ command.response_representation = Google::Apis::SpannerV1::ListDatabasesResponse::Representation
1281
+ command.response_class = Google::Apis::SpannerV1::ListDatabasesResponse
1282
+ command.params['parent'] = parent unless parent.nil?
1283
+ command.query['pageSize'] = page_size unless page_size.nil?
1284
+ command.query['pageToken'] = page_token unless page_token.nil?
1285
+ command.query['fields'] = fields unless fields.nil?
1286
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1287
+ execute_or_queue_command(command, &block)
1288
+ end
1289
+
1290
+ # Create a new database by restoring from a completed backup. The new database
1291
+ # must be in the same project and in an instance with the same instance
1292
+ # configuration as the instance containing the backup. The returned database
1293
+ # long-running operation has a name of the format `projects//instances//
1294
+ # databases//operations/`, and can be used to track the progress of the
1295
+ # operation, and to cancel it. The metadata field type is
1296
+ # RestoreDatabaseMetadata. The response type is Database, if successful.
1297
+ # Cancelling the returned operation will stop the restore and delete the
1298
+ # database. There can be only one database being restored into an instance at a
1299
+ # time. Once the restore operation completes, a new restore operation can be
1300
+ # initiated, without waiting for the optimize operation associated with the
1301
+ # first restore to complete.
1302
+ # @param [String] parent
1303
+ # Required. The name of the instance in which to create the restored database.
1304
+ # This instance must be in the same project and have the same instance
1305
+ # configuration as the instance containing the source backup. Values are of the
1306
+ # form `projects//instances/`.
1307
+ # @param [Google::Apis::SpannerV1::RestoreDatabaseRequest] restore_database_request_object
1308
+ # @param [String] fields
1309
+ # Selector specifying which fields to include in a partial response.
1310
+ # @param [String] quota_user
1311
+ # Available to use for quota purposes for server-side applications. Can be any
1312
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1313
+ # @param [Google::Apis::RequestOptions] options
1314
+ # Request-specific options
1315
+ #
1316
+ # @yield [result, err] Result & error if block supplied
1317
+ # @yieldparam result [Google::Apis::SpannerV1::Operation] parsed result object
1318
+ # @yieldparam err [StandardError] error object if request failed
1319
+ #
1320
+ # @return [Google::Apis::SpannerV1::Operation]
1321
+ #
1322
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1323
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1324
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1325
+ def restore_database(parent, restore_database_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1326
+ command = make_simple_command(:post, 'v1/{+parent}/databases:restore', options)
1327
+ command.request_representation = Google::Apis::SpannerV1::RestoreDatabaseRequest::Representation
1328
+ command.request_object = restore_database_request_object
1329
+ command.response_representation = Google::Apis::SpannerV1::Operation::Representation
1330
+ command.response_class = Google::Apis::SpannerV1::Operation
1331
+ command.params['parent'] = parent unless parent.nil?
1332
+ command.query['fields'] = fields unless fields.nil?
1333
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1334
+ execute_or_queue_command(command, &block)
1335
+ end
1336
+
1337
+ # Sets the access control policy on a database or backup resource. Replaces any
1338
+ # existing policy. Authorization requires `spanner.databases.setIamPolicy`
1339
+ # permission on resource. For backups, authorization requires `spanner.backups.
1340
+ # setIamPolicy` permission on resource.
1341
+ # @param [String] resource
1342
+ # REQUIRED: The Cloud Spanner resource for which the policy is being set. The
1343
+ # format is `projects//instances/` for instance resources and `projects//
1344
+ # instances//databases/` for databases resources.
1345
+ # @param [Google::Apis::SpannerV1::SetIamPolicyRequest] set_iam_policy_request_object
1346
+ # @param [String] fields
1347
+ # Selector specifying which fields to include in a partial response.
1348
+ # @param [String] quota_user
1349
+ # Available to use for quota purposes for server-side applications. Can be any
1350
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1351
+ # @param [Google::Apis::RequestOptions] options
1352
+ # Request-specific options
1353
+ #
1354
+ # @yield [result, err] Result & error if block supplied
1355
+ # @yieldparam result [Google::Apis::SpannerV1::Policy] parsed result object
1356
+ # @yieldparam err [StandardError] error object if request failed
1357
+ #
1358
+ # @return [Google::Apis::SpannerV1::Policy]
1359
+ #
1360
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1361
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1362
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1363
+ def set_database_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1364
+ command = make_simple_command(:post, 'v1/{+resource}:setIamPolicy', options)
1365
+ command.request_representation = Google::Apis::SpannerV1::SetIamPolicyRequest::Representation
1366
+ command.request_object = set_iam_policy_request_object
1367
+ command.response_representation = Google::Apis::SpannerV1::Policy::Representation
1368
+ command.response_class = Google::Apis::SpannerV1::Policy
1369
+ command.params['resource'] = resource unless resource.nil?
1370
+ command.query['fields'] = fields unless fields.nil?
1371
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1372
+ execute_or_queue_command(command, &block)
1373
+ end
1374
+
1375
+ # Returns permissions that the caller has on the specified database or backup
1376
+ # resource. Attempting this RPC on a non-existent Cloud Spanner database will
1377
+ # result in a NOT_FOUND error if the user has `spanner.databases.list`
1378
+ # permission on the containing Cloud Spanner instance. Otherwise returns an
1379
+ # empty set of permissions. Calling this method on a backup that does not exist
1380
+ # will result in a NOT_FOUND error if the user has `spanner.backups.list`
1381
+ # permission on the containing instance.
1382
+ # @param [String] resource
1383
+ # REQUIRED: The Cloud Spanner resource for which permissions are being tested.
1384
+ # The format is `projects//instances/` for instance resources and `projects//
1385
+ # instances//databases/` for database resources.
1386
+ # @param [Google::Apis::SpannerV1::TestIamPermissionsRequest] test_iam_permissions_request_object
1387
+ # @param [String] fields
1388
+ # Selector specifying which fields to include in a partial response.
1389
+ # @param [String] quota_user
1390
+ # Available to use for quota purposes for server-side applications. Can be any
1391
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1392
+ # @param [Google::Apis::RequestOptions] options
1393
+ # Request-specific options
1394
+ #
1395
+ # @yield [result, err] Result & error if block supplied
1396
+ # @yieldparam result [Google::Apis::SpannerV1::TestIamPermissionsResponse] parsed result object
1397
+ # @yieldparam err [StandardError] error object if request failed
1398
+ #
1399
+ # @return [Google::Apis::SpannerV1::TestIamPermissionsResponse]
1400
+ #
1401
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1402
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1403
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1404
+ def test_database_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1405
+ command = make_simple_command(:post, 'v1/{+resource}:testIamPermissions', options)
1406
+ command.request_representation = Google::Apis::SpannerV1::TestIamPermissionsRequest::Representation
1407
+ command.request_object = test_iam_permissions_request_object
1408
+ command.response_representation = Google::Apis::SpannerV1::TestIamPermissionsResponse::Representation
1409
+ command.response_class = Google::Apis::SpannerV1::TestIamPermissionsResponse
1410
+ command.params['resource'] = resource unless resource.nil?
1411
+ command.query['fields'] = fields unless fields.nil?
1412
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1413
+ execute_or_queue_command(command, &block)
1414
+ end
1415
+
1416
+ # Updates the schema of a Cloud Spanner database by creating/altering/dropping
1417
+ # tables, columns, indexes, etc. The returned long-running operation will have a
1418
+ # name of the format `/operations/` and can be used to track execution of the
1419
+ # schema change(s). The metadata field type is UpdateDatabaseDdlMetadata. The
1420
+ # operation has no response.
1421
+ # @param [String] database
1422
+ # Required. The database to update.
1423
+ # @param [Google::Apis::SpannerV1::UpdateDatabaseDdlRequest] update_database_ddl_request_object
1424
+ # @param [String] fields
1425
+ # Selector specifying which fields to include in a partial response.
1426
+ # @param [String] quota_user
1427
+ # Available to use for quota purposes for server-side applications. Can be any
1428
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1429
+ # @param [Google::Apis::RequestOptions] options
1430
+ # Request-specific options
1431
+ #
1432
+ # @yield [result, err] Result & error if block supplied
1433
+ # @yieldparam result [Google::Apis::SpannerV1::Operation] parsed result object
1434
+ # @yieldparam err [StandardError] error object if request failed
1435
+ #
1436
+ # @return [Google::Apis::SpannerV1::Operation]
1437
+ #
1438
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1439
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1440
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1441
+ def update_project_instance_database_ddl(database, update_database_ddl_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1442
+ command = make_simple_command(:patch, 'v1/{+database}/ddl', options)
1443
+ command.request_representation = Google::Apis::SpannerV1::UpdateDatabaseDdlRequest::Representation
1444
+ command.request_object = update_database_ddl_request_object
1445
+ command.response_representation = Google::Apis::SpannerV1::Operation::Representation
1446
+ command.response_class = Google::Apis::SpannerV1::Operation
1447
+ command.params['database'] = database unless database.nil?
1448
+ command.query['fields'] = fields unless fields.nil?
1449
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1450
+ execute_or_queue_command(command, &block)
1451
+ end
1452
+
1453
+ # Starts asynchronous cancellation on a long-running operation. The server makes
1454
+ # a best effort to cancel the operation, but success is not guaranteed. If the
1455
+ # server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
1456
+ # Clients can use Operations.GetOperation or other methods to check whether the
1457
+ # cancellation succeeded or whether the operation completed despite cancellation.
1458
+ # On successful cancellation, the operation is not deleted; instead, it becomes
1459
+ # an operation with an Operation.error value with a google.rpc.Status.code of 1,
1460
+ # corresponding to `Code.CANCELLED`.
1461
+ # @param [String] name
1462
+ # The name of the operation resource to be cancelled.
1463
+ # @param [String] fields
1464
+ # Selector specifying which fields to include in a partial response.
1465
+ # @param [String] quota_user
1466
+ # Available to use for quota purposes for server-side applications. Can be any
1467
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1468
+ # @param [Google::Apis::RequestOptions] options
1469
+ # Request-specific options
1470
+ #
1471
+ # @yield [result, err] Result & error if block supplied
1472
+ # @yieldparam result [Google::Apis::SpannerV1::Empty] parsed result object
1473
+ # @yieldparam err [StandardError] error object if request failed
1474
+ #
1475
+ # @return [Google::Apis::SpannerV1::Empty]
1476
+ #
1477
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1478
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1479
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1480
+ def cancel_project_instance_database_operation(name, fields: nil, quota_user: nil, options: nil, &block)
1481
+ command = make_simple_command(:post, 'v1/{+name}:cancel', options)
1482
+ command.response_representation = Google::Apis::SpannerV1::Empty::Representation
1483
+ command.response_class = Google::Apis::SpannerV1::Empty
1484
+ command.params['name'] = name unless name.nil?
1485
+ command.query['fields'] = fields unless fields.nil?
1486
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1487
+ execute_or_queue_command(command, &block)
1488
+ end
1489
+
1490
+ # Deletes a long-running operation. This method indicates that the client is no
1491
+ # longer interested in the operation result. It does not cancel the operation.
1492
+ # If the server doesn't support this method, it returns `google.rpc.Code.
1493
+ # UNIMPLEMENTED`.
1494
+ # @param [String] name
1495
+ # The name of the operation resource to be deleted.
1496
+ # @param [String] fields
1497
+ # Selector specifying which fields to include in a partial response.
1498
+ # @param [String] quota_user
1499
+ # Available to use for quota purposes for server-side applications. Can be any
1500
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1501
+ # @param [Google::Apis::RequestOptions] options
1502
+ # Request-specific options
1503
+ #
1504
+ # @yield [result, err] Result & error if block supplied
1505
+ # @yieldparam result [Google::Apis::SpannerV1::Empty] parsed result object
1506
+ # @yieldparam err [StandardError] error object if request failed
1507
+ #
1508
+ # @return [Google::Apis::SpannerV1::Empty]
1509
+ #
1510
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1511
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1512
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1513
+ def delete_project_instance_database_operation(name, fields: nil, quota_user: nil, options: nil, &block)
1514
+ command = make_simple_command(:delete, 'v1/{+name}', options)
1515
+ command.response_representation = Google::Apis::SpannerV1::Empty::Representation
1516
+ command.response_class = Google::Apis::SpannerV1::Empty
1517
+ command.params['name'] = name unless name.nil?
1518
+ command.query['fields'] = fields unless fields.nil?
1519
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1520
+ execute_or_queue_command(command, &block)
1521
+ end
1522
+
1523
+ # Gets the latest state of a long-running operation. Clients can use this method
1524
+ # to poll the operation result at intervals as recommended by the API service.
1525
+ # @param [String] name
1526
+ # The name of the operation resource.
1527
+ # @param [String] fields
1528
+ # Selector specifying which fields to include in a partial response.
1529
+ # @param [String] quota_user
1530
+ # Available to use for quota purposes for server-side applications. Can be any
1531
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1532
+ # @param [Google::Apis::RequestOptions] options
1533
+ # Request-specific options
1534
+ #
1535
+ # @yield [result, err] Result & error if block supplied
1536
+ # @yieldparam result [Google::Apis::SpannerV1::Operation] parsed result object
1537
+ # @yieldparam err [StandardError] error object if request failed
1538
+ #
1539
+ # @return [Google::Apis::SpannerV1::Operation]
1540
+ #
1541
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1542
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1543
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1544
+ def get_project_instance_database_operation(name, fields: nil, quota_user: nil, options: nil, &block)
1545
+ command = make_simple_command(:get, 'v1/{+name}', options)
1546
+ command.response_representation = Google::Apis::SpannerV1::Operation::Representation
1547
+ command.response_class = Google::Apis::SpannerV1::Operation
1548
+ command.params['name'] = name unless name.nil?
1549
+ command.query['fields'] = fields unless fields.nil?
1550
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1551
+ execute_or_queue_command(command, &block)
1552
+ end
1553
+
1554
+ # Lists operations that match the specified filter in the request. If the server
1555
+ # doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name`
1556
+ # binding allows API services to override the binding to use different resource
1557
+ # name schemes, such as `users/*/operations`. To override the binding, API
1558
+ # services can add a binding such as `"/v1/`name=users/*`/operations"` to their
1559
+ # service configuration. For backwards compatibility, the default name includes
1560
+ # the operations collection id, however overriding users must ensure the name
1561
+ # binding is the parent resource, without the operations collection id.
1562
+ # @param [String] name
1563
+ # The name of the operation's parent resource.
1564
+ # @param [String] filter
1565
+ # The standard list filter.
1566
+ # @param [Fixnum] page_size
1567
+ # The standard list page size.
1568
+ # @param [String] page_token
1569
+ # The standard list page token.
1570
+ # @param [String] fields
1571
+ # Selector specifying which fields to include in a partial response.
1572
+ # @param [String] quota_user
1573
+ # Available to use for quota purposes for server-side applications. Can be any
1574
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1575
+ # @param [Google::Apis::RequestOptions] options
1576
+ # Request-specific options
1577
+ #
1578
+ # @yield [result, err] Result & error if block supplied
1579
+ # @yieldparam result [Google::Apis::SpannerV1::ListOperationsResponse] parsed result object
1580
+ # @yieldparam err [StandardError] error object if request failed
1581
+ #
1582
+ # @return [Google::Apis::SpannerV1::ListOperationsResponse]
1583
+ #
1584
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1585
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1586
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1587
+ def list_project_instance_database_operations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
1588
+ command = make_simple_command(:get, 'v1/{+name}', options)
1589
+ command.response_representation = Google::Apis::SpannerV1::ListOperationsResponse::Representation
1590
+ command.response_class = Google::Apis::SpannerV1::ListOperationsResponse
1591
+ command.params['name'] = name unless name.nil?
1592
+ command.query['filter'] = filter unless filter.nil?
1593
+ command.query['pageSize'] = page_size unless page_size.nil?
1594
+ command.query['pageToken'] = page_token unless page_token.nil?
1595
+ command.query['fields'] = fields unless fields.nil?
1596
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1597
+ execute_or_queue_command(command, &block)
1598
+ end
1599
+
1600
+ # Creates multiple new sessions. This API can be used to initialize a session
1601
+ # cache on the clients. See https://goo.gl/TgSFN2 for best practices on session
1602
+ # cache management.
1603
+ # @param [String] database
1604
+ # Required. The database in which the new sessions are created.
1605
+ # @param [Google::Apis::SpannerV1::BatchCreateSessionsRequest] batch_create_sessions_request_object
1606
+ # @param [String] fields
1607
+ # Selector specifying which fields to include in a partial response.
1608
+ # @param [String] quota_user
1609
+ # Available to use for quota purposes for server-side applications. Can be any
1610
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1611
+ # @param [Google::Apis::RequestOptions] options
1612
+ # Request-specific options
1613
+ #
1614
+ # @yield [result, err] Result & error if block supplied
1615
+ # @yieldparam result [Google::Apis::SpannerV1::BatchCreateSessionsResponse] parsed result object
1616
+ # @yieldparam err [StandardError] error object if request failed
1617
+ #
1618
+ # @return [Google::Apis::SpannerV1::BatchCreateSessionsResponse]
1619
+ #
1620
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1621
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1622
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1623
+ def batch_create_sessions(database, batch_create_sessions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1624
+ command = make_simple_command(:post, 'v1/{+database}/sessions:batchCreate', options)
1625
+ command.request_representation = Google::Apis::SpannerV1::BatchCreateSessionsRequest::Representation
1626
+ command.request_object = batch_create_sessions_request_object
1627
+ command.response_representation = Google::Apis::SpannerV1::BatchCreateSessionsResponse::Representation
1628
+ command.response_class = Google::Apis::SpannerV1::BatchCreateSessionsResponse
1629
+ command.params['database'] = database unless database.nil?
1630
+ command.query['fields'] = fields unless fields.nil?
1631
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1632
+ execute_or_queue_command(command, &block)
1633
+ end
1634
+
1635
+ # Begins a new transaction. This step can often be skipped: Read, ExecuteSql and
1636
+ # Commit can begin a new transaction as a side-effect.
1637
+ # @param [String] session
1638
+ # Required. The session in which the transaction runs.
1639
+ # @param [Google::Apis::SpannerV1::BeginTransactionRequest] begin_transaction_request_object
1640
+ # @param [String] fields
1641
+ # Selector specifying which fields to include in a partial response.
1642
+ # @param [String] quota_user
1643
+ # Available to use for quota purposes for server-side applications. Can be any
1644
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1645
+ # @param [Google::Apis::RequestOptions] options
1646
+ # Request-specific options
1647
+ #
1648
+ # @yield [result, err] Result & error if block supplied
1649
+ # @yieldparam result [Google::Apis::SpannerV1::Transaction] parsed result object
1650
+ # @yieldparam err [StandardError] error object if request failed
1651
+ #
1652
+ # @return [Google::Apis::SpannerV1::Transaction]
1653
+ #
1654
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1655
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1656
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1657
+ def begin_session_transaction(session, begin_transaction_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1658
+ command = make_simple_command(:post, 'v1/{+session}:beginTransaction', options)
1659
+ command.request_representation = Google::Apis::SpannerV1::BeginTransactionRequest::Representation
1660
+ command.request_object = begin_transaction_request_object
1661
+ command.response_representation = Google::Apis::SpannerV1::Transaction::Representation
1662
+ command.response_class = Google::Apis::SpannerV1::Transaction
1663
+ command.params['session'] = session unless session.nil?
1664
+ command.query['fields'] = fields unless fields.nil?
1665
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1666
+ execute_or_queue_command(command, &block)
1667
+ end
1668
+
1669
+ # Commits a transaction. The request includes the mutations to be applied to
1670
+ # rows in the database. `Commit` might return an `ABORTED` error. This can occur
1671
+ # at any time; commonly, the cause is conflicts with concurrent transactions.
1672
+ # However, it can also happen for a variety of other reasons. If `Commit`
1673
+ # returns `ABORTED`, the caller should re-attempt the transaction from the
1674
+ # beginning, re-using the same session. On very rare occasions, `Commit` might
1675
+ # return `UNKNOWN`. This can happen, for example, if the client job experiences
1676
+ # a 1+ hour networking failure. At that point, Cloud Spanner has lost track of
1677
+ # the transaction outcome and we recommend that you perform another read from
1678
+ # the database to see the state of things as they are now.
1679
+ # @param [String] session
1680
+ # Required. The session in which the transaction to be committed is running.
1681
+ # @param [Google::Apis::SpannerV1::CommitRequest] commit_request_object
1682
+ # @param [String] fields
1683
+ # Selector specifying which fields to include in a partial response.
1684
+ # @param [String] quota_user
1685
+ # Available to use for quota purposes for server-side applications. Can be any
1686
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1687
+ # @param [Google::Apis::RequestOptions] options
1688
+ # Request-specific options
1689
+ #
1690
+ # @yield [result, err] Result & error if block supplied
1691
+ # @yieldparam result [Google::Apis::SpannerV1::CommitResponse] parsed result object
1692
+ # @yieldparam err [StandardError] error object if request failed
1693
+ #
1694
+ # @return [Google::Apis::SpannerV1::CommitResponse]
1695
+ #
1696
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1697
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1698
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1699
+ def commit_session(session, commit_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1700
+ command = make_simple_command(:post, 'v1/{+session}:commit', options)
1701
+ command.request_representation = Google::Apis::SpannerV1::CommitRequest::Representation
1702
+ command.request_object = commit_request_object
1703
+ command.response_representation = Google::Apis::SpannerV1::CommitResponse::Representation
1704
+ command.response_class = Google::Apis::SpannerV1::CommitResponse
1705
+ command.params['session'] = session unless session.nil?
1706
+ command.query['fields'] = fields unless fields.nil?
1707
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1708
+ execute_or_queue_command(command, &block)
1709
+ end
1710
+
1711
+ # Creates a new session. A session can be used to perform transactions that read
1712
+ # and/or modify data in a Cloud Spanner database. Sessions are meant to be
1713
+ # reused for many consecutive transactions. Sessions can only execute one
1714
+ # transaction at a time. To execute multiple concurrent read-write/write-only
1715
+ # transactions, create multiple sessions. Note that standalone reads and queries
1716
+ # use a transaction internally, and count toward the one transaction limit.
1717
+ # Active sessions use additional server resources, so it is a good idea to
1718
+ # delete idle and unneeded sessions. Aside from explicit deletes, Cloud Spanner
1719
+ # may delete sessions for which no operations are sent for more than an hour. If
1720
+ # a session is deleted, requests to it return `NOT_FOUND`. Idle sessions can be
1721
+ # kept alive by sending a trivial SQL query periodically, e.g., `"SELECT 1"`.
1722
+ # @param [String] database
1723
+ # Required. The database in which the new session is created.
1724
+ # @param [Google::Apis::SpannerV1::CreateSessionRequest] create_session_request_object
1725
+ # @param [String] fields
1726
+ # Selector specifying which fields to include in a partial response.
1727
+ # @param [String] quota_user
1728
+ # Available to use for quota purposes for server-side applications. Can be any
1729
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1730
+ # @param [Google::Apis::RequestOptions] options
1731
+ # Request-specific options
1732
+ #
1733
+ # @yield [result, err] Result & error if block supplied
1734
+ # @yieldparam result [Google::Apis::SpannerV1::Session] parsed result object
1735
+ # @yieldparam err [StandardError] error object if request failed
1736
+ #
1737
+ # @return [Google::Apis::SpannerV1::Session]
1738
+ #
1739
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1740
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1741
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1742
+ def create_project_instance_database_session(database, create_session_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1743
+ command = make_simple_command(:post, 'v1/{+database}/sessions', options)
1744
+ command.request_representation = Google::Apis::SpannerV1::CreateSessionRequest::Representation
1745
+ command.request_object = create_session_request_object
1746
+ command.response_representation = Google::Apis::SpannerV1::Session::Representation
1747
+ command.response_class = Google::Apis::SpannerV1::Session
1748
+ command.params['database'] = database unless database.nil?
1749
+ command.query['fields'] = fields unless fields.nil?
1750
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1751
+ execute_or_queue_command(command, &block)
1752
+ end
1753
+
1754
+ # Ends a session, releasing server resources associated with it. This will
1755
+ # asynchronously trigger cancellation of any operations that are running with
1756
+ # this session.
1757
+ # @param [String] name
1758
+ # Required. The name of the session to delete.
1759
+ # @param [String] fields
1760
+ # Selector specifying which fields to include in a partial response.
1761
+ # @param [String] quota_user
1762
+ # Available to use for quota purposes for server-side applications. Can be any
1763
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1764
+ # @param [Google::Apis::RequestOptions] options
1765
+ # Request-specific options
1766
+ #
1767
+ # @yield [result, err] Result & error if block supplied
1768
+ # @yieldparam result [Google::Apis::SpannerV1::Empty] parsed result object
1769
+ # @yieldparam err [StandardError] error object if request failed
1770
+ #
1771
+ # @return [Google::Apis::SpannerV1::Empty]
1772
+ #
1773
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1774
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1775
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1776
+ def delete_project_instance_database_session(name, fields: nil, quota_user: nil, options: nil, &block)
1777
+ command = make_simple_command(:delete, 'v1/{+name}', options)
1778
+ command.response_representation = Google::Apis::SpannerV1::Empty::Representation
1779
+ command.response_class = Google::Apis::SpannerV1::Empty
1780
+ command.params['name'] = name unless name.nil?
1781
+ command.query['fields'] = fields unless fields.nil?
1782
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1783
+ execute_or_queue_command(command, &block)
1784
+ end
1785
+
1786
+ # Executes a batch of SQL DML statements. This method allows many statements to
1787
+ # be run with lower latency than submitting them sequentially with ExecuteSql.
1788
+ # Statements are executed in sequential order. A request can succeed even if a
1789
+ # statement fails. The ExecuteBatchDmlResponse.status field in the response
1790
+ # provides information about the statement that failed. Clients must inspect
1791
+ # this field to determine whether an error occurred. Execution stops after the
1792
+ # first failed statement; the remaining statements are not executed.
1793
+ # @param [String] session
1794
+ # Required. The session in which the DML statements should be performed.
1795
+ # @param [Google::Apis::SpannerV1::ExecuteBatchDmlRequest] execute_batch_dml_request_object
1796
+ # @param [String] fields
1797
+ # Selector specifying which fields to include in a partial response.
1798
+ # @param [String] quota_user
1799
+ # Available to use for quota purposes for server-side applications. Can be any
1800
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1801
+ # @param [Google::Apis::RequestOptions] options
1802
+ # Request-specific options
1803
+ #
1804
+ # @yield [result, err] Result & error if block supplied
1805
+ # @yieldparam result [Google::Apis::SpannerV1::ExecuteBatchDmlResponse] parsed result object
1806
+ # @yieldparam err [StandardError] error object if request failed
1807
+ #
1808
+ # @return [Google::Apis::SpannerV1::ExecuteBatchDmlResponse]
1809
+ #
1810
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1811
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1812
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1813
+ def execute_session_batch_dml(session, execute_batch_dml_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1814
+ command = make_simple_command(:post, 'v1/{+session}:executeBatchDml', options)
1815
+ command.request_representation = Google::Apis::SpannerV1::ExecuteBatchDmlRequest::Representation
1816
+ command.request_object = execute_batch_dml_request_object
1817
+ command.response_representation = Google::Apis::SpannerV1::ExecuteBatchDmlResponse::Representation
1818
+ command.response_class = Google::Apis::SpannerV1::ExecuteBatchDmlResponse
1819
+ command.params['session'] = session unless session.nil?
1820
+ command.query['fields'] = fields unless fields.nil?
1821
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1822
+ execute_or_queue_command(command, &block)
1823
+ end
1824
+
1825
+ # Executes an SQL statement, returning all results in a single reply. This
1826
+ # method cannot be used to return a result set larger than 10 MiB; if the query
1827
+ # yields more data than that, the query fails with a `FAILED_PRECONDITION` error.
1828
+ # Operations inside read-write transactions might return `ABORTED`. If this
1829
+ # occurs, the application should restart the transaction from the beginning. See
1830
+ # Transaction for more details. Larger result sets can be fetched in streaming
1831
+ # fashion by calling ExecuteStreamingSql instead.
1832
+ # @param [String] session
1833
+ # Required. The session in which the SQL query should be performed.
1834
+ # @param [Google::Apis::SpannerV1::ExecuteSqlRequest] execute_sql_request_object
1835
+ # @param [String] fields
1836
+ # Selector specifying which fields to include in a partial response.
1837
+ # @param [String] quota_user
1838
+ # Available to use for quota purposes for server-side applications. Can be any
1839
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1840
+ # @param [Google::Apis::RequestOptions] options
1841
+ # Request-specific options
1842
+ #
1843
+ # @yield [result, err] Result & error if block supplied
1844
+ # @yieldparam result [Google::Apis::SpannerV1::ResultSet] parsed result object
1845
+ # @yieldparam err [StandardError] error object if request failed
1846
+ #
1847
+ # @return [Google::Apis::SpannerV1::ResultSet]
1848
+ #
1849
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1850
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1851
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1852
+ def execute_session_sql(session, execute_sql_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1853
+ command = make_simple_command(:post, 'v1/{+session}:executeSql', options)
1854
+ command.request_representation = Google::Apis::SpannerV1::ExecuteSqlRequest::Representation
1855
+ command.request_object = execute_sql_request_object
1856
+ command.response_representation = Google::Apis::SpannerV1::ResultSet::Representation
1857
+ command.response_class = Google::Apis::SpannerV1::ResultSet
1858
+ command.params['session'] = session unless session.nil?
1859
+ command.query['fields'] = fields unless fields.nil?
1860
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1861
+ execute_or_queue_command(command, &block)
1862
+ end
1863
+
1864
+ # Like ExecuteSql, except returns the result set as a stream. Unlike ExecuteSql,
1865
+ # there is no limit on the size of the returned result set. However, no
1866
+ # individual row in the result set can exceed 100 MiB, and no column value can
1867
+ # exceed 10 MiB.
1868
+ # @param [String] session
1869
+ # Required. The session in which the SQL query should be performed.
1870
+ # @param [Google::Apis::SpannerV1::ExecuteSqlRequest] execute_sql_request_object
1871
+ # @param [String] fields
1872
+ # Selector specifying which fields to include in a partial response.
1873
+ # @param [String] quota_user
1874
+ # Available to use for quota purposes for server-side applications. Can be any
1875
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1876
+ # @param [Google::Apis::RequestOptions] options
1877
+ # Request-specific options
1878
+ #
1879
+ # @yield [result, err] Result & error if block supplied
1880
+ # @yieldparam result [Google::Apis::SpannerV1::PartialResultSet] parsed result object
1881
+ # @yieldparam err [StandardError] error object if request failed
1882
+ #
1883
+ # @return [Google::Apis::SpannerV1::PartialResultSet]
1884
+ #
1885
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1886
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1887
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1888
+ def execute_project_instance_database_session_streaming_sql(session, execute_sql_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1889
+ command = make_simple_command(:post, 'v1/{+session}:executeStreamingSql', options)
1890
+ command.request_representation = Google::Apis::SpannerV1::ExecuteSqlRequest::Representation
1891
+ command.request_object = execute_sql_request_object
1892
+ command.response_representation = Google::Apis::SpannerV1::PartialResultSet::Representation
1893
+ command.response_class = Google::Apis::SpannerV1::PartialResultSet
1894
+ command.params['session'] = session unless session.nil?
1895
+ command.query['fields'] = fields unless fields.nil?
1896
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1897
+ execute_or_queue_command(command, &block)
1898
+ end
1899
+
1900
+ # Gets a session. Returns `NOT_FOUND` if the session does not exist. This is
1901
+ # mainly useful for determining whether a session is still alive.
1902
+ # @param [String] name
1903
+ # Required. The name of the session to retrieve.
1904
+ # @param [String] fields
1905
+ # Selector specifying which fields to include in a partial response.
1906
+ # @param [String] quota_user
1907
+ # Available to use for quota purposes for server-side applications. Can be any
1908
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1909
+ # @param [Google::Apis::RequestOptions] options
1910
+ # Request-specific options
1911
+ #
1912
+ # @yield [result, err] Result & error if block supplied
1913
+ # @yieldparam result [Google::Apis::SpannerV1::Session] parsed result object
1914
+ # @yieldparam err [StandardError] error object if request failed
1915
+ #
1916
+ # @return [Google::Apis::SpannerV1::Session]
1917
+ #
1918
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1919
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1920
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1921
+ def get_project_instance_database_session(name, fields: nil, quota_user: nil, options: nil, &block)
1922
+ command = make_simple_command(:get, 'v1/{+name}', options)
1923
+ command.response_representation = Google::Apis::SpannerV1::Session::Representation
1924
+ command.response_class = Google::Apis::SpannerV1::Session
1925
+ command.params['name'] = name unless name.nil?
1926
+ command.query['fields'] = fields unless fields.nil?
1927
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1928
+ execute_or_queue_command(command, &block)
1929
+ end
1930
+
1931
+ # Lists all sessions in a given database.
1932
+ # @param [String] database
1933
+ # Required. The database in which to list sessions.
1934
+ # @param [String] filter
1935
+ # An expression for filtering the results of the request. Filter rules are case
1936
+ # insensitive. The fields eligible for filtering are: * `labels.key` where key
1937
+ # is the name of a label Some examples of using filters are: * `labels.env:*` -->
1938
+ # The session has the label "env". * `labels.env:dev` --> The session has the
1939
+ # label "env" and the value of the label contains the string "dev".
1940
+ # @param [Fixnum] page_size
1941
+ # Number of sessions to be returned in the response. If 0 or less, defaults to
1942
+ # the server's maximum allowed page size.
1943
+ # @param [String] page_token
1944
+ # If non-empty, `page_token` should contain a next_page_token from a previous
1945
+ # ListSessionsResponse.
1946
+ # @param [String] fields
1947
+ # Selector specifying which fields to include in a partial response.
1948
+ # @param [String] quota_user
1949
+ # Available to use for quota purposes for server-side applications. Can be any
1950
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1951
+ # @param [Google::Apis::RequestOptions] options
1952
+ # Request-specific options
1953
+ #
1954
+ # @yield [result, err] Result & error if block supplied
1955
+ # @yieldparam result [Google::Apis::SpannerV1::ListSessionsResponse] parsed result object
1956
+ # @yieldparam err [StandardError] error object if request failed
1957
+ #
1958
+ # @return [Google::Apis::SpannerV1::ListSessionsResponse]
1959
+ #
1960
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1961
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1962
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1963
+ def list_project_instance_database_sessions(database, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
1964
+ command = make_simple_command(:get, 'v1/{+database}/sessions', options)
1965
+ command.response_representation = Google::Apis::SpannerV1::ListSessionsResponse::Representation
1966
+ command.response_class = Google::Apis::SpannerV1::ListSessionsResponse
1967
+ command.params['database'] = database unless database.nil?
1968
+ command.query['filter'] = filter unless filter.nil?
1969
+ command.query['pageSize'] = page_size unless page_size.nil?
1970
+ command.query['pageToken'] = page_token unless page_token.nil?
1971
+ command.query['fields'] = fields unless fields.nil?
1972
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1973
+ execute_or_queue_command(command, &block)
1974
+ end
1975
+
1976
+ # Creates a set of partition tokens that can be used to execute a query
1977
+ # operation in parallel. Each of the returned partition tokens can be used by
1978
+ # ExecuteStreamingSql to specify a subset of the query result to read. The same
1979
+ # session and read-only transaction must be used by the PartitionQueryRequest
1980
+ # used to create the partition tokens and the ExecuteSqlRequests that use the
1981
+ # partition tokens. Partition tokens become invalid when the session used to
1982
+ # create them is deleted, is idle for too long, begins a new transaction, or
1983
+ # becomes too old. When any of these happen, it is not possible to resume the
1984
+ # query, and the whole operation must be restarted from the beginning.
1985
+ # @param [String] session
1986
+ # Required. The session used to create the partitions.
1987
+ # @param [Google::Apis::SpannerV1::PartitionQueryRequest] partition_query_request_object
1988
+ # @param [String] fields
1989
+ # Selector specifying which fields to include in a partial response.
1990
+ # @param [String] quota_user
1991
+ # Available to use for quota purposes for server-side applications. Can be any
1992
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1993
+ # @param [Google::Apis::RequestOptions] options
1994
+ # Request-specific options
1995
+ #
1996
+ # @yield [result, err] Result & error if block supplied
1997
+ # @yieldparam result [Google::Apis::SpannerV1::PartitionResponse] parsed result object
1998
+ # @yieldparam err [StandardError] error object if request failed
1999
+ #
2000
+ # @return [Google::Apis::SpannerV1::PartitionResponse]
2001
+ #
2002
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2003
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2004
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2005
+ def partition_session_query(session, partition_query_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
2006
+ command = make_simple_command(:post, 'v1/{+session}:partitionQuery', options)
2007
+ command.request_representation = Google::Apis::SpannerV1::PartitionQueryRequest::Representation
2008
+ command.request_object = partition_query_request_object
2009
+ command.response_representation = Google::Apis::SpannerV1::PartitionResponse::Representation
2010
+ command.response_class = Google::Apis::SpannerV1::PartitionResponse
2011
+ command.params['session'] = session unless session.nil?
2012
+ command.query['fields'] = fields unless fields.nil?
2013
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2014
+ execute_or_queue_command(command, &block)
2015
+ end
2016
+
2017
+ # Creates a set of partition tokens that can be used to execute a read operation
2018
+ # in parallel. Each of the returned partition tokens can be used by
2019
+ # StreamingRead to specify a subset of the read result to read. The same session
2020
+ # and read-only transaction must be used by the PartitionReadRequest used to
2021
+ # create the partition tokens and the ReadRequests that use the partition tokens.
2022
+ # There are no ordering guarantees on rows returned among the returned
2023
+ # partition tokens, or even within each individual StreamingRead call issued
2024
+ # with a partition_token. Partition tokens become invalid when the session used
2025
+ # to create them is deleted, is idle for too long, begins a new transaction, or
2026
+ # becomes too old. When any of these happen, it is not possible to resume the
2027
+ # read, and the whole operation must be restarted from the beginning.
2028
+ # @param [String] session
2029
+ # Required. The session used to create the partitions.
2030
+ # @param [Google::Apis::SpannerV1::PartitionReadRequest] partition_read_request_object
2031
+ # @param [String] fields
2032
+ # Selector specifying which fields to include in a partial response.
2033
+ # @param [String] quota_user
2034
+ # Available to use for quota purposes for server-side applications. Can be any
2035
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2036
+ # @param [Google::Apis::RequestOptions] options
2037
+ # Request-specific options
2038
+ #
2039
+ # @yield [result, err] Result & error if block supplied
2040
+ # @yieldparam result [Google::Apis::SpannerV1::PartitionResponse] parsed result object
2041
+ # @yieldparam err [StandardError] error object if request failed
2042
+ #
2043
+ # @return [Google::Apis::SpannerV1::PartitionResponse]
2044
+ #
2045
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2046
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2047
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2048
+ def partition_session_read(session, partition_read_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
2049
+ command = make_simple_command(:post, 'v1/{+session}:partitionRead', options)
2050
+ command.request_representation = Google::Apis::SpannerV1::PartitionReadRequest::Representation
2051
+ command.request_object = partition_read_request_object
2052
+ command.response_representation = Google::Apis::SpannerV1::PartitionResponse::Representation
2053
+ command.response_class = Google::Apis::SpannerV1::PartitionResponse
2054
+ command.params['session'] = session unless session.nil?
2055
+ command.query['fields'] = fields unless fields.nil?
2056
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2057
+ execute_or_queue_command(command, &block)
2058
+ end
2059
+
2060
+ # Reads rows from the database using key lookups and scans, as a simple key/
2061
+ # value style alternative to ExecuteSql. This method cannot be used to return a
2062
+ # result set larger than 10 MiB; if the read matches more data than that, the
2063
+ # read fails with a `FAILED_PRECONDITION` error. Reads inside read-write
2064
+ # transactions might return `ABORTED`. If this occurs, the application should
2065
+ # restart the transaction from the beginning. See Transaction for more details.
2066
+ # Larger result sets can be yielded in streaming fashion by calling
2067
+ # StreamingRead instead.
2068
+ # @param [String] session
2069
+ # Required. The session in which the read should be performed.
2070
+ # @param [Google::Apis::SpannerV1::ReadRequest] read_request_object
2071
+ # @param [String] fields
2072
+ # Selector specifying which fields to include in a partial response.
2073
+ # @param [String] quota_user
2074
+ # Available to use for quota purposes for server-side applications. Can be any
2075
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2076
+ # @param [Google::Apis::RequestOptions] options
2077
+ # Request-specific options
2078
+ #
2079
+ # @yield [result, err] Result & error if block supplied
2080
+ # @yieldparam result [Google::Apis::SpannerV1::ResultSet] parsed result object
2081
+ # @yieldparam err [StandardError] error object if request failed
2082
+ #
2083
+ # @return [Google::Apis::SpannerV1::ResultSet]
2084
+ #
2085
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2086
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2087
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2088
+ def read_session(session, read_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
2089
+ command = make_simple_command(:post, 'v1/{+session}:read', options)
2090
+ command.request_representation = Google::Apis::SpannerV1::ReadRequest::Representation
2091
+ command.request_object = read_request_object
2092
+ command.response_representation = Google::Apis::SpannerV1::ResultSet::Representation
2093
+ command.response_class = Google::Apis::SpannerV1::ResultSet
2094
+ command.params['session'] = session unless session.nil?
2095
+ command.query['fields'] = fields unless fields.nil?
2096
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2097
+ execute_or_queue_command(command, &block)
2098
+ end
2099
+
2100
+ # Rolls back a transaction, releasing any locks it holds. It is a good idea to
2101
+ # call this for any transaction that includes one or more Read or ExecuteSql
2102
+ # requests and ultimately decides not to commit. `Rollback` returns `OK` if it
2103
+ # successfully aborts the transaction, the transaction was already aborted, or
2104
+ # the transaction is not found. `Rollback` never returns `ABORTED`.
2105
+ # @param [String] session
2106
+ # Required. The session in which the transaction to roll back is running.
2107
+ # @param [Google::Apis::SpannerV1::RollbackRequest] rollback_request_object
2108
+ # @param [String] fields
2109
+ # Selector specifying which fields to include in a partial response.
2110
+ # @param [String] quota_user
2111
+ # Available to use for quota purposes for server-side applications. Can be any
2112
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2113
+ # @param [Google::Apis::RequestOptions] options
2114
+ # Request-specific options
2115
+ #
2116
+ # @yield [result, err] Result & error if block supplied
2117
+ # @yieldparam result [Google::Apis::SpannerV1::Empty] parsed result object
2118
+ # @yieldparam err [StandardError] error object if request failed
2119
+ #
2120
+ # @return [Google::Apis::SpannerV1::Empty]
2121
+ #
2122
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2123
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2124
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2125
+ def rollback_session(session, rollback_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
2126
+ command = make_simple_command(:post, 'v1/{+session}:rollback', options)
2127
+ command.request_representation = Google::Apis::SpannerV1::RollbackRequest::Representation
2128
+ command.request_object = rollback_request_object
2129
+ command.response_representation = Google::Apis::SpannerV1::Empty::Representation
2130
+ command.response_class = Google::Apis::SpannerV1::Empty
2131
+ command.params['session'] = session unless session.nil?
2132
+ command.query['fields'] = fields unless fields.nil?
2133
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2134
+ execute_or_queue_command(command, &block)
2135
+ end
2136
+
2137
+ # Like Read, except returns the result set as a stream. Unlike Read, there is no
2138
+ # limit on the size of the returned result set. However, no individual row in
2139
+ # the result set can exceed 100 MiB, and no column value can exceed 10 MiB.
2140
+ # @param [String] session
2141
+ # Required. The session in which the read should be performed.
2142
+ # @param [Google::Apis::SpannerV1::ReadRequest] read_request_object
2143
+ # @param [String] fields
2144
+ # Selector specifying which fields to include in a partial response.
2145
+ # @param [String] quota_user
2146
+ # Available to use for quota purposes for server-side applications. Can be any
2147
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2148
+ # @param [Google::Apis::RequestOptions] options
2149
+ # Request-specific options
2150
+ #
2151
+ # @yield [result, err] Result & error if block supplied
2152
+ # @yieldparam result [Google::Apis::SpannerV1::PartialResultSet] parsed result object
2153
+ # @yieldparam err [StandardError] error object if request failed
2154
+ #
2155
+ # @return [Google::Apis::SpannerV1::PartialResultSet]
2156
+ #
2157
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2158
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2159
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2160
+ def streaming_project_instance_database_session_read(session, read_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
2161
+ command = make_simple_command(:post, 'v1/{+session}:streamingRead', options)
2162
+ command.request_representation = Google::Apis::SpannerV1::ReadRequest::Representation
2163
+ command.request_object = read_request_object
2164
+ command.response_representation = Google::Apis::SpannerV1::PartialResultSet::Representation
2165
+ command.response_class = Google::Apis::SpannerV1::PartialResultSet
2166
+ command.params['session'] = session unless session.nil?
2167
+ command.query['fields'] = fields unless fields.nil?
2168
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2169
+ execute_or_queue_command(command, &block)
2170
+ end
2171
+
2172
+ # Starts asynchronous cancellation on a long-running operation. The server makes
2173
+ # a best effort to cancel the operation, but success is not guaranteed. If the
2174
+ # server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
2175
+ # Clients can use Operations.GetOperation or other methods to check whether the
2176
+ # cancellation succeeded or whether the operation completed despite cancellation.
2177
+ # On successful cancellation, the operation is not deleted; instead, it becomes
2178
+ # an operation with an Operation.error value with a google.rpc.Status.code of 1,
2179
+ # corresponding to `Code.CANCELLED`.
2180
+ # @param [String] name
2181
+ # The name of the operation resource to be cancelled.
2182
+ # @param [String] fields
2183
+ # Selector specifying which fields to include in a partial response.
2184
+ # @param [String] quota_user
2185
+ # Available to use for quota purposes for server-side applications. Can be any
2186
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2187
+ # @param [Google::Apis::RequestOptions] options
2188
+ # Request-specific options
2189
+ #
2190
+ # @yield [result, err] Result & error if block supplied
2191
+ # @yieldparam result [Google::Apis::SpannerV1::Empty] parsed result object
2192
+ # @yieldparam err [StandardError] error object if request failed
2193
+ #
2194
+ # @return [Google::Apis::SpannerV1::Empty]
2195
+ #
2196
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2197
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2198
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2199
+ def cancel_project_instance_operation(name, fields: nil, quota_user: nil, options: nil, &block)
2200
+ command = make_simple_command(:post, 'v1/{+name}:cancel', options)
2201
+ command.response_representation = Google::Apis::SpannerV1::Empty::Representation
2202
+ command.response_class = Google::Apis::SpannerV1::Empty
2203
+ command.params['name'] = name unless name.nil?
2204
+ command.query['fields'] = fields unless fields.nil?
2205
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2206
+ execute_or_queue_command(command, &block)
2207
+ end
2208
+
2209
+ # Deletes a long-running operation. This method indicates that the client is no
2210
+ # longer interested in the operation result. It does not cancel the operation.
2211
+ # If the server doesn't support this method, it returns `google.rpc.Code.
2212
+ # UNIMPLEMENTED`.
2213
+ # @param [String] name
2214
+ # The name of the operation resource to be deleted.
2215
+ # @param [String] fields
2216
+ # Selector specifying which fields to include in a partial response.
2217
+ # @param [String] quota_user
2218
+ # Available to use for quota purposes for server-side applications. Can be any
2219
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2220
+ # @param [Google::Apis::RequestOptions] options
2221
+ # Request-specific options
2222
+ #
2223
+ # @yield [result, err] Result & error if block supplied
2224
+ # @yieldparam result [Google::Apis::SpannerV1::Empty] parsed result object
2225
+ # @yieldparam err [StandardError] error object if request failed
2226
+ #
2227
+ # @return [Google::Apis::SpannerV1::Empty]
2228
+ #
2229
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2230
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2231
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2232
+ def delete_project_instance_operation(name, fields: nil, quota_user: nil, options: nil, &block)
2233
+ command = make_simple_command(:delete, 'v1/{+name}', options)
2234
+ command.response_representation = Google::Apis::SpannerV1::Empty::Representation
2235
+ command.response_class = Google::Apis::SpannerV1::Empty
2236
+ command.params['name'] = name unless name.nil?
2237
+ command.query['fields'] = fields unless fields.nil?
2238
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2239
+ execute_or_queue_command(command, &block)
2240
+ end
2241
+
2242
+ # Gets the latest state of a long-running operation. Clients can use this method
2243
+ # to poll the operation result at intervals as recommended by the API service.
2244
+ # @param [String] name
2245
+ # The name of the operation resource.
2246
+ # @param [String] fields
2247
+ # Selector specifying which fields to include in a partial response.
2248
+ # @param [String] quota_user
2249
+ # Available to use for quota purposes for server-side applications. Can be any
2250
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2251
+ # @param [Google::Apis::RequestOptions] options
2252
+ # Request-specific options
2253
+ #
2254
+ # @yield [result, err] Result & error if block supplied
2255
+ # @yieldparam result [Google::Apis::SpannerV1::Operation] parsed result object
2256
+ # @yieldparam err [StandardError] error object if request failed
2257
+ #
2258
+ # @return [Google::Apis::SpannerV1::Operation]
2259
+ #
2260
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2261
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2262
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2263
+ def get_project_instance_operation(name, fields: nil, quota_user: nil, options: nil, &block)
2264
+ command = make_simple_command(:get, 'v1/{+name}', options)
2265
+ command.response_representation = Google::Apis::SpannerV1::Operation::Representation
2266
+ command.response_class = Google::Apis::SpannerV1::Operation
2267
+ command.params['name'] = name unless name.nil?
2268
+ command.query['fields'] = fields unless fields.nil?
2269
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2270
+ execute_or_queue_command(command, &block)
2271
+ end
2272
+
2273
+ # Lists operations that match the specified filter in the request. If the server
2274
+ # doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name`
2275
+ # binding allows API services to override the binding to use different resource
2276
+ # name schemes, such as `users/*/operations`. To override the binding, API
2277
+ # services can add a binding such as `"/v1/`name=users/*`/operations"` to their
2278
+ # service configuration. For backwards compatibility, the default name includes
2279
+ # the operations collection id, however overriding users must ensure the name
2280
+ # binding is the parent resource, without the operations collection id.
2281
+ # @param [String] name
2282
+ # The name of the operation's parent resource.
2283
+ # @param [String] filter
2284
+ # The standard list filter.
2285
+ # @param [Fixnum] page_size
2286
+ # The standard list page size.
2287
+ # @param [String] page_token
2288
+ # The standard list page token.
2289
+ # @param [String] fields
2290
+ # Selector specifying which fields to include in a partial response.
2291
+ # @param [String] quota_user
2292
+ # Available to use for quota purposes for server-side applications. Can be any
2293
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
2294
+ # @param [Google::Apis::RequestOptions] options
2295
+ # Request-specific options
2296
+ #
2297
+ # @yield [result, err] Result & error if block supplied
2298
+ # @yieldparam result [Google::Apis::SpannerV1::ListOperationsResponse] parsed result object
2299
+ # @yieldparam err [StandardError] error object if request failed
2300
+ #
2301
+ # @return [Google::Apis::SpannerV1::ListOperationsResponse]
2302
+ #
2303
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
2304
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
2305
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
2306
+ def list_project_instance_operations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
2307
+ command = make_simple_command(:get, 'v1/{+name}', options)
2308
+ command.response_representation = Google::Apis::SpannerV1::ListOperationsResponse::Representation
2309
+ command.response_class = Google::Apis::SpannerV1::ListOperationsResponse
2310
+ command.params['name'] = name unless name.nil?
2311
+ command.query['filter'] = filter unless filter.nil?
2312
+ command.query['pageSize'] = page_size unless page_size.nil?
2313
+ command.query['pageToken'] = page_token unless page_token.nil?
2314
+ command.query['fields'] = fields unless fields.nil?
2315
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2316
+ execute_or_queue_command(command, &block)
2317
+ end
2318
+
2319
+ protected
2320
+
2321
+ def apply_command_defaults(command)
2322
+ command.query['key'] = key unless key.nil?
2323
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
2324
+ end
2325
+ end
2326
+ end
2327
+ end
2328
+ end