summaryrefslogtreecommitdiffstats
path: root/src/endpoint
diff options
context:
space:
mode:
Diffstat (limited to 'src/endpoint')
-rw-r--r--src/endpoint/configured.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/endpoint/configured.rs b/src/endpoint/configured.rs
index ae54dfb..b703a5f 100644
--- a/src/endpoint/configured.rs
+++ b/src/endpoint/configured.rs
@@ -283,6 +283,19 @@ impl Endpoint {
.map(|o| o.is_some())
}
+ pub async fn get_container_by_id<'a>(&'a self, id: &str) -> Result<Option<Container<'a>>> {
+ self.container_stats()
+ .await?
+ .iter()
+ .find(|st| st.id == id)
+ .map(|_| {
+ self.docker
+ .containers()
+ .get(id)
+ })
+ .map(Ok)
+ .transpose()
+ }
}
/// Helper type to store endpoint statistics