Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove language-unusual trait conjugation for subresources - fixes #536 #560

Merged
merged 1 commit into from
Jun 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions kube/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ mod core_methods;
mod subresource;
#[cfg(feature = "ws")]
#[cfg_attr(docsrs, doc(cfg(feature = "ws")))]
pub use subresource::{AttachParams, Attachable, Executable};
pub use subresource::{EvictParams, Evictable, LogParams, Loggable, ScaleSpec, ScaleStatus};
pub use subresource::{AttachParams, Attach, Execute};
pub use subresource::{EvictParams, Evict, LogParams, Log, ScaleSpec, ScaleStatus};

// Re-exports from kube-core
#[cfg(feature = "admission")]
Expand Down
24 changes: 12 additions & 12 deletions kube/src/api/subresource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ fn log_path() {
}

/// Marker trait for objects that has logs
pub trait Loggable {}
pub trait Log {}

impl Loggable for k8s_openapi::api::core::v1::Pod {}
impl Log for k8s_openapi::api::core::v1::Pod {}

impl<K> Api<K>
where
K: DeserializeOwned + Loggable,
K: DeserializeOwned + Log,
{
/// Fetch logs as a string
pub async fn logs(&self, name: &str, lp: &LogParams) -> Result<String> {
Expand Down Expand Up @@ -185,13 +185,13 @@ fn evict_path() {
}

/// Marker trait for objects that can be evicted
pub trait Evictable {}
pub trait Evict {}

impl Evictable for k8s_openapi::api::core::v1::Pod {}
impl Evict for k8s_openapi::api::core::v1::Pod {}

impl<K> Api<K>
where
K: DeserializeOwned + Evictable,
K: DeserializeOwned + Evict,
{
/// Create an eviction
pub async fn evict(&self, name: &str, ep: &EvictParams) -> Result<Status> {
Expand Down Expand Up @@ -225,17 +225,17 @@ fn attach_path() {
/// Marker trait for objects that has attach
#[cfg(feature = "ws")]
#[cfg_attr(docsrs, doc(cfg(feature = "ws")))]
pub trait Attachable {}
pub trait Attach {}

#[cfg(feature = "ws")]
#[cfg_attr(docsrs, doc(cfg(feature = "ws")))]
impl Attachable for k8s_openapi::api::core::v1::Pod {}
impl Attach for k8s_openapi::api::core::v1::Pod {}

#[cfg(feature = "ws")]
#[cfg_attr(docsrs, doc(cfg(feature = "ws")))]
impl<K> Api<K>
where
K: Clone + DeserializeOwned + Attachable,
K: Clone + DeserializeOwned + Attach,
{
/// Attach to pod
pub async fn attach(&self, name: &str, ap: &AttachParams) -> Result<AttachedProcess> {
Expand Down Expand Up @@ -271,17 +271,17 @@ fn exec_path() {
/// Marker trait for objects that has exec
#[cfg(feature = "ws")]
#[cfg_attr(docsrs, doc(cfg(feature = "ws")))]
pub trait Executable {}
pub trait Execute {}

#[cfg(feature = "ws")]
#[cfg_attr(docsrs, doc(cfg(feature = "ws")))]
impl Executable for k8s_openapi::api::core::v1::Pod {}
impl Execute for k8s_openapi::api::core::v1::Pod {}

#[cfg(feature = "ws")]
#[cfg_attr(docsrs, doc(cfg(feature = "ws")))]
impl<K> Api<K>
where
K: Clone + DeserializeOwned + Executable,
K: Clone + DeserializeOwned + Execute,
{
/// Execute a command in a pod
pub async fn exec<I: Debug, T>(
Expand Down