Sha256: 5620596e15170ff92907d51a5ce53c9bc999d43a00caa5d9f744b0ae87522fcd

Contents?: true

Size: 1.34 KB

Versions: 54

Compression:

Stored size: 1.34 KB

Contents

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

  identity :id

  attribute :location
  attribute :flavor
  attribute :engine
  attribute :version
  attribute :storage, type: :integer
  attribute :endpoint
  attribute :provisioned_id
  attribute :modifiers

  attribute :deleted_at, type: :time

  has_one :provider
  has_one :database_service
  has_one :replication_source, resource: :database_server

  has_many :firewalls
  has_many :messages
  has_many :snapshots, model: :database_server_snapshots
  has_many :revisions, model: :database_server_revisions
  has_many :alerts

  def save!
    requires :replication_source, :provider_id

    params = {
      "url"              => self.collection.url,
      "provider"         => self.provider_id,
      "database_server"  => {
        "replication_source" => self.replication_source_id,
      },
    }

    if new_record?
      self.connection.requests.new(self.connection.create_database_server(params).body["request"])
    else
      raise NotImplementedError
    end
  end

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

  def master?
    !replication_source
  end

  def discover
    connection.requests.new(connection.discover_database_server("id" => self.identity).body["request"])
  end
end

Version data entries

54 entries across 54 versions & 3 rubygems

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