google-cloud-bigtable 1.0.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/lib/google/bigtable/admin/v2/bigtable_instance_admin_pb.rb +3 -0
  4. data/lib/google/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +6 -3
  5. data/lib/google/bigtable/admin/v2/bigtable_table_admin_pb.rb +67 -0
  6. data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +33 -6
  7. data/lib/google/bigtable/admin/v2/common_pb.rb +6 -1
  8. data/lib/google/bigtable/admin/v2/instance_pb.rb +2 -1
  9. data/lib/google/bigtable/admin/v2/table_pb.rb +39 -1
  10. data/lib/google/cloud/bigtable/admin.rb +3 -3
  11. data/lib/google/cloud/bigtable/admin/v2.rb +4 -3
  12. data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb +61 -51
  13. data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client_config.json +1 -1
  14. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +548 -59
  15. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client_config.json +31 -1
  16. data/lib/google/cloud/bigtable/admin/v2/credentials.rb +1 -1
  17. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_instance_admin.rb +47 -40
  18. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_table_admin.rb +282 -54
  19. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/instance.rb +16 -18
  20. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/table.rb +120 -27
  21. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/iam_policy.rb +1 -1
  22. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/options.rb +1 -1
  23. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +1 -1
  24. data/lib/google/cloud/bigtable/admin/v2/doc/google/longrunning/operations.rb +2 -2
  25. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/any.rb +1 -1
  26. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/duration.rb +1 -1
  27. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/empty.rb +1 -1
  28. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/field_mask.rb +1 -1
  29. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/timestamp.rb +1 -1
  30. data/lib/google/cloud/bigtable/admin/v2/doc/google/rpc/status.rb +7 -55
  31. data/lib/google/cloud/bigtable/admin/v2/doc/google/type/expr.rb +1 -1
  32. data/lib/google/cloud/bigtable/instance.rb +4 -7
  33. data/lib/google/cloud/bigtable/policy.rb +1 -1
  34. data/lib/google/cloud/bigtable/service.rb +52 -0
  35. data/lib/google/cloud/bigtable/table.rb +112 -0
  36. data/lib/google/cloud/bigtable/v2.rb +2 -2
  37. data/lib/google/cloud/bigtable/v2/bigtable_client.rb +4 -10
  38. data/lib/google/cloud/bigtable/v2/bigtable_client_config.json +7 -7
  39. data/lib/google/cloud/bigtable/v2/credentials.rb +1 -1
  40. data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +1 -19
  41. data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/data.rb +1 -1
  42. data/lib/google/cloud/bigtable/v2/doc/google/protobuf/any.rb +1 -1
  43. data/lib/google/cloud/bigtable/v2/doc/google/protobuf/wrappers.rb +1 -1
  44. data/lib/google/cloud/bigtable/v2/doc/google/rpc/status.rb +7 -55
  45. data/lib/google/cloud/bigtable/version.rb +1 -1
  46. metadata +4 -4
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "methods": {
41
41
  "CreateInstance": {
42
- "timeout_millis": 60000,
42
+ "timeout_millis": 300000,
43
43
  "retry_codes_name": "non_idempotent",
44
44
  "retry_params_name": "non_idempotent_heavy_params"
45
45
  },
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -67,7 +67,11 @@ module Google
67
67
  "list_snapshots" => Google::Gax::PageDescriptor.new(
68
68
  "page_token",
69
69
  "next_page_token",
70
- "snapshots")
70
+ "snapshots"),
71
+ "list_backups" => Google::Gax::PageDescriptor.new(
72
+ "page_token",
73
+ "next_page_token",
74
+ "backups")
71
75
  }.freeze
72
76
 
73
77
  private_constant :PAGE_DESCRIPTORS
@@ -92,6 +96,12 @@ module Google
92
96
  self::GRPC_INTERCEPTORS = BigtableTableAdminClient::GRPC_INTERCEPTORS
93
97
  end
94
98
 
99
+ BACKUP_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
100
+ "projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}"
101
+ )
102
+
103
+ private_constant :BACKUP_PATH_TEMPLATE
104
+
95
105
  CLUSTER_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
96
106
  "projects/{project}/instances/{instance}/clusters/{cluster}"
97
107
  )
@@ -116,6 +126,21 @@ module Google
116
126
 
117
127
  private_constant :TABLE_PATH_TEMPLATE
118
128
 
129
+ # Returns a fully-qualified backup resource name string.
130
+ # @param project [String]
131
+ # @param instance [String]
132
+ # @param cluster [String]
133
+ # @param backup [String]
134
+ # @return [String]
135
+ def self.backup_path project, instance, cluster, backup
136
+ BACKUP_PATH_TEMPLATE.render(
137
+ :"project" => project,
138
+ :"instance" => instance,
139
+ :"cluster" => cluster,
140
+ :"backup" => backup
141
+ )
142
+ end
143
+
119
144
  # Returns a fully-qualified cluster resource name string.
