Sha256: fe7bf891b3237e95bd36b8c4264d413dea0a755b2772205c99c5166006649e3c

Contents?: true

Size: 1.58 KB

Versions: 5

Compression:

Stored size: 1.58 KB

Contents

module Fog
  module OracleCloud
    class Database
      class Real

      	def create_snapshot(name, description, database_id)
          body_data     = {
            'name'              => name,
            'description'       => description
          }
          body_data = body_data.reject {|key, value| value.nil?}
        
          response = request(
            :method   => 'POST',
            :expects  => 202,
            :path     => "/paas/api/v1.1/instancemgmt/#{@identity_domain}/services/dbaas/instances/#{database_id}/snapshots",
            :body     => Fog::JSON.encode(body_data),
          )
          # Store the database reference in the model, so that we can use it later
          response.database_id = service_name
          response
        end
      end

      class Mock
        def create_snapshot(name, description, database_id)
      		response = Excon::Response.new

          data = {
            'name' => name,
            'description' => description,
            'creationTime' => Time.now,
            'clonedServicesSize' => 1,
            'status'=>'In Progress',
            'database_id'=>database_id,
            'clonedServices'=>[{
              'clonedServiceName'=>'ClonedService1',
              'clonedServiceCreationTime'=> Time.now
              }]
          }
          if !self.data[:snapshots].key?(database_id) then self.data[:snapshots][database_id] = {} end
          self.data[:snapshots][database_id][name] = data
          self.data[:created_at][name] = 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/create_snapshot.rb
fog-oraclecloud-0.1.16 lib/fog/oraclecloud/requests/database/create_snapshot.rb
fog-oraclecloud-0.1.15 lib/fog/oraclecloud/requests/database/create_snapshot.rb
fog-oraclecloud-0.1.14 lib/fog/oraclecloud/requests/database/create_snapshot.rb
fog-oraclecloud-0.1.13 lib/fog/oraclecloud/requests/database/create_snapshot.rb