// Mkdir creates the bucket if it doesn't exist
Mkdir creates the bucket if it doesn't exist
// Mkdir creates the bucket if it doesn ' t exist
func (f *Fs) Mkdir(dir string) error {
	f.bucketOKMu.Lock()
	defer f.bucketOKMu.Unlock()
	if f.bucketOK {
		return nil
	}
	if !f.bucketDeleted {
		exists, err := f.dirExists()
		if err == nil {
			f.bucketOK = exists
		}
		if err != nil || exists {
			return err
		}
	}
	req := s3.CreateBucketInput{
		Bucket: &f.bucket,
		ACL:    &f.opt.ACL,
	}
	if f.opt.LocationConstraint != "" {
		req.CreateBucketConfiguration = &s3.CreateBucketConfiguration{
			LocationConstraint: &f.opt.LocationConstraint,
		}
	}
	_, err := f.c.CreateBucket(&req)
	if err, ok := err.(awserr.Error); ok {
		if err.Code() == "BucketAlreadyOwnedByYou" {
			err = nil
		}
	}
	if err == nil {
		f.bucketOK = true
		f.bucketDeleted = false
	}
	return err
}
func ( f * Fs ) Mkdir ( dir string ) error { f . bucketOKMu . Lock ( ) defer f . bucketOKMu . Unlock ( ) if f . bucketOK { return nil } if ! f . bucketDeleted { exists , err := f . dirExists ( ) if err == nil { f . bucketOK = exists } if err != nil || exists { return err } } req := s3 . CreateBucketInput { Bucket : & f . bucket , ACL : & f . opt . ACL , } if f . opt . LocationConstraint != " " { req . CreateBucketConfiguration = & s3 . CreateBucketConfiguration { LocationConstraint : & f . opt . LocationConstraint , } } _ , err := f . c . CreateBucket ( & req ) if err , ok := err . ( awserr . Error ) ; ok { if err . Code ( ) == " " { err = nil } } if err == nil { f . bucketOK = true f . bucketDeleted = false } return err }
Mkdir creates the bucket if it doesn't exist
Mkdir creates the bucket if it doesn ' t exist