Class: Fog::Image::OpenStack::V2::Images
Instance Attribute Summary
#response
Instance Method Summary
collapse
#load_response
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
permalink
#method_missing(method_sym, *arguments, &block) ⇒ Object
[View source]
42
43
44
45
46
47
48
|
# File 'lib/fog/image/openstack/v2/models/images.rb', line 42
def method_missing(method_sym, *arguments, &block)
if method_sym.to_s =~ /^find_by_(.*)$/
load(service.list_images($1.to_sym => arguments.first).body['images'])
else
super
end
end
|
Instance Method Details
permalink
#all(options = {}) ⇒ Object
[View source]
11
12
13
|
# File 'lib/fog/image/openstack/v2/models/images.rb', line 11
def all(options = {})
load_response(service.list_images(options), 'images')
end
|
permalink
#destroy(id) ⇒ Object
[View source]
37
38
39
40
|
# File 'lib/fog/image/openstack/v2/models/images.rb', line 37
def destroy(id)
image = find_by_id(id)
image.destroy
end
|
permalink
#find_attribute(attribute, value) ⇒ Object
[View source]
58
59
60
61
|
# File 'lib/fog/image/openstack/v2/models/images.rb', line 58
def find_attribute(attribute, value)
attribute = attribute.to_s.gsub("find_by_", "")
load(service.list_images(attribute.to_sym => value).body['images'])
end
|
permalink
#find_by_id(id) ⇒ Object
Also known as:
get
[View source]
19
20
21
22
23
|
# File 'lib/fog/image/openstack/v2/models/images.rb', line 19
def find_by_id(id)
new(service.get_image_by_id(id).body)
rescue Fog::Image::OpenStack::NotFound
nil
end
|
permalink
#find_by_size_max(size) ⇒ Object
[View source]
54
55
56
|
# File 'lib/fog/image/openstack/v2/models/images.rb', line 54
def find_by_size_max(size)
find_attribute(__method__, size)
end
|
permalink
#find_by_size_min(size) ⇒ Object
[View source]
50
51
52
|
# File 'lib/fog/image/openstack/v2/models/images.rb', line 50
def find_by_size_min(size)
find_attribute(__method__, size)
end
|
[View source]
32
33
34
35
|
# File 'lib/fog/image/openstack/v2/models/images.rb', line 32
def private
images = load(service.list_images.body['images'])
images.delete_if(&:is_public)
end
|
[View source]
27
28
29
30
|
# File 'lib/fog/image/openstack/v2/models/images.rb', line 27
def public
images = load(service.list_images.body['images'])
images.delete_if { |image| image.is_public == false }
end
|
permalink
#summary(options = {}) ⇒ Object
[View source]
15
16
17
|
# File 'lib/fog/image/openstack/v2/models/images.rb', line 15
def summary(options = {})
load_response(service.list_images(options), 'images')
end
|