cmd and fs: Added new command settier which performs storage tier changes on

supported remotes
This commit is contained in:
sandeepkru
2018-09-10 18:59:48 -07:00
committed by Nick Craig-Wood
parent 9594fd0a0c
commit 7accd30da8
3 changed files with 70 additions and 0 deletions

View File

@ -1407,6 +1407,21 @@ func CopyFile(fdst fs.Fs, fsrc fs.Fs, dstFileName string, srcFileName string) (e
return moveOrCopyFile(fdst, fsrc, dstFileName, srcFileName, true)
}
// SetTier changes tier of object in remote
func SetTier(fsrc fs.Fs, tier string) error {
return ListFn(fsrc, func(o fs.Object) {
objImpl, ok := o.(fs.SetTierer)
if !ok {
fs.Errorf(fsrc, "Remote object does not implement SetTier")
return
}
err := objImpl.SetTier(tier)
if err != nil {
fs.Errorf(fsrc, "Failed to do SetTier, %v", err)
}
})
}
// ListFormat defines files information print format
type ListFormat struct {
separator string