Class: Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb

Overview

Service for creating, configuring, and deleting Cloud Bigtable tables.

Provides access to the table schemas only, not the data stored within the tables.

Defined Under Namespace

Classes: OperationsClient

Constant Summary collapse

SERVICE_ADDRESS =

The default address of the service.

"bigtableadmin.googleapis.com".freeze
DEFAULT_SERVICE_PORT =

The default port of the service.

443
GRPC_INTERCEPTORS =

The default set of gRPC interceptors.

[]
DEFAULT_TIMEOUT =
30
ALL_SCOPES =

The scopes needed to make gRPC calls to all of the methods defined in this service.

[
  "https://www.googleapis.com/auth/bigtable.admin",
  "https://www.googleapis.com/auth/bigtable.admin.cluster",
  "https://www.googleapis.com/auth/bigtable.admin.instance",
  "https://www.googleapis.com/auth/bigtable.admin.table",
  "https://www.googleapis.com/auth/cloud-bigtable.admin",
  "https://www.googleapis.com/auth/cloud-bigtable.admin.cluster",
  "https://www.googleapis.com/auth/cloud-bigtable.admin.table",
  "https://www.googleapis.com/auth/cloud-platform",
  "https://www.googleapis.com/auth/cloud-platform.read-only"
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, metadata: nil, exception_transformer: nil, lib_name: nil, lib_version: "") ⇒ BigtableTableAdminClient

Returns a new instance of BigtableTableAdminClient

Parameters:

  • credentials (Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc)

    Provides the means for authenticating requests made by the client. This parameter can be many types. A Google::Auth::Credentials uses a the properties of its represented keyfile for authenticating requests made by this client. A String will be treated as the path to the keyfile to be used for the construction of credentials for this client. A Hash will be treated as the contents of a keyfile to be used for the construction of credentials for this client. A GRPC::Core::Channel will be used to make calls through. A GRPC::Core::ChannelCredentials for the setting up the RPC client. The channel credentials should already be composed with a GRPC::Core::CallCredentials object. A Proc will be used as an updater_proc for the Grpc channel. The proc transforms the metadata for requests, generally, to give OAuth credentials.

  • scopes (Array<String>)

    The OAuth scopes for this service. This parameter is ignored if an updater_proc is supplied.

  • client_config (Hash)

    A Hash for call options for each method. See Google::Gax#construct_settings for the structure of this data. Falls back to the default config if not specified or the specified config is missing data points.

  • timeout (Numeric)

    The default timeout, in seconds, for calls made through this client.

  • metadata (Hash)

    Default metadata to be sent with each request. This can be overridden on a per call basis.

  • exception_transformer (Proc)

    An optional proc that intercepts any exceptions raised during an API call to inject custom error handling.



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 196

