google-cloud-bigtable-admin-v2 0.1.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +188 -190
  3. data/README.md +64 -0
  4. data/lib/google/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +20 -21
  5. data/lib/google/bigtable/admin/v2/bigtable_table_admin_pb.rb +27 -27
  6. data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +30 -30
  7. data/lib/google/bigtable/admin/v2/instance_pb.rb +5 -0
  8. data/lib/google/bigtable/admin/v2/table_pb.rb +16 -0
  9. data/lib/google/cloud/bigtable/admin/v2.rb +3 -0
  10. data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin/client.rb +13 -5
  11. data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin/operations.rb +90 -5
  12. data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin/paths.rb +21 -0
  13. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin/client.rb +67 -47
  14. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin/operations.rb +90 -5
  15. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin/paths.rb +23 -0
  16. data/lib/google/cloud/bigtable/admin/v2/version.rb +1 -1
  17. data/proto_docs/google/api/field_behavior.rb +6 -0
  18. data/proto_docs/google/api/resource.rb +50 -14
  19. data/proto_docs/google/bigtable/admin/v2/bigtable_instance_admin.rb +1 -1
  20. data/proto_docs/google/bigtable/admin/v2/bigtable_table_admin.rb +114 -123
  21. data/proto_docs/google/bigtable/admin/v2/instance.rb +21 -1
  22. data/proto_docs/google/bigtable/admin/v2/table.rb +58 -4
  23. data/proto_docs/google/longrunning/operations.rb +17 -3
  24. data/proto_docs/google/protobuf/any.rb +5 -2
  25. data/proto_docs/google/protobuf/timestamp.rb +10 -1
  26. metadata +7 -4
@@ -104,8 +104,13 @@ module Google
104
104
  # Lists operations that match the specified filter in the request. If the
105
105
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
106
106
  #
107
- # NOTE: the `name` binding below allows API services to override the binding
108
- # to use different resource name schemes, such as `users/*/operations`.
107
+ # NOTE: the `name` binding allows API services to override the binding
108
+ # to use different resource name schemes, such as `users/*/operations`. To
109
+ # override the binding, API services can add a binding such as
110
+ # `"/v1/{name=users/*}/operations"` to their service configuration.
111
+ # For backwards compatibility, the default name includes the operations
112
+ # collection id, however overriding users must ensure the name binding
113
+ # is the parent resource, without the operations collection id.
109
114
  #
110
115
  # @overload list_operations(request, options = nil)
111
116
  # Pass arguments to `list_operations` via a request object, either of type
@@ -123,7 +128,7 @@ module Google
123
128
  # the default parameter values, pass an empty Hash as a request object (see above).
124
129
  #
125
130
  # @param name [::String]
126
- # The name of the operation collection.
131
+ # The name of the operation's parent resource.
127
132
  # @param filter [::String]
128
133
  # The standard list filter.
129
134
  # @param page_size [::Integer]
@@ -391,6 +396,79 @@ module Google
391
396
  raise ::Google::Cloud::Error.from_error(e)
392
397
  end
393
398
 
