Sha256: 49aef0bccf12749d2e23875a879b0a8136ebdad25042ebbf2d084ec2550208a2

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

module Fog
  module Compute
    class Vsphere
      class Real
        def list_storage_pods(filters = { })
          datacenter_name = filters[:datacenter]
          raw_storage_pods(datacenter_name).map do |storage_pod|
            storage_pod_attributes(storage_pod, datacenter_name)
          end.compact
        end

        private

        def raw_storage_pods(datacenter_name)
          list_container_view(datacenter_name, 'StoragePod')
        end

        protected

        def storage_pod_attributes(storage_pod, datacenter)
          {
            :id          => managed_obj_id(storage_pod),
            :name        => storage_pod.name,
            :freespace   => storage_pod.summary.freeSpace,
            :capacity    => storage_pod.summary.capacity,
            :datacenter  => datacenter,
          }
        end
      end
      class Mock
        def list_storage_pods(filters = {})
          if filters.key?(:datacenter)
            self.data[:storage_pods].select{|h| h[:datacenter] == filters[:datacenter] }
          else
            self.data[:storage_pods]
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-vsphere-2.1.1 lib/fog/vsphere/requests/compute/list_storage_pods.rb
fog-vsphere-2.1.0 lib/fog/vsphere/requests/compute/list_storage_pods.rb
fog-vsphere-2.0.1 lib/fog/vsphere/requests/compute/list_storage_pods.rb