Sha256: 84aa7276150b502e0a539d4183134e56c7b630abf193fbb1aae8ed40eda11f0c

Contents?: true

Size: 1.39 KB

Versions: 5

Compression:

Stored size: 1.39 KB

Contents

module Fog
  module OracleCloud
    class Database
      class Real

      	def backup_instance(service_name)
          # Oracle Cloud requires an empty JSON object in the body
          body_data     = {}
        
          response = request(
            :method   => 'POST',
            :expects  => 202,
            :path     => "/paas/service/dbcs/api/v1.1/instances/#{@identity_domain}/#{service_name}/backups",
            :body     => Fog::JSON.encode(body_data),
          )
          response.database_id = service_name
          response
        end
      end

      class Mock
        def backup_instance(service_name)
      		response = Excon::Response.new

          if !self.data[:backups][service_name].is_a? Array 
            self.data[:backups][service_name] = []
          end
          self.data[:backups][service_name].push({
            'backupCompleteDate'=>Time.now.strftime('%d-%b-%Y %H:%M:%S UTC'),
            'dbTag'=>'TAG' + Time.now.strftime('%Y%m%dT%H%M%S'),
            'status'=>'IN PROGRESS',
            'database_id'=>service_name
          })
          if !self.data[:created_at][:backups] 
            self.data[:created_at][:backups] = {}
            self.data[:created_at][:backups][service_name] = []
          end
          self.data[:created_at][:backups][service_name].push(Time.now)
          response.status = 202
          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/backup_instance.rb
fog-oraclecloud-0.1.16 lib/fog/oraclecloud/requests/database/backup_instance.rb
fog-oraclecloud-0.1.15 lib/fog/oraclecloud/requests/database/backup_instance.rb
fog-oraclecloud-0.1.14 lib/fog/oraclecloud/requests/database/backup_instance.rb
fog-oraclecloud-0.1.13 lib/fog/oraclecloud/requests/database/backup_instance.rb