Class: Fog::Compute::OpenStack::Flavor

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/openstack/models/compute/flavor.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

#initialize(attributes) ⇒ Flavor

Returns a new instance of Flavor.



20
21
22
23
# File 'lib/fog/openstack/models/compute/flavor.rb', line 20

def initialize(attributes)
  @connection = attributes[:connection]
  super
end

Instance Method Details

#destroyObject



36
37
38
39
40
# File 'lib/fog/openstack/models/compute/flavor.rb', line 36

def destroy
  requires :id
  connection.delete_flavor(self.id)
  true
end

#saveObject



25
26
27
28
29
30
31
32
33
34
# File 'lib/fog/openstack/models/compute/flavor.rb', line 25

def save
  requires :name, :ram, :vcpus, :disk
  attributes[:ephemeral] = self.ephemeral || 0
  attributes[:is_public] = self.is_public || false
  attributes[:disabled] = self.disabled || false
  attributes[:swap] = self.swap || 0
  attributes[:rxtx_factor] = self.rxtx_factor || 1.0
  merge_attributes(connection.create_flavor(self.attributes).body['flavor'])
  self
end