Sha256: 1387f3eacf2f2fba9fd5d479e2af9580dc4005e6846225ad7970459255ab5347
Contents?: true
Size: 1.52 KB
Versions: 14
Compression:
Stored size: 1.52 KB
Contents
module Fog module Compute class Google class Mock def list_aggregated_disks(options = {}) # Create a Hash of unique zones from the disks Array previously filled when disks are created zones = Hash[data[:disks].values.map { |disk| ["zones/#{disk['zone'].split('/')[-1]}", { "disks" => [] }] }] if options[:filter] # Look up for the disk name disk = data[:disks][options[:filter].gsub(/name eq \.\*/, "")] # Fill the zones Hash with the disk (if it's found) zones["zones/#{disk['zone'].split('/')[-1]}"]["disks"].concat([disk]) if disk else # Fill the zones Hash with the disks attached to each zone data[:disks].values.each { |disk| zones["zones/#{disk['zone'].split('/')[-1]}"]["disks"].concat([disk]) } end build_excon_response("kind" => "compute#diskAggregatedList", "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/aggregated/disks", "id" => "projects/#{@project}/aggregated/disks", "items" => zones) end end class Real def list_aggregated_disks(options = {}) api_method = @compute.disks.aggregated_list parameters = { "project" => @project } parameters["filter"] = options[:filter] if options[:filter] request(api_method, parameters) end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems