Sha256: cbad471cef4af57a95cdf211b7a6f250dd2b455ac42af6c7b675eaec771ee2cb

Contents?: true

Size: 1.32 KB

Versions: 9

Compression:

Stored size: 1.32 KB

Contents

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

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

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

          recoveries.each_with_index { |r, i| 
            if r['status'] = 'IN PROGRESS' then
              if Time.now - self.data[:created_at][:recoveries][db_name][i] >= Fog::Mock.delay
                self.data[:created_at][:recoveries][db_name].delete(i)
                self.data[:recoveries][db_name][i]['status'] = 'COMPLETED'
                self.data[:recoveries][db_name][i]['recoveryCompleteDate'] = Time.now.strftime('%d-%b-%Y %H:%M:%S UTC')
                b = self.data[:backups][db_name][i]
              end
            end
          }
          response.body = {
            'recoveryList' => recoveries
          }
          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_recoveries.rb
fog-oraclecloud-0.1.11 lib/fog/oraclecloud/requests/database/list_recoveries.rb
fog-oraclecloud-0.1.10 lib/fog/oraclecloud/requests/database/list_recoveries.rb
fog-oraclecloud-0.1.9 lib/fog/oraclecloud/requests/database/list_recoveries.rb
fog-oraclecloud-0.1.8 lib/fog/oraclecloud/requests/database/list_recoveries.rb
fog-oraclecloud-0.1.7 lib/fog/oraclecloud/requests/database/list_recoveries.rb
fog-oraclecloud-0.1.6 lib/fog/oraclecloud/requests/database/list_recoveries.rb
fog-oraclecloud-0.1.5 lib/fog/oraclecloud/requests/database/list_recoveries.rb
fog-oraclecloud-0.1.4 lib/fog/oraclecloud/requests/database/list_recoveries.rb