Class: Ey::Core::Client::LoadBalancer

Inherits:
Model
  • Object
show all
Extended by:
Associations
Defined in:
lib/ey-core/models/load_balancer.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

#destroy!Object



40
41
42
# File 'lib/ey-core/models/load_balancer.rb', line 40

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

#save!Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ey-core/models/load_balancer.rb', line 22

def save!
  requires :provider_id, :name

  params = {
      "url" => self.collection.url,
      "provider" => self.provider_id,
      "load_balancer" => {
        "location" => self.location,
        "name" => self.name
      },
  }

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

#servicesObject



18
19
20
# File 'lib/ey-core/models/load_balancer.rb', line 18

def services
  load_balancer_services
end