Class: Fog::Compute::Google::Subnetworks
- Inherits:
-
Fog::Collection
- Object
- Fog::Collection
- Fog::Compute::Google::Subnetworks
- Defined in:
- lib/fog/compute/google/models/subnetworks.rb
Instance Method Summary collapse
- #all(region: nil, filter: nil, max_results: nil, order_by: nil, page_token: nil) ⇒ Object
- #get(identity, region) ⇒ Object
Instance Method Details
#all(region: nil, filter: nil, max_results: nil, order_by: nil, page_token: nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/compute/google/models/subnetworks.rb', line 7 def all(region: nil, filter: nil, max_results: nil, order_by: nil, page_token: nil) filters = { :filter => filter, :max_results => max_results, :order_by => order_by, :page_token => page_token } if region.nil? data = [] service.list_aggregated_subnetworks(filters).to_h[:items].each_value do |region_obj| data.concat(region_obj["subnetworks"]) if region_obj["subnetworks"] end else data = service.list_subnetworks(region, filters).to_h[:items] end load(data || []) end |
#get(identity, region) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/fog/compute/google/models/subnetworks.rb', line 26 def get(identity, region) if subnetwork = service.get_subnetwork(identity, region).to_h new(subnetwork) end rescue ::Google::Apis::ClientError => e raise e unless e.status_code == 404 nil end |