makeBucket method

Future<void> makeBucket(
  1. String bucket, [
  2. String? region
])

Creates the bucket bucket.

Implementation

Future<void> makeBucket(String bucket, [String? region]) async {
  MinioInvalidBucketNameError.check(bucket);
  if (this.region != null && region != null && this.region != region) {
    throw MinioInvalidArgumentError(
      'Configured region ${this.region}, requested $region',
    );
  }

  region ??= this.region ?? 'us-east-1';
  final payload = region == 'us-east-1'
      ? ''
      : CreateBucketConfiguration(region).toXml().toString();

  final resp = await _client.request(
    method: 'PUT',
    bucket: bucket,
    region: region,
    payload: payload,
  );

  validate(resp);
  // return resp.body;
}