Sha256: 3cee83ee253f40dccb9ca78de73910f7c90fe0c6d0c1f52f938efab22c4d0d84

Contents?: true

Size: 1.63 KB

Versions: 10

Compression:

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

10 entries across 10 versions & 1 rubygems

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