399
+ ##
400
+ # Waits for the specified long-running operation until it is done or reaches
401
+ # at most a specified timeout, returning the latest state. If the operation
402
+ # is already done, the latest state is immediately returned. If the timeout
403
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
404
+ # timeout is used. If the server does not support this method, it returns
405
+ # `google.rpc.Code.UNIMPLEMENTED`.
406
+ # Note that this method is on a best-effort basis. It may return the latest
407
+ # state before the specified timeout (including immediately), meaning even an
408
+ # immediate response is no guarantee that the operation is done.
409
+ #
410
+ # @overload wait_operation(request, options = nil)
411
+ # Pass arguments to `wait_operation` via a request object, either of type
412
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
413
+ #
414
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
415
+ # A request object representing the call parameters. Required. To specify no
416
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
417
+ # @param options [::Gapic::CallOptions, ::Hash]
418
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
419
+ #
420
+ # @overload wait_operation(name: nil, timeout: nil)
421
+ # Pass arguments to `wait_operation` via keyword arguments. Note that at
422
+ # least one keyword argument is required. To specify no parameters, or to keep all
423
+ # the default parameter values, pass an empty Hash as a request object (see above).
424
+ #
425
+ # @param name [::String]
426
+ # The name of the operation resource to wait on.
427
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
428
+ # The maximum duration to wait before timing out. If left blank, the wait
429
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
430
+ # If RPC context deadline is also specified, the shorter one will be used.
431
+ #
432
+ # @yield [response, operation] Access the result along with the RPC operation
433
+ # @yieldparam response [::Gapic::Operation]
434
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
435
+ #
436
+ # @return [::Gapic::Operation]
437
+ #
438
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
439
+ #
440
+ def wait_operation request, options = nil
441
+ raise ::ArgumentError, "request must be provided" if request.nil?
442
+
443
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
444
+
445
+ # Converts hash and nil to an options object
446
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
447
+
448
+ # Customize the options with defaults
449
+ metadata = @config.rpcs.wait_operation.metadata.to_h
450
+
451
+ # Set x-goog-api-client and x-goog-user-project headers
452
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
453
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
454
+ gapic_version: ::Google::Cloud::Bigtable::Admin::V2::VERSION
455
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
456
+
457
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
458
+ metadata: metadata,
459
+ retry_policy: @config.rpcs.wait_operation.retry_policy
460
+ options.apply_defaults metadata: @config.metadata,
461
+ retry_policy: @config.retry_policy
462
+
463
+ @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
464
+ response = ::Gapic::Operation.new response, @operations_client, options: options
465
+ yield response, operation if block_given?
466
+ return response
467
+ end
468
+ rescue ::GRPC::BadStatus => e
469
+ raise ::Google::Cloud::Error.from_error(e)
470
+ end
471
+
394
472
  ##
395
473
  # Configuration class for the Operations API.
396
474
  #
@@ -476,7 +554,7 @@ module Google
476
554
 
477
555
  config_attr :endpoint, "bigtableadmin.googleapis.com", ::String
478
556
  config_attr :credentials, nil do |value|
479
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
557
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
480
558
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
481
559
  allowed.any? { |klass| klass === value }
482
560
  end
@@ -516,7 +594,7 @@ module Google
516
594
  # Each configuration object is of type `Gapic::Config::Method` and includes
517
595
  # the following configuration fields:
518
596
  #
519
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
597
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
520
598
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
521
599
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
522
600
  # include the following keys:
@@ -547,6 +625,11 @@ module Google
547
625
  # @return [::Gapic::Config::Method]
548
626
  #
549
627
  attr_reader :cancel_operation
628
+ ##
629
+ # RPC-specific configuration for `wait_operation`
630
+ # @return [::Gapic::Config::Method]
631
+ #
632
+ attr_reader :wait_operation
550
633
 
551
634
  # @private
552
635
  def initialize parent_rpcs = nil
@@ -558,6 +641,8 @@ module Google
558
641
  @delete_operation = ::Gapic::Config::Method.new delete_operation_config
559
642
  cancel_operation_config = parent_rpcs&.cancel_operation if parent_rpcs&.respond_to? :cancel_operation
560
643
  @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
644
+ wait_operation_config = parent_rpcs&.wait_operation if parent_rpcs&.respond_to? :wait_operation
645
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
561
646
 
562
647
  yield self if block_given?
563
648
  end
@@ -63,6 +63,27 @@ module Google
63
63
  "projects/#{project}/instances/#{instance}/clusters/#{cluster}"
64
64
  end
65
65
 
66
+ ##
67
+ # Create a fully-qualified CryptoKey resource string.
68
+ #
69
+ # The resource will be in the following format:
70
+ #
71
+ # `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`
72
+ #
73
+ # @param project [String]
74
+ # @param location [String]
75
+ # @param key_ring [String]
76
+ # @param crypto_key [String]
77
+ #
78
+ # @return [::String]
79
+ def crypto_key_path project:, location:, key_ring:, crypto_key:
80
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
81
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
82
+ raise ::ArgumentError, "key_ring cannot contain /" if key_ring.to_s.include? "/"
83
+
84
+ "projects/#{project}/locations/#{location}/keyRings/#{key_ring}/cryptoKeys/#{crypto_key}"
85
+ end
86
+
66
87
  ##
67
88
  # Create a fully-qualified Instance resource string.
68
89
  #
