Class: Fog::Compute::OpenStack::Flavor
- Defined in:
- lib/rackspace-fog/openstack/models/compute/flavor.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Flavor
constructor
A new instance of Flavor.
- #save ⇒ Object
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.
18 19 20 21 |
# File 'lib/rackspace-fog/openstack/models/compute/flavor.rb', line 18 def initialize(attributes) @connection = attributes[:connection] super end |
Instance Method Details
#destroy ⇒ Object
32 33 34 35 36 |
# File 'lib/rackspace-fog/openstack/models/compute/flavor.rb', line 32 def destroy requires :id connection.delete_flavor(self.id) true end |
#save ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/rackspace-fog/openstack/models/compute/flavor.rb', line 23 def save requires :name, :ram, :vcpus, :disk attributes[:ephemeral] = self.ephemeral || 0 attributes[:swap] = self.swap || 0 attributes[:rxtx_factor] = self.rxtx_factor || 1 merge_attributes(connection.create_flavor(self.attributes).body['flavor']) self end |