120
145
  # @param project [String]
121
146
  # @param instance [String]
@@ -257,6 +282,9 @@ module Google
257
282
  google_api_client.freeze
258
283
 
259
284
  headers = { :"x-goog-api-client" => google_api_client }
285
+ if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
286
+ headers[:"x-goog-user-project"] = credentials.quota_project_id
287
+ end
260
288
  headers.merge!(metadata) unless metadata.nil?
261
289
  client_config_file = Pathname.new(__dir__).join(
262
290
  "bigtable_table_admin_client_config.json"
@@ -417,6 +445,54 @@ module Google
417
445
  {'name' => request.name}
418
446
  end
419
447
  )
448
+ @create_backup = Google::Gax.create_api_call(
449
+ @bigtable_table_admin_stub.method(:create_backup),
450
+ defaults["create_backup"],
451
+ exception_transformer: exception_transformer,
452
+ params_extractor: proc do |request|
453
+ {'parent' => request.parent}
454
+ end
455
+ )
456
+ @get_backup = Google::Gax.create_api_call(
457
+ @bigtable_table_admin_stub.method(:get_backup),
458
+ defaults["get_backup"],
459
+ exception_transformer: exception_transformer,
460
+ params_extractor: proc do |request|
461
+ {'name' => request.name}
462
+ end
463
+ )
464
+ @list_backups = Google::Gax.create_api_call(
465
+ @bigtable_table_admin_stub.method(:list_backups),
466
+ defaults["list_backups"],
467
+ exception_transformer: exception_transformer,
468
+ params_extractor: proc do |request|
469
+ {'parent' => request.parent}
470
+ end
471
+ )
472
+ @update_backup = Google::Gax.create_api_call(
473
+ @bigtable_table_admin_stub.method(:update_backup),
474
+ defaults["update_backup"],
475
+ exception_transformer: exception_transformer,
476
+ params_extractor: proc do |request|
477
+ {'backup.name' => request.backup.name}
478
+ end
479
+ )
480
+ @delete_backup = Google::Gax.create_api_call(
481
+ @bigtable_table_admin_stub.method(:delete_backup),
482
+ defaults["delete_backup"],
483
+ exception_transformer: exception_transformer,
484
+ params_extractor: proc do |request|
485
+ {'name' => request.name}
486
+ end
487
+ )
488
+ @restore_table = Google::Gax.create_api_call(
489
+ @bigtable_table_admin_stub.method(:restore_table),
490
+ defaults["restore_table"],
491
+ exception_transformer: exception_transformer,
492
+ params_extractor: proc do |request|
493
+ {'parent' => request.parent}
494
+ end
495
+ )
420
496
  end
421
497
 
422
498
  # Service calls
@@ -426,13 +502,14 @@ module Google
426
502
  # specified in the request.
427
503
  #
428
504
  # @param parent [String]
429
- # The unique name of the instance in which to create the table.
430
- # Values are of the form `projects/<project>/instances/<instance>`.
505
+ # Required. The unique name of the instance in which to create the table.
506
+ # Values are of the form `projects/{project}/instances/{instance}`.
431
507
  # @param table_id [String]
432
- # The name by which the new table should be referred to within the parent
433
- # instance, e.g., `foobar` rather than `<parent>/tables/foobar`.
508
+ # Required. The name by which the new table should be referred to within the
509
+ # parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`.
510
+ # Maximum 50 characters.
434
511
  # @param table [Google::Bigtable::Admin::V2::Table | Hash]
435
- # The Table to create.
512
+ # Required. The Table to create.
436
513
  # A hash of the same form as `Google::Bigtable::Admin::V2::Table`
437
514
  # can also be provided.
438
515
  # @param initial_splits [Array<Google::Bigtable::Admin::V2::CreateTableRequest::Split | Hash>]
@@ -502,16 +579,16 @@ module Google
502
579
  # policy.
503
580
  #
504
581
  # @param parent [String]
505
- # The unique name of the instance in which to create the table.
506
- # Values are of the form `projects/<project>/instances/<instance>`.
582
+ # Required. The unique name of the instance in which to create the table.
583
+ # Values are of the form `projects/{project}/instances/{instance}`.
507
584
  # @param table_id [String]
508
- # The name by which the new table should be referred to within the parent
509
- # instance, e.g., `foobar` rather than `<parent>/tables/foobar`.
585
+ # Required. The name by which the new table should be referred to within the
586
+ # parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`.
510
587
  # @param source_snapshot [String]