@@ -72,8 +72,6 @@ module Google
72
72
 
73
73
  default_config.rpcs.create_table.timeout = 300.0
74
74
 
75
- default_config.rpcs.create_table_from_snapshot.timeout = 60.0
76
-
77
75
  default_config.rpcs.list_tables.timeout = 60.0
78
76
  default_config.rpcs.list_tables.retry_policy = {
79
77
  initial_delay: 1.0,
@@ -112,8 +110,6 @@ module Google
112
110
  retry_codes: [14, 4]
113
111
  }
114
112
 
115
- default_config.rpcs.snapshot_table.timeout = 60.0
116
-
117
113
  default_config.rpcs.get_snapshot.timeout = 60.0
118
114
  default_config.rpcs.get_snapshot.retry_policy = {
119
115
  initial_delay: 1.0,
@@ -132,6 +128,26 @@ module Google
132
128
 
133
129
  default_config.rpcs.delete_snapshot.timeout = 60.0
134
130
 
131
+ default_config.rpcs.get_backup.timeout = 60.0
132
+ default_config.rpcs.get_backup.retry_policy = {
133
+ initial_delay: 1.0,
134
+ max_delay: 60.0,
135
+ multiplier: 2,
136
+ retry_codes: [14, 4]
137
+ }
138
+
139
+ default_config.rpcs.update_backup.timeout = 60.0
140
+
141
+ default_config.rpcs.delete_backup.timeout = 60.0
142
+
143
+ default_config.rpcs.list_backups.timeout = 60.0
144
+ default_config.rpcs.list_backups.retry_policy = {
145
+ initial_delay: 1.0,
146
+ max_delay: 60.0,
147
+ multiplier: 2,
148
+ retry_codes: [14, 4]
149
+ }
150
+
135
151
  default_config.rpcs.get_iam_policy.timeout = 60.0
136
152
  default_config.rpcs.get_iam_policy.retry_policy = {
137
153
  initial_delay: 1.0,
@@ -211,7 +227,13 @@ module Google
211
227
 
212
228
  # Create credentials
213
229
  credentials = @config.credentials
214
- credentials ||= Credentials.default scope: @config.scope
230
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
231
+ # but only if the default endpoint does not have a region prefix.
232
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
233
+ @config.endpoint == Client.configure.endpoint &&
234
+ !@config.endpoint.split(".").first.include?("-")
235
+ credentials ||= Credentials.default scope: @config.scope,
236
+ enable_self_signed_jwt: enable_self_signed_jwt
215
237
  if credentials.is_a?(String) || credentials.is_a?(Hash)
216
238
  credentials = Credentials.new credentials, scope: @config.scope
217
239
  end
@@ -265,8 +287,8 @@ module Google
265
287
  # Required. The unique name of the instance in which to create the table.
266
288
  # Values are of the form `projects/{project}/instances/{instance}`.
267
289
  # @param table_id [::String]
268
- # Required. The name by which the new table should be referred to within the
269
- # parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`.
290
+ # Required. The name by which the new table should be referred to within the parent
291
+ # instance, e.g., `foobar` rather than `{parent}/tables/foobar`.
270
292
  # Maximum 50 characters.
271
293
  # @param table [::Google::Cloud::Bigtable::Admin::V2::Table, ::Hash]
272
294
  # Required. The Table to create.
@@ -362,12 +384,12 @@ module Google
362
384
  # Required. The unique name of the instance in which to create the table.
363
385
  # Values are of the form `projects/{project}/instances/{instance}`.
364
386
  # @param table_id [::String]
365
- # Required. The name by which the new table should be referred to within the
366
- # parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`.
387
+ # Required. The name by which the new table should be referred to within the parent
388
+ # instance, e.g., `foobar` rather than `{parent}/tables/foobar`.
367
389
  # @param source_snapshot [::String]
368
- # Required. The unique name of the snapshot from which to restore the table.
369
- # The snapshot and the table must be in the same instance. Values are of the
370
- # form
390
+ # Required. The unique name of the snapshot from which to restore the table. The
391
+ # snapshot and the table must be in the same instance.
392
+ # Values are of the form
371
393
  # `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`.
372
394
  #
373
395
  # @yield [response, operation] Access the result along with the RPC operation
@@ -435,8 +457,8 @@ module Google
435
457
  # the default parameter values, pass an empty Hash as a request object (see above).
436
458
  #
437
459
  # @param parent [::String]
438
- # Required. The unique name of the instance for which tables should be
439
- # listed. Values are of the form `projects/{project}/instances/{instance}`.
460
+ # Required. The unique name of the instance for which tables should be listed.
461
+ # Values are of the form `projects/{project}/instances/{instance}`.
440
462
  # @param view [::Google::Cloud::Bigtable::Admin::V2::Table::View]
441
463
  # The view to be applied to the returned tables' fields.
442
464
  # Only NAME_ONLY view (default) and REPLICATION_VIEW are supported.
@@ -664,10 +686,10 @@ module Google
664
686
  # Values are of the form
665
687
  # `projects/{project}/instances/{instance}/tables/{table}`.
666
688
  # @param modifications [::Array<::Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification, ::Hash>]
667
- # Required. Modifications to be atomically applied to the specified table's
668
- # families. Entries are applied in order, meaning that earlier modifications
669
- # can be masked by later ones (in the case of repeated updates to the same
670
- # family, for example).
689
+ # Required. Modifications to be atomically applied to the specified table's families.
690
+ # Entries are applied in order, meaning that earlier modifications can be
691
+ # masked by later ones (in the case of repeated updates to the same family,
692
+ # for example).
671
693
  #
672
694
  # @yield [response, operation] Access the result along with the RPC operation
673
695
  # @yieldparam response [::Google::Cloud::Bigtable::Admin::V2::Table]
@@ -811,8 +833,8 @@ module Google
811
833
  # the default parameter values, pass an empty Hash as a request object (see above).
812
834
  #
813
835
  # @param name [::String]
814
- # Required. The unique name of the Table for which to create a consistency
815
- # token. Values are of the form
836
+ # Required. The unique name of the Table for which to create a consistency token.
837
+ # Values are of the form
816
838
  # `projects/{project}/instances/{instance}/tables/{table}`.
817
839
  #
818
840
  # @yield [response, operation] Access the result along with the RPC operation
@@ -881,8 +903,8 @@ module Google
881
903
  # the default parameter values, pass an empty Hash as a request object (see above).
882
904
  #
883
905
  # @param name [::String]
884
- # Required. The unique name of the Table for which to check replication
885
- # consistency. Values are of the form
906
+ # Required. The unique name of the Table for which to check replication consistency.
907
+ # Values are of the form
886
908
  # `projects/{project}/instances/{instance}/tables/{table}`.
887
909
  # @param consistency_token [::String]
888
910
  # Required. The token created using GenerateConsistencyToken for the Table.
@@ -966,9 +988,9 @@ module Google
966
988
  # Values are of the form
967
989
  # `projects/{project}/instances/{instance}/clusters/{cluster}`.
968
990
  # @param snapshot_id [::String]
969
- # Required. The ID by which the new snapshot should be referred to within the
970
- # parent cluster, e.g., `mysnapshot` of the form:
971
- # `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` rather than
991
+ # Required. The ID by which the new snapshot should be referred to within the parent
992
+ # cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*`
993
+ # rather than
972
994
  # `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`.
973
995
  # @param ttl [::Google::Protobuf::Duration, ::Hash]
974
996
  # The amount of time that the new snapshot can stay active after it is
@@ -1123,8 +1145,8 @@ module Google
1123
1145
  # the default parameter values, pass an empty Hash as a request object (see above).
1124
1146
  #
1125
1147
  # @param parent [::String]
1126
- # Required. The unique name of the cluster for which snapshots should be
1127
- # listed. Values are of the form
1148
+ # Required. The unique name of the cluster for which snapshots should be listed.
1149
+ # Values are of the form
1128
1150
  # `projects/{project}/instances/{instance}/clusters/{cluster}`.
1129
1151
  # Use `{cluster} = '-'` to list snapshots for all clusters in an instance,
1130
1152
  # e.g., `projects/{project}/instances/{instance}/clusters/-`.
@@ -1255,14 +1277,14 @@ module Google
1255
1277
  end
1256
1278
 
1257
1279
  ##
1258
- # Starts creating a new Cloud Bigtable Backup. The returned backup
1280
+ # Starts creating a new Cloud Bigtable Backup. The returned backup
1259
1281
  # {::Google::Longrunning::Operation long-running operation} can be used to
1260
1282
  # track creation of the backup. The
1261
1283
  # {::Google::Longrunning::Operation#metadata metadata} field type is
1262
1284
  # {::Google::Cloud::Bigtable::Admin::V2::CreateBackupMetadata CreateBackupMetadata}. The
1263
1285
  # {::Google::Longrunning::Operation#response response} field type is
1264
- # {::Google::Cloud::Bigtable::Admin::V2::Backup Backup}, if successful. Cancelling the
1265
- # returned operation will stop the creation and delete the backup.
1286
+ # {::Google::Cloud::Bigtable::Admin::V2::Backup Backup}, if successful. Cancelling the returned operation will stop the
1287
+ # creation and delete the backup.
1266
1288
  #
1267
1289
  # @overload create_backup(request, options = nil)
1268
1290
  # Pass arguments to `create_backup` via a request object, either of type
@@ -1570,7 +1592,7 @@ module Google
1570
1592
  # the default parameter values, pass an empty Hash as a request object (see above).
1571
1593
  #
1572
1594
  # @param parent [::String]
1573
- # Required. The cluster to list backups from. Values are of the
1595
+ # Required. The cluster to list backups from. Values are of the
1574
1596
  # form `projects/{project}/instances/{instance}/clusters/{cluster}`.
1575
1597
  # Use `{cluster} = '-'` to list backups for all clusters in an instance,
1576
1598
  # e.g., `projects/{project}/instances/{instance}/clusters/-`.
@@ -1579,7 +1601,7 @@ module Google
1579
1601
  # The expression must specify the field name, a comparison operator,
1580
1602
  # and the value that you want to use for filtering. The value must be a
1581
1603
  # string, a number, or a boolean. The comparison operator must be
1582
- # <, >, <=, >=, !=, =, or :. Colon ‘:’ represents a HAS operator which is
1604
+ # <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is
1583
1605
  # roughly synonymous with equality. Filter rules are case insensitive.
1584
1606
  #
1585
1607
  # The fields eligible for filtering are:
@@ -1609,9 +1631,8 @@ module Google
1609
1631
  # * `size_bytes > 10000000000` --> The backup's size is greater than 10GB
1610
1632
  # @param order_by [::String]
1611
1633
  # An expression for specifying the sort order of the results of the request.
1612
- # The string value should specify one or more fields in
1613
- # {::Google::Cloud::Bigtable::Admin::V2::Backup Backup}. The full syntax is described at
1614
- # https://aip.dev/132#ordering.
1634
+ # The string value should specify one or more fields in {::Google::Cloud::Bigtable::Admin::V2::Backup Backup}. The full
1635
+ # syntax is described at https://aip.dev/132#ordering.
1615
1636
  #
1616
1637
  # Fields supported are:
1617
1638
  # * name
@@ -1634,10 +1655,9 @@ module Google
1634
1655
  # less, defaults to the server's maximum allowed page size.
1635
1656
  # @param page_token [::String]
1636
1657
  # If non-empty, `page_token` should contain a
1637
- # {::Google::Cloud::Bigtable::Admin::V2::ListBackupsResponse#next_page_token next_page_token}
1638
- # from a previous
1639
- # {::Google::Cloud::Bigtable::Admin::V2::ListBackupsResponse ListBackupsResponse} to the
1640
- # same `parent` and with the same `filter`.
1658
+ # {::Google::Cloud::Bigtable::Admin::V2::ListBackupsResponse#next_page_token next_page_token} from a
1659
+ # previous {::Google::Cloud::Bigtable::Admin::V2::ListBackupsResponse ListBackupsResponse} to the same `parent` and with the same
1660
+ # `filter`.
1641
1661
  #
1642
1662
  # @yield [response, operation] Access the result along with the RPC operation
1643
1663
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Bigtable::Admin::V2::Backup>]
@@ -1687,11 +1707,11 @@ module Google
1687
1707
 
1688
1708
  ##
1689
1709
  # Create a new table by restoring from a completed backup. The new table
1690
- # must be in the same instance as the instance containing the backup. The
1710
+ # must be in the same instance as the instance containing the backup. The
1691
1711
  # returned table {::Google::Longrunning::Operation long-running operation} can
1692
- # be used to track the progress of the operation, and to cancel it. The
1712
+ # be used to track the progress of the operation, and to cancel it. The
1693
1713
  # {::Google::Longrunning::Operation#metadata metadata} field type is
1694
- # [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The
1714
+ # [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The
1695
1715
  # {::Google::Longrunning::Operation#response response} type is
1696
1716
  # {::Google::Cloud::Bigtable::Admin::V2::Table Table}, if successful.
1697
1717
  #
@@ -1720,7 +1740,7 @@ module Google
1720
1740
  # `parent` forms the full table name of the form
1721
1741
  # `projects/<project>/instances/<instance>/tables/<table_id>`.
1722
1742
  # @param backup [::String]
1723
- # Name of the backup from which to restore. Values are of the form
1743
+ # Name of the backup from which to restore. Values are of the form
1724
1744
  # `projects/<project>/instances/<instance>/clusters/<cluster>/backups/<backup>`.
1725
1745
  #
1726
1746
  # @yield [response, operation] Access the result along with the RPC operation
@@ -1770,7 +1790,7 @@ module Google
1770
1790
  end
1771
1791
 
1772
1792
  ##
1773
- # Gets the access control policy for a resource.
1793
+ # Gets the access control policy for a Table or Backup resource.
1774
1794
  # Returns an empty policy if the resource exists but does not have a policy
1775
1795
  # set.
1776
1796
  #
@@ -1915,7 +1935,7 @@ module Google
1915
1935
  end
1916
1936
 
1917
1937
  ##
1918
- # Returns permissions that the caller has on the specified table resource.
1938
+ # Returns permissions that the caller has on the specified Table or Backup resource.
1919
1939
  #
1920
1940
  # @overload test_iam_permissions(request, options = nil)
1921
1941
  # Pass arguments to `test_iam_permissions` via a request object, either of type
@@ -2071,7 +2091,7 @@ module Google
2071
2091
 
2072
2092
  config_attr :endpoint, "bigtableadmin.googleapis.com", ::String
2073
2093
  config_attr :credentials, nil do |value|
2074
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
2094
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
2075
2095
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
2076
2096
  allowed.any? { |klass| klass === value }
2077
2097
  end
@@ -2111,7 +2131,7 @@ module Google
2111
2131
  # Each configuration object is of type `Gapic::Config::Method` and includes
2112
2132
  # the following configuration fields:
2113
2133
  #
2114
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
2134
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
2115
2135
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
2116
2136
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
2117
2137
  # include the following keys:
@@ -104,8 +104,13 @@ module Google
104
104
  # Lists operations that match the specified filter in the request. If the
105
105
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
106
106
  #
107
- # NOTE: the `name` binding below allows API services to override the binding
108
- # to use different resource name schemes, such as `users/*/operations`.
107
+ # NOTE: the `name` binding allows API services to override the binding
108
+ # to use different resource name schemes, such as `users/*/operations`. To
109
+ # override the binding, API services can add a binding such as
110
+ # `"/v1/{name=users/*}/operations"` to their service configuration.
111
+ # For backwards compatibility, the default name includes the operations
112
+ # collection id, however overriding users must ensure the name binding
113
+ # is the parent resource, without the operations collection id.
109
114
  #
110
115
  # @overload list_operations(request, options = nil)
111
116
  # Pass arguments to `list_operations` via a request object, either of type
@@ -123,7 +128,7 @@ module Google
123
128
  # the default parameter values, pass an empty Hash as a request object (see above).
124
129
  #
125
130
  # @param name [::String]
126
- # The name of the operation collection.
131
+ # The name of the operation's parent resource.
127
132
  # @param filter [::String]
128
133
  # The standard list filter.
129
134
  # @param page_size [::Integer]
@@ -391,6 +396,79 @@ module Google
391
396
  raise ::Google::Cloud::Error.from_error(e)
392
397
  end
393
398
 
399
+ ##
400
+ # Waits for the specified long-running operation until it is done or reaches
401
+ # at most a specified timeout, returning the latest state. If the operation
402
+ # is already done, the latest state is immediately returned. If the timeout
403
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
404
+ # timeout is used. If the server does not support this method, it returns
405
+ # `google.rpc.Code.UNIMPLEMENTED`.
406
+ # Note that this method is on a best-effort basis. It may return the latest
407
+ # state before the specified timeout (including immediately), meaning even an
408
+ # immediate response is no guarantee that the operation is done.
409
+ #
410
+ # @overload wait_operation(request, options = nil)
411
+ # Pass arguments to `wait_operation` via a request object, either of type
412
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
413
+ #
414
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
415
+ # A request object representing the call parameters. Required. To specify no
416
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
417
+ # @param options [::Gapic::CallOptions, ::Hash]
418
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
419
+ #
420
+ # @overload wait_operation(name: nil, timeout: nil)
421
+ # Pass arguments to `wait_operation` via keyword arguments. Note that at
422
+ # least one keyword argument is required. To specify no parameters, or to keep all
423
+ # the default parameter values, pass an empty Hash as a request object (see above).
424
+ #
425
+ # @param name [::String]
426
+ # The name of the operation resource to wait on.
427
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
428
+ # The maximum duration to wait before timing out. If left blank, the wait
429
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
430
+ # If RPC context deadline is also specified, the shorter one will be used.
431
+ #
432
+ # @yield [response, operation] Access the result along with the RPC operation
433
+ # @yieldparam response [::Gapic::Operation]
434
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
435
+ #
436
+ # @return [::Gapic::Operation]
437
+ #
438
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
439
+ #
440
+ def wait_operation request, options = nil
441
+ raise ::ArgumentError, "request must be provided" if request.nil?
442
+
443
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
444
+
445
+ # Converts hash and nil to an options object
446
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
447
+
448
+ # Customize the options with defaults
449
+ metadata = @config.rpcs.wait_operation.metadata.to_h
450
+
451
+ # Set x-goog-api-client and x-goog-user-project headers
452
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
453
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
454
+ gapic_version: ::Google::Cloud::Bigtable::Admin::V2::VERSION
455
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
456
+
457
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
458
+ metadata: metadata,
459
+ retry_policy: @config.rpcs.wait_operation.retry_policy
460
+ options.apply_defaults metadata: @config.metadata,
461
+ retry_policy: @config.retry_policy
462
+
463
+ @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
464
+ response = ::Gapic::Operation.new response, @operations_client, options: options
465
+ yield response, operation if block_given?
466
+ return response
467
+ end
468
+ rescue ::GRPC::BadStatus => e
469
+ raise ::Google::Cloud::Error.from_error(e)
470
+ end
471
+
394
472
  ##
395
473
  # Configuration class for the Operations API.
396
474
  #
@@ -476,7 +554,7 @@ module Google
476
554
 
477
555
  config_attr :endpoint, "bigtableadmin.googleapis.com", ::String
478
556
  config_attr :credentials, nil do |value|
479
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
557
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
480
558
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
481
559
  allowed.any? { |klass| klass === value }
482
560
  end
@@ -516,7 +594,7 @@ module Google
516
594
  # Each configuration object is of type `Gapic::Config::Method` and includes
517
595
  # the following configuration fields:
518
596
  #
519
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
597
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
520
598
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
521
599
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
522
600
  # include the following keys:
@@ -547,6 +625,11 @@ module Google
547
625
  # @return [::Gapic::Config::Method]
548
626
  #
549
627
  attr_reader :cancel_operation
628
+ ##
629
+ # RPC-specific configuration for `wait_operation`
630
+ # @return [::Gapic::Config::Method]
631
+ #
632
+ attr_reader :wait_operation
550
633
 
551
634
  # @private
552
635
  def initialize parent_rpcs = nil
@@ -558,6 +641,8 @@ module Google
558
641
  @delete_operation = ::Gapic::Config::Method.new delete_operation_config
559
642
  cancel_operation_config = parent_rpcs&.cancel_operation if parent_rpcs&.respond_to? :cancel_operation
560
643
  @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
644
+ wait_operation_config = parent_rpcs&.wait_operation if parent_rpcs&.respond_to? :wait_operation
645
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
561
646
 
562
647
  yield self if block_given?
563
648
  end