Class: Fog::Google::SQL::BackupRuns

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/google/models/sql/backup_runs.rb

Instance Method Summary collapse

Instance Method Details

#all(instance_id) ⇒ Array<Fog::Google::SQL::BackupRun>

Lists all backup runs associated with a given instance.


15
16
17
18
# File 'lib/fog/google/models/sql/backup_runs.rb', line 15

def all(instance_id)
  data = service.list_backup_runs(instance_id).to_h[:items] || []
  load(data)
end

#get(instance_id, backup_run_id) ⇒ Fog::Google::SQL::BackupRun

Retrieves a resource containing information about a backup run


26
27
28
29
30
31
32
33
34
# File 'lib/fog/google/models/sql/backup_runs.rb', line 26

def get(instance_id, backup_run_id)
  backup_run = service.get_backup_run(instance_id, backup_run_id).to_h
  if backup_run
    new(backup_run)
  end
rescue ::Google::Apis::ClientError => e
  raise e unless e.status_code == 404
  nil
end