511
- # The unique name of the snapshot from which to restore the table. The
512
- # snapshot and the table must be in the same instance.
513
- # Values are of the form
514
- # `projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>`.
588
+ # Required. The unique name of the snapshot from which to restore the table.
589
+ # The snapshot and the table must be in the same instance. Values are of the
590
+ # form
591
+ # `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`.
515
592
  # @param options [Google::Gax::CallOptions]
516
593
  # Overrides the default settings for this call, e.g, timeout,
517
594
  # retries, etc.
@@ -581,14 +658,21 @@ module Google
581
658
  # Lists all tables served from a specified instance.
582
659
  #
583
660
  # @param parent [String]
584
- # The unique name of the instance for which tables should be listed.
585
- # Values are of the form `projects/<project>/instances/<instance>`.
661
+ # Required. The unique name of the instance for which tables should be
662
+ # listed. Values are of the form `projects/{project}/instances/{instance}`.
586
663
  # @param view [Google::Bigtable::Admin::V2::Table::View]
587
664
  # The view to be applied to the returned tables' fields.
588
- # Defaults to `NAME_ONLY` if unspecified; no others are currently supported.
665
+ # Only NAME_ONLY view (default) and REPLICATION_VIEW are supported.
589
666
  # @param page_size [Integer]
590
667
  # Maximum number of results per page.
591
- # CURRENTLY UNIMPLEMENTED AND IGNORED.
668
+ #
669
+ # A page_size of zero lets the server choose the number of items to return.
670
+ # A page_size which is strictly positive will return at most that many items.
671
+ # A negative page_size will cause an error.
672
+ #
673
+ # Following the first request, subsequent paginated calls are not required
674
+ # to pass a page_size. If a page_size is set in subsequent calls, it must
675
+ # match the page_size given in the first request.
592
676
  # @param options [Google::Gax::CallOptions]
593
677
  # Overrides the default settings for this call, e.g, timeout,
594
678
  # retries, etc.
@@ -638,9 +722,9 @@ module Google
638
722
  # Gets metadata information about the specified table.
639
723
  #
640
724
  # @param name [String]
641
- # The unique name of the requested table.
725
+ # Required. The unique name of the requested table.
642
726
  # Values are of the form
643
- # `projects/<project>/instances/<instance>/tables/<table>`.
727
+ # `projects/{project}/instances/{instance}/tables/{table}`.
644
728
  # @param view [Google::Bigtable::Admin::V2::Table::View]
645
729
  # The view to be applied to the returned table's fields.
646
730
  # Defaults to `SCHEMA_VIEW` if unspecified.
@@ -675,9 +759,9 @@ module Google
675
759
  # Permanently deletes a specified table and all of its data.
676
760
  #
677
761
  # @param name [String]
678
- # The unique name of the table to be deleted.
762
+ # Required. The unique name of the table to be deleted.
679
763
  # Values are of the form
680
- # `projects/<project>/instances/<instance>/tables/<table>`.
764
+ # `projects/{project}/instances/{instance}/tables/{table}`.
681
765
  # @param options [Google::Gax::CallOptions]
682
766
  # Overrides the default settings for this call, e.g, timeout,
683
767
  # retries, etc.
@@ -710,14 +794,14 @@ module Google
710
794
  # where only some modifications have taken effect.
711
795
  #
712
796
  # @param name [String]
713
- # The unique name of the table whose families should be modified.
797
+ # Required. The unique name of the table whose families should be modified.
714
798
  # Values are of the form
715
- # `projects/<project>/instances/<instance>/tables/<table>`.
799
+ # `projects/{project}/instances/{instance}/tables/{table}`.
716
800
  # @param modifications [Array<Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification | Hash>]
717
- # Modifications to be atomically applied to the specified table's families.
718
- # Entries are applied in order, meaning that earlier modifications can be
719
- # masked by later ones (in the case of repeated updates to the same family,
720
- # for example).
801
+ # Required. Modifications to be atomically applied to the specified table's
802
+ # families. Entries are applied in order, meaning that earlier modifications
803
+ # can be masked by later ones (in the case of repeated updates to the same
804
+ # family, for example).
721
805
  # A hash of the same form as `Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification`
722
806
  # can also be provided.
723
807
  # @param options [Google::Gax::CallOptions]
@@ -756,9 +840,9 @@ module Google
756
840
  # particular prefix.
757
841
  #
758
842
  # @param name [String]
759
- # The unique name of the table on which to drop a range of rows.
843
+ # Required. The unique name of the table on which to drop a range of rows.
760
844
  # Values are of the form
761
- # `projects/<project>/instances/<instance>/tables/<table>`.
845
+ # `projects/{project}/instances/{instance}/tables/{table}`.
762
846
  # @param row_key_prefix [String]
