Class: Ey::Core::Client::LogicalDatabase

Inherits:
Model
  • Object
show all
Extended by:
Associations
Defined in:
lib/ey-core/models/logical_database.rb

Instance Method Summary collapse

Methods included from Associations

assoc_accessor, assoc_coverage, assoc_reader, assoc_writer, associations, collection_reader

Methods inherited from Model

#destroy, range_parser, #save, #to_s, #update!, #url

Instance Method Details

#connect(cluster_component, configuration = {}) ⇒ Object



35
36
37
38
39
# File 'lib/ey-core/models/logical_database.rb', line 35

def connect(cluster_component, configuration={})
  requires :identity

  self.connection.connectors.create(source: self, destination: cluster_component, configuration: configuration)
end

#destroy!Object



31
32
33
# File 'lib/ey-core/models/logical_database.rb', line 31

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

#save!Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ey-core/models/logical_database.rb', line 16

def save!
  requires :name

  params = {
    "url"              => self.collection.url,
    "database_service" => self.service_id,
    "logical_database" => Cistern::Hash.slice(attributes, :name, :extensions),
  }

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