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

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

Instance Attribute Summary

Attributes inherited from Model

#project

Instance Method Summary collapse

Methods inherited from Model

#create, #initialize, #update

Constructor Details

This class inherits a constructor from Fog::OpenStack::Model

Instance Method Details

#create_metadata(metadata) ⇒ Object



44
45
46
47
48
# File 'lib/fog/openstack/compute/models/flavor.rb', line 44

def ()
  service.(id, )
rescue Fog::OpenStack::Compute::NotFound
  nil
end

#delete_metadata(key) ⇒ Object



56
57
58
59
60
# File 'lib/fog/openstack/compute/models/flavor.rb', line 56

def (key)
  service.(id, key)
rescue Fog::OpenStack::Compute::NotFound
  nil
end

#destroyObject



32
33
34
35
36
# File 'lib/fog/openstack/compute/models/flavor.rb', line 32

def destroy
  requires :id
  service.delete_flavor(id)
  true
end

#metadataObject



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

def 
  service.(id).body['extra_specs']
rescue Fog::OpenStack::Compute::NotFound
  nil
end

#saveObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/fog/openstack/compute/models/flavor.rb', line 21

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

#update_metadata(key, value) ⇒ Object



50
51
52
53
54
# File 'lib/fog/openstack/compute/models/flavor.rb', line 50

def (key, value)
  service.(id, key, value)
rescue Fog::OpenStack::Compute::NotFound
  nil
end