google-cloud-spanner 1.15.0 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -448,6 +448,77 @@ module Google
448
448
  end
449
449
  end
450
450
 
451
+ def create_backup instance_id, database_id, backup_id, expire_time
452
+ backup = {
453
+ database: database_path(instance_id, database_id),
454
+ expire_time: expire_time
455
+ }
456
+ execute do
457
+ databases.create_backup \
458
+ instance_path(instance_id),
459
+ backup_id,
460
+ backup
461
+ end
462
+ end
463
+
464
+ def get_backup instance_id, backup_id
465
+ execute do
466
+ databases.get_backup backup_path(instance_id, backup_id)
467
+ end
468
+ end
469
+
470
+ def update_backup backup, update_mask
471
+ execute do
472
+ databases.update_backup backup, update_mask
473
+ end
474
+ end
475
+
476
+ def delete_backup instance_id, backup_id
477
+ execute do
478
+ databases.delete_backup backup_path(instance_id, backup_id)
479
+ end
480
+ end
481
+
482
+ def list_backups instance_id, filter: nil, page_size: nil
483
+ execute do
484
+ databases.list_backups \
485
+ instance_path(instance_id),
486
+ filter,
487
+ page_size: page_size
488
+ end
489
+ end
490
+
491
+ def list_database_operations instance_id, filter: nil, page_size: nil
492
+ execute do
493
+ databases.list_database_operations \
494
+ instance_path(instance_id),
495
+ filter,
496
+ page_size: page_size
497
+ end
498
+ end
499
+
500
+ def list_backup_operations instance_id, filter: nil, page_size: nil
501
+ execute do
502
+ databases.list_backup_operations \
503
+ instance_path(instance_id),
504
+ filter,
505
+ page_size: page_size
506
+ end
507
+ end
508
+
509
+ def restore_database \
510
+ backup_instance_id,
511
+ backup_id,
512
+ database_instance_id,
513
+ database_id
514
+ execute do
515
+ databases.restore_database \
516
+ instance_path(database_instance_id),
517
+ database_id,
518
+ backup: backup_path(backup_instance_id, backup_id)
519
+ end
520
+ end
521
+
451
522
  def inspect
452
523
  "#{self.class}(#{@project})"
453
524
  end
@@ -518,6 +589,12 @@ module Google
518
589
  )
519
590
  end
520
591
 
592
+ def backup_path instance_id, backup_id
593
+ Admin::Database::V1::DatabaseAdminClient.backup_path(
594
+ project, instance_id, backup_id
595
+ )
596
+ end
597
+
521
598
  def execute
522
599
  yield
523
600
  rescue Google::Gax::GaxError => e
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Spanner
19
- VERSION = "1.15.0".freeze
19
+ VERSION = "1.16.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-spanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.0
4
+ version: 1.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-03-17 00:00:00.000000000 Z
12
+ date: 2020-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -329,6 +329,11 @@ files:
329
329
  - lib/google/cloud/spanner/admin/instance/v1/doc/google/type/expr.rb
330
330
  - lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb
331
331
  - lib/google/cloud/spanner/admin/instance/v1/instance_admin_client_config.json
332
+ - lib/google/cloud/spanner/backup.rb
333
+ - lib/google/cloud/spanner/backup/job.rb
334
+ - lib/google/cloud/spanner/backup/job/list.rb
335
+ - lib/google/cloud/spanner/backup/list.rb
336
+ - lib/google/cloud/spanner/backup/restore/job.rb
332
337
  - lib/google/cloud/spanner/batch_client.rb
333
338
  - lib/google/cloud/spanner/batch_snapshot.rb
334
339
  - lib/google/cloud/spanner/batch_update.rb
@@ -339,8 +344,11 @@ files:
339
344
  - lib/google/cloud/spanner/credentials.rb
340
345
  - lib/google/cloud/spanner/data.rb
341
346
  - lib/google/cloud/spanner/database.rb
347
+ - lib/google/cloud/spanner/database/backup_info.rb
342
348
  - lib/google/cloud/spanner/database/job.rb
349
+ - lib/google/cloud/spanner/database/job/list.rb
343
350
  - lib/google/cloud/spanner/database/list.rb
351
+ - lib/google/cloud/spanner/database/restore_info.rb
344
352
  - lib/google/cloud/spanner/errors.rb
345
353
  - lib/google/cloud/spanner/fields.rb
346
354
  - lib/google/cloud/spanner/instance.rb