1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
mod error;
mod cert;
mod uri;
mod list_stream;
#[cfg(feature = "native")]
mod native;
#[cfg(feature = "native")]
pub use native::*;
pub use self::error::ClientError;
pub use k8_config::K8Config;
#[cfg(feature = "hyper2")]
mod hyper;
#[cfg(feature = "hyper2")]
pub use crate::hyper::*;
#[cfg(feature = "k8")]
pub mod fixture;
use cert::*;
pub mod metadata {
pub use k8_metadata_client::*;
}
pub use shared::SharedK8Client;
pub use shared::new_shared;
pub use shared::load_and_share;
mod shared {
use std::sync::Arc;
use super::K8Config;
use super::ClientError;
use super::K8Client;
pub type SharedK8Client = Arc<K8Client>;
pub fn new_shared(config: K8Config) -> Result<SharedK8Client,ClientError> {
let client= K8Client::new(config)?;
Ok(Arc::new(client))
}
pub fn load_and_share() -> Result<SharedK8Client,ClientError> {
let config = K8Config::load()?;
new_shared(config)
}
}