Class: Fog::Compute::OpenStack::Flavor
Instance Attribute Summary
#project
Instance Method Summary
collapse
#create, #initialize, #update
Instance Method Details
44
45
46
47
48
|
# File 'lib/fog/compute/openstack/models/flavor.rb', line 44
def create_metadata(metadata)
service.create_flavor_metadata(id, metadata)
rescue Fog::Compute::OpenStack::NotFound
nil
end
|
56
57
58
59
60
|
# File 'lib/fog/compute/openstack/models/flavor.rb', line 56
def delete_metadata(key)
service.delete_flavor_metadata(id, key)
rescue Fog::Compute::OpenStack::NotFound
nil
end
|
#destroy ⇒ Object
32
33
34
35
36
|
# File 'lib/fog/compute/openstack/models/flavor.rb', line 32
def destroy
requires :id
service.delete_flavor(id)
true
end
|
38
39
40
41
42
|
# File 'lib/fog/compute/openstack/models/flavor.rb', line 38
def metadata
service.get_flavor_metadata(id).body['extra_specs']
rescue Fog::Compute::OpenStack::NotFound
nil
end
|
#save ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/fog/compute/openstack/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
|
50
51
52
53
54
|
# File 'lib/fog/compute/openstack/models/flavor.rb', line 50
def update_metadata(key, value)
service.update_flavor_metadata(id, key, value)
rescue Fog::Compute::OpenStack::NotFound
nil
end
|