763
847
  # Delete all rows that start with this row key prefix. Prefix cannot be
764
848
  # zero length.
@@ -800,9 +884,9 @@ module Google
800
884
  # for 90 days.
801
885
  #
802
886
  # @param name [String]
803
- # The unique name of the Table for which to create a consistency token.
804
- # Values are of the form
805
- # `projects/<project>/instances/<instance>/tables/<table>`.
887
+ # Required. The unique name of the Table for which to create a consistency
888
+ # token. Values are of the form
889
+ # `projects/{project}/instances/{instance}/tables/{table}`.
806
890
  # @param options [Google::Gax::CallOptions]
807
891
  # Overrides the default settings for this call, e.g, timeout,
808
892
  # retries, etc.
@@ -834,11 +918,11 @@ module Google
834
918
  # and the check request.
835
919
  #
836
920
  # @param name [String]
837
- # The unique name of the Table for which to check replication consistency.
838
- # Values are of the form
839
- # `projects/<project>/instances/<instance>/tables/<table>`.
921
+ # Required. The unique name of the Table for which to check replication
922
+ # consistency. Values are of the form
923
+ # `projects/{project}/instances/{instance}/tables/{table}`.
840
924
  # @param consistency_token [String]
841
- # The token created using GenerateConsistencyToken for the Table.
925
+ # Required. The token created using GenerateConsistencyToken for the Table.
842
926
  # @param options [Google::Gax::CallOptions]
843
927
  # Overrides the default settings for this call, e.g, timeout,
844
928
  # retries, etc.
@@ -870,8 +954,9 @@ module Google
870
954
  @check_consistency.call(req, options, &block)
871
955
  end
872
956
 
873
- # Gets the access control policy for a table resource. Returns an empty
874
- # policy if an table exists but does not have a policy set.
957
+ # Gets the access control policy for a resource.
958
+ # Returns an empty policy if the resource exists but does not have a policy
959
+ # set.
875
960
  #
876
961
  # @param resource [String]
877
962
  # REQUIRED: The resource for which the policy is being requested.
@@ -909,8 +994,8 @@ module Google
909
994
  @get_iam_policy.call(req, options, &block)
910
995
  end
911
996
 
912
- # Sets the access control policy on a table resource. Replaces any existing
913
- # policy.
997
+ # Sets the access control policy on a Table or Backup resource.
998
+ # Replaces any existing policy.
914
999
  #
915
1000
  # @param resource [String]
916
1001
  # REQUIRED: The resource for which the policy is being specified.
@@ -1004,18 +1089,18 @@ module Google
1004
1089
  # policy.
1005
1090
  #
1006
1091
  # @param name [String]
1007
- # The unique name of the table to have the snapshot taken.
1092
+ # Required. The unique name of the table to have the snapshot taken.
1008
1093
  # Values are of the form
1009
- # `projects/<project>/instances/<instance>/tables/<table>`.
1094
+ # `projects/{project}/instances/{instance}/tables/{table}`.
1010
1095
  # @param cluster [String]
1011
- # The name of the cluster where the snapshot will be created in.
1096
+ # Required. The name of the cluster where the snapshot will be created in.
1012
1097
  # Values are of the form
1013
- # `projects/<project>/instances/<instance>/clusters/<cluster>`.
1098
+ # `projects/{project}/instances/{instance}/clusters/{cluster}`.
1014
1099
  # @param snapshot_id [String]
1015
- # The ID by which the new snapshot should be referred to within the parent
1016
- # cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*`
1017
- # rather than
1018
- # `projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/mysnapshot`.
1100
+ # Required. The ID by which the new snapshot should be referred to within the
1101
+ # parent cluster, e.g., `mysnapshot` of the form:
1102
+ # `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` rather than
1103
+ # `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`.
1019
1104
  # @param description [String]
1020
1105
  # Description of the snapshot.
1021
1106
  # @param ttl [Google::Protobuf::Duration | Hash]
@@ -1107,9 +1192,9 @@ module Google
1107
1192
  # policy.
1108
1193
  #
1109
1194
  # @param name [String]
1110
- # The unique name of the requested snapshot.
1195
+ # Required. The unique name of the requested snapshot.
1111
1196
  # Values are of the form
1112
- # `projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>`.
1197
+ # `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`.
1113
1198
  # @param options [Google::Gax::CallOptions]
1114
1199
  # Overrides the default settings for this call, e.g, timeout,
1115
1200
  # retries, etc.
@@ -1145,11 +1230,11 @@ module Google
1145
1230
  # policy.
1146
1231
  #
1147
1232
  # @param parent [String]
