Sha256: 342a3a5104519e4deeb5b96aea03a22280a699d25f812c450c516a573d4e994b

Contents?: true

Size: 1.2 KB

Versions: 38

Compression:

Stored size: 1.2 KB

Contents

class Ey::Core::Client::DatabaseServerSnapshot < Ey::Core::Model
  extend Ey::Core::Associations

  identity :id

  attribute :deleted_at,     type: :time
  attribute :engine
  attribute :engine_version
  attribute :location
  attribute :provisioned_at, type: :time
  attribute :provisioned_id
  attribute :storage,        type: :integer

  has_one :provider
  has_one :database_server
  has_one :database_service

  attr_accessor :name

  def save!
    if new_record?
      create_params = if collection.url
                        { "url" => collection.url }
                      elsif self.database_service
                        { "database_service" => self.database_service.identity }
                      else
                        requires_one :database_server, :database_service

                        { "database_service" => self.database_server.database_service.identity }
                      end

      connection.requests.new(
        connection.create_database_service_snapshot(create_params.merge("name" => self.name)).body["request"]
      )
    end
  end

  def destroy!
    connection.requests.new(
      connection.destroy_database_server_snapshot("id" => self.identity).body["request"]
    )
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
ey-core-3.6.4 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.6.3 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.6.1 lib/ey-core/models/database_server_snapshot.rb
groove-ey-core-3.6.3 lib/ey-core/models/database_server_snapshot.rb
groove-ey-core-3.6.2 lib/ey-core/models/database_server_snapshot.rb
groove-ey-core-3.6.1 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.5.0 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.4.4 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.4.2 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.4.1 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.4.0 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.3.1 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.3.0 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.2.6 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.2.5 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.2.4 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.2.3 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.2.2 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.2.1 lib/ey-core/models/database_server_snapshot.rb
ey-core-3.2.0 lib/ey-core/models/database_server_snapshot.rb