Sha256: 336cfde81be2c65650dd03ad8392d9618d88a557e7901a895c5b2d98c9a7e2f2

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

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

          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

1 entries across 1 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.3 lib/fog/oraclecloud/requests/database/list_recoveries.rb