summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-11-09 10:11:07 +0200
committerLars Wirzenius <liw@liw.fi>2020-11-09 10:11:07 +0200
commitf2d97ebf2efdc6d33492f00672a98c1cc52681a1 (patch)
tree361d8d84c739d273b03b7647a7360d2a9e672a8a /src
parentf46e19447a1d4adbdebd3e9e448e2445327b40f1 (diff)
downloadobnam2-f2d97ebf2efdc6d33492f00672a98c1cc52681a1.tar.gz
client-list works
Diffstat (limited to 'src')
-rw-r--r--src/client.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/client.rs b/src/client.rs
index 5402588..1dbe1d0 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -165,6 +165,15 @@ impl BackupClient {
}
pub fn list_generations(&self) -> anyhow::Result<Vec<ChunkId>> {
- Ok(vec![])
+ let url = format!("{}/?generation=true", self.base_url());
+ trace!("list_generations: url={:?}", url);
+ let req = self.client.get(&url).build()?;
+ let res = self.client.execute(req)?;
+ debug!("list_generations: status={}", res.status());
+ let body = res.bytes()?;
+ debug!("list_generationgs: body={:?}", body);
+ let map: HashMap<String, ChunkMeta> = serde_yaml::from_slice(&body)?;
+ debug!("list_generations: map={:?}", map);
+ Ok(map.keys().into_iter().map(|key| key.into()).collect())
}
}