jeudi 26 mars 2015

Amazon AWS: How to replicate tree/branch functionality from AWS Ruby SDK v1 in AWS Ruby SDK v2?

In version 1 of their SDK, Amazon provided some really useful methods that could be used to explore the contents of buckets using Tree, ChildCollection, LeafNode, BranchNode, etc. Unfortunately, I've had a difficulty time replicating their functionality with version 2 of the SDK, which doesn't seem to include such methods. Ideally, I'd like to do something similar to the example below, which is taken from the v1 SDK.



tree = bucket.as_tree

directories = tree.children.select(&:branch?).collect(&:prefix)
#=> ['photos', 'videos']

files = tree.children.select(&:leaf?).collect(&:key)
#=> ['README.txt']


Any ideas on how one might achieve this?





Aucun commentaire:

Enregistrer un commentaire