Class: Ey::Core::Client::Slot

Inherits:
Model
  • Object
show all
Extended by:
Associations
Defined in:
lib/vendor/core/ey-core/models/slot.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, #update!, #url

Instance Method Details

#disableObject



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/vendor/core/ey-core/models/slot.rb', line 34

def disable
  return false if new_record?
  params = {
    "id" => id,
    "slot" => {
      "disabled" => true
    }
  }

  merge_attributes(self.connection.update_slot(params).body["slot"])
end

#retireObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vendor/core/ey-core/models/slot.rb', line 22

def retire
  return false if new_record?
  params = {
    "id" => id,
    "slot" => {
      "retired" => true
    }
  }

  merge_attributes(self.connection.update_slot(params).body["slot"])
end

#save!Object

Raises:

  • (NotImplementedError)


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/vendor/core/ey-core/models/slot.rb', line 46

def save!
  raise NotImplementedError, "Cannot create or update a single slot"
=begin
  params = {
    "cluster" => self.cluster_id,
    "url"     => self.collection.url,
    "slot"    => {
      "image"   => self.image,
      "flavor"  => self.flavor,
    },
  }

  if new_record?
    self.connections.slots.load(self.connection.create_slot(params).body["slot"])
  else raise NotImplementedError # update
  end
=end
end