Class: Fog::Compute::Google::Flavors

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/google/models/compute/flavors.rb

Instance Method Summary collapse

Instance Method Details

#all(filters = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fog/google/models/compute/flavors.rb', line 10

def all(filters = {})
  if filters[:zone]
    data = service.list_machine_types(filters[:zone]).body["items"]
  else
    data = []
    service.list_aggregated_machine_types.body['items'].each_value do |zone|
      data.concat(zone['machineTypes']) if zone['machineTypes']
    end
  end
  load(data)
end

#get(identity, zone_name = nil) ⇒ Object



22
23
24
25
26
27
# File 'lib/fog/google/models/compute/flavors.rb', line 22

def get(identity, zone_name = nil)
  data = service.get_machine_type(identity, zone_name).body
  new(data)
rescue Fog::Errors::NotFound
  nil
end