Class: Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient

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

Overview

Service for creating, configuring, and deleting Cloud Bigtable Instances and Clusters. Provides access to the Instance and Cluster schemas only, not the tables' metadata or data stored in those 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: "") ⇒ BigtableInstanceAdminClient

Returns a new instance of BigtableInstanceAdminClient

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.



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
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 201

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_instance_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_instance_admin_client_config.json"
  )
  defaults = client_config_file.open do |f|
    Google::Gax.construct_settings(
      "google.bigtable.admin.v2.BigtableInstanceAdmin",
      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_instance_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::BigtableInstanceAdmin::Stub.method(:new)
  )

  @create_instance = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:create_instance),
    defaults["create_instance"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @get_instance = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:get_instance),
    defaults["get_instance"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @list_instances = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:list_instances),
    defaults["list_instances"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @update_instance = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:update_instance),
    defaults["update_instance"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @partial_update_instance = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:partial_update_instance),
    defaults["partial_update_instance"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'instance.name' => request.instance.name}
    end
  )
  @delete_instance = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:delete_instance),
    defaults["delete_instance"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @create_cluster = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:create_cluster),
    defaults["create_cluster"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @get_cluster = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:get_cluster),
    defaults["get_cluster"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @list_clusters = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:list_clusters),
    defaults["list_clusters"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @update_cluster = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:update_cluster),
    defaults["update_cluster"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @delete_cluster = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:delete_cluster),
    defaults["delete_cluster"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @create_app_profile = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:create_app_profile),
    defaults["create_app_profile"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @get_app_profile = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:get_app_profile),
    defaults["get_app_profile"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @list_app_profiles = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:list_app_profiles),
    defaults["list_app_profiles"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @update_app_profile = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:update_app_profile),
    defaults["update_app_profile"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'app_profile.name' => request.app_profile.name}
    end
  )
  @delete_app_profile = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:delete_app_profile),
    defaults["delete_app_profile"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @get_iam_policy = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:get_iam_policy),
    defaults["get_iam_policy"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'resource' => request.resource}
    end
  )
  @set_iam_policy = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:set_iam_policy),
    defaults["set_iam_policy"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'resource' => request.resource}
    end
  )
  @test_iam_permissions = Google::Gax.create_api_call(
    @bigtable_instance_admin_stub.method(:test_iam_permissions),
    defaults["test_iam_permissions"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'resource' => request.resource}
    end
  )
end

Instance Attribute Details

#bigtable_instance_admin_stubGoogle::Bigtable::Admin::V2::BigtableInstanceAdmin::Stub (readonly)

Returns:

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


43
44
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
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 43

