google-cloud-spanner-admin-instance-v1 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1701 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/spanner/admin/instance/v1/spanner_instance_admin_pb"
21
+ require "google/cloud/spanner/admin/instance/v1/instance_admin/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Spanner
26
+ module Admin
27
+ module Instance
28
+ module V1
29
+ module InstanceAdmin
30
+ module Rest
31
+ ##
32
+ # REST client for the InstanceAdmin service.
33
+ #
34
+ # Cloud Spanner Instance Admin API
35
+ #
36
+ # The Cloud Spanner Instance Admin API can be used to create, delete,
37
+ # modify and list instances. Instances are dedicated Cloud Spanner serving
38
+ # and storage resources to be used by Cloud Spanner databases.
39
+ #
40
+ # Each instance has a "configuration", which dictates where the
41
+ # serving resources for the Cloud Spanner instance are located (e.g.,
42
+ # US-central, Europe). Configurations are created by Google based on
43
+ # resource availability.
44
+ #
45
+ # Cloud Spanner billing is based on the instances that exist and their
46
+ # sizes. After an instance exists, there are no additional
47
+ # per-database or per-operation charges for use of the instance
48
+ # (though there may be additional network bandwidth charges).
49
+ # Instances offer isolation: problems with databases in one instance
50
+ # will not affect other instances. However, within an instance
51
+ # databases can affect each other. For example, if one database in an
52
+ # instance receives a lot of requests and consumes most of the
53
+ # instance resources, fewer resources are available for other
54
+ # databases in that instance, and their performance may suffer.
55
+ #
56
+ class Client
57
+ include Paths
58
+
59
+ # @private
60
+ attr_reader :instance_admin_stub
61
+
62
+ ##
63
+ # Configure the InstanceAdmin Client class.
64
+ #
65
+ # See {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Client::Configuration}
66
+ # for a description of the configuration fields.
67
+ #
68
+ # @example
69
+ #
70
+ # # Modify the configuration for all InstanceAdmin clients
71
+ # ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Client.configure do |config|
72
+ # config.timeout = 10.0
73
+ # end
74
+ #
75
+ # @yield [config] Configure the Client client.
76
+ # @yieldparam config [Client::Configuration]
77
+ #
78
+ # @return [Client::Configuration]
79
+ #
80
+ def self.configure
81
+ @configure ||= begin
82
+ namespace = ["Google", "Cloud", "Spanner", "Admin", "Instance", "V1"]
83
+ parent_config = while namespace.any?
84
+ parent_name = namespace.join "::"
85
+ parent_const = const_get parent_name
86
+ break parent_const.configure if parent_const.respond_to? :configure
87
+ namespace.pop
88
+ end
89
+ default_config = Client::Configuration.new parent_config
90
+
91
+ default_config.rpcs.list_instance_configs.timeout = 3600.0
92
+ default_config.rpcs.list_instance_configs.retry_policy = {
93
+ initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
94
+ }
95
+
96
+ default_config.rpcs.get_instance_config.timeout = 3600.0
97
+ default_config.rpcs.get_instance_config.retry_policy = {
98
+ initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
99
+ }
100
+
101
+ default_config.rpcs.list_instances.timeout = 3600.0
102
+ default_config.rpcs.list_instances.retry_policy = {
103
+ initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
104
+ }
105
+
106
+ default_config.rpcs.get_instance.timeout = 3600.0
107
+ default_config.rpcs.get_instance.retry_policy = {
108
+ initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
109
+ }
110
+
111
+ default_config.rpcs.create_instance.timeout = 3600.0
112
+
113
+ default_config.rpcs.update_instance.timeout = 3600.0
114
+
115
+ default_config.rpcs.delete_instance.timeout = 3600.0
116
+ default_config.rpcs.delete_instance.retry_policy = {
117
+ initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
118
+ }
119
+
120
+ default_config.rpcs.set_iam_policy.timeout = 30.0
121
+
122
+ default_config.rpcs.get_iam_policy.timeout = 30.0
123
+ default_config.rpcs.get_iam_policy.retry_policy = {
124
+ initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
125
+ }
126
+
127
+ default_config.rpcs.test_iam_permissions.timeout = 30.0
128
+
129
+ default_config
130
+ end
131
+ yield @configure if block_given?
132
+ @configure
133
+ end
134
+
135
+ ##
136
+ # Configure the InstanceAdmin Client instance.
137
+ #
138
+ # The configuration is set to the derived mode, meaning that values can be changed,
139
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
140
+ # should be made on {Client.configure}.
141
+ #
142
+ # See {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Client::Configuration}
143
+ # for a description of the configuration fields.
144
+ #
145
+ # @yield [config] Configure the Client client.
146
+ # @yieldparam config [Client::Configuration]
147
+ #
148
+ # @return [Client::Configuration]
149
+ #
150
+ def configure
151
+ yield @config if block_given?
152
+ @config
153
+ end
154
+
155
+ ##
156
+ # Create a new InstanceAdmin REST client object.
157
+ #
158
+ # @example
159
+ #
160
+ # # Create a client using the default configuration
161
+ # client = ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Client.new
162
+ #
163
+ # # Create a client using a custom configuration
164
+ # client = ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Client.new do |config|
165
+ # config.timeout = 10.0
166
+ # end
167
+ #
168
+ # @yield [config] Configure the InstanceAdmin client.
169
+ # @yieldparam config [Client::Configuration]
170
+ #
171
+ def initialize
172
+ # Create the configuration object
173
+ @config = Configuration.new Client.configure
174
+
175
+ # Yield the configuration if needed
176
+ yield @config if block_given?
177
+
178
+ # Create credentials
179
+ credentials = @config.credentials
180
+ # Use self-signed JWT if the endpoint is unchanged from default,
181
+ # but only if the default endpoint does not have a region prefix.
182
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
183
+ !@config.endpoint.split(".").first.include?("-")
184
+ credentials ||= Credentials.default scope: @config.scope,
185
+ enable_self_signed_jwt: enable_self_signed_jwt
186
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
187
+ credentials = Credentials.new credentials, scope: @config.scope
188
+ end
189
+
190
+ @quota_project_id = @config.quota_project
191
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
192
+
193
+ @operations_client = ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Operations.new do |config|
194
+ config.credentials = credentials
195
+ config.quota_project = @quota_project_id
196
+ config.endpoint = @config.endpoint
197
+ end
198
+
199
+ @instance_admin_stub = ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
200
+ end
201
+
202
+ ##
203
+ # Get the associated client for long-running operations.
204
+ #
205
+ # @return [::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Operations]
206
+ #
207
+ attr_reader :operations_client
208
+
209
+ # Service calls
210
+
211
+ ##
212
+ # Lists the supported instance configurations for a given project.
213
+ #
214
+ # @overload list_instance_configs(request, options = nil)
215
+ # Pass arguments to `list_instance_configs` via a request object, either of type
216
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigsRequest} or an equivalent Hash.
217
+ #
218
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigsRequest, ::Hash]
219
+ # A request object representing the call parameters. Required. To specify no
220
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
221
+ # @param options [::Gapic::CallOptions, ::Hash]
222
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
223
+ #
224
+ # @overload list_instance_configs(parent: nil, page_size: nil, page_token: nil)
225
+ # Pass arguments to `list_instance_configs` via keyword arguments. Note that at
226
+ # least one keyword argument is required. To specify no parameters, or to keep all
227
+ # the default parameter values, pass an empty Hash as a request object (see above).
228
+ #
229
+ # @param parent [::String]
230
+ # Required. The name of the project for which a list of supported instance
231
+ # configurations is requested. Values are of the form
232
+ # `projects/<project>`.
233
+ # @param page_size [::Integer]
234
+ # Number of instance configurations to be returned in the response. If 0 or
235
+ # less, defaults to the server's maximum allowed page size.
236
+ # @param page_token [::String]
237
+ # If non-empty, `page_token` should contain a
238
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigsResponse#next_page_token next_page_token}
239
+ # from a previous
240
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigsResponse ListInstanceConfigsResponse}.
241
+ # @yield [result, operation] Access the result along with the TransportOperation object
242
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig>]
243
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
244
+ #
245
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig>]
246
+ #
247
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
248
+ def list_instance_configs request, options = nil
249
+ raise ::ArgumentError, "request must be provided" if request.nil?
250
+
251
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigsRequest
252
+
253
+ # Converts hash and nil to an options object
254
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
255
+
256
+ # Customize the options with defaults
257
+ call_metadata = @config.rpcs.list_instance_configs.metadata.to_h
258
+
259
+ # Set x-goog-api-client and x-goog-user-project headers
260
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
261
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
262
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
263
+ transports_version_send: [:rest]
264
+
265
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
266
+
267
+ options.apply_defaults timeout: @config.rpcs.list_instance_configs.timeout,
268
+ metadata: call_metadata,
269
+ retry_policy: @config.rpcs.list_instance_configs.retry_policy
270
+
271
+ options.apply_defaults timeout: @config.timeout,
272
+ metadata: @config.metadata,
273
+ retry_policy: @config.retry_policy
274
+
275
+ @instance_admin_stub.list_instance_configs request, options do |result, operation|
276
+ result = ::Gapic::Rest::PagedEnumerable.new @instance_admin_stub, :list_instance_configs, "instance_configs", request, result, options
277
+ yield result, operation if block_given?
278
+ return result
279
+ end
280
+ rescue ::Gapic::Rest::Error => e
281
+ raise ::Google::Cloud::Error.from_error(e)
282
+ end
283
+
284
+ ##
285
+ # Gets information about a particular instance configuration.
286
+ #
287
+ # @overload get_instance_config(request, options = nil)
288
+ # Pass arguments to `get_instance_config` via a request object, either of type
289
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::GetInstanceConfigRequest} or an equivalent Hash.
290
+ #
291
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::GetInstanceConfigRequest, ::Hash]
292
+ # A request object representing the call parameters. Required. To specify no
293
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
294
+ # @param options [::Gapic::CallOptions, ::Hash]
295
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
296
+ #
297
+ # @overload get_instance_config(name: nil)
298
+ # Pass arguments to `get_instance_config` via keyword arguments. Note that at
299
+ # least one keyword argument is required. To specify no parameters, or to keep all
300
+ # the default parameter values, pass an empty Hash as a request object (see above).
301
+ #
302
+ # @param name [::String]
303
+ # Required. The name of the requested instance configuration. Values are of
304
+ # the form `projects/<project>/instanceConfigs/<config>`.
305
+ # @yield [result, operation] Access the result along with the TransportOperation object
306
+ # @yieldparam result [::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig]
307
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
308
+ #
309
+ # @return [::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig]
310
+ #
311
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
312
+ def get_instance_config request, options = nil
313
+ raise ::ArgumentError, "request must be provided" if request.nil?
314
+
315
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::GetInstanceConfigRequest
316
+
317
+ # Converts hash and nil to an options object
318
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
319
+
320
+ # Customize the options with defaults
321
+ call_metadata = @config.rpcs.get_instance_config.metadata.to_h
322
+
323
+ # Set x-goog-api-client and x-goog-user-project headers
324
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
325
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
326
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
327
+ transports_version_send: [:rest]
328
+
329
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
330
+
331
+ options.apply_defaults timeout: @config.rpcs.get_instance_config.timeout,
332
+ metadata: call_metadata,
333
+ retry_policy: @config.rpcs.get_instance_config.retry_policy
334
+
335
+ options.apply_defaults timeout: @config.timeout,
336
+ metadata: @config.metadata,
337
+ retry_policy: @config.retry_policy
338
+
339
+ @instance_admin_stub.get_instance_config request, options do |result, operation|
340
+ yield result, operation if block_given?
341
+ return result
342
+ end
343
+ rescue ::Gapic::Rest::Error => e
344
+ raise ::Google::Cloud::Error.from_error(e)
345
+ end
346
+
347
+ ##
348
+ # Creates an instance config and begins preparing it to be used. The
349
+ # returned {::Google::Longrunning::Operation long-running operation}
350
+ # can be used to track the progress of preparing the new
351
+ # instance config. The instance config name is assigned by the caller. If the
352
+ # named instance config already exists, `CreateInstanceConfig` returns
353
+ # `ALREADY_EXISTS`.
354
+ #
355
+ # Immediately after the request returns:
356
+ #
357
+ # * The instance config is readable via the API, with all requested
358
+ # attributes. The instance config's
359
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig#reconciling reconciling}
360
+ # field is set to true. Its state is `CREATING`.
361
+ #
362
+ # While the operation is pending:
363
+ #
364
+ # * Cancelling the operation renders the instance config immediately
365
+ # unreadable via the API.
366
+ # * Except for deleting the creating resource, all other attempts to modify
367
+ # the instance config are rejected.
368
+ #
369
+ # Upon completion of the returned operation:
370
+ #
371
+ # * Instances can be created using the instance configuration.
372
+ # * The instance config's
373
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig#reconciling reconciling}
374
+ # field becomes false. Its state becomes `READY`.
375
+ #
376
+ # The returned {::Google::Longrunning::Operation long-running operation} will
377
+ # have a name of the format
378
+ # `<instance_config_name>/operations/<operation_id>` and can be used to track
379
+ # creation of the instance config. The
380
+ # {::Google::Longrunning::Operation#metadata metadata} field type is
381
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceConfigMetadata CreateInstanceConfigMetadata}.
382
+ # The {::Google::Longrunning::Operation#response response} field type is
383
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig InstanceConfig}, if
384
+ # successful.
385
+ #
386
+ # Authorization requires `spanner.instanceConfigs.create` permission on
387
+ # the resource
388
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceConfigRequest#parent parent}.
389
+ #
390
+ # @overload create_instance_config(request, options = nil)
391
+ # Pass arguments to `create_instance_config` via a request object, either of type
392
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceConfigRequest} or an equivalent Hash.
393
+ #
394
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceConfigRequest, ::Hash]
395
+ # A request object representing the call parameters. Required. To specify no
396
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
397
+ # @param options [::Gapic::CallOptions, ::Hash]
398
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
399
+ #
400
+ # @overload create_instance_config(parent: nil, instance_config_id: nil, instance_config: nil, validate_only: nil)
401
+ # Pass arguments to `create_instance_config` via keyword arguments. Note that at
402
+ # least one keyword argument is required. To specify no parameters, or to keep all
403
+ # the default parameter values, pass an empty Hash as a request object (see above).
404
+ #
405
+ # @param parent [::String]
406
+ # Required. The name of the project in which to create the instance config.
407
+ # Values are of the form `projects/<project>`.
408
+ # @param instance_config_id [::String]
409
+ # Required. The ID of the instance config to create. Valid identifiers are
410
+ # of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64
411
+ # characters in length. The `custom-` prefix is required to avoid name
412
+ # conflicts with Google managed configurations.
413
+ # @param instance_config [::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig, ::Hash]
414
+ # Required. The InstanceConfig proto of the configuration to create.
415
+ # instance_config.name must be
416
+ # `<parent>/instanceConfigs/<instance_config_id>`.
417
+ # instance_config.base_config must be a Google managed configuration name,
418
+ # e.g. <parent>/instanceConfigs/us-east1, <parent>/instanceConfigs/nam3.
419
+ # @param validate_only [::Boolean]
420
+ # An option to validate, but not actually execute, a request,
421
+ # and provide the same response.
422
+ # @yield [result, operation] Access the result along with the TransportOperation object
423
+ # @yieldparam result [::Gapic::Operation]
424
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
425
+ #
426
+ # @return [::Gapic::Operation]
427
+ #
428
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
429
+ def create_instance_config request, options = nil
430
+ raise ::ArgumentError, "request must be provided" if request.nil?
431
+
432
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceConfigRequest
433
+
434
+ # Converts hash and nil to an options object
435
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
436
+
437
+ # Customize the options with defaults
438
+ call_metadata = @config.rpcs.create_instance_config.metadata.to_h
439
+
440
+ # Set x-goog-api-client and x-goog-user-project headers
441
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
442
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
443
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
444
+ transports_version_send: [:rest]
445
+
446
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
447
+
448
+ options.apply_defaults timeout: @config.rpcs.create_instance_config.timeout,
449
+ metadata: call_metadata,
450
+ retry_policy: @config.rpcs.create_instance_config.retry_policy
451
+
452
+ options.apply_defaults timeout: @config.timeout,
453
+ metadata: @config.metadata,
454
+ retry_policy: @config.retry_policy
455
+
456
+ @instance_admin_stub.create_instance_config request, options do |result, operation|
457
+ result = ::Gapic::Operation.new result, @operations_client, options: options
458
+ yield result, operation if block_given?
459
+ return result
460
+ end
461
+ rescue ::Gapic::Rest::Error => e
462
+ raise ::Google::Cloud::Error.from_error(e)
463
+ end
464
+
465
+ ##
466
+ # Updates an instance config. The returned
467
+ # {::Google::Longrunning::Operation long-running operation} can be used to track
468
+ # the progress of updating the instance. If the named instance config does
469
+ # not exist, returns `NOT_FOUND`.
470
+ #
471
+ # Only user managed configurations can be updated.
472
+ #
473
+ # Immediately after the request returns:
474
+ #
475
+ # * The instance config's
476
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig#reconciling reconciling}
477
+ # field is set to true.
478
+ #
479
+ # While the operation is pending:
480
+ #
481
+ # * Cancelling the operation sets its metadata's
482
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceConfigMetadata#cancel_time cancel_time}.
483
+ # The operation is guaranteed to succeed at undoing all changes, after
484
+ # which point it terminates with a `CANCELLED` status.
485
+ # * All other attempts to modify the instance config are rejected.
486
+ # * Reading the instance config via the API continues to give the
487
+ # pre-request values.
488
+ #
489
+ # Upon completion of the returned operation:
490
+ #
491
+ # * Creating instances using the instance configuration uses the new
492
+ # values.
493
+ # * The instance config's new values are readable via the API.
494
+ # * The instance config's
495
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig#reconciling reconciling}
496
+ # field becomes false.
497
+ #
498
+ # The returned {::Google::Longrunning::Operation long-running operation} will
499
+ # have a name of the format
500
+ # `<instance_config_name>/operations/<operation_id>` and can be used to track
501
+ # the instance config modification. The
502
+ # {::Google::Longrunning::Operation#metadata metadata} field type is
503
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceConfigMetadata UpdateInstanceConfigMetadata}.
504
+ # The {::Google::Longrunning::Operation#response response} field type is
505
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig InstanceConfig}, if
506
+ # successful.
507
+ #
508
+ # Authorization requires `spanner.instanceConfigs.update` permission on
509
+ # the resource {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig#name name}.
510
+ #
511
+ # @overload update_instance_config(request, options = nil)
512
+ # Pass arguments to `update_instance_config` via a request object, either of type
513
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceConfigRequest} or an equivalent Hash.
514
+ #
515
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceConfigRequest, ::Hash]
516
+ # A request object representing the call parameters. Required. To specify no
517
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
518
+ # @param options [::Gapic::CallOptions, ::Hash]
519
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
520
+ #
521
+ # @overload update_instance_config(instance_config: nil, update_mask: nil, validate_only: nil)
522
+ # Pass arguments to `update_instance_config` via keyword arguments. Note that at
523
+ # least one keyword argument is required. To specify no parameters, or to keep all
524
+ # the default parameter values, pass an empty Hash as a request object (see above).
525
+ #
526
+ # @param instance_config [::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig, ::Hash]
527
+ # Required. The user instance config to update, which must always include the
528
+ # instance config name. Otherwise, only fields mentioned in
529
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceConfigRequest#update_mask update_mask}
530
+ # need be included. To prevent conflicts of concurrent updates,
531
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig#reconciling etag} can
532
+ # be used.
533
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
534
+ # Required. A mask specifying which fields in
535
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig InstanceConfig} should be
536
+ # updated. The field mask must always be specified; this prevents any future
537
+ # fields in {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig InstanceConfig}
538
+ # from being erased accidentally by clients that do not know about them. Only
539
+ # display_name and labels can be updated.
540
+ # @param validate_only [::Boolean]
541
+ # An option to validate, but not actually execute, a request,
542
+ # and provide the same response.
543
+ # @yield [result, operation] Access the result along with the TransportOperation object
544
+ # @yieldparam result [::Gapic::Operation]
545
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
546
+ #
547
+ # @return [::Gapic::Operation]
548
+ #
549
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
550
+ def update_instance_config request, options = nil
551
+ raise ::ArgumentError, "request must be provided" if request.nil?
552
+
553
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceConfigRequest
554
+
555
+ # Converts hash and nil to an options object
556
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
557
+
558
+ # Customize the options with defaults
559
+ call_metadata = @config.rpcs.update_instance_config.metadata.to_h
560
+
561
+ # Set x-goog-api-client and x-goog-user-project headers
562
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
563
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
564
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
565
+ transports_version_send: [:rest]
566
+
567
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
568
+
569
+ options.apply_defaults timeout: @config.rpcs.update_instance_config.timeout,
570
+ metadata: call_metadata,
571
+ retry_policy: @config.rpcs.update_instance_config.retry_policy
572
+
573
+ options.apply_defaults timeout: @config.timeout,
574
+ metadata: @config.metadata,
575
+ retry_policy: @config.retry_policy
576
+
577
+ @instance_admin_stub.update_instance_config request, options do |result, operation|
578
+ result = ::Gapic::Operation.new result, @operations_client, options: options
579
+ yield result, operation if block_given?
580
+ return result
581
+ end
582
+ rescue ::Gapic::Rest::Error => e
583
+ raise ::Google::Cloud::Error.from_error(e)
584
+ end
585
+
586
+ ##
587
+ # Deletes the instance config. Deletion is only allowed when no
588
+ # instances are using the configuration. If any instances are using
589
+ # the config, returns `FAILED_PRECONDITION`.
590
+ #
591
+ # Only user managed configurations can be deleted.
592
+ #
593
+ # Authorization requires `spanner.instanceConfigs.delete` permission on
594
+ # the resource {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig#name name}.
595
+ #
596
+ # @overload delete_instance_config(request, options = nil)
597
+ # Pass arguments to `delete_instance_config` via a request object, either of type
598
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstanceConfigRequest} or an equivalent Hash.
599
+ #
600
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstanceConfigRequest, ::Hash]
601
+ # A request object representing the call parameters. Required. To specify no
602
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
603
+ # @param options [::Gapic::CallOptions, ::Hash]
604
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
605
+ #
606
+ # @overload delete_instance_config(name: nil, etag: nil, validate_only: nil)
607
+ # Pass arguments to `delete_instance_config` via keyword arguments. Note that at
608
+ # least one keyword argument is required. To specify no parameters, or to keep all
609
+ # the default parameter values, pass an empty Hash as a request object (see above).
610
+ #
611
+ # @param name [::String]
612
+ # Required. The name of the instance configuration to be deleted.
613
+ # Values are of the form
614
+ # `projects/<project>/instanceConfigs/<instance_config>`
615
+ # @param etag [::String]
616
+ # Used for optimistic concurrency control as a way to help prevent
617
+ # simultaneous deletes of an instance config from overwriting each
618
+ # other. If not empty, the API
619
+ # only deletes the instance config when the etag provided matches the current
620
+ # status of the requested instance config. Otherwise, deletes the instance
621
+ # config without checking the current status of the requested instance
622
+ # config.
623
+ # @param validate_only [::Boolean]
624
+ # An option to validate, but not actually execute, a request,
625
+ # and provide the same response.
626
+ # @yield [result, operation] Access the result along with the TransportOperation object
627
+ # @yieldparam result [::Google::Protobuf::Empty]
628
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
629
+ #
630
+ # @return [::Google::Protobuf::Empty]
631
+ #
632
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
633
+ def delete_instance_config request, options = nil
634
+ raise ::ArgumentError, "request must be provided" if request.nil?
635
+
636
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstanceConfigRequest
637
+
638
+ # Converts hash and nil to an options object
639
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
640
+
641
+ # Customize the options with defaults
642
+ call_metadata = @config.rpcs.delete_instance_config.metadata.to_h
643
+
644
+ # Set x-goog-api-client and x-goog-user-project headers
645
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
646
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
647
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
648
+ transports_version_send: [:rest]
649
+
650
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
651
+
652
+ options.apply_defaults timeout: @config.rpcs.delete_instance_config.timeout,
653
+ metadata: call_metadata,
654
+ retry_policy: @config.rpcs.delete_instance_config.retry_policy
655
+
656
+ options.apply_defaults timeout: @config.timeout,
657
+ metadata: @config.metadata,
658
+ retry_policy: @config.retry_policy
659
+
660
+ @instance_admin_stub.delete_instance_config request, options do |result, operation|
661
+ yield result, operation if block_given?
662
+ return result
663
+ end
664
+ rescue ::Gapic::Rest::Error => e
665
+ raise ::Google::Cloud::Error.from_error(e)
666
+ end
667
+
668
+ ##
669
+ # Lists the user-managed instance config [long-running
670
+ # operations][google.longrunning.Operation] in the given project. An instance
671
+ # config operation has a name of the form
672
+ # `projects/<project>/instanceConfigs/<instance_config>/operations/<operation>`.
673
+ # The long-running operation
674
+ # {::Google::Longrunning::Operation#metadata metadata} field type
675
+ # `metadata.type_url` describes the type of the metadata. Operations returned
676
+ # include those that have completed/failed/canceled within the last 7 days,
677
+ # and pending operations. Operations returned are ordered by
678
+ # `operation.metadata.value.start_time` in descending order starting
679
+ # from the most recently started operation.
680
+ #
681
+ # @overload list_instance_config_operations(request, options = nil)
682
+ # Pass arguments to `list_instance_config_operations` via a request object, either of type
683
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigOperationsRequest} or an equivalent Hash.
684
+ #
685
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigOperationsRequest, ::Hash]
686
+ # A request object representing the call parameters. Required. To specify no
687
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
688
+ # @param options [::Gapic::CallOptions, ::Hash]
689
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
690
+ #
691
+ # @overload list_instance_config_operations(parent: nil, filter: nil, page_size: nil, page_token: nil)
692
+ # Pass arguments to `list_instance_config_operations` via keyword arguments. Note that at
693
+ # least one keyword argument is required. To specify no parameters, or to keep all
694
+ # the default parameter values, pass an empty Hash as a request object (see above).
695
+ #
696
+ # @param parent [::String]
697
+ # Required. The project of the instance config operations.
698
+ # Values are of the form `projects/<project>`.
699
+ # @param filter [::String]
700
+ # An expression that filters the list of returned operations.
701
+ #
702
+ # A filter expression consists of a field name, a
703
+ # comparison operator, and a value for filtering.
704
+ # The value must be a string, a number, or a boolean. The comparison operator
705
+ # must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
706
+ # Colon `:` is the contains operator. Filter rules are not case sensitive.
707
+ #
708
+ # The following fields in the {::Google::Longrunning::Operation Operation}
709
+ # are eligible for filtering:
710
+ #
711
+ # * `name` - The name of the long-running operation
712
+ # * `done` - False if the operation is in progress, else true.
713
+ # * `metadata.@type` - the type of metadata. For example, the type string
714
+ # for
715
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceConfigMetadata CreateInstanceConfigMetadata}
716
+ # is
717
+ # `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`.
718
+ # * `metadata.<field_name>` - any field in metadata.value.
719
+ # `metadata.@type` must be specified first, if filtering on metadata
720
+ # fields.
721
+ # * `error` - Error associated with the long-running operation.
722
+ # * `response.@type` - the type of response.
723
+ # * `response.<field_name>` - any field in response.value.
724
+ #
725
+ # You can combine multiple expressions by enclosing each expression in
726
+ # parentheses. By default, expressions are combined with AND logic. However,
727
+ # you can specify AND, OR, and NOT logic explicitly.
728
+ #
729
+ # Here are a few examples:
730
+ #
731
+ # * `done:true` - The operation is complete.
732
+ # * `(metadata.@type=` \
733
+ # `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata)
734
+ # AND` \
735
+ # `(metadata.instance_config.name:custom-config) AND` \
736
+ # `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \
737
+ # `(error:*)` - Return operations where:
738
+ # * The operation's metadata type is
739
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceConfigMetadata CreateInstanceConfigMetadata}.
740
+ # * The instance config name contains "custom-config".
741
+ # * The operation started before 2021-03-28T14:50:00Z.
742
+ # * The operation resulted in an error.
743
+ # @param page_size [::Integer]
744
+ # Number of operations to be returned in the response. If 0 or
745
+ # less, defaults to the server's maximum allowed page size.
746
+ # @param page_token [::String]
747
+ # If non-empty, `page_token` should contain a
748
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigOperationsResponse#next_page_token next_page_token}
749
+ # from a previous
750
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigOperationsResponse ListInstanceConfigOperationsResponse}
751
+ # to the same `parent` and with the same `filter`.
752
+ # @yield [result, operation] Access the result along with the TransportOperation object
753
+ # @yieldparam result [::Gapic::Operation]
754
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
755
+ #
756
+ # @return [::Gapic::Operation]
757
+ #
758
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
759
+ def list_instance_config_operations request, options = nil
760
+ raise ::ArgumentError, "request must be provided" if request.nil?
761
+
762
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigOperationsRequest
763
+
764
+ # Converts hash and nil to an options object
765
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
766
+
767
+ # Customize the options with defaults
768
+ call_metadata = @config.rpcs.list_instance_config_operations.metadata.to_h
769
+
770
+ # Set x-goog-api-client and x-goog-user-project headers
771
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
772
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
773
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
774
+ transports_version_send: [:rest]
775
+
776
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
777
+
778
+ options.apply_defaults timeout: @config.rpcs.list_instance_config_operations.timeout,
779
+ metadata: call_metadata,
780
+ retry_policy: @config.rpcs.list_instance_config_operations.retry_policy
781
+
782
+ options.apply_defaults timeout: @config.timeout,
783
+ metadata: @config.metadata,
784
+ retry_policy: @config.retry_policy
785
+
786
+ @instance_admin_stub.list_instance_config_operations request, options do |result, operation|
787
+ result = ::Gapic::Rest::PagedEnumerable.new @instance_admin_stub, :list_instance_config_operations, "operations", request, result, options
788
+ yield result, operation if block_given?
789
+ return result
790
+ end
791
+ rescue ::Gapic::Rest::Error => e
792
+ raise ::Google::Cloud::Error.from_error(e)
793
+ end
794
+
795
+ ##
796
+ # Lists all instances in the given project.
797
+ #
798
+ # @overload list_instances(request, options = nil)
799
+ # Pass arguments to `list_instances` via a request object, either of type
800
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesRequest} or an equivalent Hash.
801
+ #
802
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesRequest, ::Hash]
803
+ # A request object representing the call parameters. Required. To specify no
804
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
805
+ # @param options [::Gapic::CallOptions, ::Hash]
806
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
807
+ #
808
+ # @overload list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil)
809
+ # Pass arguments to `list_instances` via keyword arguments. Note that at
810
+ # least one keyword argument is required. To specify no parameters, or to keep all
811
+ # the default parameter values, pass an empty Hash as a request object (see above).
812
+ #
813
+ # @param parent [::String]
814
+ # Required. The name of the project for which a list of instances is
815
+ # requested. Values are of the form `projects/<project>`.
816
+ # @param page_size [::Integer]
817
+ # Number of instances to be returned in the response. If 0 or less, defaults
818
+ # to the server's maximum allowed page size.
819
+ # @param page_token [::String]
820
+ # If non-empty, `page_token` should contain a
821
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesResponse#next_page_token next_page_token}
822
+ # from a previous
823
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesResponse ListInstancesResponse}.
824
+ # @param filter [::String]
825
+ # An expression for filtering the results of the request. Filter rules are
826
+ # case insensitive. The fields eligible for filtering are:
827
+ #
828
+ # * `name`
829
+ # * `display_name`
830
+ # * `labels.key` where key is the name of a label
831
+ #
832
+ # Some examples of using filters are:
833
+ #
834
+ # * `name:*` --> The instance has a name.
835
+ # * `name:Howl` --> The instance's name contains the string "howl".
836
+ # * `name:HOWL` --> Equivalent to above.
837
+ # * `NAME:howl` --> Equivalent to above.
838
+ # * `labels.env:*` --> The instance has the label "env".
839
+ # * `labels.env:dev` --> The instance has the label "env" and the value of
840
+ # the label contains the string "dev".
841
+ # * `name:howl labels.env:dev` --> The instance's name contains "howl" and
842
+ # it has the label "env" with its value
843
+ # containing "dev".
844
+ # @yield [result, operation] Access the result along with the TransportOperation object
845
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::Instance>]
846
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
847
+ #
848
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::Instance>]
849
+ #
850
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
851
+ def list_instances request, options = nil
852
+ raise ::ArgumentError, "request must be provided" if request.nil?
853
+
854
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesRequest
855
+
856
+ # Converts hash and nil to an options object
857
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
858
+
859
+ # Customize the options with defaults
860
+ call_metadata = @config.rpcs.list_instances.metadata.to_h
861
+
862
+ # Set x-goog-api-client and x-goog-user-project headers
863
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
864
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
865
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
866
+ transports_version_send: [:rest]
867
+
868
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
869
+
870
+ options.apply_defaults timeout: @config.rpcs.list_instances.timeout,
871
+ metadata: call_metadata,
872
+ retry_policy: @config.rpcs.list_instances.retry_policy
873
+
874
+ options.apply_defaults timeout: @config.timeout,
875
+ metadata: @config.metadata,
876
+ retry_policy: @config.retry_policy
877
+
878
+ @instance_admin_stub.list_instances request, options do |result, operation|
879
+ result = ::Gapic::Rest::PagedEnumerable.new @instance_admin_stub, :list_instances, "instances", request, result, options
880
+ yield result, operation if block_given?
881
+ return result
882
+ end
883
+ rescue ::Gapic::Rest::Error => e
884
+ raise ::Google::Cloud::Error.from_error(e)
885
+ end
886
+
887
+ ##
888
+ # Gets information about a particular instance.
889
+ #
890
+ # @overload get_instance(request, options = nil)
891
+ # Pass arguments to `get_instance` via a request object, either of type
892
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::GetInstanceRequest} or an equivalent Hash.
893
+ #
894
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::GetInstanceRequest, ::Hash]
895
+ # A request object representing the call parameters. Required. To specify no
896
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
897
+ # @param options [::Gapic::CallOptions, ::Hash]
898
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
899
+ #
900
+ # @overload get_instance(name: nil, field_mask: nil)
901
+ # Pass arguments to `get_instance` via keyword arguments. Note that at
902
+ # least one keyword argument is required. To specify no parameters, or to keep all
903
+ # the default parameter values, pass an empty Hash as a request object (see above).
904
+ #
905
+ # @param name [::String]
906
+ # Required. The name of the requested instance. Values are of the form
907
+ # `projects/<project>/instances/<instance>`.
908
+ # @param field_mask [::Google::Protobuf::FieldMask, ::Hash]
909
+ # If field_mask is present, specifies the subset of
910
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::Instance Instance} fields that should be
911
+ # returned. If absent, all
912
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::Instance Instance} fields are returned.
913
+ # @yield [result, operation] Access the result along with the TransportOperation object
914
+ # @yieldparam result [::Google::Cloud::Spanner::Admin::Instance::V1::Instance]
915
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
916
+ #
917
+ # @return [::Google::Cloud::Spanner::Admin::Instance::V1::Instance]
918
+ #
919
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
920
+ def get_instance request, options = nil
921
+ raise ::ArgumentError, "request must be provided" if request.nil?
922
+
923
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::GetInstanceRequest
924
+
925
+ # Converts hash and nil to an options object
926
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
927
+
928
+ # Customize the options with defaults
929
+ call_metadata = @config.rpcs.get_instance.metadata.to_h
930
+
931
+ # Set x-goog-api-client and x-goog-user-project headers
932
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
933
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
934
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
935
+ transports_version_send: [:rest]
936
+
937
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
938
+
939
+ options.apply_defaults timeout: @config.rpcs.get_instance.timeout,
940
+ metadata: call_metadata,
941
+ retry_policy: @config.rpcs.get_instance.retry_policy
942
+
943
+ options.apply_defaults timeout: @config.timeout,
944
+ metadata: @config.metadata,
945
+ retry_policy: @config.retry_policy
946
+
947
+ @instance_admin_stub.get_instance request, options do |result, operation|
948
+ yield result, operation if block_given?
949
+ return result
950
+ end
951
+ rescue ::Gapic::Rest::Error => e
952
+ raise ::Google::Cloud::Error.from_error(e)
953
+ end
954
+
955
+ ##
956
+ # Creates an instance and begins preparing it to begin serving. The
957
+ # returned {::Google::Longrunning::Operation long-running operation}
958
+ # can be used to track the progress of preparing the new
959
+ # instance. The instance name is assigned by the caller. If the
960
+ # named instance already exists, `CreateInstance` returns
961
+ # `ALREADY_EXISTS`.
962
+ #
963
+ # Immediately upon completion of this request:
964
+ #
965
+ # * The instance is readable via the API, with all requested attributes
966
+ # but no allocated resources. Its state is `CREATING`.
967
+ #
968
+ # Until completion of the returned operation:
969
+ #
970
+ # * Cancelling the operation renders the instance immediately unreadable
971
+ # via the API.
972
+ # * The instance can be deleted.
973
+ # * All other attempts to modify the instance are rejected.
974
+ #
975
+ # Upon completion of the returned operation:
976
+ #
977
+ # * Billing for all successfully-allocated resources begins (some types
978
+ # may have lower than the requested levels).
979
+ # * Databases can be created in the instance.
980
+ # * The instance's allocated resource levels are readable via the API.
981
+ # * The instance's state becomes `READY`.
982
+ #
983
+ # The returned {::Google::Longrunning::Operation long-running operation} will
984
+ # have a name of the format `<instance_name>/operations/<operation_id>` and
985
+ # can be used to track creation of the instance. The
986
+ # {::Google::Longrunning::Operation#metadata metadata} field type is
987
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceMetadata CreateInstanceMetadata}.
988
+ # The {::Google::Longrunning::Operation#response response} field type is
989
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::Instance Instance}, if successful.
990
+ #
991
+ # @overload create_instance(request, options = nil)
992
+ # Pass arguments to `create_instance` via a request object, either of type
993
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceRequest} or an equivalent Hash.
994
+ #
995
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceRequest, ::Hash]
996
+ # A request object representing the call parameters. Required. To specify no
997
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
998
+ # @param options [::Gapic::CallOptions, ::Hash]
999
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1000
+ #
1001
+ # @overload create_instance(parent: nil, instance_id: nil, instance: nil)
1002
+ # Pass arguments to `create_instance` via keyword arguments. Note that at
1003
+ # least one keyword argument is required. To specify no parameters, or to keep all
1004
+ # the default parameter values, pass an empty Hash as a request object (see above).
1005
+ #
1006
+ # @param parent [::String]
1007
+ # Required. The name of the project in which to create the instance. Values
1008
+ # are of the form `projects/<project>`.
1009
+ # @param instance_id [::String]
1010
+ # Required. The ID of the instance to create. Valid identifiers are of the
1011
+ # form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in
1012
+ # length.
1013
+ # @param instance [::Google::Cloud::Spanner::Admin::Instance::V1::Instance, ::Hash]
1014
+ # Required. The instance to create. The name may be omitted, but if
1015
+ # specified must be `<parent>/instances/<instance_id>`.
1016
+ # @yield [result, operation] Access the result along with the TransportOperation object
1017
+ # @yieldparam result [::Gapic::Operation]
1018
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1019
+ #
1020
+ # @return [::Gapic::Operation]
1021
+ #
1022
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1023
+ def create_instance request, options = nil
1024
+ raise ::ArgumentError, "request must be provided" if request.nil?
1025
+
1026
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceRequest
1027
+
1028
+ # Converts hash and nil to an options object
1029
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1030
+
1031
+ # Customize the options with defaults
1032
+ call_metadata = @config.rpcs.create_instance.metadata.to_h
1033
+
1034
+ # Set x-goog-api-client and x-goog-user-project headers
1035
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1036
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1037
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
1038
+ transports_version_send: [:rest]
1039
+
1040
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1041
+
1042
+ options.apply_defaults timeout: @config.rpcs.create_instance.timeout,
1043
+ metadata: call_metadata,
1044
+ retry_policy: @config.rpcs.create_instance.retry_policy
1045
+
1046
+ options.apply_defaults timeout: @config.timeout,
1047
+ metadata: @config.metadata,
1048
+ retry_policy: @config.retry_policy
1049
+
1050
+ @instance_admin_stub.create_instance request, options do |result, operation|
1051
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1052
+ yield result, operation if block_given?
1053
+ return result
1054
+ end
1055
+ rescue ::Gapic::Rest::Error => e
1056
+ raise ::Google::Cloud::Error.from_error(e)
1057
+ end
1058
+
1059
+ ##
1060
+ # Updates an instance, and begins allocating or releasing resources
1061
+ # as requested. The returned [long-running
1062
+ # operation][google.longrunning.Operation] can be used to track the
1063
+ # progress of updating the instance. If the named instance does not
1064
+ # exist, returns `NOT_FOUND`.
1065
+ #
1066
+ # Immediately upon completion of this request:
1067
+ #
1068
+ # * For resource types for which a decrease in the instance's allocation
1069
+ # has been requested, billing is based on the newly-requested level.
1070
+ #
1071
+ # Until completion of the returned operation:
1072
+ #
1073
+ # * Cancelling the operation sets its metadata's
1074
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceMetadata#cancel_time cancel_time},
1075
+ # and begins restoring resources to their pre-request values. The
1076
+ # operation is guaranteed to succeed at undoing all resource changes,
1077
+ # after which point it terminates with a `CANCELLED` status.
1078
+ # * All other attempts to modify the instance are rejected.
1079
+ # * Reading the instance via the API continues to give the pre-request
1080
+ # resource levels.
1081
+ #
1082
+ # Upon completion of the returned operation:
1083
+ #
1084
+ # * Billing begins for all successfully-allocated resources (some types
1085
+ # may have lower than the requested levels).
1086
+ # * All newly-reserved resources are available for serving the instance's
1087
+ # tables.
1088
+ # * The instance's new resource levels are readable via the API.
1089
+ #
1090
+ # The returned {::Google::Longrunning::Operation long-running operation} will
1091
+ # have a name of the format `<instance_name>/operations/<operation_id>` and
1092
+ # can be used to track the instance modification. The
1093
+ # {::Google::Longrunning::Operation#metadata metadata} field type is
1094
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceMetadata UpdateInstanceMetadata}.
1095
+ # The {::Google::Longrunning::Operation#response response} field type is
1096
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::Instance Instance}, if successful.
1097
+ #
1098
+ # Authorization requires `spanner.instances.update` permission on
1099
+ # the resource {::Google::Cloud::Spanner::Admin::Instance::V1::Instance#name name}.
1100
+ #
1101
+ # @overload update_instance(request, options = nil)
1102
+ # Pass arguments to `update_instance` via a request object, either of type
1103
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceRequest} or an equivalent Hash.
1104
+ #
1105
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceRequest, ::Hash]
1106
+ # A request object representing the call parameters. Required. To specify no
1107
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1108
+ # @param options [::Gapic::CallOptions, ::Hash]
1109
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1110
+ #
1111
+ # @overload update_instance(instance: nil, field_mask: nil)
1112
+ # Pass arguments to `update_instance` via keyword arguments. Note that at
1113
+ # least one keyword argument is required. To specify no parameters, or to keep all
1114
+ # the default parameter values, pass an empty Hash as a request object (see above).
1115
+ #
1116
+ # @param instance [::Google::Cloud::Spanner::Admin::Instance::V1::Instance, ::Hash]
1117
+ # Required. The instance to update, which must always include the instance
1118
+ # name. Otherwise, only fields mentioned in
1119
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceRequest#field_mask field_mask}
1120
+ # need be included.
1121
+ # @param field_mask [::Google::Protobuf::FieldMask, ::Hash]
1122
+ # Required. A mask specifying which fields in
1123
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::Instance Instance} should be updated.
1124
+ # The field mask must always be specified; this prevents any future fields in
1125
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::Instance Instance} from being erased
1126
+ # accidentally by clients that do not know about them.
1127
+ # @yield [result, operation] Access the result along with the TransportOperation object
1128
+ # @yieldparam result [::Gapic::Operation]
1129
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1130
+ #
1131
+ # @return [::Gapic::Operation]
1132
+ #
1133
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1134
+ def update_instance request, options = nil
1135
+ raise ::ArgumentError, "request must be provided" if request.nil?
1136
+
1137
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceRequest
1138
+
1139
+ # Converts hash and nil to an options object
1140
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1141
+
1142
+ # Customize the options with defaults
1143
+ call_metadata = @config.rpcs.update_instance.metadata.to_h
1144
+
1145
+ # Set x-goog-api-client and x-goog-user-project headers
1146
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1147
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1148
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
1149
+ transports_version_send: [:rest]
1150
+
1151
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1152
+
1153
+ options.apply_defaults timeout: @config.rpcs.update_instance.timeout,
1154
+ metadata: call_metadata,
1155
+ retry_policy: @config.rpcs.update_instance.retry_policy
1156
+
1157
+ options.apply_defaults timeout: @config.timeout,
1158
+ metadata: @config.metadata,
1159
+ retry_policy: @config.retry_policy
1160
+
1161
+ @instance_admin_stub.update_instance request, options do |result, operation|
1162
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1163
+ yield result, operation if block_given?
1164
+ return result
1165
+ end
1166
+ rescue ::Gapic::Rest::Error => e
1167
+ raise ::Google::Cloud::Error.from_error(e)
1168
+ end
1169
+
1170
+ ##
1171
+ # Deletes an instance.
1172
+ #
1173
+ # Immediately upon completion of the request:
1174
+ #
1175
+ # * Billing ceases for all of the instance's reserved resources.
1176
+ #
1177
+ # Soon afterward:
1178
+ #
1179
+ # * The instance and *all of its databases* immediately and
1180
+ # irrevocably disappear from the API. All data in the databases
1181
+ # is permanently deleted.
1182
+ #
1183
+ # @overload delete_instance(request, options = nil)
1184
+ # Pass arguments to `delete_instance` via a request object, either of type
1185
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstanceRequest} or an equivalent Hash.
1186
+ #
1187
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstanceRequest, ::Hash]
1188
+ # A request object representing the call parameters. Required. To specify no
1189
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1190
+ # @param options [::Gapic::CallOptions, ::Hash]
1191
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1192
+ #
1193
+ # @overload delete_instance(name: nil)
1194
+ # Pass arguments to `delete_instance` via keyword arguments. Note that at
1195
+ # least one keyword argument is required. To specify no parameters, or to keep all
1196
+ # the default parameter values, pass an empty Hash as a request object (see above).
1197
+ #
1198
+ # @param name [::String]
1199
+ # Required. The name of the instance to be deleted. Values are of the form
1200
+ # `projects/<project>/instances/<instance>`
1201
+ # @yield [result, operation] Access the result along with the TransportOperation object
1202
+ # @yieldparam result [::Google::Protobuf::Empty]
1203
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1204
+ #
1205
+ # @return [::Google::Protobuf::Empty]
1206
+ #
1207
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1208
+ def delete_instance request, options = nil
1209
+ raise ::ArgumentError, "request must be provided" if request.nil?
1210
+
1211
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstanceRequest
1212
+
1213
+ # Converts hash and nil to an options object
1214
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1215
+
1216
+ # Customize the options with defaults
1217
+ call_metadata = @config.rpcs.delete_instance.metadata.to_h
1218
+
1219
+ # Set x-goog-api-client and x-goog-user-project headers
1220
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1221
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1222
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
1223
+ transports_version_send: [:rest]
1224
+
1225
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1226
+
1227
+ options.apply_defaults timeout: @config.rpcs.delete_instance.timeout,
1228
+ metadata: call_metadata,
1229
+ retry_policy: @config.rpcs.delete_instance.retry_policy
1230
+
1231
+ options.apply_defaults timeout: @config.timeout,
1232
+ metadata: @config.metadata,
1233
+ retry_policy: @config.retry_policy
1234
+
1235
+ @instance_admin_stub.delete_instance request, options do |result, operation|
1236
+ yield result, operation if block_given?
1237
+ return result
1238
+ end
1239
+ rescue ::Gapic::Rest::Error => e
1240
+ raise ::Google::Cloud::Error.from_error(e)
1241
+ end
1242
+
1243
+ ##
1244
+ # Sets the access control policy on an instance resource. Replaces any
1245
+ # existing policy.
1246
+ #
1247
+ # Authorization requires `spanner.instances.setIamPolicy` on
1248
+ # {::Google::Iam::V1::SetIamPolicyRequest#resource resource}.
1249
+ #
1250
+ # @overload set_iam_policy(request, options = nil)
1251
+ # Pass arguments to `set_iam_policy` via a request object, either of type
1252
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
1253
+ #
1254
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
1255
+ # A request object representing the call parameters. Required. To specify no
1256
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1257
+ # @param options [::Gapic::CallOptions, ::Hash]
1258
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1259
+ #
1260
+ # @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
1261
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
1262
+ # least one keyword argument is required. To specify no parameters, or to keep all
1263
+ # the default parameter values, pass an empty Hash as a request object (see above).
1264
+ #
1265
+ # @param resource [::String]
1266
+ # REQUIRED: The resource for which the policy is being specified.
1267
+ # See the operation documentation for the appropriate value for this field.
1268
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
1269
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
1270
+ # the policy is limited to a few 10s of KB. An empty policy is a
1271
+ # valid policy but certain Cloud Platform services (such as Projects)
1272
+ # might reject them.
1273
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1274
+ # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
1275
+ # the fields in the mask will be modified. If no mask is provided, the
1276
+ # following default mask is used:
1277
+ #
1278
+ # `paths: "bindings, etag"`
1279
+ # @yield [result, operation] Access the result along with the TransportOperation object
1280
+ # @yieldparam result [::Google::Iam::V1::Policy]
1281
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1282
+ #
1283
+ # @return [::Google::Iam::V1::Policy]
1284
+ #
1285
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1286
+ def set_iam_policy request, options = nil
1287
+ raise ::ArgumentError, "request must be provided" if request.nil?
1288
+
1289
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
1290
+
1291
+ # Converts hash and nil to an options object
1292
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1293
+
1294
+ # Customize the options with defaults
1295
+ call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
1296
+
1297
+ # Set x-goog-api-client and x-goog-user-project headers
1298
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1299
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1300
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
1301
+ transports_version_send: [:rest]
1302
+
1303
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1304
+
1305
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
1306
+ metadata: call_metadata,
1307
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
1308
+
1309
+ options.apply_defaults timeout: @config.timeout,
1310
+ metadata: @config.metadata,
1311
+ retry_policy: @config.retry_policy
1312
+
1313
+ @instance_admin_stub.set_iam_policy request, options do |result, operation|
1314
+ yield result, operation if block_given?
1315
+ return result
1316
+ end
1317
+ rescue ::Gapic::Rest::Error => e
1318
+ raise ::Google::Cloud::Error.from_error(e)
1319
+ end
1320
+
1321
+ ##
1322
+ # Gets the access control policy for an instance resource. Returns an empty
1323
+ # policy if an instance exists but does not have a policy set.
1324
+ #
1325
+ # Authorization requires `spanner.instances.getIamPolicy` on
1326
+ # {::Google::Iam::V1::GetIamPolicyRequest#resource resource}.
1327
+ #
1328
+ # @overload get_iam_policy(request, options = nil)
1329
+ # Pass arguments to `get_iam_policy` via a request object, either of type
1330
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
1331
+ #
1332
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
1333
+ # A request object representing the call parameters. Required. To specify no
1334
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1335
+ # @param options [::Gapic::CallOptions, ::Hash]
1336
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1337
+ #
1338
+ # @overload get_iam_policy(resource: nil, options: nil)
1339
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
1340
+ # least one keyword argument is required. To specify no parameters, or to keep all
1341
+ # the default parameter values, pass an empty Hash as a request object (see above).
1342
+ #
1343
+ # @param resource [::String]
1344
+ # REQUIRED: The resource for which the policy is being requested.
1345
+ # See the operation documentation for the appropriate value for this field.
1346
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
1347
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
1348
+ # `GetIamPolicy`.
1349
+ # @yield [result, operation] Access the result along with the TransportOperation object
1350
+ # @yieldparam result [::Google::Iam::V1::Policy]
1351
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1352
+ #
1353
+ # @return [::Google::Iam::V1::Policy]
1354
+ #
1355
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1356
+ def get_iam_policy request, options = nil
1357
+ raise ::ArgumentError, "request must be provided" if request.nil?
1358
+
1359
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
1360
+
1361
+ # Converts hash and nil to an options object
1362
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1363
+
1364
+ # Customize the options with defaults
1365
+ call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
1366
+
1367
+ # Set x-goog-api-client and x-goog-user-project headers
1368
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1369
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1370
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
1371
+ transports_version_send: [:rest]
1372
+
1373
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1374
+
1375
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
1376
+ metadata: call_metadata,
1377
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
1378
+
1379
+ options.apply_defaults timeout: @config.timeout,
1380
+ metadata: @config.metadata,
1381
+ retry_policy: @config.retry_policy
1382
+
1383
+ @instance_admin_stub.get_iam_policy request, options do |result, operation|
1384
+ yield result, operation if block_given?
1385
+ return result
1386
+ end
1387
+ rescue ::Gapic::Rest::Error => e
1388
+ raise ::Google::Cloud::Error.from_error(e)
1389
+ end
1390
+
1391
+ ##
1392
+ # Returns permissions that the caller has on the specified instance resource.
1393
+ #
1394
+ # Attempting this RPC on a non-existent Cloud Spanner instance resource will
1395
+ # result in a NOT_FOUND error if the user has `spanner.instances.list`
1396
+ # permission on the containing Google Cloud Project. Otherwise returns an
1397
+ # empty set of permissions.
1398
+ #
1399
+ # @overload test_iam_permissions(request, options = nil)
1400
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
1401
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
1402
+ #
1403
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
1404
+ # A request object representing the call parameters. Required. To specify no
1405
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1406
+ # @param options [::Gapic::CallOptions, ::Hash]
1407
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1408
+ #
1409
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
1410
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
1411
+ # least one keyword argument is required. To specify no parameters, or to keep all
1412
+ # the default parameter values, pass an empty Hash as a request object (see above).
1413
+ #
1414
+ # @param resource [::String]
1415
+ # REQUIRED: The resource for which the policy detail is being requested.
1416
+ # See the operation documentation for the appropriate value for this field.
1417
+ # @param permissions [::Array<::String>]
1418
+ # The set of permissions to check for the `resource`. Permissions with
1419
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
1420
+ # information see
1421
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
1422
+ # @yield [result, operation] Access the result along with the TransportOperation object
1423
+ # @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse]
1424
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1425
+ #
1426
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
1427
+ #
1428
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1429
+ def test_iam_permissions request, options = nil
1430
+ raise ::ArgumentError, "request must be provided" if request.nil?
1431
+
1432
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
1433
+
1434
+ # Converts hash and nil to an options object
1435
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1436
+
1437
+ # Customize the options with defaults
1438
+ call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
1439
+
1440
+ # Set x-goog-api-client and x-goog-user-project headers
1441
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1442
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1443
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
1444
+ transports_version_send: [:rest]
1445
+
1446
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1447
+
1448
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
1449
+ metadata: call_metadata,
1450
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
1451
+
1452
+ options.apply_defaults timeout: @config.timeout,
1453
+ metadata: @config.metadata,
1454
+ retry_policy: @config.retry_policy
1455
+
1456
+ @instance_admin_stub.test_iam_permissions request, options do |result, operation|
1457
+ yield result, operation if block_given?
1458
+ return result
1459
+ end
1460
+ rescue ::Gapic::Rest::Error => e
1461
+ raise ::Google::Cloud::Error.from_error(e)
1462
+ end
1463
+
1464
+ ##
1465
+ # Configuration class for the InstanceAdmin REST API.
1466
+ #
1467
+ # This class represents the configuration for InstanceAdmin REST,
1468
+ # providing control over timeouts, retry behavior, logging, transport
1469
+ # parameters, and other low-level controls. Certain parameters can also be
1470
+ # applied individually to specific RPCs. See
1471
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Client::Configuration::Rpcs}
1472
+ # for a list of RPCs that can be configured independently.
1473
+ #
1474
+ # Configuration can be applied globally to all clients, or to a single client
1475
+ # on construction.
1476
+ #
1477
+ # @example
1478
+ #
1479
+ # # Modify the global config, setting the timeout for
1480
+ # # list_instance_configs to 20 seconds,
1481
+ # # and all remaining timeouts to 10 seconds.
1482
+ # ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Client.configure do |config|
1483
+ # config.timeout = 10.0
1484
+ # config.rpcs.list_instance_configs.timeout = 20.0
1485
+ # end
1486
+ #
1487
+ # # Apply the above configuration only to a new client.
1488
+ # client = ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Client.new do |config|
1489
+ # config.timeout = 10.0
1490
+ # config.rpcs.list_instance_configs.timeout = 20.0
1491
+ # end
1492
+ #
1493
+ # @!attribute [rw] endpoint
1494
+ # The hostname or hostname:port of the service endpoint.
1495
+ # Defaults to `"spanner.googleapis.com"`.
1496
+ # @return [::String]
1497
+ # @!attribute [rw] credentials
1498
+ # Credentials to send with calls. You may provide any of the following types:
1499
+ # * (`String`) The path to a service account key file in JSON format
1500
+ # * (`Hash`) A service account key as a Hash
1501
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1502
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1503
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1504
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1505
+ # * (`nil`) indicating no credentials
1506
+ # @return [::Object]
1507
+ # @!attribute [rw] scope
1508
+ # The OAuth scopes
1509
+ # @return [::Array<::String>]
1510
+ # @!attribute [rw] lib_name
1511
+ # The library name as recorded in instrumentation and logging
1512
+ # @return [::String]
1513
+ # @!attribute [rw] lib_version
1514
+ # The library version as recorded in instrumentation and logging
1515
+ # @return [::String]
1516
+ # @!attribute [rw] timeout
1517
+ # The call timeout in seconds.
1518
+ # @return [::Numeric]
1519
+ # @!attribute [rw] metadata
1520
+ # Additional headers to be sent with the call.
1521
+ # @return [::Hash{::Symbol=>::String}]
1522
+ # @!attribute [rw] retry_policy
1523
+ # The retry policy. The value is a hash with the following keys:
1524
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1525
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1526
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1527
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1528
+ # trigger a retry.
1529
+ # @return [::Hash]
1530
+ # @!attribute [rw] quota_project
1531
+ # A separate project against which to charge quota.
1532
+ # @return [::String]
1533
+ #
1534
+ class Configuration
1535
+ extend ::Gapic::Config
1536
+
1537
+ config_attr :endpoint, "spanner.googleapis.com", ::String
1538
+ config_attr :credentials, nil do |value|
1539
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1540
+ allowed.any? { |klass| klass === value }
1541
+ end
1542
+ config_attr :scope, nil, ::String, ::Array, nil
1543
+ config_attr :lib_name, nil, ::String, nil
1544
+ config_attr :lib_version, nil, ::String, nil
1545
+ config_attr :timeout, nil, ::Numeric, nil
1546
+ config_attr :metadata, nil, ::Hash, nil
1547
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1548
+ config_attr :quota_project, nil, ::String, nil
1549
+
1550
+ # @private
1551
+ def initialize parent_config = nil
1552
+ @parent_config = parent_config unless parent_config.nil?
1553
+
1554
+ yield self if block_given?
1555
+ end
1556
+
1557
+ ##
1558
+ # Configurations for individual RPCs
1559
+ # @return [Rpcs]
1560
+ #
1561
+ def rpcs
1562
+ @rpcs ||= begin
1563
+ parent_rpcs = nil
1564
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1565
+ Rpcs.new parent_rpcs
1566
+ end
1567
+ end
1568
+
1569
+ ##
1570
+ # Configuration RPC class for the InstanceAdmin API.
1571
+ #
1572
+ # Includes fields providing the configuration for each RPC in this service.
1573
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1574
+ # the following configuration fields:
1575
+ #
1576
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1577
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1578
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1579
+ # include the following keys:
1580
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1581
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1582
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1583
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1584
+ # trigger a retry.
1585
+ #
1586
+ class Rpcs
1587
+ ##
1588
+ # RPC-specific configuration for `list_instance_configs`
1589
+ # @return [::Gapic::Config::Method]
1590
+ #
1591
+ attr_reader :list_instance_configs
1592
+ ##
1593
+ # RPC-specific configuration for `get_instance_config`
1594
+ # @return [::Gapic::Config::Method]
1595
+ #
1596
+ attr_reader :get_instance_config
1597
+ ##
1598
+ # RPC-specific configuration for `create_instance_config`
1599
+ # @return [::Gapic::Config::Method]
1600
+ #
1601
+ attr_reader :create_instance_config
1602
+ ##
1603
+ # RPC-specific configuration for `update_instance_config`
1604
+ # @return [::Gapic::Config::Method]
1605
+ #
1606
+ attr_reader :update_instance_config
1607
+ ##
1608
+ # RPC-specific configuration for `delete_instance_config`
1609
+ # @return [::Gapic::Config::Method]
1610
+ #
1611
+ attr_reader :delete_instance_config
1612
+ ##
1613
+ # RPC-specific configuration for `list_instance_config_operations`
1614
+ # @return [::Gapic::Config::Method]
1615
+ #
1616
+ attr_reader :list_instance_config_operations
1617
+ ##
1618
+ # RPC-specific configuration for `list_instances`
1619
+ # @return [::Gapic::Config::Method]
1620
+ #
1621
+ attr_reader :list_instances
1622
+ ##
1623
+ # RPC-specific configuration for `get_instance`
1624
+ # @return [::Gapic::Config::Method]
1625
+ #
1626
+ attr_reader :get_instance
1627
+ ##
1628
+ # RPC-specific configuration for `create_instance`
1629
+ # @return [::Gapic::Config::Method]
1630
+ #
1631
+ attr_reader :create_instance
1632
+ ##
1633
+ # RPC-specific configuration for `update_instance`
1634
+ # @return [::Gapic::Config::Method]
1635
+ #
1636
+ attr_reader :update_instance
1637
+ ##
1638
+ # RPC-specific configuration for `delete_instance`
1639
+ # @return [::Gapic::Config::Method]
1640
+ #
1641
+ attr_reader :delete_instance
1642
+ ##
1643
+ # RPC-specific configuration for `set_iam_policy`
1644
+ # @return [::Gapic::Config::Method]
1645
+ #
1646
+ attr_reader :set_iam_policy
1647
+ ##
1648
+ # RPC-specific configuration for `get_iam_policy`
1649
+ # @return [::Gapic::Config::Method]
1650
+ #
1651
+ attr_reader :get_iam_policy
1652
+ ##
1653
+ # RPC-specific configuration for `test_iam_permissions`
1654
+ # @return [::Gapic::Config::Method]
1655
+ #
1656
+ attr_reader :test_iam_permissions
1657
+
1658
+ # @private
1659
+ def initialize parent_rpcs = nil
1660
+ list_instance_configs_config = parent_rpcs.list_instance_configs if parent_rpcs.respond_to? :list_instance_configs
1661
+ @list_instance_configs = ::Gapic::Config::Method.new list_instance_configs_config
1662
+ get_instance_config_config = parent_rpcs.get_instance_config if parent_rpcs.respond_to? :get_instance_config
1663
+ @get_instance_config = ::Gapic::Config::Method.new get_instance_config_config
1664
+ create_instance_config_config = parent_rpcs.create_instance_config if parent_rpcs.respond_to? :create_instance_config
1665
+ @create_instance_config = ::Gapic::Config::Method.new create_instance_config_config
1666
+ update_instance_config_config = parent_rpcs.update_instance_config if parent_rpcs.respond_to? :update_instance_config
1667
+ @update_instance_config = ::Gapic::Config::Method.new update_instance_config_config
1668
+ delete_instance_config_config = parent_rpcs.delete_instance_config if parent_rpcs.respond_to? :delete_instance_config
1669
+ @delete_instance_config = ::Gapic::Config::Method.new delete_instance_config_config
1670
+ list_instance_config_operations_config = parent_rpcs.list_instance_config_operations if parent_rpcs.respond_to? :list_instance_config_operations
1671
+ @list_instance_config_operations = ::Gapic::Config::Method.new list_instance_config_operations_config
1672
+ list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
1673
+ @list_instances = ::Gapic::Config::Method.new list_instances_config
1674
+ get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
1675
+ @get_instance = ::Gapic::Config::Method.new get_instance_config
1676
+ create_instance_config = parent_rpcs.create_instance if parent_rpcs.respond_to? :create_instance
1677
+ @create_instance = ::Gapic::Config::Method.new create_instance_config
1678
+ update_instance_config = parent_rpcs.update_instance if parent_rpcs.respond_to? :update_instance
1679
+ @update_instance = ::Gapic::Config::Method.new update_instance_config
1680
+ delete_instance_config = parent_rpcs.delete_instance if parent_rpcs.respond_to? :delete_instance
1681
+ @delete_instance = ::Gapic::Config::Method.new delete_instance_config
1682
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
1683
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
1684
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
1685
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
1686
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
1687
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
1688
+
1689
+ yield self if block_given?
1690
+ end
1691
+ end
1692
+ end
1693
+ end
1694
+ end
1695
+ end
1696
+ end
1697
+ end
1698
+ end
1699
+ end
1700
+ end
1701
+ end