Bucket operations
(ctx context.Context, bucketName string, opts MakeBucketOptions)
| 28 | |
| 29 | // Bucket operations |
| 30 | func (c *Client) makeBucket(ctx context.Context, bucketName string, opts MakeBucketOptions) (err error) { |
| 31 | // Validate the input arguments. |
| 32 | if err := s3utils.CheckValidBucketNameStrict(bucketName); err != nil { |
| 33 | return err |
| 34 | } |
| 35 | |
| 36 | err = c.doMakeBucket(ctx, bucketName, opts) |
| 37 | if err != nil && (opts.Region == "" || opts.Region == "us-east-1") { |
| 38 | if resp, ok := err.(ErrorResponse); ok && resp.Code == AuthorizationHeaderMalformed && resp.Region != "" { |
| 39 | opts.Region = resp.Region |
| 40 | err = c.doMakeBucket(ctx, bucketName, opts) |
| 41 | } |
| 42 | } |
| 43 | return err |
| 44 | } |
| 45 | |
| 46 | func (c *Client) doMakeBucket(ctx context.Context, bucketName string, opts MakeBucketOptions) (err error) { |
| 47 | defer func() { |
no test coverage detected