class BigtableInstanceAdminClient
  attr_reader :bigtable_instance_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_app_profiles" => Google::Gax::PageDescriptor.new(
      "page_token",
      "next_page_token",
      "app_profiles")
  }.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 = BigtableInstanceAdminClient::SERVICE_ADDRESS
    self::GRPC_INTERCEPTORS = BigtableInstanceAdminClient::GRPC_INTERCEPTORS
  end

  PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "projects/{project}"
  )

  private_constant :PROJECT_PATH_TEMPLATE

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

  private_constant :INSTANCE_PATH_TEMPLATE

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

  private_constant :APP_PROFILE_PATH_TEMPLATE

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

  private_constant :CLUSTER_PATH_TEMPLATE

  LOCATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "projects/{project}/locations/{location}"
  )

  private_constant :LOCATION_PATH_TEMPLATE

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

  # 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 app_profile resource name string.
  # @param project [String]
  # @param instance [String]
  # @param app_profile [String]
  # @return [String]
  def self.app_profile_path project, instance, app_profile
    APP_PROFILE_PATH_TEMPLATE.render(
      :"project" => project,
      :"instance" => instance,
      :"app_profile" => app_profile
    )
  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 location resource name string.
  # @param project [String]
  # @param location [String]
  # @return [String]
  def self.location_path project, location
    LOCATION_PATH_TEMPLATE.render(
      :"project" => project,
      :"location" => location
    )
  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_instance_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_instance_admin_client_config.json"
    )
    defaults = client_config_file.open do |f|
      Google::Gax.construct_settings(
        "google.bigtable.admin.v2.BigtableInstanceAdmin",
        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_instance_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::BigtableInstanceAdmin::Stub.method(:new)
    )

    @create_instance = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:create_instance),
      defaults["create_instance"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'parent' => request.parent}
      end
    )
    @get_instance = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:get_instance),
      defaults["get_instance"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @list_instances = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:list_instances),
      defaults["list_instances"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'parent' => request.parent}
      end
    )
    @update_instance = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:update_instance),
      defaults["update_instance"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @partial_update_instance = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:partial_update_instance),
      defaults["partial_update_instance"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'instance.name' => request.instance.name}
      end
    )
    @delete_instance = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:delete_instance),
      defaults["delete_instance"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @create_cluster = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:create_cluster),
      defaults["create_cluster"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'parent' => request.parent}
      end
    )
    @get_cluster = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:get_cluster),
      defaults["get_cluster"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @list_clusters = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:list_clusters),
      defaults["list_clusters"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'parent' => request.parent}
      end
    )
    @update_cluster = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:update_cluster),
      defaults["update_cluster"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @delete_cluster = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:delete_cluster),
      defaults["delete_cluster"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @create_app_profile = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:create_app_profile),
      defaults["create_app_profile"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'parent' => request.parent}
      end
    )
    @get_app_profile = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:get_app_profile),
      defaults["get_app_profile"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @list_app_profiles = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:list_app_profiles),
      defaults["list_app_profiles"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'parent' => request.parent}
      end
    )
    @update_app_profile = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:update_app_profile),
      defaults["update_app_profile"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'app_profile.name' => request.app_profile.name}
      end
    )
    @delete_app_profile = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:delete_app_profile),
      defaults["delete_app_profile"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'name' => request.name}
      end
    )
    @get_iam_policy = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:get_iam_policy),
      defaults["get_iam_policy"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'resource' => request.resource}
      end
    )
    @set_iam_policy = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:set_iam_policy),
      defaults["set_iam_policy"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'resource' => request.resource}
      end
    )
    @test_iam_permissions = Google::Gax.create_api_call(
      @bigtable_instance_admin_stub.method(:test_iam_permissions),
      defaults["test_iam_permissions"],
      exception_transformer: exception_transformer,
      params_extractor: proc do |request|
        {'resource' => request.resource}
      end
    )
  end

  # Service calls

  # Create an instance within a project.
  #
  # @param parent [String]
  #   The unique name of the project in which to create the new instance.
  #   Values are of the form +projects/<project>+.
  # @param instance_id [String]
  #   The ID to be used when referring to the new instance within its project,
  #   e.g., just +myinstance+ rather than
  #   +projects/myproject/instances/myinstance+.
  # @param instance [Google::Bigtable::Admin::V2::Instance | Hash]
  #   The instance to create.
  #   Fields marked +OutputOnly+ must be left blank.
  #   A hash of the same form as `Google::Bigtable::Admin::V2::Instance`
  #   can also be provided.
  # @param clusters [Hash{String => Google::Bigtable::Admin::V2::Cluster | Hash}]
  #   The clusters to be created within the instance, mapped by desired
  #   cluster ID, e.g., just +mycluster+ rather than
  #   +projects/myproject/instances/myinstance/clusters/mycluster+.
  #   Fields marked +OutputOnly+ must be left blank.
  #   Currently exactly one cluster must be specified.
  #   A hash of the same form as `Google::Bigtable::Admin::V2::Cluster`
  #   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_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.project_path("[PROJECT]")
  #
  #   # TODO: Initialize +instance_id+:
  #   instance_id = ''
  #
  #   # TODO: Initialize +instance+:
  #   instance = {}
  #
  #   # TODO: Initialize +clusters+:
  #   clusters = {}
  #
  #   # Register a callback during the method call.
  #   operation = bigtable_instance_admin_client.create_instance(formatted_parent, instance_id, instance, clusters) 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_instance \
      parent,
      instance_id,
      instance,
      clusters,
      options: nil
    req = {
      parent: parent,
      instance_id: instance_id,
      instance: instance,
      clusters: clusters
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateInstanceRequest)
    operation = Google::Gax::Operation.new(
      @create_instance.call(req, options),
      @operations_client,
      Google::Bigtable::Admin::V2::Instance,
      Google::Bigtable::Admin::V2::CreateInstanceMetadata,
      call_options: options
    )
    operation.on_done { |operation| yield(operation) } if block_given?
    operation
  end

  # Gets information about an instance.
  #
  # @param name [String]
  #   The unique name of the requested instance. Values are of the form
  #   +projects/<project>/instances/<instance>+.
  # @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::Instance]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Bigtable::Admin::V2::Instance]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
  #   response = bigtable_instance_admin_client.get_instance(formatted_name)

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

  # Lists information about instances in a project.
  #
  # @param parent [String]
  #   The unique name of the project for which a list of instances is requested.
  #   Values are of the form +projects/<project>+.
  # @param page_token [String]
  #   The value of +next_page_token+ returned by a previous call.
  # @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::ListInstancesResponse]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Bigtable::Admin::V2::ListInstancesResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.project_path("[PROJECT]")
  #   response = bigtable_instance_admin_client.list_instances(formatted_parent)

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

  # Updates an instance within a project.
  #
  # @param name [String]
  #   (+OutputOnly+)
  #   The unique name of the instance. Values are of the form
  #   +projects/<project>/instances/[a-z][a-z0-9\\-]+[a-z0-9]+.
  # @param display_name [String]
  #   The descriptive name for this instance as it appears in UIs.
  #   Can be changed at any time, but should be kept globally unique
  #   to avoid confusion.
  # @param type [Google::Bigtable::Admin::V2::Instance::Type]
  #   The type of the instance. Defaults to +PRODUCTION+.
  # @param labels [Hash{String => String}]
  #   Labels are a flexible and lightweight mechanism for organizing cloud
  #   resources into groups that reflect a customer's organizational needs and
  #   deployment strategies. They can be used to filter resources and aggregate
  #   metrics.
  #
  #   * Label keys must be between 1 and 63 characters long and must conform to
  #     the regular expression: +[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}+.
  #   * Label values must be between 0 and 63 characters long and must conform to
  #     the regular expression: +[\p{Ll}\p{Lo}\p{N}_-]{0,63}+.
  #   * No more than 64 labels can be associated with a given resource.
  #   * Keys and values must both be under 128 bytes.
  # @param state [Google::Bigtable::Admin::V2::Instance::State]
  #   (+OutputOnly+)
  #   The current state of the instance.
  # @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::Instance]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Bigtable::Admin::V2::Instance]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
  #
  #   # TODO: Initialize +display_name+:
  #   display_name = ''
  #
  #   # TODO: Initialize +type+:
  #   type = :TYPE_UNSPECIFIED
  #
  #   # TODO: Initialize +labels+:
  #   labels = {}
  #   response = bigtable_instance_admin_client.update_instance(formatted_name, display_name, type, labels)

  def update_instance \
      name,
      display_name,
      type,
      labels,
      state: nil,
      options: nil,
      &block
    req = {
      name: name,
      display_name: display_name,
      type: type,
      labels: labels,
      state: state
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::Instance)
    @update_instance.call(req, options, &block)
  end

  # Partially updates an instance within a project.
  #
  # @param instance [Google::Bigtable::Admin::V2::Instance | Hash]
  #   The Instance which will (partially) replace the current value.
  #   A hash of the same form as `Google::Bigtable::Admin::V2::Instance`
  #   can also be provided.
  # @param update_mask [Google::Protobuf::FieldMask | Hash]
  #   The subset of Instance fields which should be replaced.
  #   Must be explicitly set.
  #   A hash of the same form as `Google::Protobuf::FieldMask`
  #   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_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #
  #   # TODO: Initialize +instance+:
  #   instance = {}
  #
  #   # TODO: Initialize +update_mask+:
  #   update_mask = {}
  #
  #   # Register a callback during the method call.
  #   operation = bigtable_instance_admin_client.partial_update_instance(instance, update_mask) 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 partial_update_instance \
      instance,
      update_mask,
      options: nil
    req = {
      instance: instance,
      update_mask: update_mask
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::PartialUpdateInstanceRequest)
    operation = Google::Gax::Operation.new(
      @partial_update_instance.call(req, options),
      @operations_client,
      Google::Bigtable::Admin::V2::Instance,
      Google::Bigtable::Admin::V2::UpdateInstanceMetadata,
      call_options: options
    )
    operation.on_done { |operation| yield(operation) } if block_given?
    operation
  end

  # Delete an instance from a project.
  #
  # @param name [String]
  #   The unique name of the instance to be deleted.
  #   Values are of the form +projects/<project>/instances/<instance>+.
  # @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_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
  #   bigtable_instance_admin_client.delete_instance(formatted_name)

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

  # Creates a cluster within an instance.
  #
  # @param parent [String]
  #   The unique name of the instance in which to create the new cluster.
  #   Values are of the form
  #   +projects/<project>/instances/<instance>+.
  # @param cluster_id [String]
  #   The ID to be used when referring to the new cluster within its instance,
  #   e.g., just +mycluster+ rather than
  #   +projects/myproject/instances/myinstance/clusters/mycluster+.
  # @param cluster [Google::Bigtable::Admin::V2::Cluster | Hash]
  #   The cluster to be created.
  #   Fields marked +OutputOnly+ must be left blank.
  #   A hash of the same form as `Google::Bigtable::Admin::V2::Cluster`
  #   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_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
  #
  #   # TODO: Initialize +cluster_id+:
  #   cluster_id = ''
  #
  #   # TODO: Initialize +cluster+:
  #   cluster = {}
  #
  #   # Register a callback during the method call.
  #   operation = bigtable_instance_admin_client.create_cluster(formatted_parent, cluster_id, cluster) 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_cluster \
      parent,
      cluster_id,
      cluster,
      options: nil
    req = {
      parent: parent,
      cluster_id: cluster_id,
      cluster: cluster
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateClusterRequest)
    operation = Google::Gax::Operation.new(
      @create_cluster.call(req, options),
      @operations_client,
      Google::Bigtable::Admin::V2::Cluster,
      Google::Bigtable::Admin::V2::CreateClusterMetadata,
      call_options: options
    )
    operation.on_done { |operation| yield(operation) } if block_given?
    operation
  end

  # Gets information about a cluster.
  #
  # @param name [String]
  #   The unique name of the requested cluster. Values are of the form
  #   +projects/<project>/instances/<instance>/clusters/<cluster>+.
  # @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::Cluster]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Bigtable::Admin::V2::Cluster]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
  #   response = bigtable_instance_admin_client.get_cluster(formatted_name)

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

  # Lists information about clusters in an instance.
  #
  # @param parent [String]
  #   The unique name of the instance for which a list of clusters is requested.
  #   Values are of the form +projects/<project>/instances/<instance>+.
  #   Use +<instance> = '-'+ to list Clusters for all Instances in a project,
  #   e.g., +projects/myproject/instances/-+.
  # @param page_token [String]
  #   The value of +next_page_token+ returned by a previous call.
  # @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::ListClustersResponse]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Bigtable::Admin::V2::ListClustersResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
  #   response = bigtable_instance_admin_client.list_clusters(formatted_parent)

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

  # Updates a cluster within an instance.
  #
  # @param name [String]
  #   (+OutputOnly+)
  #   The unique name of the cluster. Values are of the form
  #   +projects/<project>/instances/<instance>/clusters/[a-z][-a-z0-9]*+.
  # @param serve_nodes [Integer]
  #   The number of nodes allocated to this cluster. More nodes enable higher
  #   throughput and more consistent performance.
  # @param location [String]
  #   (+CreationOnly+)
  #   The location where this cluster's nodes and storage reside. For best
  #   performance, clients should be located as close as possible to this
  #   cluster. Currently only zones are supported, so values should be of the
  #   form +projects/<project>/locations/<zone>+.
  # @param state [Google::Bigtable::Admin::V2::Cluster::State]
  #   (+OutputOnly+)
  #   The current state of the cluster.
  # @param default_storage_type [Google::Bigtable::Admin::V2::StorageType]
  #   (+CreationOnly+)
  #   The type of storage used by this cluster to serve its
  #   parent instance's tables, unless explicitly overridden.
  # @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_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
  #
  #   # TODO: Initialize +serve_nodes+:
  #   serve_nodes = 0
  #
  #   # Register a callback during the method call.
  #   operation = bigtable_instance_admin_client.update_cluster(formatted_name, serve_nodes) 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 update_cluster \
      name,
      serve_nodes,
      location: nil,
      state: nil,
      default_storage_type: nil,
      options: nil
    req = {
      name: name,
      serve_nodes: serve_nodes,
      location: location,
      state: state,
      default_storage_type: default_storage_type
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::Cluster)
    operation = Google::Gax::Operation.new(
      @update_cluster.call(req, options),
      @operations_client,
      Google::Bigtable::Admin::V2::Cluster,
      Google::Bigtable::Admin::V2::UpdateClusterMetadata,
      call_options: options
    )
    operation.on_done { |operation| yield(operation) } if block_given?
    operation
  end

  # Deletes a cluster from an instance.
  #
  # @param name [String]
  #   The unique name of the cluster to be deleted. Values are of the form
  #   +projects/<project>/instances/<instance>/clusters/<cluster>+.
  # @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_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
  #   bigtable_instance_admin_client.delete_cluster(formatted_name)

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

  # Creates an app profile within an instance.
  #
  # @param parent [String]
  #   The unique name of the instance in which to create the new app profile.
  #   Values are of the form
  #   +projects/<project>/instances/<instance>+.
  # @param app_profile_id [String]
  #   The ID to be used when referring to the new app profile within its
  #   instance, e.g., just +myprofile+ rather than
  #   +projects/myproject/instances/myinstance/appProfiles/myprofile+.
  # @param app_profile [Google::Bigtable::Admin::V2::AppProfile | Hash]
  #   The app profile to be created.
  #   Fields marked +OutputOnly+ will be ignored.
  #   A hash of the same form as `Google::Bigtable::Admin::V2::AppProfile`
  #   can also be provided.
  # @param ignore_warnings [true, false]
  #   If true, ignore safety checks when creating the app profile.
  # @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::AppProfile]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Bigtable::Admin::V2::AppProfile]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
  #
  #   # TODO: Initialize +app_profile_id+:
  #   app_profile_id = ''
  #
  #   # TODO: Initialize +app_profile+:
  #   app_profile = {}
  #   response = bigtable_instance_admin_client.create_app_profile(formatted_parent, app_profile_id, app_profile)

  def create_app_profile \
      parent,
      app_profile_id,
      app_profile,
      ignore_warnings: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      app_profile_id: app_profile_id,
      app_profile: app_profile,
      ignore_warnings: ignore_warnings
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateAppProfileRequest)
    @create_app_profile.call(req, options, &block)
  end

  # Gets information about an app profile.
  #
  # @param name [String]
  #   The unique name of the requested app profile. Values are of the form
  #   +projects/<project>/instances/<instance>/appProfiles/<app_profile>+.
  # @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::AppProfile]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Bigtable::Admin::V2::AppProfile]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.app_profile_path("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]")
  #   response = bigtable_instance_admin_client.get_app_profile(formatted_name)

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

  # Lists information about app profiles in an instance.
  #
  # @param parent [String]
  #   The unique name of the instance for which a list of app profiles is
  #   requested. Values are of the form
  #   +projects/<project>/instances/<instance>+.
  # @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::AppProfile>]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::AppProfile>]
  #   An enumerable of Google::Bigtable::Admin::V2::AppProfile 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_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
  #
  #   # Iterate over all results.
  #   bigtable_instance_admin_client.list_app_profiles(formatted_parent).each do |element|
  #     # Process element.
  #   end
  #
  #   # Or iterate over results one page at a time.
  #   bigtable_instance_admin_client.list_app_profiles(formatted_parent).each_page do |page|
  #     # Process each page at a time.
  #     page.each do |element|
  #       # Process element.
  #     end
  #   end

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

  # Updates an app profile within an instance.
  #
  # @param app_profile [Google::Bigtable::Admin::V2::AppProfile | Hash]
  #   The app profile which will (partially) replace the current value.
  #   A hash of the same form as `Google::Bigtable::Admin::V2::AppProfile`
  #   can also be provided.
  # @param update_mask [Google::Protobuf::FieldMask | Hash]
  #   The subset of app profile fields which should be replaced.
  #   If unset, all fields will be replaced.
  #   A hash of the same form as `Google::Protobuf::FieldMask`
  #   can also be provided.
  # @param ignore_warnings [true, false]
  #   If true, ignore safety checks when updating the app profile.
  # @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_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #
  #   # TODO: Initialize +app_profile+:
  #   app_profile = {}
  #
  #   # TODO: Initialize +update_mask+:
  #   update_mask = {}
  #
  #   # Register a callback during the method call.
  #   operation = bigtable_instance_admin_client.update_app_profile(app_profile, update_mask) 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 update_app_profile \
      app_profile,
      update_mask,
      ignore_warnings: nil,
      options: nil
    req = {
      app_profile: app_profile,
      update_mask: update_mask,
      ignore_warnings: ignore_warnings
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::UpdateAppProfileRequest)
    operation = Google::Gax::Operation.new(
      @update_app_profile.call(req, options),
      @operations_client,
      Google::Bigtable::Admin::V2::AppProfile,
      Google::Bigtable::Admin::V2::UpdateAppProfileMetadata,
      call_options: options
    )
    operation.on_done { |operation| yield(operation) } if block_given?
    operation
  end

  # Deletes an app profile from an instance.
  #
  # @param name [String]
  #   The unique name of the app profile to be deleted. Values are of the form
  #   +projects/<project>/instances/<instance>/appProfiles/<app_profile>+.
  # @param ignore_warnings [true, false]
  #   If true, ignore safety checks when deleting the app profile.
  # @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_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.app_profile_path("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]")
  #
  #   # TODO: Initialize +ignore_warnings+:
  #   ignore_warnings = false
  #   bigtable_instance_admin_client.delete_app_profile(formatted_name, ignore_warnings)

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

  # Gets the access control policy for an instance resource. Returns an empty
  # policy if an instance exists but does not have a policy set.
  #
  # @param resource [String]
  #   REQUIRED: The resource for which the policy is being requested.
  #   +resource+ is usually specified as a path. For example, a Project
  #   resource is specified as +projects/{project}+.
  # @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::Iam::V1::Policy]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Iam::V1::Policy]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
  #   response = bigtable_instance_admin_client.get_iam_policy(formatted_resource)

  def get_iam_policy \
      resource,
      options: nil,
      &block
    req = {
      resource: resource
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
    @get_iam_policy.call(req, options, &block)
  end

  # Sets the access control policy on an instance resource. Replaces any
  # existing policy.
  #
  # @param resource [String]
  #   REQUIRED: The resource for which the policy is being specified.
  #   +resource+ is usually specified as a path. For example, a Project
  #   resource is specified as +projects/{project}+.
  # @param policy [Google::Iam::V1::Policy | Hash]
  #   REQUIRED: The complete policy to be applied to the +resource+. The size of
  #   the policy is limited to a few 10s of KB. An empty policy is a
  #   valid policy but certain Cloud Platform services (such as Projects)
  #   might reject them.
  #   A hash of the same form as `Google::Iam::V1::Policy`
  #   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::Iam::V1::Policy]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Iam::V1::Policy]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
  #
  #   # TODO: Initialize +policy+:
  #   policy = {}
  #   response = bigtable_instance_admin_client.set_iam_policy(formatted_resource, policy)

  def set_iam_policy \
      resource,
      policy,
      options: nil,
      &block
    req = {
      resource: resource,
      policy: policy
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
    @set_iam_policy.call(req, options, &block)
  end

  # Returns permissions that the caller has on the specified instance resource.
  #
  # @param resource [String]
  #   REQUIRED: The resource for which the policy detail is being requested.
  #   +resource+ is usually specified as a path. For example, a Project
  #   resource is specified as +projects/{project}+.
  # @param permissions [Array<String>]
  #   The set of permissions to check for the +resource+. Permissions with
  #   wildcards (such as '*' or 'storage.*') are not allowed. For more
  #   information see
  #   [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
  # @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::Iam::V1::TestIamPermissionsResponse]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Iam::V1::TestIamPermissionsResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/bigtable/admin"
  #
  #   bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
  #   formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
  #
  #   # TODO: Initialize +permissions+:
  #   permissions = []
  #   response = bigtable_instance_admin_client.test_iam_permissions(formatted_resource, permissions)

  def test_iam_permissions \
      resource,
      permissions,
      options: nil,
      &block
    req = {
      resource: resource,
      permissions: permissions
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
    @test_iam_permissions.call(req, options, &block)
  end
end

Class Method Details

.app_profile_path(project, instance, app_profile) ⇒ String

Returns a fully-qualified app_profile resource name string.

Parameters:

  • project (String)
  • instance (String)
  • app_profile (String)

Returns:

  • (String)


140
141
142
143
144
145
146
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 140

def self.app_profile_path project, instance, app_profile
  APP_PROFILE_PATH_TEMPLATE.render(
    :"project" => project,
    :"instance" => instance,
    :"app_profile" => app_profile
  )
end

.cluster_path(project, instance, cluster) ⇒ String

Returns a fully-qualified cluster resource name string.

Parameters:

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

Returns:

  • (String)


153
154
155
156
157
158
159
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 153

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)


128
129
130
131
132
133
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 128

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

.location_path(project, location) ⇒ String

Returns a fully-qualified location resource name string.

Parameters:

  • project (String)
  • location (String)

Returns:

  • (String)


165
166
167
168
169
170
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 165

def self.location_path project, location
  LOCATION_PATH_TEMPLATE.render(
    :"project" => project,
    :"location" => location
  )
end

.project_path(project) ⇒ String

Returns a fully-qualified project resource name string.

Parameters:

  • project (String)

Returns:

  • (String)


118
119
120
121
122
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 118

def self.project_path project
  PROJECT_PATH_TEMPLATE.render(
    :"project" => project
  )
end

Instance Method Details

#create_app_profile(parent, app_profile_id, app_profile, ignore_warnings: nil, options: nil) {|result, operation| ... } ⇒ Google::Bigtable::Admin::V2::AppProfile

Creates an app profile within an instance.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")

# TODO: Initialize +app_profile_id+:
app_profile_id = ''

# TODO: Initialize +app_profile+:
app_profile = {}
response = bigtable_instance_admin_client.create_app_profile(formatted_parent, app_profile_id, app_profile)

Parameters:

  • parent (String)

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

  • app_profile_id (String)

    The ID to be used when referring to the new app profile within its instance, e.g., just +myprofile+ rather than +projects/myproject/instances/myinstance/appProfiles/myprofile+.

  • app_profile (Google::Bigtable::Admin::V2::AppProfile | Hash)

    The app profile to be created. Fields marked +OutputOnly+ will be ignored. A hash of the same form as Google::Bigtable::Admin::V2::AppProfile can also be provided.

  • ignore_warnings (true, false)

    If true, ignore safety checks when creating the app profile.

  • 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.



1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 1081

def create_app_profile \
    parent,
    app_profile_id,
    app_profile,
    ignore_warnings: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    app_profile_id: app_profile_id,
    app_profile: app_profile,
    ignore_warnings: ignore_warnings
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateAppProfileRequest)
  @create_app_profile.call(req, options, &block)
end

#create_cluster(parent, cluster_id, cluster, options: nil) ⇒ Google::Gax::Operation

Creates a cluster within an instance.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")

# TODO: Initialize +cluster_id+:
cluster_id = ''

# TODO: Initialize +cluster+:
cluster = {}

# Register a callback during the method call.
operation = bigtable_instance_admin_client.create_cluster(formatted_parent, cluster_id, cluster) 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 new cluster. Values are of the form +projects//instances/+.

  • cluster_id (String)

    The ID to be used when referring to the new cluster within its instance, e.g., just +mycluster+ rather than +projects/myproject/instances/myinstance/clusters/mycluster+.

  • cluster (Google::Bigtable::Admin::V2::Cluster | Hash)

    The cluster to be created. Fields marked +OutputOnly+ must be left blank. A hash of the same form as Google::Bigtable::Admin::V2::Cluster 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.



833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 833

def create_cluster \
    parent,
    cluster_id,
    cluster,
    options: nil
  req = {
    parent: parent,
    cluster_id: cluster_id,
    cluster: cluster
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateClusterRequest)
  operation = Google::Gax::Operation.new(
    @create_cluster.call(req, options),
    @operations_client,
    Google::Bigtable::Admin::V2::Cluster,
    Google::Bigtable::Admin::V2::CreateClusterMetadata,
    call_options: options
  )
  operation.on_done { |operation| yield(operation) } if block_given?
  operation
end

#create_instance(parent, instance_id, instance, clusters, options: nil) ⇒ Google::Gax::Operation

Create an instance within a project.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.project_path("[PROJECT]")

# TODO: Initialize +instance_id+:
instance_id = ''

# TODO: Initialize +instance+:
instance = {}

# TODO: Initialize +clusters+:
clusters = {}

# Register a callback during the method call.
operation = bigtable_instance_admin_client.create_instance(formatted_parent, instance_id, instance, clusters) 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 project in which to create the new instance. Values are of the form +projects/+.

  • instance_id (String)

    The ID to be used when referring to the new instance within its project, e.g., just +myinstance+ rather than +projects/myproject/instances/myinstance+.

  • instance (Google::Bigtable::Admin::V2::Instance | Hash)

    The instance to create. Fields marked +OutputOnly+ must be left blank. A hash of the same form as Google::Bigtable::Admin::V2::Instance can also be provided.

  • clusters (Hash{String => Google::Bigtable::Admin::V2::Cluster | Hash})

    The clusters to be created within the instance, mapped by desired cluster ID, e.g., just +mycluster+ rather than +projects/myproject/instances/myinstance/clusters/mycluster+. Fields marked +OutputOnly+ must be left blank. Currently exactly one cluster must be specified. A hash of the same form as Google::Bigtable::Admin::V2::Cluster 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.



509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 509

def create_instance \
    parent,
    instance_id,
    instance,
    clusters,
    options: nil
  req = {
    parent: parent,
    instance_id: instance_id,
    instance: instance,
    clusters: clusters
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateInstanceRequest)
  operation = Google::Gax::Operation.new(
    @create_instance.call(req, options),
    @operations_client,
    Google::Bigtable::Admin::V2::Instance,
    Google::Bigtable::Admin::V2::CreateInstanceMetadata,
    call_options: options
  )
  operation.on_done { |operation| yield(operation) } if block_given?
  operation
end

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

Deletes an app profile from an instance.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.app_profile_path("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]")

# TODO: Initialize +ignore_warnings+:
ignore_warnings = false
bigtable_instance_admin_client.delete_app_profile(formatted_name, ignore_warnings)

Parameters:

  • name (String)

    The unique name of the app profile to be deleted. Values are of the form +projects//instances//appProfiles/+.

  • ignore_warnings (true, false)

    If true, ignore safety checks when deleting the app profile.

  • 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.



1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 1279

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

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

Deletes a cluster from an instance.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
bigtable_instance_admin_client.delete_cluster(formatted_name)

Parameters:

  • name (String)

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

  • 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.



1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 1031

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

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

Delete an instance from a project.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
bigtable_instance_admin_client.delete_instance(formatted_name)

Parameters:

  • name (String)

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

  • 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.



762
763
764
765
766
767
768
769
770
771
772
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 762

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

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

Gets information about an app profile.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.app_profile_path("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]")
response = bigtable_instance_admin_client.get_app_profile(formatted_name)

Parameters:

  • name (String)

    The unique name of the requested app profile. Values are of the form +projects//instances//appProfiles/+.

  • 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.



1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 1118

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

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

Gets information about a cluster.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
response = bigtable_instance_admin_client.get_cluster(formatted_name)

Parameters:

  • name (String)

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

  • 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.



875
876
877
878
879
880
881
882
883
884
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 875

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

#get_iam_policy(resource, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::Policy

Gets the access control policy for an instance resource. Returns an empty policy if an instance exists but does not have a policy set.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
response = bigtable_instance_admin_client.get_iam_policy(formatted_resource)

Parameters:

  • resource (String)

    REQUIRED: The resource for which the policy is being requested. +resource+ is usually specified as a path. For example, a Project resource is specified as +projects/project+.

  • 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.



1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 1315

def get_iam_policy \
    resource,
    options: nil,
    &block
  req = {
    resource: resource
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
  @get_iam_policy.call(req, options, &block)
end

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

Gets information about an instance.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
response = bigtable_instance_admin_client.get_instance(formatted_name)

Parameters:

  • name (String)

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

  • 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.



553
554
555
556
557
558
559
560
561
562
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 553

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

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

Lists information about app profiles in an instance.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")

# Iterate over all results.
bigtable_instance_admin_client.list_app_profiles(formatted_parent).each do |element|
  # Process element.
end

# Or iterate over results one page at a time.
bigtable_instance_admin_client.list_app_profiles(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 a list of app profiles is requested. Values are of the form +projects//instances/+.

  • 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::AppProfile>)

    An enumerable of Google::Bigtable::Admin::V2::AppProfile 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.



1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 1166

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

#list_clusters(parent, page_token: nil, options: nil) {|result, operation| ... } ⇒ Google::Bigtable::Admin::V2::ListClustersResponse

Lists information about clusters in an instance.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
response = bigtable_instance_admin_client.list_clusters(formatted_parent)

Parameters:

  • parent (String)

    The unique name of the instance for which a list of clusters is requested. Values are of the form +projects//instances/+. Use + = '-'+ to list Clusters for all Instances in a project, e.g., +projects/myproject/instances/-+.

  • page_token (String)

    The value of +next_page_token+ returned by a previous call.

  • 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.



910
911
912
913
914
915
916
917
918
919
920
921
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 910

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

#list_instances(parent, page_token: nil, options: nil) {|result, operation| ... } ⇒ Google::Bigtable::Admin::V2::ListInstancesResponse

Lists information about instances in a project.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.project_path("[PROJECT]")
response = bigtable_instance_admin_client.list_instances(formatted_parent)

Parameters:

  • parent (String)

    The unique name of the project for which a list of instances is requested. Values are of the form +projects/+.

  • page_token (String)

    The value of +next_page_token+ returned by a previous call.

  • 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.



586
587
588
589
590
591
592
593
594
595
596
597
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 586

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

#partial_update_instance(instance, update_mask, options: nil) ⇒ Google::Gax::Operation

Partially updates an instance within a project.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)

# TODO: Initialize +instance+:
instance = {}

# TODO: Initialize +update_mask+:
update_mask = {}

# Register a callback during the method call.
operation = bigtable_instance_admin_client.partial_update_instance(instance, update_mask) 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:

  • instance (Google::Bigtable::Admin::V2::Instance | Hash)

    The Instance which will (partially) replace the current value. A hash of the same form as Google::Bigtable::Admin::V2::Instance can also be provided.

  • update_mask (Google::Protobuf::FieldMask | Hash)

    The subset of Instance fields which should be replaced. Must be explicitly set. A hash of the same form as Google::Protobuf::FieldMask 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.



723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 723

def partial_update_instance \
    instance,
    update_mask,
    options: nil
  req = {
    instance: instance,
    update_mask: update_mask
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::PartialUpdateInstanceRequest)
  operation = Google::Gax::Operation.new(
    @partial_update_instance.call(req, options),
    @operations_client,
    Google::Bigtable::Admin::V2::Instance,
    Google::Bigtable::Admin::V2::UpdateInstanceMetadata,
    call_options: options
  )
  operation.on_done { |operation| yield(operation) } if block_given?
  operation
end

#set_iam_policy(resource, policy, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::Policy

Sets the access control policy on an instance resource. Replaces any existing policy.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")

# TODO: Initialize +policy+:
policy = {}
response = bigtable_instance_admin_client.set_iam_policy(formatted_resource, policy)

Parameters:

  • resource (String)

    REQUIRED: The resource for which the policy is being specified. +resource+ is usually specified as a path. For example, a Project resource is specified as +projects/project+.

  • policy (Google::Iam::V1::Policy | Hash)

    REQUIRED: The complete policy to be applied to the +resource+. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them. A hash of the same form as Google::Iam::V1::Policy 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.



1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 1358

def set_iam_policy \
    resource,
    policy,
    options: nil,
    &block
  req = {
    resource: resource,
    policy: policy
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
  @set_iam_policy.call(req, options, &block)
end

#test_iam_permissions(resource, permissions, options: nil) {|result, operation| ... } ⇒ Google::Iam::V1::TestIamPermissionsResponse

Returns permissions that the caller has on the specified instance resource.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")

# TODO: Initialize +permissions+:
permissions = []
response = bigtable_instance_admin_client.test_iam_permissions(formatted_resource, permissions)

Parameters:

  • resource (String)

    REQUIRED: The resource for which the policy detail is being requested. +resource+ is usually specified as a path. For example, a Project resource is specified as +projects/project+.

  • permissions (Array<String>)

    The set of permissions to check for the +resource+. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

  • 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.



1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 1400

def test_iam_permissions \
    resource,
    permissions,
    options: nil,
    &block
  req = {
    resource: resource,
    permissions: permissions
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
  @test_iam_permissions.call(req, options, &block)
end

#update_app_profile(app_profile, update_mask, ignore_warnings: nil, options: nil) ⇒ Google::Gax::Operation

Updates an app profile within an instance.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)

# TODO: Initialize +app_profile+:
app_profile = {}

# TODO: Initialize +update_mask+:
update_mask = {}

# Register a callback during the method call.
operation = bigtable_instance_admin_client.update_app_profile(app_profile, update_mask) 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:

  • app_profile (Google::Bigtable::Admin::V2::AppProfile | Hash)

    The app profile which will (partially) replace the current value. A hash of the same form as Google::Bigtable::Admin::V2::AppProfile can also be provided.

  • update_mask (Google::Protobuf::FieldMask | Hash)

    The subset of app profile fields which should be replaced. If unset, all fields will be replaced. A hash of the same form as Google::Protobuf::FieldMask can also be provided.

  • ignore_warnings (true, false)

    If true, ignore safety checks when updating the app profile.

  • 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.



1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 1233

def update_app_profile \
    app_profile,
    update_mask,
    ignore_warnings: nil,
    options: nil
  req = {
    app_profile: app_profile,
    update_mask: update_mask,
    ignore_warnings: ignore_warnings
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::UpdateAppProfileRequest)
  operation = Google::Gax::Operation.new(
    @update_app_profile.call(req, options),
    @operations_client,
    Google::Bigtable::Admin::V2::AppProfile,
    Google::Bigtable::Admin::V2::UpdateAppProfileMetadata,
    call_options: options
  )
  operation.on_done { |operation| yield(operation) } if block_given?
  operation
end

#update_cluster(name, serve_nodes, location: nil, state: nil, default_storage_type: nil, options: nil) ⇒ Google::Gax::Operation

Updates a cluster within an instance.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")

# TODO: Initialize +serve_nodes+:
serve_nodes = 0

# Register a callback during the method call.
operation = bigtable_instance_admin_client.update_cluster(formatted_name, serve_nodes) 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)

    (+OutputOnly+) The unique name of the cluster. Values are of the form +projects//instances//clusters/[a-z][-a-z0-9]*+.

  • serve_nodes (Integer)

    The number of nodes allocated to this cluster. More nodes enable higher throughput and more consistent performance.

  • location (String)

    (+CreationOnly+) The location where this cluster's nodes and storage reside. For best performance, clients should be located as close as possible to this cluster. Currently only zones are supported, so values should be of the form +projects//locations/+.

  • state (Google::Bigtable::Admin::V2::Cluster::State)

    (+OutputOnly+) The current state of the cluster.

  • default_storage_type (Google::Bigtable::Admin::V2::StorageType)

    (+CreationOnly+) The type of storage used by this cluster to serve its parent instance's tables, unless explicitly overridden.

  • 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.



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
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 986

def update_cluster \
    name,
    serve_nodes,
    location: nil,
    state: nil,
    default_storage_type: nil,
    options: nil
  req = {
    name: name,
    serve_nodes: serve_nodes,
    location: location,
    state: state,
    default_storage_type: default_storage_type
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::Cluster)
  operation = Google::Gax::Operation.new(
    @update_cluster.call(req, options),
    @operations_client,
    Google::Bigtable::Admin::V2::Cluster,
    Google::Bigtable::Admin::V2::UpdateClusterMetadata,
    call_options: options
  )
  operation.on_done { |operation| yield(operation) } if block_given?
  operation
end

#update_instance(name, display_name, type, labels, state: nil, options: nil) {|result, operation| ... } ⇒ Google::Bigtable::Admin::V2::Instance

Updates an instance within a project.

Examples:

require "google/cloud/bigtable/admin"

bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")

# TODO: Initialize +display_name+:
display_name = ''

# TODO: Initialize +type+:
type = :TYPE_UNSPECIFIED

# TODO: Initialize +labels+:
labels = {}
response = bigtable_instance_admin_client.update_instance(formatted_name, display_name, type, labels)

Parameters:

  • name (String)

    (+OutputOnly+) The unique name of the instance. Values are of the form +projects//instances/[a-z][a-z0-9\-]+[a-z0-9]+.

  • display_name (String)

    The descriptive name for this instance as it appears in UIs. Can be changed at any time, but should be kept globally unique to avoid confusion.

  • type (Google::Bigtable::Admin::V2::Instance::Type)

    The type of the instance. Defaults to +PRODUCTION+.

  • labels (Hash{String => String})

    Labels are a flexible and lightweight mechanism for organizing cloud resources into groups that reflect a customer's organizational needs and deployment strategies. They can be used to filter resources and aggregate metrics.

    • Label keys must be between 1 and 63 characters long and must conform to the regular expression: +[\pLl\pLo][\pLl\pLo\pN_-]0,62+.
    • Label values must be between 0 and 63 characters long and must conform to the regular expression: +[\pLl\pLo\pN_-]0,63+.
    • No more than 64 labels can be associated with a given resource.
    • Keys and values must both be under 128 bytes.
  • state (Google::Bigtable::Admin::V2::Instance::State)

    (+OutputOnly+) The current state of the instance.

  • 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.



650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
# File 'lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb', line 650

def update_instance \
    name,
    display_name,
    type,
    labels,
    state: nil,
    options: nil,
    &block
  req = {
    name: name,
    display_name: display_name,
    type: type,
    labels: labels,
    state: state
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::Instance)
  @update_instance.call(req, options, &block)
end