Class: Fog::Compute::OpenStack::Flavor
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::OpenStack::Flavor
- Defined in:
- lib/fog/openstack/models/compute/flavor.rb
Instance Method Summary collapse
- #create_metadata(metadata) ⇒ Object
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Flavor
constructor
A new instance of Flavor.
- #metadata ⇒ Object
- #save ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Flavor
Returns a new instance of Flavor.
21 22 23 24 25 |
# File 'lib/fog/openstack/models/compute/flavor.rb', line 21 def initialize(attributes) # Old 'connection' is renamed as service and should be used instead prepare_service_value(attributes) super end |
Instance Method Details
#create_metadata(metadata) ⇒ Object
50 51 52 53 54 |
# File 'lib/fog/openstack/models/compute/flavor.rb', line 50 def () service.(self.id, ) rescue Fog::Compute::OpenStack::NotFound nil end |
#destroy ⇒ Object
38 39 40 41 42 |
# File 'lib/fog/openstack/models/compute/flavor.rb', line 38 def destroy requires :id service.delete_flavor(self.id) true end |
#metadata ⇒ Object
44 45 46 47 48 |
# File 'lib/fog/openstack/models/compute/flavor.rb', line 44 def service.(self.id).body['extra_specs'] rescue Fog::Compute::OpenStack::NotFound nil end |
#save ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fog/openstack/models/compute/flavor.rb', line 27 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(service.create_flavor(self.attributes).body['flavor']) self end |