def self.get_container(url, token, container, marker=nil, limit=nil,
prefix=nil, delimiter=nil, http_conn=nil, full_listing=nil)
if not http_conn
http_conn = http_connection(url)
end
parsed = http_conn[0].clone
conn = http_conn[1]
if full_listing
rv = get_account(url, token, marker, limit, prefix, http_conn)
listing = rv[1]
while listing.length > 0
marker = listing[-1]['name']
listing = get_account(url, token, marker, limit, prefix, http_conn)[1]
if listing.length > 0
rv[1] += listing
end
end
return rv
end
query = Query.new(parsed.query)
query.add('format', 'json')
query.add('marker', quote(marker.to_s)) if marker
query.add('limit', quote(limit.to_s)) if limit
query.add('prefix', quote(prefix.to_s)) if prefix
parsed.query = query.to_url_params
conn.start if !conn.started?
parsed.path += "/#{quote(container)}"
resp = conn.get(parsed.request_uri, {'x-auth-token' => token})
if resp.code.to_i < 200 or resp.code.to_i > 300
raise ClientException.new('Container GET failed', :http_scheme=>parsed.scheme,
:http_host=>conn.address, :http_port=>conn.port,
:http_path=>parsed.path, :http_query=>parsed.query, :http_status=>resp.code,
:http_reason=>resp.message)
end
resp_headers = {}
resp.header.each do |k,v|
resp_headers[k.downcase] = v
end
if resp.code.to_i == 204
[resp_headers, []]
else
[resp_headers, JSON.parse(resp.body())]
end
end