def initialize \
    credentials: nil,
    scopes: ALL_SCOPES,
    client_config: {},
    timeout: DEFAULT_TIMEOUT,
    metadata: nil,
    exception_transformer: nil,
    lib_name: nil,
    lib_version: ""
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "google/gax/grpc"
  require "google/bigtable/admin/v2/bigtable_table_admin_services_pb"

  credentials ||= Google::Cloud::Bigtable::Admin::V2::Credentials.default

  @operations_client = OperationsClient.new(
    credentials: credentials,
    scopes: scopes,
    client_config: client_config,
    timeout: timeout,
    lib_name: lib_name,
    lib_version: lib_version,
  )

  if credentials.is_a?(String) || credentials.is_a?(Hash)
    updater_proc = Google::Cloud::Bigtable::Admin::V2::Credentials.new(credentials).updater_proc
  end
  if credentials.is_a?(GRPC::Core::Channel)
    channel = credentials
  end
  if credentials.is_a?(GRPC::Core::ChannelCredentials)
    chan_creds = credentials
  end
  if credentials.is_a?(Proc)
    updater_proc = credentials
  end
  if credentials.is_a?(Google::Auth::Credentials)
    updater_proc = credentials.updater_proc
  end

  package_version = Gem.loaded_specs['google-cloud-bigtable'].version.version

  google_api_client = "gl-ruby/#{RUBY_VERSION}"
  google_api_client << " #{lib_name}/#{lib_version}" if lib_name
  google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
  google_api_client << " grpc/#{GRPC::VERSION}"
  google_api_client.freeze

  headers = { :"x-goog-api-client" => google_api_client }
  headers.merge!() unless .nil?
  client_config_file = Pathname.new(__dir__).join(
    "bigtable_table_admin_client_config.json"
  )
  defaults = client_config_file.open do |f|
    Google::Gax.construct_settings(
      "google.bigtable.admin.v2.BigtableTableAdmin",
      JSON.parse(f.read),
      client_config,
      Google::Gax::Grpc::STATUS_CODE_NAMES,
      timeout,
      page_descriptors: PAGE_DESCRIPTORS,
      errors: Google::Gax::Grpc::API_ERRORS,
      metadata: headers
    )
  end

  # Allow overriding the service path/port in subclasses.
  service_path = self.class::SERVICE_ADDRESS
  port = self.class::DEFAULT_SERVICE_PORT
  interceptors = self.class::GRPC_INTERCEPTORS
  @bigtable_table_admin_stub = Google::Gax::Grpc.create_stub(
    service_path,
    port,
    chan_creds: chan_creds,
    channel: channel,
    updater_proc: updater_proc,
    scopes: scopes,
    interceptors: interceptors,
    &Google::Bigtable::Admin::V2::BigtableTableAdmin::Stub.method(:new)
  )

  @create_table = Google::Gax.create_api_call(
    @bigtable_table_admin_stub.method(:create_table),
    defaults["create_table"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @create_table_from_snapshot = Google::Gax.create_api_call(
    @bigtable_table_admin_stub.method(:create_table_from_snapshot),
    defaults["create_table_from_snapshot"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @list_tables = Google::Gax.create_api_call(
    @bigtable_table_admin_stub.method(:list_tables),
    defaults["list_tables"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @get_table = Google::Gax.create_api_call(
    @bigtable_table_admin_stub.method(:get_table),
    defaults["get_table"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @delete_table = Google::Gax.create_api_call(
    @bigtable_table_admin_stub.method(:delete_table),
    defaults["delete_table"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @modify_column_families = Google::Gax.create_api_call(
    @bigtable_table_admin_stub.method(:modify_column_families),
    defaults["modify_column_families"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @drop_row_range = Google::Gax.create_api_call(
    @bigtable_table_admin_stub.method(:drop_row_range),
    defaults["drop_row_range"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @generate_consistency_token = Google::Gax.create_api_call(
    @bigtable_table_admin_stub.method(:generate_consistency_token),
    defaults["generate_consistency_token"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @check_consistency = Google::Gax.create_api_call(
    @bigtable_table_admin_stub.method(:check_consistency),
    defaults["check_consistency"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @snapshot_table = Google::Gax.create_api_call(
    @bigtable_table_admin_stub.method(:snapshot_table),
    defaults["snapshot_table"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @get_snapshot = Google::Gax.create_api_call(
    @bigtable_table_admin_stub.method(:get_snapshot),
    defaults["get_snapshot"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @list_snapshots = Google::Gax.create_api_call(
    @bigtable_table_admin_stub.method(:list_snapshots),
    defaults["list_snapshots"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @delete_snapshot = Google::Gax.create_api_call(
    @bigtable_table_admin_stub.method(:delete_snapshot),
    defaults["delete_snapshot"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
end

Instance Attribute Details

#bigtable_table_admin_stubGoogle::Bigtable::Admin::V2::BigtableTableAdmin::Stub (readonly)

Returns:

  • (Google::Bigtable::Admin::V2::BigtableTableAdmin::Stub)


45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 45

class BigtableTableAdminClient
  attr_reader :bigtable_table_admin_stub

  # The default address of the service.
  SERVICE_ADDRESS = "bigtableadmin.googleapis.com".freeze

  # The default port of the service.
  DEFAULT_SERVICE_PORT = 443

  # The default set of gRPC interceptors.
  GRPC_INTERCEPTORS = []

  DEFAULT_TIMEOUT = 30

  PAGE_DESCRIPTORS = {
    "list_tables" => Google::Gax::PageDescriptor.new(
      "page_token",
      "next_page_token",
      "tables"),
    "list_snapshots" => Google::Gax::PageDescriptor.new(
      "page_token",
      "next_page_token",
      "snapshots")
  }.freeze

  private_constant :PAGE_DESCRIPTORS

  # The scopes needed to make gRPC calls to all of the methods defined in
  # this service.
  ALL_SCOPES = [
    "https://www.googleapis.com/auth/bigtable.admin",
    "https://www.googleapis.com/auth/bigtable.admin.cluster",
    "https://www.googleapis.com/auth/bigtable.admin.instance",
    "https://www.googleapis.com/auth/bigtable.admin.table",
    "https://www.googleapis.com/auth/cloud-bigtable.admin",
    "https://www.googleapis.com/auth/cloud-bigtable.admin.cluster",
    "https://www.googleapis.com/auth/cloud-bigtable.admin.table",
    "https://www.googleapis.com/auth/cloud-platform",
    "https://www.googleapis.com/auth/cloud-platform.read-only"
  ].freeze

  class OperationsClient < Google::Longrunning::OperationsClient
    self::SERVICE_ADDRESS = BigtableTableAdminClient::SERVICE_ADDRESS
    self::GRPC_INTERCEPTORS = BigtableTableAdminClient::GRPC_INTERCEPTORS
  end

  INSTANCE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "projects/{project}/instances/{instance}"
  )

  private_constant :INSTANCE_PATH_TEMPLATE

  CLUSTER_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "projects/{project}/instances/{instance}/clusters/{cluster}"
  )

  private_constant :CLUSTER_PATH_TEMPLATE

  SNAPSHOT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}"
  )

  private_constant :SNAPSHOT_PATH_TEMPLATE

  TABLE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "projects/{project}/instances/{instance}/tables/{table}"
  )

  private_constant :TABLE_PATH_TEMPLATE

  # Returns a fully-qualified instance resource name string.
  # @param project [String]
  # @param instance [String]
  # @return [String]
  def self.instance_path project, instance
    INSTANCE_PATH_TEMPLATE.render(
      :"project" => project,
      :"instance" => instance
    )
  end

  # Returns a fully-qualified cluster resource name string.
  # @param project [String]
  # @param instance [String]
  # @param cluster [String]
  # @return [String]
  def self.cluster_path project, instance, cluster
    CLUSTER_PATH_TEMPLATE.render(
      :"project" => project,
      :"instance" => instance,
      :"cluster" => cluster
    )
  end

  # Returns a fully-qualified snapshot resource name string.
  # @param project [String]
  # @param instance [String]
  # @param cluster [String]
  # @param snapshot [String]
  # @return [String]
  def self.snapshot_path project, instance, cluster, snapshot
    SNAPSHOT_PATH_TEMPLATE.render(
      :"project" => project,
      :"instance" => instance,
      :"cluster" => cluster,
      :"snapshot" => snapshot
    )
  end

  # Returns a fully-qualified table resource name string.
  # @param project [String]
  # @param instance [String]
  # @param table [String]
  # @return [String]
  def self.table_path project, instance, table
    TABLE_PATH_TEMPLATE.render(
      :"project" => project,
      :"instance" => instance,
      :"table" => table
    )
  end

  # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
  #   Provides the means for authenticating requests made by the client. This parameter can
  #   be many types.
  #   A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
  #   authenticating requests made by this client.
  #   A `String` will be treated as the path to the keyfile to be used for the construction of
  #   credentials for this client.
  #   A `Hash` will be treated as the contents of a keyfile to be used for the construction of
  #   credentials for this client.
  #   A `GRPC::Core::Channel` will be used to make calls through.
  #   A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
  #   should already be composed with a `GRPC::Core::CallCredentials` object.
  #   A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
  #   metadata for requests, generally, to give OAuth credentials.
  # @param scopes [Array<String>]
  #   The OAuth scopes for this service. This parameter is ignored if
  #   an updater_proc is supplied.
  # @param client_config [Hash]
  #   A Hash for call options for each method. See
  #   Google::Gax#construct_settings for the structure of
  #   this data. Falls back to the default config if not specified
  #   or the specified config is missing data points.
  # @param timeout [Numeric]
  #   The default timeout, in seconds, for calls made through this client.
  # @param metadata [Hash]
  #   Default metadata to be sent with each request. This can be overridden on a per call basis.
  # @param exception_transformer [Proc]
  #   An optional proc that intercepts any exceptions raised during an API call to inject
  #   custom error handling.
  def initialize \
      credentials: nil,
      scopes: ALL_SCOPES,
      client_config: {},
      timeout: DEFAULT_TIMEOUT,
      metadata: nil,
      exception_transformer: nil,
      lib_name: nil,
      lib_version: ""
    # These require statements are intentionally placed here to initialize
    # the gRPC module only when it's required.
    # See https://github.com/googleapis/toolkit/issues/446
    require "google/gax/grpc"
    require "google/bigtable/admin/v2/bigtable_table_admin_services_pb"

    credentials ||= Google::Cloud::Bigtable::Admin::V2::Credentials.default

    @operations_client = OperationsClient.new(
      credentials: credentials,
      scopes: scopes,
      client_config: client_config,
      timeout: timeout,
      lib_name: lib_name,
      lib_version: lib_version,
    )

    if credentials.is_a?(String) || credentials.is_a?(Hash)
      updater_proc = Google::Cloud::Bigtable::Admin::V2::Credentials.new(credentials).updater_proc
    end
    if credentials.is_a?(GRPC::Core::Channel)
      channel = credentials
    end
    if credentials.is_a?(GRPC::Core::ChannelCredentials)
      chan_creds = credentials
    end
    if credentials.is_a?(Proc)
      updater_proc = credentials
    end
    if credentials.is_a?(Google::Auth::Credentials)
      updater_proc = credentials.updater_proc
    end

    package_version = Gem.loaded_specs['google-cloud-bigtable'].version.version

    google_api_client = "gl-ruby/#{RUBY_VERSION}"
    google_api_client << " #{lib_name}/#{lib_version}" if lib_name
    google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
    google_api_client << " grpc/#{GRPC::VERSION}"
    google_api_client.freeze

    headers = { :"x-goog-api-client" => google_api_client }
    headers.merge!() unless .nil?
    client_config_file = Pathname.new(__dir__).join(
      "bigtable_table_admin_client_config.json"
    )
    defaults = client_config_file.open do |f|
      Google::Gax.construct_settings(
        "google.bigtable.admin.v2.BigtableTableAdmin",
        JSON.parse(f.read),
        client_config,
        Google::Gax::Grpc::STATUS_CODE_NAMES,
        timeout,
        page_descriptors: PAGE_DESCRIPTORS,
        errors: Google::Gax::Grpc::API_ERRORS,
        metadata: headers
      )
    end

    # Allow overriding the service path/port in subclasses.
    service_path = self.class::SERVICE_ADDRESS
    port = self.class::DEFAULT_SERVICE_PORT
    interceptors = self.class::GRPC_INTERCEPTORS
    @bigtable_table_admin_stub = Google::Gax::Grpc.create_stub(
      service_path,
      port,
      chan_creds: chan_creds,
      channel: channel,
      updater_proc: updater_proc,
      scopes: scopes,
      interceptors: interceptors,
      &Google::Bigtable::Admin::V2::BigtableTableAdmin::Stub.method(:new)
    )

    @create_table = Google::Gax.create_api_call(
      @bigtable_table_admin_stub.method(:create_table),
      defaults["create_table"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'parent' => request.parent}
      end
    )
    @create_table_from_snapshot = Google::Gax.create_api_call(
      @bigtable_table_admin_stub.method(:create_table_from_snapshot),
      defaults["create_table_from_snapshot"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'parent' => request.parent}
      end
    )
    @list_tables = Google::Gax.create_api_call(
      @bigtable_table_admin_stub.method(:list_tables),
      defaults["list_tables"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'parent' => request.parent}
      end
    )
    @get_table = Google::Gax.create_api_call(
      @bigtable_table_admin_stub.method(:get_table),
      defaults["get_table"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @delete_table = Google::Gax.create_api_call(
      @bigtable_table_admin_stub.method(:delete_table),
      defaults["delete_table"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @modify_column_families = Google::Gax.create_api_call(
      @bigtable_table_admin_stub.method(:modify_column_families),
      defaults["modify_column_families"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @drop_row_range = Google::Gax.create_api_call(
      @bigtable_table_admin_stub.method(:drop_row_range),
      defaults["drop_row_range"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @generate_consistency_token = Google::Gax.create_api_call(
      @bigtable_table_admin_stub.method(:generate_consistency_token),
      defaults["generate_consistency_token"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @check_consistency = Google::Gax.create_api_call(
      @bigtable_table_admin_stub.method(:check_consistency),
      defaults["check_consistency"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @snapshot_table = Google::Gax.create_api_call(
      @bigtable_table_admin_stub.method(:snapshot_table),
      defaults["snapshot_table"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @get_snapshot = Google::Gax.create_api_call(
      @bigtable_table_admin_stub.method(:get_snapshot),
      defaults["get_snapshot"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @list_snapshots = Google::Gax.create_api_call(
      @bigtable_table_admin_stub.method(:list_snapshots),
      defaults["list_snapshots"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'parent' => request.parent}
      end
    )
    @delete_snapshot = Google::Gax.create_api_call(
      @bigtable_table_admin_stub.method(:delete_snapshot),
      defaults["delete_snapshot"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
  end

  # Service calls

  # Creates a new table in the specified instance.
  # The table can be created with a full set of initial column families,
  # specified in the request.
  #
  # @param parent [String]
  #   The unique name of the instance in which to create the table.
  #   Values are of the form +projects/<project>/instances/<instance>+.
  # @param table_id [String]
  #   The name by which the new table should be referred to within the parent
  #   instance, e.g., +foobar+ rather than +<parent>/tables/foobar+.
  # @param table [Google::Bigtable::Admin::V2::Table | Hash]
  #   The Table to create.
  #   A hash of the same form as `Google::Bigtable::Admin::V2::Table`
  #   can also be provided.
  # @param initial_splits [Array<Google::Bigtable::Admin::V2::CreateTableRequest::Split | Hash>]
  #   The optional list of row keys that will be used to initially split the
  #   table into several tablets (tablets are similar to HBase regions).
  #   Given two split keys, +s1+ and +s2+, three tablets will be created,
  #   spanning the key ranges: +[, s1), [s1, s2), [s2, )+.
  #
  #   Example:
  #
  #   * Row keys := +["a", "apple", "custom", "customer_1", "customer_2",+
  #     +"other", "zz"]+
  #   * initial_split_keys := +["apple", "customer_1", "customer_2", "other"]+
  #   * Key assignment:
  #     * Tablet 1 +[, apple)                => {"a"}.+
  #       * Tablet 2 +[apple, customer_1)      => {"apple", "custom"}.+
  #       * Tablet 3 +[customer_1, customer_2) => {"customer_1"}.+
  #       * Tablet 4 +[customer_2, other)      => {"customer_2"}.+
  #       * Tablet 5 +[other, )                => {"other", "zz"}.+
  #   A hash of the same form as `Google::Bigtable::Admin::V2::CreateTableRequest::Split`
  #   can also be provided.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Bigtable::Admin::V2::Table]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Bigtable::Admin::V2::Table]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
  #   formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
  #
  #   # TODO: Initialize +table_id+:
  #   table_id = ''
  #
  #   # TODO: Initialize +table+:
  #   table = {}
  #   response = bigtable_table_admin_client.create_table(formatted_parent, table_id, table)

  def create_table \
      parent,
      table_id,
      table,
      initial_splits: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      table_id: table_id,
      table: table,
      initial_splits: initial_splits
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateTableRequest)
    @create_table.call(req, options, &block)
  end

  # Creates a new table from the specified snapshot. The target table must
  # not exist. The snapshot and the table must be in the same instance.
  #
  # Note: This is a private alpha release of Cloud Bigtable snapshots. This
  # feature is not currently available to most Cloud Bigtable customers. This
  # feature might be changed in backward-incompatible ways and is not
  # recommended for production use. It is not subject to any SLA or deprecation
  # policy.
  #
  # @param parent [String]
  #   The unique name of the instance in which to create the table.
  #   Values are of the form +projects/<project>/instances/<instance>+.
  # @param table_id [String]
  #   The name by which the new table should be referred to within the parent
  #   instance, e.g., +foobar+ rather than +<parent>/tables/foobar+.
  # @param source_snapshot [String]
  #   The unique name of the snapshot from which to restore the table. The
  #   snapshot and the table must be in the same instance.
  #   Values are of the form
  #   +projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>+.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @return [Google::Gax::Operation]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
  #   formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
  #
  #   # TODO: Initialize +table_id+:
  #   table_id = ''
  #
  #   # TODO: Initialize +source_snapshot+:
  #   source_snapshot = ''
  #
  #   # Register a callback during the method call.
  #   operation = bigtable_table_admin_client.create_table_from_snapshot(formatted_parent, table_id, source_snapshot) do |op|
  #     raise op.results.message if op.error?
  #     op_results = op.results
  #     # Process the results.
  #
  #     metadata = op.metadata
  #     # Process the metadata.
  #   end
  #
  #   # Or use the return value to register a callback.
  #   operation.on_done do |op|
  #     raise op.results.message if op.error?
  #     op_results = op.results
  #     # Process the results.
  #
  #     metadata = op.metadata
  #     # Process the metadata.
  #   end
  #
  #   # Manually reload the operation.
  #   operation.reload!
  #
  #   # Or block until the operation completes, triggering callbacks on
  #   # completion.
  #   operation.wait_until_done!

  def create_table_from_snapshot \
      parent,
      table_id,
      source_snapshot,
      options: nil
    req = {
      parent: parent,
      table_id: table_id,
      source_snapshot: source_snapshot
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateTableFromSnapshotRequest)
    operation = Google::Gax::Operation.new(
      @create_table_from_snapshot.call(req, options),
      @operations_client,
      Google::Bigtable::Admin::V2::Table,
      Google::Bigtable::Admin::V2::CreateTableFromSnapshotMetadata,
      call_options: options
    )
    operation.on_done { |operation| yield(operation) } if block_given?
    operation
  end

  # Lists all tables served from a specified instance.
  #
  # @param parent [String]
  #   The unique name of the instance for which tables should be listed.
  #   Values are of the form +projects/<project>/instances/<instance>+.
  # @param view [Google::Bigtable::Admin::V2::Table::View]
  #   The view to be applied to the returned tables' fields.
  #   Defaults to +NAME_ONLY+ if unspecified; no others are currently supported.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Table>]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Table>]
  #   An enumerable of Google::Bigtable::Admin::V2::Table instances.
  #   See Google::Gax::PagedEnumerable documentation for other
  #   operations such as per-page iteration or access to the response
  #   object.
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
  #   formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
  #
  #   # Iterate over all results.
  #   bigtable_table_admin_client.list_tables(formatted_parent).each do |element|
  #     # Process element.
  #   end
  #
  #   # Or iterate over results one page at a time.
  #   bigtable_table_admin_client.list_tables(formatted_parent).each_page do |page|
  #     # Process each page at a time.
  #     page.each do |element|
  #       # Process element.
  #     end
  #   end

  def list_tables \
      parent,
      view: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      view: view
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListTablesRequest)
    @list_tables.call(req, options, &block)
  end

  # Gets metadata information about the specified table.
  #
  # @param name [String]
  #   The unique name of the requested table.
  #   Values are of the form
  #   +projects/<project>/instances/<instance>/tables/<table>+.
  # @param view [Google::Bigtable::Admin::V2::Table::View]
  #   The view to be applied to the returned table's fields.
  #   Defaults to +SCHEMA_VIEW+ if unspecified.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Bigtable::Admin::V2::Table]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Bigtable::Admin::V2::Table]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
  #   response = bigtable_table_admin_client.get_table(formatted_name)

  def get_table \
      name,
      view: nil,
      options: nil,
      &block
    req = {
      name: name,
      view: view
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetTableRequest)
    @get_table.call(req, options, &block)
  end

  # Permanently deletes a specified table and all of its data.
  #
  # @param name [String]
  #   The unique name of the table to be deleted.
  #   Values are of the form
  #   +projects/<project>/instances/<instance>/tables/<table>+.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result []
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
  #   bigtable_table_admin_client.delete_table(formatted_name)

  def delete_table \
      name,
      options: nil,
      &block
    req = {
      name: name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteTableRequest)
    @delete_table.call(req, options, &block)
    nil
  end

  # Performs a series of column family modifications on the specified table.
  # Either all or none of the modifications will occur before this method
  # returns, but data requests received prior to that point may see a table
  # where only some modifications have taken effect.
  #
  # @param name [String]
  #   The unique name of the table whose families should be modified.
  #   Values are of the form
  #   +projects/<project>/instances/<instance>/tables/<table>+.
  # @param modifications [Array<Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification | Hash>]
  #   Modifications to be atomically applied to the specified table's families.
  #   Entries are applied in order, meaning that earlier modifications can be
  #   masked by later ones (in the case of repeated updates to the same family,
  #   for example).
  #   A hash of the same form as `Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification`
  #   can also be provided.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Bigtable::Admin::V2::Table]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Bigtable::Admin::V2::Table]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
  #
  #   # TODO: Initialize +modifications+:
  #   modifications = []
  #   response = bigtable_table_admin_client.modify_column_families(formatted_name, modifications)

  def modify_column_families \
      name,
      modifications,
      options: nil,
      &block
    req = {
      name: name,
      modifications: modifications
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest)
    @modify_column_families.call(req, options, &block)
  end

  # Permanently drop/delete a row range from a specified table. The request can
  # specify whether to delete all rows in a table, or only those that match a
  # particular prefix.
  #
  # @param name [String]
  #   The unique name of the table on which to drop a range of rows.
  #   Values are of the form
  #   +projects/<project>/instances/<instance>/tables/<table>+.
  # @param row_key_prefix [String]
  #   Delete all rows that start with this row key prefix. Prefix cannot be
  #   zero length.
  # @param delete_all_data_from_table [true, false]
  #   Delete all rows in the table. Setting this to false is a no-op.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result []
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
  #   bigtable_table_admin_client.drop_row_range(formatted_name)

  def drop_row_range \
      name,
      row_key_prefix: nil,
      delete_all_data_from_table: nil,
      options: nil,
      &block
    req = {
      name: name,
      row_key_prefix: row_key_prefix,
      delete_all_data_from_table: delete_all_data_from_table
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DropRowRangeRequest)
    @drop_row_range.call(req, options, &block)
    nil
  end

  # Generates a consistency token for a Table, which can be used in
  # CheckConsistency to check whether mutations to the table that finished
  # before this call started have been replicated. The tokens will be available
  # for 90 days.
  #
  # @param name [String]
  #   The unique name of the Table for which to create a consistency token.
  #   Values are of the form
  #   +projects/<project>/instances/<instance>/tables/<table>+.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Bigtable::Admin::V2::GenerateConsistencyTokenResponse]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Bigtable::Admin::V2::GenerateConsistencyTokenResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
  #   response = bigtable_table_admin_client.generate_consistency_token(formatted_name)

  def generate_consistency_token \
      name,
      options: nil,
      &block
    req = {
      name: name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GenerateConsistencyTokenRequest)
    @generate_consistency_token.call(req, options, &block)
  end

  # Checks replication consistency based on a consistency token, that is, if
  # replication has caught up based on the conditions specified in the token
  # and the check request.
  #
  # @param name [String]
  #   The unique name of the Table for which to check replication consistency.
  #   Values are of the form
  #   +projects/<project>/instances/<instance>/tables/<table>+.
  # @param consistency_token [String]
  #   The token created using GenerateConsistencyToken for the Table.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Bigtable::Admin::V2::CheckConsistencyResponse]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Bigtable::Admin::V2::CheckConsistencyResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
  #
  #   # TODO: Initialize +consistency_token+:
  #   consistency_token = ''
  #   response = bigtable_table_admin_client.check_consistency(formatted_name, consistency_token)

  def check_consistency \
      name,
      consistency_token,
      options: nil,
      &block
    req = {
      name: name,
      consistency_token: consistency_token
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CheckConsistencyRequest)
    @check_consistency.call(req, options, &block)
  end

  # Creates a new snapshot in the specified cluster from the specified
  # source table. The cluster and the table must be in the same instance.
  #
  # Note: This is a private alpha release of Cloud Bigtable snapshots. This
  # feature is not currently available to most Cloud Bigtable customers. This
  # feature might be changed in backward-incompatible ways and is not
  # recommended for production use. It is not subject to any SLA or deprecation
  # policy.
  #
  # @param name [String]
  #   The unique name of the table to have the snapshot taken.
  #   Values are of the form
  #   +projects/<project>/instances/<instance>/tables/<table>+.
  # @param cluster [String]
  #   The name of the cluster where the snapshot will be created in.
  #   Values are of the form
  #   +projects/<project>/instances/<instance>/clusters/<cluster>+.
  # @param snapshot_id [String]
  #   The ID by which the new snapshot should be referred to within the parent
  #   cluster, e.g., +mysnapshot+ of the form: +[_a-zA-Z0-9][-_.a-zA-Z0-9]*+
  #   rather than
  #   +projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/mysnapshot+.
  # @param description [String]
  #   Description of the snapshot.
  # @param ttl [Google::Protobuf::Duration | Hash]
  #   The amount of time that the new snapshot can stay active after it is
  #   created. Once 'ttl' expires, the snapshot will get deleted. The maximum
  #   amount of time a snapshot can stay active is 7 days. If 'ttl' is not
  #   specified, the default value of 24 hours will be used.
  #   A hash of the same form as `Google::Protobuf::Duration`
  #   can also be provided.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @return [Google::Gax::Operation]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
  #
  #   # TODO: Initialize +cluster+:
  #   cluster = ''
  #
  #   # TODO: Initialize +snapshot_id+:
  #   snapshot_id = ''
  #
  #   # TODO: Initialize +description+:
  #   description = ''
  #
  #   # Register a callback during the method call.
  #   operation = bigtable_table_admin_client.snapshot_table(formatted_name, cluster, snapshot_id, description) do |op|
  #     raise op.results.message if op.error?
  #     op_results = op.results
  #     # Process the results.
  #
  #     metadata = op.metadata
  #     # Process the metadata.
  #   end
  #
  #   # Or use the return value to register a callback.
  #   operation.on_done do |op|
  #     raise op.results.message if op.error?
  #     op_results = op.results
  #     # Process the results.
  #
  #     metadata = op.metadata
  #     # Process the metadata.
  #   end
  #
  #   # Manually reload the operation.
  #   operation.reload!
  #
  #   # Or block until the operation completes, triggering callbacks on
  #   # completion.
  #   operation.wait_until_done!

  def snapshot_table \
      name,
      cluster,
      snapshot_id,
      description,
      ttl: nil,
      options: nil
    req = {
      name: name,
      cluster: cluster,
      snapshot_id: snapshot_id,
      description: description,
      ttl: ttl
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::SnapshotTableRequest)
    operation = Google::Gax::Operation.new(
      @snapshot_table.call(req, options),
      @operations_client,
      Google::Bigtable::Admin::V2::Snapshot,
      Google::Bigtable::Admin::V2::SnapshotTableMetadata,
      call_options: options
    )
    operation.on_done { |operation| yield(operation) } if block_given?
    operation
  end

  # Gets metadata information about the specified snapshot.
  #
  # Note: This is a private alpha release of Cloud Bigtable snapshots. This
  # feature is not currently available to most Cloud Bigtable customers. This
  # feature might be changed in backward-incompatible ways and is not
  # recommended for production use. It is not subject to any SLA or deprecation
  # policy.
  #
  # @param name [String]
  #   The unique name of the requested snapshot.
  #   Values are of the form
  #   +projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>+.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Bigtable::Admin::V2::Snapshot]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Bigtable::Admin::V2::Snapshot]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.snapshot_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]")
  #   response = bigtable_table_admin_client.get_snapshot(formatted_name)

  def get_snapshot \
      name,
      options: nil,
      &block
    req = {
      name: name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetSnapshotRequest)
    @get_snapshot.call(req, options, &block)
  end

  # Lists all snapshots associated with the specified cluster.
  #
  # Note: This is a private alpha release of Cloud Bigtable snapshots. This
  # feature is not currently available to most Cloud Bigtable customers. This
  # feature might be changed in backward-incompatible ways and is not
  # recommended for production use. It is not subject to any SLA or deprecation
  # policy.
  #
  # @param parent [String]
  #   The unique name of the cluster for which snapshots should be listed.
  #   Values are of the form
  #   +projects/<project>/instances/<instance>/clusters/<cluster>+.
  #   Use +<cluster> = '-'+ to list snapshots for all clusters in an instance,
  #   e.g., +projects/<project>/instances/<instance>/clusters/-+.
  # @param page_size [Integer]
  #   The maximum number of resources contained in the underlying API
  #   response. If page streaming is performed per-resource, this
  #   parameter does not affect the return value. If page streaming is
  #   performed per-page, this determines the maximum number of
  #   resources in a page.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Snapshot>]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Snapshot>]
  #   An enumerable of Google::Bigtable::Admin::V2::Snapshot instances.
  #   See Google::Gax::PagedEnumerable documentation for other
  #   operations such as per-page iteration or access to the response
  #   object.
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
  #   formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
  #
  #   # Iterate over all results.
  #   bigtable_table_admin_client.list_snapshots(formatted_parent).each do |element|
  #     # Process element.
  #   end
  #
  #   # Or iterate over results one page at a time.
  #   bigtable_table_admin_client.list_snapshots(formatted_parent).each_page do |page|
  #     # Process each page at a time.
  #     page.each do |element|
  #       # Process element.
  #     end
  #   end

  def list_snapshots \
      parent,
      page_size: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      page_size: page_size
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListSnapshotsRequest)
    @list_snapshots.call(req, options, &block)
  end

  # Permanently deletes the specified snapshot.
  #
  # Note: This is a private alpha release of Cloud Bigtable snapshots. This
  # feature is not currently available to most Cloud Bigtable customers. This
  # feature might be changed in backward-incompatible ways and is not
  # recommended for production use. It is not subject to any SLA or deprecation
  # policy.
  #
  # @param name [String]
  #   The unique name of the snapshot to be deleted.
  #   Values are of the form
  #   +projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>+.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result []
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.snapshot_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]")
  #   bigtable_table_admin_client.delete_snapshot(formatted_name)

  def delete_snapshot \
      name,
      options: nil,
      &block
    req = {
      name: name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteSnapshotRequest)
    @delete_snapshot.call(req, options, &block)
    nil
  end
end

Class Method Details

.cluster_path(project, instance, cluster) ⇒ String

Returns a fully-qualified cluster resource name string.

Parameters:

  • project (String)
  • instance (String)
  • cluster (String)

Returns:

  • (String)


131
132
133
134
135
136
137
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 131

def self.cluster_path project, instance, cluster
  CLUSTER_PATH_TEMPLATE.render(
    :"project" => project,
    :"instance" => instance,
    :"cluster" => cluster
  )
end

.instance_path(project, instance) ⇒ String

Returns a fully-qualified instance resource name string.

Parameters:

  • project (String)
  • instance (String)

Returns:

  • (String)


119
120
121
122
123
124
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 119

def self.instance_path project, instance
  INSTANCE_PATH_TEMPLATE.render(
    :"project" => project,
    :"instance" => instance
  )
end

.snapshot_path(project, instance, cluster, snapshot) ⇒ String

Returns a fully-qualified snapshot resource name string.

Parameters:

  • project (String)
  • instance (String)
  • cluster (String)
  • snapshot (String)

Returns:

  • (String)


145
146
147
148
149
150
151
152
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 145

def self.snapshot_path project, instance, cluster, snapshot
  SNAPSHOT_PATH_TEMPLATE.render(
    :"project" => project,
    :"instance" => instance,
    :"cluster" => cluster,
    :"snapshot" => snapshot
  )
end

.table_path(project, instance, table) ⇒ String

Returns a fully-qualified table resource name string.

Parameters:

  • project (String)
  • instance (String)
  • table (String)

Returns:

  • (String)


159
160
161
162
163
164
165
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 159

def self.table_path project, instance, table
  TABLE_PATH_TEMPLATE.render(
    :"project" => project,
    :"instance" => instance,
    :"table" => table
  )
end

Instance Method Details

#check_consistency(name, consistency_token, options: nil) {|result, operation| ... } ⇒ Google::Bigtable::Admin::V2::CheckConsistencyResponse

Checks replication consistency based on a consistency token, that is, if replication has caught up based on the conditions specified in the token and the check request.

Examples:

require "google/cloud/bigtable/admin"

bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")

# TODO: Initialize +consistency_token+:
consistency_token = ''
response = bigtable_table_admin_client.check_consistency(formatted_name, consistency_token)

Parameters:

  • name (String)

    The unique name of the Table for which to check replication consistency. Values are of the form +projects//instances//tables/

    +.

  • consistency_token (String)

    The token created using GenerateConsistencyToken for the Table.

  • options (Google::Gax::CallOptions)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

  • Yields:

    • (result, operation)

      Access the result along with the RPC operation

    Yield Parameters:

    Returns:

    Raises:

    • (Google::Gax::GaxError)

      if the RPC is aborted.

    
    
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    # File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 818
    
    def check_consistency \
        name,
        consistency_token,
        options: nil,
        &block
      req = {
        name: name,
        consistency_token: consistency_token
      }.delete_if { |_, v| v.nil? }
      req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CheckConsistencyRequest)
      @check_consistency.call(req, options, &block)
    end

    #create_table(parent, table_id, table, initial_splits: nil, options: nil) {|result, operation| ... } ⇒ Google::Bigtable::Admin::V2::Table

    Creates a new table in the specified instance. The table can be created with a full set of initial column families, specified in the request.

    Examples:

    require "google/cloud/bigtable/admin"
    
    bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
    formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
    
    # TODO: Initialize +table_id+:
    table_id = ''
    
    # TODO: Initialize +table+:
    table = {}
    response = bigtable_table_admin_client.create_table(formatted_parent, table_id, table)

    Parameters:

    • parent (String)

      The unique name of the instance in which to create the table. Values are of the form +projects//instances/+.

    • table_id (String)

      The name by which the new table should be referred to within the parent instance, e.g., +foobar+ rather than +/tables/foobar+.

    • table (Google::Bigtable::Admin::V2::Table | Hash)

      The Table to create. A hash of the same form as Google::Bigtable::Admin::V2::Table can also be provided.

    • initial_splits (Array<Google::Bigtable::Admin::V2::CreateTableRequest::Split | Hash>)

      The optional list of row keys that will be used to initially split the table into several tablets (tablets are similar to HBase regions). Given two split keys, +s1+ and +s2+, three tablets will be created, spanning the key ranges: +[, s1), [s1, s2), [s2, )+.

      Example:

      • Row keys := +["a", "apple", "custom", "customer_1", "customer_2",+ +"other", "zz"]+
      • initial_split_keys := +["apple", "customer_1", "customer_2", "other"]+
      • Key assignment:
        • Tablet 1 +[, apple) => "a".+
        • Tablet 2 +[apple, customer_1) => "custom".+
        • Tablet 3 +[customer_1, customer_2) => "customer_1".+
        • Tablet 4 +[customer_2, other) => "customer_2".+
        • Tablet 5 +[other, ) => "zz".+ A hash of the same form as Google::Bigtable::Admin::V2::CreateTableRequest::Split can also be provided.
    • options (Google::Gax::CallOptions)

      Overrides the default settings for this call, e.g, timeout, retries, etc.

    Yields:

    • (result, operation)

      Access the result along with the RPC operation

    Yield Parameters:

    Returns:

    Raises:

    • (Google::Gax::GaxError)

      if the RPC is aborted.

    
    
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    # File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 441
    
    def create_table \
        parent,
        table_id,
        table,
        initial_splits: nil,
        options: nil,
        &block
      req = {
        parent: parent,
        table_id: table_id,
        table: table,
        initial_splits: initial_splits
      }.delete_if { |_, v| v.nil? }
      req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateTableRequest)
      @create_table.call(req, options, &block)
    end

    #create_table_from_snapshot(parent, table_id, source_snapshot, options: nil) ⇒ Google::Gax::Operation

    Creates a new table from the specified snapshot. The target table must not exist. The snapshot and the table must be in the same instance.

    Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.

    Examples:

    require "google/cloud/bigtable/admin"
    
    bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
    formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
    
    # TODO: Initialize +table_id+:
    table_id = ''
    
    # TODO: Initialize +source_snapshot+:
    source_snapshot = ''
    
    # Register a callback during the method call.
    operation = bigtable_table_admin_client.create_table_from_snapshot(formatted_parent, table_id, source_snapshot) do |op|
      raise op.results.message if op.error?
      op_results = op.results
      # Process the results.
    
       = op.
      # Process the metadata.
    end
    
    # Or use the return value to register a callback.
    operation.on_done do |op|
      raise op.results.message if op.error?
      op_results = op.results
      # Process the results.
    
       = op.
      # Process the metadata.
    end
    
    # Manually reload the operation.
    operation.reload!
    
    # Or block until the operation completes, triggering callbacks on
    # completion.
    operation.wait_until_done!

    Parameters:

    • parent (String)

      The unique name of the instance in which to create the table. Values are of the form +projects//instances/+.

    • table_id (String)

      The name by which the new table should be referred to within the parent instance, e.g., +foobar+ rather than +/tables/foobar+.

    • source_snapshot (String)

      The unique name of the snapshot from which to restore the table. The snapshot and the table must be in the same instance. Values are of the form +projects//instances//clusters//snapshots/+.

    • options (Google::Gax::CallOptions)

      Overrides the default settings for this call, e.g, timeout, retries, etc.

    Returns:

    • (Google::Gax::Operation)

    Raises:

    • (Google::Gax::GaxError)

      if the RPC is aborted.

    
    
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    # File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 522
    
    def create_table_from_snapshot \
        parent,
        table_id,
        source_snapshot,
        options: nil
      req = {
        parent: parent,
        table_id: table_id,
        source_snapshot: source_snapshot
      }.delete_if { |_, v| v.nil? }
      req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateTableFromSnapshotRequest)
      operation = Google::Gax::Operation.new(
        @create_table_from_snapshot.call(req, options),
        @operations_client,
        Google::Bigtable::Admin::V2::Table,
        Google::Bigtable::Admin::V2::CreateTableFromSnapshotMetadata,
        call_options: options
      )
      operation.on_done { |operation| yield(operation) } if block_given?
      operation
    end

    #delete_snapshot(name, options: nil) {|result, operation| ... } ⇒ Object

    Permanently deletes the specified snapshot.

    Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.

    Examples:

    require "google/cloud/bigtable/admin"
    
    bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
    formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.snapshot_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]")
    bigtable_table_admin_client.delete_snapshot(formatted_name)

    Parameters:

    • name (String)

      The unique name of the snapshot to be deleted. Values are of the form +projects//instances//clusters//snapshots/+.

    • options (Google::Gax::CallOptions)

      Overrides the default settings for this call, e.g, timeout, retries, etc.

    Yields:

    • (result, operation)

      Access the result along with the RPC operation

    Yield Parameters:

    • result

      []

    • operation (GRPC::ActiveCall::Operation)

    Raises:

    • (Google::Gax::GaxError)

      if the RPC is aborted.

    
    
    1063
    1064
    1065
    1066
    1067
    1068
    1069
    1070
    1071
    1072
    1073
    # File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 1063
    
    def delete_snapshot \
        name,
        options: nil,
        &block
      req = {
        name: name
      }.delete_if { |_, v| v.nil? }
      req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteSnapshotRequest)
      @delete_snapshot.call(req, options, &block)
      nil
    end

    #delete_table(name, options: nil) {|result, operation| ... } ⇒ Object

    Permanently deletes a specified table and all of its data.

    Examples:

    require "google/cloud/bigtable/admin"
    
    bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
    formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
    bigtable_table_admin_client.delete_table(formatted_name)

    Parameters:

    • name (String)

      The unique name of the table to be deleted. Values are of the form +projects//instances//tables/

      +.

    • options (Google::Gax::CallOptions)

      Overrides the default settings for this call, e.g, timeout, retries, etc.

    • Yields:

      • (result, operation)

        Access the result along with the RPC operation

      Yield Parameters:

      • result

        []

      • operation (GRPC::ActiveCall::Operation)

      Raises:

      • (Google::Gax::GaxError)

        if the RPC is aborted.

      
      
      653
      654
      655
      656
      657
      658
      659
      660
      661
      662
      663
      # File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 653
      
      def delete_table \
          name,
          options: nil,
          &block
        req = {
          name: name
        }.delete_if { |_, v| v.nil? }
        req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteTableRequest)
        @delete_table.call(req, options, &block)
        nil
      end

      #drop_row_range(name, row_key_prefix: nil, delete_all_data_from_table: nil, options: nil) {|result, operation| ... } ⇒ Object

      Permanently drop/delete a row range from a specified table. The request can specify whether to delete all rows in a table, or only those that match a particular prefix.

      Examples:

      require "google/cloud/bigtable/admin"
      
      bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
      formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
      bigtable_table_admin_client.drop_row_range(formatted_name)

      Parameters:

      • name (String)

        The unique name of the table on which to drop a range of rows. Values are of the form +projects//instances//tables/

        +.

      • row_key_prefix (String)

        Delete all rows that start with this row key prefix. Prefix cannot be zero length.

      • delete_all_data_from_table (true, false)

        Delete all rows in the table. Setting this to false is a no-op.

      • options (Google::Gax::CallOptions)

        Overrides the default settings for this call, e.g, timeout, retries, etc.

      • Yields:

        • (result, operation)

          Access the result along with the RPC operation

        Yield Parameters:

        • result

          []

        • operation (GRPC::ActiveCall::Operation)

        Raises:

        • (Google::Gax::GaxError)

          if the RPC is aborted.

        
        
        739
        740
        741
        742
        743
        744
        745
        746
        747
        748
        749
        750
        751
        752
        753
        # File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 739
        
        def drop_row_range \
            name,
            row_key_prefix: nil,
            delete_all_data_from_table: nil,
            options: nil,
            &block
          req = {
            name: name,
            row_key_prefix: row_key_prefix,
            delete_all_data_from_table: delete_all_data_from_table
          }.delete_if { |_, v| v.nil? }
          req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DropRowRangeRequest)
          @drop_row_range.call(req, options, &block)
          nil
        end

        #generate_consistency_token(name, options: nil) {|result, operation| ... } ⇒ Google::Bigtable::Admin::V2::GenerateConsistencyTokenResponse

        Generates a consistency token for a Table, which can be used in CheckConsistency to check whether mutations to the table that finished before this call started have been replicated. The tokens will be available for 90 days.

        Examples:

        require "google/cloud/bigtable/admin"
        
        bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
        formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
        response = bigtable_table_admin_client.generate_consistency_token(formatted_name)

        Parameters:

        • name (String)

          The unique name of the Table for which to create a consistency token. Values are of the form +projects//instances//tables/

          +.

        • options (Google::Gax::CallOptions)

          Overrides the default settings for this call, e.g, timeout, retries, etc.

        • Yields:

          • (result, operation)

            Access the result along with the RPC operation

          Yield Parameters:

          Returns:

          Raises:

          • (Google::Gax::GaxError)

            if the RPC is aborted.

          
          
          779
          780
          781
          782
          783
          784
          785
          786
          787
          788
          # File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 779
          
          def generate_consistency_token \
              name,
              options: nil,
              &block
            req = {
              name: name
            }.delete_if { |_, v| v.nil? }
            req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GenerateConsistencyTokenRequest)
            @generate_consistency_token.call(req, options, &block)
          end

          #get_snapshot(name, options: nil) {|result, operation| ... } ⇒ Google::Bigtable::Admin::V2::Snapshot

          Gets metadata information about the specified snapshot.

          Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.

          Examples:

          require "google/cloud/bigtable/admin"
          
          bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
          formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.snapshot_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]")
          response = bigtable_table_admin_client.get_snapshot(formatted_name)

          Parameters:

          • name (String)

            The unique name of the requested snapshot. Values are of the form +projects//instances//clusters//snapshots/+.

          • options (Google::Gax::CallOptions)

            Overrides the default settings for this call, e.g, timeout, retries, etc.

          Yields:

          • (result, operation)

            Access the result along with the RPC operation

          Yield Parameters:

          Returns:

          Raises:

          • (Google::Gax::GaxError)

            if the RPC is aborted.

          
          
          962
          963
          964
          965
          966
          967
          968
          969
          970
          971
          # File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 962
          
          def get_snapshot \
              name,
              options: nil,
              &block
            req = {
              name: name
            }.delete_if { |_, v| v.nil? }
            req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetSnapshotRequest)
            @get_snapshot.call(req, options, &block)
          end

          #get_table(name, view: nil, options: nil) {|result, operation| ... } ⇒ Google::Bigtable::Admin::V2::Table

          Gets metadata information about the specified table.

          Examples:

          require "google/cloud/bigtable/admin"
          
          bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
          formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
          response = bigtable_table_admin_client.get_table(formatted_name)

          Parameters:

          • name (String)

            The unique name of the requested table. Values are of the form +projects//instances//tables/

            +.

          • view (Google::Bigtable::Admin::V2::Table::View)

            The view to be applied to the returned table's fields. Defaults to +SCHEMA_VIEW+ if unspecified.

          • options (Google::Gax::CallOptions)

            Overrides the default settings for this call, e.g, timeout, retries, etc.

          • Yields:

            • (result, operation)

              Access the result along with the RPC operation

            Yield Parameters:

            Returns:

            Raises:

            • (Google::Gax::GaxError)

              if the RPC is aborted.

            
            
            620
            621
            622
            623
            624
            625
            626
            627
            628
            629
            630
            631
            # File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 620
            
            def get_table \
                name,
                view: nil,
                options: nil,
                &block
              req = {
                name: name,
                view: view
              }.delete_if { |_, v| v.nil? }
              req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetTableRequest)
              @get_table.call(req, options, &block)
            end

            #list_snapshots(parent, page_size: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Snapshot>

            Lists all snapshots associated with the specified cluster.

            Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.

            Examples:

            require "google/cloud/bigtable/admin"
            
            bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
            formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
            
            # Iterate over all results.
            bigtable_table_admin_client.list_snapshots(formatted_parent).each do |element|
              # Process element.
            end
            
            # Or iterate over results one page at a time.
            bigtable_table_admin_client.list_snapshots(formatted_parent).each_page do |page|
              # Process each page at a time.
              page.each do |element|
                # Process element.
              end
            end

            Parameters:

            • parent (String)

              The unique name of the cluster for which snapshots should be listed. Values are of the form +projects//instances//clusters/+. Use + = '-'+ to list snapshots for all clusters in an instance, e.g., +projects//instances//clusters/-+.

            • page_size (Integer)

              The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

            • options (Google::Gax::CallOptions)

              Overrides the default settings for this call, e.g, timeout, retries, etc.

            Yields:

            • (result, operation)

              Access the result along with the RPC operation

            Yield Parameters:

            Returns:

            • (Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Snapshot>)

              An enumerable of Google::Bigtable::Admin::V2::Snapshot instances. See Google::Gax::PagedEnumerable documentation for other operations such as per-page iteration or access to the response object.

            Raises:

            • (Google::Gax::GaxError)

              if the RPC is aborted.

            
            
            1024
            1025
            1026
            1027
            1028
            1029
            1030
            1031
            1032
            1033
            1034
            1035
            # File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 1024
            
            def list_snapshots \
                parent,
                page_size: nil,
                options: nil,
                &block
              req = {
                parent: parent,
                page_size: page_size
              }.delete_if { |_, v| v.nil? }
              req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListSnapshotsRequest)
              @list_snapshots.call(req, options, &block)
            end

            #list_tables(parent, view: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Table>

            Lists all tables served from a specified instance.

            Examples:

            require "google/cloud/bigtable/admin"
            
            bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
            formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
            
            # Iterate over all results.
            bigtable_table_admin_client.list_tables(formatted_parent).each do |element|
              # Process element.
            end
            
            # Or iterate over results one page at a time.
            bigtable_table_admin_client.list_tables(formatted_parent).each_page do |page|
              # Process each page at a time.
              page.each do |element|
                # Process element.
              end
            end

            Parameters:

            • parent (String)

              The unique name of the instance for which tables should be listed. Values are of the form +projects//instances/+.

            • view (Google::Bigtable::Admin::V2::Table::View)

              The view to be applied to the returned tables' fields. Defaults to +NAME_ONLY+ if unspecified; no others are currently supported.

            • options (Google::Gax::CallOptions)

              Overrides the default settings for this call, e.g, timeout, retries, etc.

            Yields:

            • (result, operation)

              Access the result along with the RPC operation

            Yield Parameters:

            Returns:

            • (Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Table>)

              An enumerable of Google::Bigtable::Admin::V2::Table instances. See Google::Gax::PagedEnumerable documentation for other operations such as per-page iteration or access to the response object.

            Raises:

            • (Google::Gax::GaxError)

              if the RPC is aborted.

            
            
            583
            584
            585
            586
            587
            588
            589
            590
            591
            592
            593
            594
            # File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 583
            
            def list_tables \
                parent,
                view: nil,
                options: nil,
                &block
              req = {
                parent: parent,
                view: view
              }.delete_if { |_, v| v.nil? }
              req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListTablesRequest)
              @list_tables.call(req, options, &block)
            end

            #modify_column_families(name, modifications, options: nil) {|result, operation| ... } ⇒ Google::Bigtable::Admin::V2::Table

            Performs a series of column family modifications on the specified table. Either all or none of the modifications will occur before this method returns, but data requests received prior to that point may see a table where only some modifications have taken effect.

            Examples:

            require "google/cloud/bigtable/admin"
            
            bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
            formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
            
            # TODO: Initialize +modifications+:
            modifications = []
            response = bigtable_table_admin_client.modify_column_families(formatted_name, modifications)

            Parameters:

            • name (String)

              The unique name of the table whose families should be modified. Values are of the form +projects//instances//tables/

              +.

            • modifications (Array<Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification | Hash>)

              Modifications to be atomically applied to the specified table's families. Entries are applied in order, meaning that earlier modifications can be masked by later ones (in the case of repeated updates to the same family, for example). A hash of the same form as Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification can also be provided.

            • options (Google::Gax::CallOptions)

              Overrides the default settings for this call, e.g, timeout, retries, etc.

            • Yields:

              • (result, operation)

                Access the result along with the RPC operation

              Yield Parameters:

              Returns:

              Raises:

              • (Google::Gax::GaxError)

                if the RPC is aborted.

              
              
              699
              700
              701
              702
              703
              704
              705
              706
              707
              708
              709
              710
              # File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 699
              
              def modify_column_families \
                  name,
                  modifications,
                  options: nil,
                  &block
                req = {
                  name: name,
                  modifications: modifications
                }.delete_if { |_, v| v.nil? }
                req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest)
                @modify_column_families.call(req, options, &block)
              end

              #snapshot_table(name, cluster, snapshot_id, description, ttl: nil, options: nil) ⇒ Google::Gax::Operation

              Creates a new snapshot in the specified cluster from the specified source table. The cluster and the table must be in the same instance.

              Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.

              Examples:

              require "google/cloud/bigtable/admin"
              
              bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
              formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
              
              # TODO: Initialize +cluster+:
              cluster = ''
              
              # TODO: Initialize +snapshot_id+:
              snapshot_id = ''
              
              # TODO: Initialize +description+:
              description = ''
              
              # Register a callback during the method call.
              operation = bigtable_table_admin_client.snapshot_table(formatted_name, cluster, snapshot_id, description) do |op|
                raise op.results.message if op.error?
                op_results = op.results
                # Process the results.
              
                 = op.
                # Process the metadata.
              end
              
              # Or use the return value to register a callback.
              operation.on_done do |op|
                raise op.results.message if op.error?
                op_results = op.results
                # Process the results.
              
                 = op.
                # Process the metadata.
              end
              
              # Manually reload the operation.
              operation.reload!
              
              # Or block until the operation completes, triggering callbacks on
              # completion.
              operation.wait_until_done!

              Parameters:

              • name (String)

                The unique name of the table to have the snapshot taken. Values are of the form +projects//instances//tables/

                +.

              • cluster (String)

                The name of the cluster where the snapshot will be created in. Values are of the form +projects//instances//clusters/+.

              • snapshot_id (String)

                The ID by which the new snapshot should be referred to within the parent cluster, e.g., +mysnapshot+ of the form: +[a-zA-Z0-9][-.a-zA-Z0-9]*+ rather than +projects//instances//clusters//snapshots/mysnapshot+.

              • description (String)

                Description of the snapshot.

              • ttl (Google::Protobuf::Duration | Hash)

                The amount of time that the new snapshot can stay active after it is created. Once 'ttl' expires, the snapshot will get deleted. The maximum amount of time a snapshot can stay active is 7 days. If 'ttl' is not specified, the default value of 24 hours will be used. A hash of the same form as Google::Protobuf::Duration can also be provided.

              • options (Google::Gax::CallOptions)

                Overrides the default settings for this call, e.g, timeout, retries, etc.

              • Returns:

                • (Google::Gax::Operation)

                Raises:

                • (Google::Gax::GaxError)

                  if the RPC is aborted.

                
                
                909
                910
                911
                912
                913
                914
                915
                916
                917
                918
                919
                920
                921
                922
                923
                924
                925
                926
                927
                928
                929
                930
                931
                932
                933
                # File 'lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb', line 909
                
                def snapshot_table \
                    name,
                    cluster,
                    snapshot_id,
                    description,
                    ttl: nil,
                    options: nil
                  req = {
                    name: name,
                    cluster: cluster,
                    snapshot_id: snapshot_id,
                    description: description,
                    ttl: ttl
                  }.delete_if { |_, v| v.nil? }
                  req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::SnapshotTableRequest)
                  operation = Google::Gax::Operation.new(
                    @snapshot_table.call(req, options),
                    @operations_client,
                    Google::Bigtable::Admin::V2::Snapshot,
                    Google::Bigtable::Admin::V2::SnapshotTableMetadata,
                    call_options: options
                  )
                  operation.on_done { |operation| yield(operation) } if block_given?
                  operation
                end