# File lib/facter/ec2/rest.rb, line 57 def fetch(path = '') results = {} keys = fetch_endpoint(path) keys.each do |key| next if FILTERED_KEYS.include? key if key.match(%r[/$]) # If a metadata key is suffixed with '/' then it's a general metadata # resource, so we have to recursively look up all the keys in the given # collection. name = key[0..-2] results[name] = fetch("#{path}#{key}") else # This is a simple key/value pair, we can just query the given endpoint # and store the results. ret = fetch_endpoint("#{path}#{key}") results[key] = ret.size > 1 ? ret : ret.first end end results end