public RiakResponse<string[]> ListBuckets()
{
var connection = _connectionManager.GetNextConnection();
var r = connection.WriteRequestWithoutBody(new string[] {}, RequestMethod.ListBuckets);
if (r.ResponseCode == RiakResponseCode.Failed)
{
return RiakResponse<string[]>.WithErrors(r.Messages);
}
var response = connection.Read<ListBucketsResponse>();
return response.ResponseCode == RiakResponseCode.Failed || response.Result.Buckets.Count() == 0
? RiakResponse<string[]>.WithErrors("No buckets", response.Messages.FirstOrDefault())
: RiakResponse<string[]>.WithoutErrors(response.Result
.Buckets
.Select(x => x.DecodeToString())
.ToArray());
}