Rmdir deletes the bucket if the fs is at the root Returns an error if it isn't empty: Error 409: The bucket you tried to delete was not empty.
(ctx context.Context, dir string)
| 1090 | // Returns an error if it isn't empty: Error 409: The bucket you tried |
| 1091 | // to delete was not empty. |
| 1092 | func (f *Fs) Rmdir(ctx context.Context, dir string) (err error) { |
| 1093 | bucket, directory := f.split(dir) |
| 1094 | // Remove directory marker file |
| 1095 | if f.opt.DirectoryMarkers && bucket != "" && dir != "" { |
| 1096 | o := &Object{ |
| 1097 | fs: f, |
| 1098 | remote: dir + "/", |
| 1099 | } |
| 1100 | fs.Debugf(o, "Removing directory marker") |
| 1101 | err := o.Remove(ctx) |
| 1102 | if err != nil { |
| 1103 | return fmt.Errorf("removing directory marker failed: %w", err) |
| 1104 | } |
| 1105 | } |
| 1106 | if bucket == "" || directory != "" { |
| 1107 | return nil |
| 1108 | } |
| 1109 | return f.cache.Remove(bucket, func() error { |
| 1110 | return f.pacer.Call(func() (bool, error) { |
| 1111 | deleteBucket := f.svc.Buckets.Delete(bucket).Context(ctx) |
| 1112 | if f.opt.UserProject != "" { |
| 1113 | deleteBucket = deleteBucket.UserProject(f.opt.UserProject) |
| 1114 | } |
| 1115 | err = deleteBucket.Do() |
| 1116 | return shouldRetry(ctx, err) |
| 1117 | }) |
| 1118 | }) |
| 1119 | } |
| 1120 | |
| 1121 | // Precision returns the precision |
| 1122 | func (f *Fs) Precision() time.Duration { |