Class: Fog::Compute::Google::Images
- Inherits:
-
Fog::Collection
- Object
- Fog::Collection
- Fog::Compute::Google::Images
- Defined in:
- lib/fog/compute/google/models/images.rb
Constant Summary collapse
- GLOBAL_PROJECTS =
NOTE: some of these operating systems are premium and users will be charged a license fee beyond the base Google Compute Engine VM charges. See cloud.google.com/compute/docs/operating-systems/ for more info.
[ "centos-cloud", "coreos-cloud", "debian-cloud", "google-containers", "opensuse-cloud", "rhel-cloud", "suse-cloud", "ubuntu-os-cloud", "windows-cloud" ]
Instance Method Summary collapse
- #all ⇒ Object
-
#current ⇒ Object
Only return the non-deprecated list of images.
- #get(identity) ⇒ Object
- #get_from_family(family) ⇒ Object
Instance Method Details
#all ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fog/compute/google/models/images.rb', line 23 def all data = [] all_projects.each do |project| begin images = service.list_images(project).body["items"] || [] # Keep track of the project in which we found the image(s) images.each { |img| img[:project] = project } data += images rescue Fog::Errors::NotFound # Not everyone has access to every Global Project. Requests # return 404 if you don't have access. next end end load(data) end |
#current ⇒ Object
Only return the non-deprecated list of images
44 45 46 47 48 49 |
# File 'lib/fog/compute/google/models/images.rb', line 44 def current data = [] all_images = all all_images.each { |img| data.push(img) unless img.deprecated } data end |
#get(identity) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/fog/compute/google/models/images.rb', line 51 def get(identity) data = nil all_projects.each do |project| begin data = service.get_image(identity, project).body data[:project] = project rescue Fog::Errors::NotFound next else break end end return nil if data.nil? new(data) end |
#get_from_family(family) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/fog/compute/google/models/images.rb', line 68 def get_from_family(family) data = nil all_projects.each do |project| begin data = service.get_image_from_family(family, project).body data[:project] = project rescue Fog::Errors::NotFound next else break end end return nil if data.nil? new(data) end |