def find_by_id(id, options = [])
if options.kind_of? Symbol
options = [options]
end
if service.openstack_cache_ttl > 0
cached_project, expires = Fog::Identity::OpenStack::V3::Project.cache[{:token => service.auth_token,
:id => id,
:options => options}]
return cached_project if cached_project && expires > Time.now
end
project_hash = service.get_project(id, options).body['project']
top_project = project_from_hash(project_hash, service)
if options.include? :subtree_as_list
top_project.subtree.map! { |proj_hash| project_from_hash(proj_hash['project'], service) }
end
if options.include? :parents_as_list
top_project.parents.map! { |proj_hash| project_from_hash(proj_hash['project'], service) }
end
if service.openstack_cache_ttl > 0
cache = Fog::Identity::OpenStack::V3::Project.cache
cache[{:token => service.auth_token, :id => id, :options => options}] = [
top_project, Time.now + service.openstack_cache_ttl
]
Fog::Identity::OpenStack::V3::Project.cache = cache
end
top_project
end