1148
- # The unique name of the cluster for which snapshots should be listed.
1149
- # Values are of the form
1150
- # `projects/<project>/instances/<instance>/clusters/<cluster>`.
1151
- # Use `<cluster> = '-'` to list snapshots for all clusters in an instance,
1152
- # e.g., `projects/<project>/instances/<instance>/clusters/-`.
1233
+ # Required. The unique name of the cluster for which snapshots should be
1234
+ # listed. Values are of the form
1235
+ # `projects/{project}/instances/{instance}/clusters/{cluster}`.
1236
+ # Use `{cluster} = '-'` to list snapshots for all clusters in an instance,
1237
+ # e.g., `projects/{project}/instances/{instance}/clusters/-`.
1153
1238
  # @param page_size [Integer]
1154
1239
  # The maximum number of resources contained in the underlying API
1155
1240
  # response. If page streaming is performed per-resource, this
@@ -1209,9 +1294,9 @@ module Google
1209
1294
  # policy.
1210
1295
  #
1211
1296
  # @param name [String]
1212
- # The unique name of the snapshot to be deleted.
1297
+ # Required. The unique name of the snapshot to be deleted.
1213
1298
  # Values are of the form
1214
- # `projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>`.
1299
+ # `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`.
1215
1300
  # @param options [Google::Gax::CallOptions]
1216
1301
  # Overrides the default settings for this call, e.g, timeout,
1217
1302
  # retries, etc.
@@ -1237,6 +1322,410 @@ module Google
1237
1322
  @delete_snapshot.call(req, options, &block)
1238
1323
  nil
1239
1324
  end
