blob: a175655f1019b6085b831f11c58123ffe5313a8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
use crate::client::AsyncBackupClient;
use crate::config::ClientConfig;
use crate::error::ObnamError;
use structopt::StructOpt;
use tokio::runtime::Runtime;
#[derive(Debug, StructOpt)]
pub struct Resolve {
generation: String,
}
impl Resolve {
pub fn run(&self, config: &ClientConfig) -> Result<(), ObnamError> {
let rt = Runtime::new()?;
rt.block_on(self.run_async(config))
}
async fn run_async(&self, config: &ClientConfig) -> Result<(), ObnamError> {
let client = AsyncBackupClient::new(config)?;
let generations = client.list_generations().await?;
match generations.resolve(&self.generation) {
Err(err) => {
return Err(err.into());
}
Ok(old_id) => {
println!("{}", old_id);
}
};
Ok(())
}
}
|