lib/fog/compute/google/models/global_forwarding_rules.rb in fog-google-0.6.0 vs lib/fog/compute/google/models/global_forwarding_rules.rb in fog-google-1.0.0
- old
+ new
@@ -2,19 +2,20 @@
module Compute
class Google
class GlobalForwardingRules < Fog::Collection
model Fog::Compute::Google::GlobalForwardingRule
- def all
- data = service.list_global_forwarding_rules.body["items"] || []
+ def all(opts = {})
+ data = service.list_global_forwarding_rules(opts).to_h[:items] || []
load(data)
end
- def get(identity, region = "global")
- if global_forwarding_rule = service.get_global_forwarding_rule(identity, region).body
- new(global_forwarding_rule)
+ def get(identity)
+ if rule = service.get_global_forwarding_rule(identity).to_h
+ new(rule)
end
- rescue Fog::Errors::NotFound
+ rescue ::Google::Apis::ClientError => e
+ raise e unless e.status_code == 404
nil
end
end
end
end