google-cloud-bigtable 2.7.1 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67e534271f2a313216bfb3d54e7a5ac84dec994ee4f42da33a81a0ecd9ab1230
4
- data.tar.gz: 6a4e80bf21ded6b239f26a59fbb51997a3f32130454787ff0c15136841ce8c45
3
+ metadata.gz: 735e0a2c4fcb24227bbdf5e7f1ee76d6e8f718b6d23cf30bdf56fd8c6f13f830
4
+ data.tar.gz: fd7c5cb8fa45cd44a7e0a39c78a88bf63e52214c133505dbfbc2977a86b89cd0
5
5
  SHA512:
6
- metadata.gz: 0cd1d97d9bb9663ccb56653cb6de6e60062ad9f9bb2ff8a3c010f12dab27d0ef93fb5ce38c3fefc1830df60857cb2fb26189c6bb6c15c21a53b5149b170f7040
7
- data.tar.gz: d0407fd6d9f71869bc1e3a2897ab83d6de5b65c9c94a14332bb4d557de17c7c9e20cb2c74fd3e005fedb53917db02c098236d96e8aaf2213d101b2760bf0af4c
6
+ metadata.gz: 2ee38cb00b572386d02f7b7f4f7abd593b0d8022e4dd366a54b2789bf8f4e8ee04b73a9ece3286707a81ce68006fb8f2f84685a721057c16b607911e4d8da5e2
7
+ data.tar.gz: a9686ba49ac1a4761761570f0486edcbb6d628eaaa5c8183df65b6f697c9f50022abf8b61f7420f6b79b5f7e00ad4b9a99f1f0f45266ca248fc47ae8e874ec5a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 2.8.0 (2023-08-17)
4
+
5
+ #### Features
6
+
7
+ * Added support for copybackup ([#19341](https://github.com/googleapis/google-cloud-ruby/issues/19341))
8
+
3
9
  ### 2.7.1 (2023-06-16)
4
10
 
5
11
  #### Documentation
@@ -109,6 +109,18 @@ module Google
109
109
  @grpc.name
110
110
  end
111
111
 
112
+ ##
113
+ # The name of the backup from which this backup is copied.
114
+ # Value will be empty if its not a copied backup and of the form -
115
+ # `projects/<project>/instances/<instance>/clusters/<cluster>/backups/<source_backup>`
116
+ # if this is a copied backup.
117
+ #
118
+ # @return [String]
119
+ #
120
+ def source_backup
121
+ @grpc.source_backup
122
+ end
123
+
112
124
  ##
113
125
  # The table from which this backup was created.
114
126
  #
@@ -412,6 +424,61 @@ module Google
412
424
  Table::RestoreJob.from_grpc grpc, service
413
425
  end
414
426
 
427
+ ##
428
+ # Creates a copy of the backup at the desired location. Copy of the backup won't be created
429
+ # if the backup is already a copied one.
430
+ #
431
+ # @param dest_project_id [String] Existing project ID. Copy of the backup
432
+ # will be created in this project. Required.
433
+ # @param dest_instance_id [Instance, String] Existing instance ID. Copy
434
+ # of the backup will be created in this instance. Required.
435
+ # @param dest_cluster_id [String] Existing cluster ID. Copy of the backup
436
+ # will be created in this cluster. Required.
437
+ # @param new_backup_id [String] The id of the copy of the backup to be created. This string must
438
+ # be between 1 and 50 characters in length and match the regex
439
+ # `[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. Required.
440
+ # @param expire_time [Time] The expiration time of the copy of the backup, with microseconds
441
+ # granularity that must be at least 6 hours and at most 30 days from the time the request
442
+ # is received. Once the `expire_time` has passed, Cloud Bigtable will delete the backup
443
+ # and free the resources used by the backup. Required.
444
+ #
445
+ # @return [Google::Cloud::Bigtable::Backup::Job] The job representing the long-running, asynchronous
446
+ # processing of a copy backup operation.
447
+ #
448
+ # @example Create a copy of the backup at a specific location
449
+ # require "google/cloud/bigtable"
450
+ #
451
+ # bigtable = Google::Cloud::Bigtable.new
452
+ # instance = bigtable.instance "my-instance"
453
+ # cluster = instance.cluster "my-cluster"
454
+ #
455
+ # backup = cluster.backup "my-backup"
456
+ #
457
+ # job = backup.copy dest_project_id:"my-project-2",
458
+ # dest_instance_id:"my-instance-2",
459
+ # dest_cluster_id:"my-cluster-2",
460
+ # new_backup_id:"my-backup-2",
461
+ # expire_time: Time.now + 60 * 60 * 7
462
+ #
463
+ # job.wait_until_done!
464
+ # job.done? #=> true
465
+ #
466
+ # if job.error?
467
+ # status = job.error
468
+ # else
469
+ # backup = job.backup
470
+ # end
471
+ #
472
+ def copy dest_project_id:, dest_instance_id:, dest_cluster_id:, new_backup_id:, expire_time:
473
+ grpc = service.copy_backup project_id: dest_project_id,
474
+ instance_id: dest_instance_id,
475
+ cluster_id: dest_cluster_id,
476
+ backup_id: new_backup_id,
477
+ source_backup: service.backup_path(instance_id, cluster_id, backup_id),
478
+ expire_time: expire_time
479
+ Backup::Job.from_grpc grpc, service
480
+ end
481
+
415
482
  ##
416
483
  # Updates the backup.
417
484
  #
@@ -457,6 +457,67 @@ module Google
457
457
  true
458
458
  end
459
459
 
460
+ ##
461
+ # Creates a copy of the backup at the desired location. Copy of the backup won't be created
462
+ # if the backup is already a copied one.
463
+ #
464
+ # @param dest_project_id [String] Existing project ID. Copy of the backup
465
+ # will be created in this project. Required.
466
+ # @param dest_instance_id [Instance, String] Existing instance ID. Copy
467
+ # of the backup will be created in this instance. Required.
468
+ # @param dest_cluster_id [String] Existing cluster ID. Copy of the backup
469
+ # will be created in this cluster. Required.
470
+ # @param new_backup_id [String] The id of the copy of the backup to be created. This string must
471
+ # be between 1 and 50 characters in length and match the regex
472
+ # `[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. Required.
473
+ # @param source_instance_id [String] Existing instance ID. Backup will be copied from this instance. Required.
474
+ # @param source_cluster_id [String] Existing cluster ID. Backup will be copied from this cluster. Required.
475
+ # @param source_backup_id [Instance, String] Existing backup ID. This backup will be copied. Required.
476
+ # @param expire_time [Time] The expiration time of the copy of the backup, with microseconds
477
+ # granularity that must be at least 6 hours and at most 30 days from the time the request
478
+ # is received. Once the `expire_time` has passed, Cloud Bigtable will delete the backup
479
+ # and free the resources used by the backup. Required.
480
+ #
481
+ # @return [Google::Cloud::Bigtable::Backup::Job] The job representing the long-running, asynchronous
482
+ # processing of a copy backup operation.
483
+ #
484
+ # @example Create a copy of the specified backup at a specific location
485
+ # require "google/cloud/bigtable"
486
+ #
487
+ # bigtable = Google::Cloud::Bigtable.new
488
+ #
489
+ # job = bigtable.copy_backup dest_project_id:"my-project-2",
490
+ # dest_instance_id:"my-instance-2",
491
+ # dest_cluster_id:"my-cluster-2",
492
+ # new_backup_id:"my-backup-2",
493
+ # source_instance_id:"my-instance",
494
+ # source_cluster_id:"my-cluster",
495
+ # source_backup_id:"my-backup",
496
+ # expire_time: Time.now + 60 * 60 * 7
497
+ #
498
+ # job.wait_until_done!
499
+ # job.done? #=> true
500
+ #
501
+ # if job.error?
502
+ # status = job.error
503
+ # else
504
+ # backup = job.backup
505
+ # end
506
+ #
507
+ def copy_backup dest_project_id:, dest_instance_id:, dest_cluster_id:, new_backup_id:,
508
+ source_instance_id:, source_cluster_id:, source_backup_id:, expire_time:
509
+ ensure_service!
510
+ grpc = service.copy_backup project_id: dest_project_id,
511
+ instance_id: dest_instance_id,
512
+ cluster_id: dest_cluster_id,
513
+ backup_id: new_backup_id,
514
+ source_backup: service.backup_path(source_instance_id,
515
+ source_cluster_id,
516
+ source_backup_id),
517
+ expire_time: expire_time
518
+ Backup::Job.from_grpc grpc, service
519
+ end
520
+
460
521
  protected
461
522
 
462
523
  # @private
@@ -725,6 +725,19 @@ module Google
725
725
  tables.create_backup parent: cluster_path(instance_id, cluster_id), backup_id: backup_id, backup: backup
726
726
  end
727
727
 
728
+ ##
729
+ # Starts copying the selected backup to the chosen location.
730
+ # The underlying Google::Longrunning::Operation tracks the copying of backup.
731
+ #
732
+ # @return [Gapic::Operation]
733
+ #
734
+ def copy_backup project_id:, instance_id:, cluster_id:, backup_id:, source_backup:, expire_time:
735
+ tables.copy_backup parent: "projects/#{project_id}/instances/#{instance_id}/clusters/#{cluster_id}",
736
+ backup_id: backup_id,
737
+ source_backup: source_backup,
738
+ expire_time: expire_time
739
+ end
740
+
728
741
  ##
729
742
  # @return [Google::Cloud::Bigtable::Admin::V2::Backup]
730
743
  #
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigtable
19
- VERSION = "2.7.1".freeze
19
+ VERSION = "2.8.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-bigtable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-16 00:00:00.000000000 Z
11
+ date: 2023-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-bigtable-admin-v2