Sha256: c4876ce030e30868a0e7148eb360f9138df672f5ef521961f55aa87307f94876

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

module Fog
  module OracleCloud
    class Database
      class Real
      	def list_backups(db_name)
          response = request(
            :expects  => 200,
            :method   => 'GET',
            :path     => "/paas/service/dbcs/api/v1.1/instances/#{@identity_domain}/#{db_name}/backups"
          )
          response
        end
      end

      class Mock
        def list_backups(db_name)
          response = Excon::Response.new

          if !self.data[:backups][db_name] then self.data[:backups][db_name] = [] end
          backups = self.data[:backups][db_name]

          backups.each_with_index { |b, i| 
            if b['status'] = 'IN PROGRESS' then
              if Time.now - self.data[:created_at][:backups][db_name][i] >= Fog::Mock.delay
                self.data[:created_at][:backups][db_name].delete(i)
                self.data[:backups][db_name][i]['status'] = 'COMPLETED'
                b = self.data[:backups][db_name][i]
              end
            end
          }
          response.body = {
            'backupList' => backups
          }
          response
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.17 lib/fog/oraclecloud/requests/database/list_backups.rb
fog-oraclecloud-0.1.16 lib/fog/oraclecloud/requests/database/list_backups.rb
fog-oraclecloud-0.1.15 lib/fog/oraclecloud/requests/database/list_backups.rb
fog-oraclecloud-0.1.14 lib/fog/oraclecloud/requests/database/list_backups.rb
fog-oraclecloud-0.1.13 lib/fog/oraclecloud/requests/database/list_backups.rb