pub struct K8Client { /* private fields */ }
Expand description
K8 Cluster accessible thru API
Implementations§
source§impl K8Client
impl K8Client
pub fn try_default() -> Result<Self>
pub fn new(config: K8Config) -> Result<Self>
pub async fn server_version(&self) -> Result<VersionInfo>
pub async fn retrieve_items_inner<S, N>( &self, namespace: N, options: Option<ListOptions> ) -> Result<K8List<S>>where S: Spec, N: Into<NameSpace> + Send + Sync,
sourcepub async fn replace_item<S>(&self, value: UpdatedK8Obj<S>) -> Result<K8Obj<S>>where
S: Spec,
pub async fn replace_item<S>(&self, value: UpdatedK8Obj<S>) -> Result<K8Obj<S>>where S: Spec,
replace existing object. object must exist
pub async fn retrieve_log( &self, namespace: &str, pod_name: &str, container_name: &str ) -> Result<LogStream>
Trait Implementations§
source§impl MetadataClient for K8Client
impl MetadataClient for K8Client
source§fn retrieve_item<'life0, 'life1, 'async_trait, S, M>(
&'life0 self,
metadata: &'life1 M
) -> Pin<Box<dyn Future<Output = Result<Option<K8Obj<S>>>> + Send + 'async_trait>>where
S: Spec + 'async_trait,
M: K8Meta + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn retrieve_item<'life0, 'life1, 'async_trait, S, M>( &'life0 self, metadata: &'life1 M ) -> Pin<Box<dyn Future<Output = Result<Option<K8Obj<S>>>> + Send + 'async_trait>>where S: Spec + 'async_trait, M: K8Meta + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
retrieval a single item
source§fn create_item<'life0, 'async_trait, S>(
&'life0 self,
value: InputK8Obj<S>
) -> Pin<Box<dyn Future<Output = Result<K8Obj<S>>> + Send + 'async_trait>>where
S: Spec + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn create_item<'life0, 'async_trait, S>( &'life0 self, value: InputK8Obj<S> ) -> Pin<Box<dyn Future<Output = Result<K8Obj<S>>> + Send + 'async_trait>>where S: Spec + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,
create new object
source§fn update_status<'life0, 'life1, 'async_trait, S>(
&'life0 self,
value: &'life1 UpdateK8ObjStatus<S>
) -> Pin<Box<dyn Future<Output = Result<K8Obj<S>>> + Send + 'async_trait>>where
S: Spec + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_status<'life0, 'life1, 'async_trait, S>( &'life0 self, value: &'life1 UpdateK8ObjStatus<S> ) -> Pin<Box<dyn Future<Output = Result<K8Obj<S>>> + Send + 'async_trait>>where S: Spec + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
update status
source§fn patch<'life0, 'life1, 'life2, 'async_trait, S, M>(
&'life0 self,
metadata: &'life1 M,
patch: &'life2 Value,
merge_type: PatchMergeType
) -> Pin<Box<dyn Future<Output = Result<K8Obj<S>>> + Send + 'async_trait>>where
S: Spec + 'async_trait,
M: K8Meta + Display + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn patch<'life0, 'life1, 'life2, 'async_trait, S, M>( &'life0 self, metadata: &'life1 M, patch: &'life2 Value, merge_type: PatchMergeType ) -> Pin<Box<dyn Future<Output = Result<K8Obj<S>>> + Send + 'async_trait>>where S: Spec + 'async_trait, M: K8Meta + Display + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
patch existing with spec
source§fn patch_status<'life0, 'life1, 'life2, 'async_trait, S, M>(
&'life0 self,
metadata: &'life1 M,
patch: &'life2 Value,
merge_type: PatchMergeType
) -> Pin<Box<dyn Future<Output = Result<K8Obj<S>>> + Send + 'async_trait>>where
S: Spec + 'async_trait,
M: K8Meta + Display + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn patch_status<'life0, 'life1, 'life2, 'async_trait, S, M>( &'life0 self, metadata: &'life1 M, patch: &'life2 Value, merge_type: PatchMergeType ) -> Pin<Box<dyn Future<Output = Result<K8Obj<S>>> + Send + 'async_trait>>where S: Spec + 'async_trait, M: K8Meta + Display + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
patch status
source§fn watch_stream_since<S, N>(
&self,
namespace: N,
resource_version: Option<String>
) -> BoxStream<'_, TokenStreamResult<S>>where
S: Spec + 'static,
S::Status: 'static,
S::Header: 'static,
N: Into<NameSpace>,
fn watch_stream_since<S, N>( &self, namespace: N, resource_version: Option<String> ) -> BoxStream<'_, TokenStreamResult<S>>where S: Spec + 'static, S::Status: 'static, S::Header: 'static, N: Into<NameSpace>,
stream items since resource versions
fn retrieve_items_with_option<'life0, 'async_trait, S, N>( &'life0 self, namespace: N, option: Option<ListArg> ) -> Pin<Box<dyn Future<Output = Result<K8List<S>>> + Send + 'async_trait>>where S: Spec + 'async_trait, N: Into<NameSpace> + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,
source§fn retrieve_items_in_chunks<'a, S, N>(
self: Arc<Self>,
namespace: N,
limit: u32,
option: Option<ListArg>
) -> BoxStream<'a, K8List<S>>where
S: Spec + 'static,
N: Into<NameSpace> + Send + Sync + 'static,
fn retrieve_items_in_chunks<'a, S, N>( self: Arc<Self>, namespace: N, limit: u32, option: Option<ListArg> ) -> BoxStream<'a, K8List<S>>where S: Spec + 'static, N: Into<NameSpace> + Send + Sync + 'static,
returns stream of items in chunks
fn delete_item_with_option<'life0, 'life1, 'async_trait, S, M>( &'life0 self, metadata: &'life1 M, option: Option<DeleteOptions> ) -> Pin<Box<dyn Future<Output = Result<DeleteStatus<S>>> + Send + 'async_trait>>where S: Spec + 'async_trait, M: K8Meta + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
source§fn retrieve_items<'life0, 'async_trait, S, N>(
&'life0 self,
namespace: N
) -> Pin<Box<dyn Future<Output = Result<K8List<S>, Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
S: Spec + 'async_trait,
N: Into<NameSpace> + Send + Sync + 'async_trait,
Self: 'async_trait,
fn retrieve_items<'life0, 'async_trait, S, N>( &'life0 self, namespace: N ) -> Pin<Box<dyn Future<Output = Result<K8List<S>, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, S: Spec + 'async_trait, N: Into<NameSpace> + Send + Sync + 'async_trait, Self: 'async_trait,
retrieve all items a single chunk
this may cause client to hang if there are too many items
fn delete_item<'life0, 'life1, 'async_trait, S, M>( &'life0 self, metadata: &'life1 M ) -> Pin<Box<dyn Future<Output = Result<DeleteStatus<S>, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, S: Spec + 'async_trait, M: K8Meta + Send + Sync + 'async_trait, Self: 'async_trait,
source§fn apply<'life0, 'async_trait, S>(
&'life0 self,
value: K8SpecObj<S, InputObjectMeta>
) -> Pin<Box<dyn Future<Output = Result<ApplyResult<S>, Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
S: Spec + 'async_trait,
Self: 'async_trait,
fn apply<'life0, 'async_trait, S>( &'life0 self, value: K8SpecObj<S, InputObjectMeta> ) -> Pin<Box<dyn Future<Output = Result<ApplyResult<S>, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, S: Spec + 'async_trait, Self: 'async_trait,
apply object, this is similar to
kubectl apply
for now, this doesn’t do any optimization
if object doesn’t exist, it will be created
if object exist, it will be patched by using strategic merge diffsource§fn patch_obj<'life0, 'life1, 'life2, 'async_trait, S, M>(
&'life0 self,
metadata: &'life1 M,
patch: &'life2 Value
) -> Pin<Box<dyn Future<Output = Result<K8Obj<S>, Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
S: Spec + 'async_trait,
M: K8Meta + Display + Send + Sync + 'async_trait,
Self: 'async_trait,
fn patch_obj<'life0, 'life1, 'life2, 'async_trait, S, M>( &'life0 self, metadata: &'life1 M, patch: &'life2 Value ) -> Pin<Box<dyn Future<Output = Result<K8Obj<S>, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, S: Spec + 'async_trait, M: K8Meta + Display + Send + Sync + 'async_trait, Self: 'async_trait,
patch existing obj
fn watch_stream_now<S>( &self, ns: String ) -> Pin<Box<dyn Stream<Item = Result<Vec<Result<K8Watch<S>, Error>, Global>, Error>> + Send + '_, Global>>where S: Spec + 'static,
source§fn exists<'life0, 'life1, 'async_trait, S, M>(
&'life0 self,
metadata: &'life1 M
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
S: Spec + 'async_trait,
M: K8Meta + Display + Send + Sync + 'async_trait,
Self: 'async_trait,
fn exists<'life0, 'life1, 'async_trait, S, M>( &'life0 self, metadata: &'life1 M ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, S: Spec + 'async_trait, M: K8Meta + Display + Send + Sync + 'async_trait, Self: 'async_trait,
Check if the object exists, return true or false.
Auto Trait Implementations§
impl !RefUnwindSafe for K8Client
impl Send for K8Client
impl Sync for K8Client
impl Unpin for K8Client
impl !UnwindSafe for K8Client
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more