Class: Fog::Compute::Google::GlobalForwardingRules

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

Instance Method Summary collapse

Instance Method Details

#all(opts = {}) ⇒ Object



7
8
9
10
# File 'lib/fog/compute/google/models/global_forwarding_rules.rb', line 7

def all(opts = {})
  data = service.list_global_forwarding_rules(opts).to_h[:items] || []
  load(data)
end

#get(identity) ⇒ Object



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

def get(identity)
  if identity
    rule = service.get_global_forwarding_rule(identity).to_h
    return new(rule)
  end
rescue ::Google::Apis::ClientError => e
  raise e unless e.status_code == 404
  nil
end