cloud drive: add list buckets

This commit is contained in:
Chris Lu
2021-09-03 20:42:02 -07:00
parent fbfc90fd1e
commit 83cd0fc739
5 changed files with 45 additions and 0 deletions

View File

@@ -205,6 +205,7 @@ func (az *azureRemoteStorageClient) UpdateFileMetadata(loc *remote_pb.RemoteStor
return
}
func (az *azureRemoteStorageClient) DeleteFile(loc *remote_pb.RemoteStorageLocation) (err error) {
key := loc.Path[1:]
containerURL := az.serviceURL.NewContainerURL(loc.Bucket)
@@ -214,3 +215,17 @@ func (az *azureRemoteStorageClient) DeleteFile(loc *remote_pb.RemoteStorageLocat
}
return
}
func (az *azureRemoteStorageClient) ListBuckets() (buckets []*remote_storage.Bucket, err error) {
resp, err := az.ListBuckets()
if err != nil {
return nil, fmt.Errorf("list buckets: %v", err)
}
for _, b := range resp {
buckets = append(buckets, &remote_storage.Bucket{
Name: b.Name,
CreatedAt: b.CreatedAt,
})
}
return
}