Ejemplo n.º 1
0
        public async Task <ActionResult <CreateBucketResponse> > CreateBucketAsync(string bucketName)
        {
            _logger.LogInformation("Incoming Create Bucket request");

            if (await _bucketRepository.DoesS3BucketExist(bucketName))
            {
                return(BadRequest("Bucket already exists!"));
            }
            var result = await _bucketRepository.CreateS3BucketAsync(bucketName);

            if (result != null && !string.IsNullOrEmpty(result.RequestId))
            {
                return(Ok(result));
            }

            _logger.LogInformation("Something went wrong along the way");
            return(BadRequest("Unable to create S3 bucket"));
        }