getBucketRegion method
Gets the region of bucket
. The region is cached for subsequent calls.
Implementation
Future<String> getBucketRegion(String bucket) async {
MinioInvalidBucketNameError.check(bucket);
if (_bucketRegionMap.containsKey(bucket)) {
return _bucketRegionMap[bucket]!;
}
final resp = await _client.request(
method: 'GET',
bucket: bucket,
queries: <String, dynamic>{'location': null},
);
validate(resp);
final node = xml.XmlDocument.parse(resp.body);
var location = node.findAllElements('LocationConstraint').first.text;
_bucketRegionMap[bucket] = location;
return location;
}