Skip to content

Commit

Permalink
kube: Add restart method to Deployments and Sets.
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Pistol <vifino@tty.sh>
  • Loading branch information
vifino committed Sep 20, 2021
1 parent 7f9360a commit 388077d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kube/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ mod subresource;
pub use subresource::{Attach, AttachParams, Execute};
pub use subresource::{Evict, EvictParams, Log, LogParams, ScaleSpec, ScaleStatus};

mod util;

// Re-exports from kube-core
#[cfg(feature = "admission")]
#[cfg_attr(docsrs, doc(cfg(feature = "admission")))]
Expand Down
14 changes: 14 additions & 0 deletions kube/src/api/util.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::api::{Api, Resource};
use crate::Result;
use kube_core::util::Restart;
use serde::de::DeserializeOwned;

impl<K> Api<K>
where K: Restart + Resource + DeserializeOwned {
/// Trigger a restart of a Resource.
pub async fn restart(&self, name: &str) -> Result<K> {
let mut req = self.request.restart(name)?;
req.extensions_mut().insert("restart");
self.client.request::<K>(req).await
}
}

0 comments on commit 388077d

Please sign in to comment.