diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-03-05 20:06:16 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-03-07 21:50:29 +0100 |
commit | ec4d6eff956eba228c949d3ac178218682c73cdf (patch) | |
tree | 13f17016b767973dc2a815191e611ef78c3a4f36 | |
parent | 22a63db2381c4466df953fc91a4b7ec1a9d30ce4 (diff) |
Add Endpoint::has_container_with_id()
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
-rw-r--r-- | src/endpoint/configured.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/endpoint/configured.rs b/src/endpoint/configured.rs index 454850d..ae54dfb 100644 --- a/src/endpoint/configured.rs +++ b/src/endpoint/configured.rs @@ -272,6 +272,17 @@ impl Endpoint { .collect() }) } + + pub async fn has_container_with_id(&self, id: &str) -> Result<bool> { + self.container_stats() + .await? + .iter() + .find(|st| st.id == id) + .map(Ok) + .transpose() + .map(|o| o.is_some()) + } + } /// Helper type to store endpoint statistics |