Sha256: ccb18ecdb9d9728c61340771c8599a6c4378c86cbbf68e010b851a8ad3781fd7

Contents?: true

Size: 1.14 KB

Versions: 41

Compression:

Stored size: 1.14 KB

Contents

require "fog/core/collection"
require "fog/google/models/sql/backup_run"

module Fog
  module Google
    class SQL
      class BackupRuns < Fog::Collection
        model Fog::Google::SQL::BackupRun

        ##
        # Lists all backup runs associated with a given instance.
        #
        # @param [String] instance_id Instance ID
        # @return [Array<Fog::Google::SQL::BackupRun>] List of Backup run resources
        def all(instance_id)
          data = service.list_backup_runs(instance_id).to_h[:items] || []
          load(data)
        end

        ##
        # Retrieves a resource containing information about a backup run
        #
        # @param [String] instance_id Instance ID
        # @param [String] backup_run_id Backup Configuration ID
        # @return [Fog::Google::SQL::BackupRun] Backup run resource
        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
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
fog-google-1.24.1 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.24.0 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.23.0 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.22.0 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.21.1 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.21.0 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.20.0 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.19.0 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.18.0 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.17.0 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.16.1 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.16.0 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.15.0 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.14.0 lib/fog/google/models/sql/backup_runs.rb
gitlab-fog-google-1.14.0 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.13.0 lib/fog/google/models/sql/backup_runs.rb
gitlab-fog-google-1.13.0 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.12.1 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.12.0 lib/fog/google/models/sql/backup_runs.rb
fog-google-1.11.0 lib/fog/google/models/sql/backup_runs.rb