Class: Fog::Compute::Google::ForwardingRules
- Inherits:
-
Fog::Collection
- Object
- Fog::Collection
- Fog::Compute::Google::ForwardingRules
- Defined in:
- lib/fog/google/models/compute/forwarding_rules.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/forwarding_rules.rb', line 10 def all(filters={}) if filters['region'].nil? data = [] service.list_regions.body['items'].each do |region| data += service.list_forwarding_rules(region['name']).body['items'] || [] end else data = service.list_forwarding_rules(filters['region']).body['items'] || [] end load(data) end |
#get(identity, region = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fog/google/models/compute/forwarding_rules.rb', line 22 def get(identity, region=nil) response = nil if region.nil? service.list_regions.body['items'].each do |region| begin response = service.get_forwarding_rule(identity, region['name']) break if response.status == 200 rescue Fog::Errors::Error end end else response = service.get_forwarding_rule(identity, region) end return nil if response.nil? new(response.body) end |