1325
+
1326
+ # Starts creating a new Cloud Bigtable Backup. The returned backup
1327
+ # {Google::Longrunning::Operation long-running operation} can be used to
1328
+ # track creation of the backup. The
1329
+ # {Google::Longrunning::Operation#metadata metadata} field type is
1330
+ # {Google::Bigtable::Admin::V2::CreateBackupMetadata CreateBackupMetadata}. The
1331
+ # {Google::Longrunning::Operation#response response} field type is
1332
+ # {Google::Bigtable::Admin::V2::Backup Backup}, if successful. Cancelling the
1333
+ # returned operation will stop the creation and delete the backup.
1334
+ #
1335
+ # @param parent [String]
1336
+ # Required. This must be one of the clusters in the instance in which this
1337
+ # table is located. The backup will be stored in this cluster. Values are
1338
+ # of the form `projects/{project}/instances/{instance}/clusters/{cluster}`.
1339
+ # @param backup_id [String]
1340
+ # Required. The id of the backup to be created. The `backup_id` along with
1341
+ # the parent `parent` are combined as \\{parent}/backups/\\{backup_id} to create
1342
+ # the full backup name, of the form:
1343
+ # `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}`.
1344
+ # This string must be between 1 and 50 characters in length and match the
1345
+ # regex [_a-zA-Z0-9][-_.a-zA-Z0-9]*.
1346
+ # @param backup [Google::Bigtable::Admin::V2::Backup | Hash]
1347
+ # Required. The backup to create.
1348
+ # A hash of the same form as `Google::Bigtable::Admin::V2::Backup`
1349
+ # can also be provided.
1350
+ # @param options [Google::Gax::CallOptions]
1351
+ # Overrides the default settings for this call, e.g, timeout,
1352
+ # retries, etc.
1353
+ # @return [Google::Gax::Operation]
1354
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1355
+ # @example
1356
+ # require "google/cloud/bigtable/admin"
1357
+ #
1358
+ # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1359
+ # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
1360
+ #
1361
+ # # TODO: Initialize `backup_id`:
1362
+ # backup_id = ''
1363
+ #
1364
+ # # TODO: Initialize `backup`:
1365
+ # backup = {}
1366
+ #
1367
+ # # Register a callback during the method call.
1368
+ # operation = bigtable_table_admin_client.create_backup(formatted_parent, backup_id, backup) do |op|
1369
+ # raise op.results.message if op.error?
1370
+ # op_results = op.results
1371
+ # # Process the results.
1372
+ #
1373
+ # metadata = op.metadata
1374
+ # # Process the metadata.
1375
+ # end
1376
+ #
1377
+ # # Or use the return value to register a callback.
1378
+ # operation.on_done do |op|
1379
+ # raise op.results.message if op.error?
1380
+ # op_results = op.results
1381
+ # # Process the results.
1382
+ #
1383
+ # metadata = op.metadata
1384
+ # # Process the metadata.
1385
+ # end
1386
+ #
1387
+ # # Manually reload the operation.
1388
+ # operation.reload!
1389
+ #
1390
+ # # Or block until the operation completes, triggering callbacks on
1391
+ # # completion.
1392
+ # operation.wait_until_done!
1393
+
1394
+ def create_backup \
1395
+ parent,
1396
+ backup_id,
1397
+ backup,
1398
+ options: nil
1399
+ req = {
1400
+ parent: parent,
1401
+ backup_id: backup_id,
1402
+ backup: backup
1403
+ }.delete_if { |_, v| v.nil? }
1404
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateBackupRequest)
1405
+ operation = Google::Gax::Operation.new(
1406
+ @create_backup.call(req, options),
1407
+ @operations_client,
1408
+ Google::Bigtable::Admin::V2::Backup,
1409
+ Google::Bigtable::Admin::V2::CreateBackupMetadata,
1410
+ call_options: options
1411
+ )
1412
+ operation.on_done { |operation| yield(operation) } if block_given?
1413
+ operation
1414
+ end
1415
+
1416
+ # Gets metadata on a pending or completed Cloud Bigtable Backup.
1417
+ #
1418
+ # @param name [String]
1419
+ # Required. Name of the backup.
1420
+ # Values are of the form
1421
+ # `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`.
1422
+ # @param options [Google::Gax::CallOptions]
1423
+ # Overrides the default settings for this call, e.g, timeout,
1424
+ # retries, etc.
1425
+ # @yield [result, operation] Access the result along with the RPC operation
1426
+ # @yieldparam result [Google::Bigtable::Admin::V2::Backup]
1427
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1428
+ # @return [Google::Bigtable::Admin::V2::Backup]
1429
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1430
+ # @example
1431
+ # require "google/cloud/bigtable/admin"
1432
+ #
1433
+ # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1434
+ # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.backup_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]")
1435
+ # response = bigtable_table_admin_client.get_backup(formatted_name)
1436
+
1437
+ def get_backup \
1438
+ name,
1439
+ options: nil,
1440
+ &block
1441
+ req = {
1442
+ name: name
1443
+ }.delete_if { |_, v| v.nil? }
1444
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetBackupRequest)
1445
+ @get_backup.call(req, options, &block)
1446
+ end
1447
+
1448
+ # Lists Cloud Bigtable backups. Returns both completed and pending
1449
+ # backups.
1450
+ #
1451
+ # @param parent [String]
1452
+ # Required. The cluster to list backups from. Values are of the
1453
+ # form `projects/{project}/instances/{instance}/clusters/{cluster}`.
1454
+ # Use `{cluster} = '-'` to list backups for all clusters in an instance,
1455
+ # e.g., `projects/{project}/instances/{instance}/clusters/-`.
1456
+ # @param filter [String]
1457
+ # A filter expression that filters backups listed in the response.
1458
+ # The expression must specify the field name, a comparison operator,
1459
+ # and the value that you want to use for filtering. The value must be a
1460
+ # string, a number, or a boolean. The comparison operator must be
1461
+ # <, >, <=, >=, !=, =, or :. Colon ‘:’ represents a HAS operator which is
1462
+ # roughly synonymous with equality. Filter rules are case insensitive.
1463
+ #
1464
+ # The fields eligible for filtering are:
1465
+ # * `name`
1466
+ # * `source_table`
1467
+ # * `state`
1468
+ # * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1469
+ # * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1470
+ # * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1471
+ # * `size_bytes`
1472
+ #
1473
+ # To filter on multiple expressions, provide each separate expression within
1474
+ # parentheses. By default, each expression is an AND expression. However,
1475
+ # you can include AND, OR, and NOT expressions explicitly.
1476
+ #
1477
+ # Some examples of using filters are:
1478
+ #
1479
+ # * `name:"exact"` --> The backup's name is the string "exact".
1480
+ # * `name:howl` --> The backup's name contains the string "howl".
1481
+ # * `source_table:prod`
1482
+ # --> The source_table's name contains the string "prod".
1483
+ # * `state:CREATING` --> The backup is pending creation.
1484
+ # * `state:READY` --> The backup is fully created and ready for use.
1485
+ # * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")`
1486
+ # --> The backup name contains the string "howl" and start_time
1487
+ # of the backup is before 2018-03-28T14:50:00Z.
1488
+ # * `size_bytes > 10000000000` --> The backup's size is greater than 10GB
1489
+ # @param order_by [String]
1490
+ # An expression for specifying the sort order of the results of the request.
1491
+ # The string value should specify one or more fields in
1492
+ # {Google::Bigtable::Admin::V2::Backup Backup}. The full syntax is described at
1493
+ # https://aip.dev/132#ordering.
1494
+ #
1495
+ # Fields supported are:
1496
+ # * name
1497
+ # * source_table
1498
+ # * expire_time
1499
+ # * start_time
1500
+ # * end_time
1501
+ # * size_bytes
1502
+ # * state
1503
+ #
1504
+ # For example, "start_time". The default sorting order is ascending.
1505
+ # To specify descending order for the field, a suffix " desc" should
1506
+ # be appended to the field name. For example, "start_time desc".
1507
+ # Redundant space characters in the syntax are insigificant.
1508
+ #
1509
+ # If order_by is empty, results will be sorted by `start_time` in descending
1510
+ # order starting from the most recently created backup.
1511
+ # @param page_size [Integer]
1512
+ # The maximum number of resources contained in the underlying API
1513
+ # response. If page streaming is performed per-resource, this
1514
+ # parameter does not affect the return value. If page streaming is
1515
+ # performed per-page, this determines the maximum number of
1516
+ # resources in a page.
1517
+ # @param options [Google::Gax::CallOptions]
1518
+ # Overrides the default settings for this call, e.g, timeout,
1519
+ # retries, etc.
1520
+ # @yield [result, operation] Access the result along with the RPC operation
1521
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Backup>]
1522
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1523
+ # @return [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Backup>]
1524
+ # An enumerable of Google::Bigtable::Admin::V2::Backup instances.
1525
+ # See Google::Gax::PagedEnumerable documentation for other
1526
+ # operations such as per-page iteration or access to the response
1527
+ # object.
1528
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1529
+ # @example
1530
+ # require "google/cloud/bigtable/admin"
1531
+ #
1532
+ # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1533
+ # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
1534
+ #
1535
+ # # Iterate over all results.
1536
+ # bigtable_table_admin_client.list_backups(formatted_parent).each do |element|
1537
+ # # Process element.
1538
+ # end
1539
+ #
1540
+ # # Or iterate over results one page at a time.
1541
+ # bigtable_table_admin_client.list_backups(formatted_parent).each_page do |page|
1542
+ # # Process each page at a time.
1543
+ # page.each do |element|
1544
+ # # Process element.
1545
+ # end
1546
+ # end
1547
+
1548
+ def list_backups \
1549
+ parent,
1550
+ filter: nil,
1551
+ order_by: nil,
1552
+ page_size: nil,
1553
+ options: nil,
1554
+ &block
1555
+ req = {
1556
+ parent: parent,
1557
+ filter: filter,
1558
+ order_by: order_by,
1559
+ page_size: page_size
1560
+ }.delete_if { |_, v| v.nil? }
1561
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListBackupsRequest)
1562
+ @list_backups.call(req, options, &block)
1563
+ end
1564
+
1565
+ # Updates a pending or completed Cloud Bigtable Backup.
1566
+ #
1567
+ # @param backup [Google::Bigtable::Admin::V2::Backup | Hash]
1568
+ # Required. The backup to update. `backup.name`, and the fields to be updated
1569
+ # as specified by `update_mask` are required. Other fields are ignored.
1570
+ # Update is only supported for the following fields:
1571
+ # * `backup.expire_time`.
1572
+ # A hash of the same form as `Google::Bigtable::Admin::V2::Backup`
1573
+ # can also be provided.
1574
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
1575
+ # Required. A mask specifying which fields (e.g. `expire_time`) in the
1576
+ # Backup resource should be updated. This mask is relative to the Backup
1577
+ # resource, not to the request message. The field mask must always be
1578
+ # specified; this prevents any future fields from being erased accidentally
1579
+ # by clients that do not know about them.
1580
+ # A hash of the same form as `Google::Protobuf::FieldMask`
1581
+ # can also be provided.
1582
+ # @param options [Google::Gax::CallOptions]
1583
+ # Overrides the default settings for this call, e.g, timeout,
1584
+ # retries, etc.
1585
+ # @yield [result, operation] Access the result along with the RPC operation
1586
+ # @yieldparam result [Google::Bigtable::Admin::V2::Backup]
1587
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1588
+ # @return [Google::Bigtable::Admin::V2::Backup]
1589
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1590
+ # @example
1591
+ # require "google/cloud/bigtable/admin"
1592
+ #
1593
+ # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1594
+ #
1595
+ # # TODO: Initialize `backup`:
1596
+ # backup = {}
1597
+ #
1598
+ # # TODO: Initialize `update_mask`:
1599
+ # update_mask = {}
1600
+ # response = bigtable_table_admin_client.update_backup(backup, update_mask)
1601
+
1602
+ def update_backup \
1603
+ backup,
1604
+ update_mask,
1605
+ options: nil,
1606
+ &block
1607
+ req = {
1608
+ backup: backup,
1609
+ update_mask: update_mask
1610
+ }.delete_if { |_, v| v.nil? }
1611
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::UpdateBackupRequest)
1612
+ @update_backup.call(req, options, &block)
1613
+ end
1614
+
1615
+ # Deletes a pending or completed Cloud Bigtable backup.
1616
+ #
1617
+ # @param name [String]
1618
+ # Required. Name of the backup to delete.
1619
+ # Values are of the form
1620
+ # `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`.
1621
+ # @param options [Google::Gax::CallOptions]
1622
+ # Overrides the default settings for this call, e.g, timeout,
1623
+ # retries, etc.
1624
+ # @yield [result, operation] Access the result along with the RPC operation
1625
+ # @yieldparam result []
1626
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1627
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1628
+ # @example
1629
+ # require "google/cloud/bigtable/admin"
1630
+ #
1631
+ # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1632
+ # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.backup_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]")
1633
+ # bigtable_table_admin_client.delete_backup(formatted_name)
1634
+
1635
+ def delete_backup \
1636
+ name,
1637
+ options: nil,
1638
+ &block
1639
+ req = {
1640
+ name: name
1641
+ }.delete_if { |_, v| v.nil? }
1642
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteBackupRequest)
1643
+ @delete_backup.call(req, options, &block)
1644
+ nil
1645
+ end
1646
+
1647
+ # Create a new table by restoring from a completed backup. The new table
1648
+ # must be in the same instance as the instance containing the backup. The
1649
+ # returned table {Google::Longrunning::Operation long-running operation} can
1650
+ # be used to track the progress of the operation, and to cancel it. The
1651
+ # {Google::Longrunning::Operation#metadata metadata} field type is
1652
+ # {Google::Bigtable::Admin::RestoreTableMetadata RestoreTableMetadata}. The
1653
+ # {Google::Longrunning::Operation#response response} type is
1654
+ # {Google::Bigtable::Admin::V2::Table Table}, if successful.
1655
+ #
1656
+ # @param parent [String]
1657
+ # Required. The name of the instance in which to create the restored
1658
+ # table. This instance must be the parent of the source backup. Values are
1659
+ # of the form `projects/<project>/instances/<instance>`.
1660
+ # @param table_id [String]
1661
+ # Required. The id of the table to create and restore to. This
1662
+ # table must not already exist. The `table_id` appended to
1663
+ # `parent` forms the full table name of the form
1664
+ # `projects/<project>/instances/<instance>/tables/<table_id>`.
1665
+ # @param backup [String]
1666
+ # Name of the backup from which to restore. Values are of the form
1667
+ # `projects/<project>/instances/<instance>/clusters/<cluster>/backups/<backup>`.
1668
+ # @param options [Google::Gax::CallOptions]
1669
+ # Overrides the default settings for this call, e.g, timeout,
1670
+ # retries, etc.
1671
+ # @return [Google::Gax::Operation]
1672
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1673
+ # @example
1674
+ # require "google/cloud/bigtable/admin"
1675
+ #
1676
+ # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1677
+ #
1678
+ # # TODO: Initialize `parent`:
1679
+ # parent = ''
1680
+ #
1681
+ # # Register a callback during the method call.
1682
+ # operation = bigtable_table_admin_client.restore_table(parent) do |op|
1683
+ # raise op.results.message if op.error?
1684
+ # op_results = op.results
1685
+ # # Process the results.
1686
+ #
1687
+ # metadata = op.metadata
1688
+ # # Process the metadata.
1689
+ # end
1690
+ #
1691
+ # # Or use the return value to register a callback.
1692
+ # operation.on_done do |op|
1693
+ # raise op.results.message if op.error?
1694
+ # op_results = op.results
1695
+ # # Process the results.
1696
+ #
1697
+ # metadata = op.metadata
1698
+ # # Process the metadata.
1699
+ # end
1700
+ #
1701
+ # # Manually reload the operation.
1702
+ # operation.reload!
1703
+ #
1704
+ # # Or block until the operation completes, triggering callbacks on
1705
+ # # completion.
1706
+ # operation.wait_until_done!
1707
+
1708
+ def restore_table \
1709
+ parent,
1710
+ table_id: nil,
1711
+ backup: nil,
1712
+ options: nil
1713
+ req = {
1714
+ parent: parent,
1715
+ table_id: table_id,
1716
+ backup: backup
1717
+ }.delete_if { |_, v| v.nil? }
1718
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::RestoreTableRequest)
1719
+ operation = Google::Gax::Operation.new(
1720
+ @restore_table.call(req, options),
1721
+ @operations_client,
1722
+ Google::Bigtable::Admin::V2::Table,
1723
+ Google::Bigtable::Admin::V2::RestoreTableMetadata,
1724
+ call_options: options
1725
+ )
1726
+ operation.on_done { |operation| yield(operation) } if block_given?
1727
+ operation
1728
+ end
1240
1729
  end
1241
1730
  end
1242
1731
  end