Sha256: bd696a4db371abad07469d75e66d2d76f3c278f525daf68d147790f94c848740

Contents?: true

Size: 1.57 KB

Versions: 12

Compression:

Stored size: 1.57 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[self.data[:disks].values.map { |disk| ["zones/#{disk['zone'].split('/')[-1]}", {'disks' => [] }] }]
          if options[:filter]
            # Look up for the disk name
            disk = self.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
            self.data[:disks].values.each { |disk| zones["zones/#{disk['zone'].split('/')[-1]}"]['disks'].concat([disk]) }
          end
          build_response(:body => {
            "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]

          result = self.build_result(api_method, parameters)
          response = self.build_response(result)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/google/requests/compute/list_aggregated_disks.rb
ns-fog-1.22.11 lib/fog/google/requests/compute/list_aggregated_disks.rb
ns-fog-1.22.10 lib/fog/google/requests/compute/list_aggregated_disks.rb
ns-fog-1.22.9 lib/fog/google/requests/compute/list_aggregated_disks.rb
ns-fog-1.22.8 lib/fog/google/requests/compute/list_aggregated_disks.rb
ns-fog-1.22.7 lib/fog/google/requests/compute/list_aggregated_disks.rb
ns-fog-1.22.6 lib/fog/google/requests/compute/list_aggregated_disks.rb
fog-1.23.0 lib/fog/google/requests/compute/list_aggregated_disks.rb
ns-fog-1.22.4 lib/fog/google/requests/compute/list_aggregated_disks.rb
ns-fog-1.22.3 lib/fog/google/requests/compute/list_aggregated_disks.rb
ns-fog-1.22.2 lib/fog/google/requests/compute/list_aggregated_disks.rb
fog-1.22.1 lib/fog/google/requests/compute/list_aggregated_disks.rb