Sha256: 1f8f1112ebbdadbfe2a951254a70a42780ac78cc8f04d9f91db1ad48b0301358

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 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

9 entries across 9 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.12 lib/fog/oraclecloud/requests/database/list_backups.rb
fog-oraclecloud-0.1.11 lib/fog/oraclecloud/requests/database/list_backups.rb
fog-oraclecloud-0.1.10 lib/fog/oraclecloud/requests/database/list_backups.rb
fog-oraclecloud-0.1.9 lib/fog/oraclecloud/requests/database/list_backups.rb
fog-oraclecloud-0.1.8 lib/fog/oraclecloud/requests/database/list_backups.rb
fog-oraclecloud-0.1.7 lib/fog/oraclecloud/requests/database/list_backups.rb
fog-oraclecloud-0.1.6 lib/fog/oraclecloud/requests/database/list_backups.rb
fog-oraclecloud-0.1.5 lib/fog/oraclecloud/requests/database/list_backups.rb
fog-oraclecloud-0.1.4 lib/fog/oraclecloud/requests/database/list_backups.rb