Sha256: 50569b0f5155d379b7ca5b0ae71a7b22558f990b15077c648820f3516838a11c

Contents?: true

Size: 1.4 KB

Versions: 10

Compression:

Stored size: 1.4 KB

Contents

require 'fog/core/model'

module Fog
  module OracleCloud
    class Database
      class Snapshot < Fog::Model
        identity  :name

        attribute :cloned_services_size,  :aliases=>'clonedServicesSize'
        attribute :creation_time,  :aliases=>'creationTime'
        attribute :cloned_services,  :aliases=>'clonedServices'
        attribute :status
        attribute :description

        attribute :database_id
       
        def completed?
          status == "Succeeded"
        end

        def deleting?
          status == "Terminating"
        end
 
        def save
          create
        end

        def destroy
          requires :name, :database_id
          service.delete_snapshot(database_id, name).body
        end

        # Had to override snapshot as we need to pass the database_id
        def reload
          requires :identity, :database_id

          data = begin
            collection.get(database_id, identity)
          rescue Excon::Errors::SocketError
            nil
          end

          return unless data

          new_attributes = data.attributes
          merge_attributes(new_attributes)
          self
        end

        private

        def create
          requires :name, :description, :database_id 
          data = service.create_snapshot(name, description, database_id)
        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/models/database/snapshot.rb
fog-oraclecloud-0.1.11 lib/fog/oraclecloud/models/database/snapshot.rb
fog-oraclecloud-0.1.10 lib/fog/oraclecloud/models/database/snapshot.rb
fog-oraclecloud-0.1.9 lib/fog/oraclecloud/models/database/snapshot.rb
fog-oraclecloud-0.1.8 lib/fog/oraclecloud/models/database/snapshot.rb
fog-oraclecloud-0.1.7 lib/fog/oraclecloud/models/database/snapshot.rb
fog-oraclecloud-0.1.6 lib/fog/oraclecloud/models/database/snapshot.rb
fog-oraclecloud-0.1.5 lib/fog/oraclecloud/models/database/snapshot.rb
fog-oraclecloud-0.1.4 lib/fog/oraclecloud/models/database/snapshot.rb
fog-oraclecloud-0.1.3 lib/fog/oraclecloud/models/database/snapshot.rb