diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-06-16 18:20:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-16 18:20:11 +0200 |
commit | f02d1531b5828bc3ed18bbf32358a185c70c5fa2 (patch) | |
tree | 805f63e3b9a15ea2bab4c51d2d17c128f566f5f5 | |
parent | ebc26b9d91a5c5727339d5aaed75aa5060baa951 (diff) | |
parent | 7cd30b1bc167eb7b6baf1a893c484f40d84cb5a7 (diff) |
Merge pull request #281 from jpommerening/fix-networks-list-type
Fix incorrect return type of Networks::list
-rw-r--r-- | src/container.rs | 16 | ||||
-rw-r--r-- | src/lib.rs | 4 | ||||
-rw-r--r-- | src/network.rs | 16 |
3 files changed, 18 insertions, 18 deletions
diff --git a/src/container.rs b/src/container.rs index 83b5475..bf014f7 100644 --- a/src/container.rs +++ b/src/container.rs @@ -20,7 +20,7 @@ use crate::{ errors::{Error, Result}, exec::{Exec, ExecContainerOptions}, image::Config, - network::{NetworkInfo, NetworkSettings}, + network::NetworkSettings, transport::Payload, tty::{self, Multiplexer as TtyMultiPlexer}, }; @@ -1290,13 +1290,25 @@ pub struct Port { #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Stats { pub read: String, - pub networks: HashMap<String, NetworkInfo>, + pub networks: HashMap<String, NetworkStats>, pub memory_stats: MemoryStats, pub blkio_stats: BlkioStats, pub cpu_stats: CpuStats, } #[derive(Clone, Debug, Serialize, Deserialize)] +pub struct NetworkStats { + pub rx_dropped: u64, + pub rx_bytes: u64, + pub rx_errors: u64, + pub tx_packets: u64, + pub tx_dropped: u64, + pub rx_packets: u64, + pub tx_errors: u64, + pub tx_bytes: u64, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] pub struct MemoryStats { pub max_usage: u64, pub usage: u64, @@ -113,7 +113,7 @@ reexport! { mod rep; container::{ ContainerInfo as Container, ContainerDetails, Mount, State, HostConfig, Port, Stats, - MemoryStats, MemoryStat, CpuStats, CpuUsage, ThrottlingData, BlkioStats, BlkioStat, Change, + MemoryStats, MemoryStat, NetworkStats as Network, CpuStats, CpuUsage, ThrottlingData, BlkioStats, BlkioStat, Change, Top, ContainerCreateInfo, Exit, }; docker::{Version, Info, Event, Actor}; @@ -122,7 +122,7 @@ reexport! { SearchResult, ImageInfo as Image, ImageDetails, Config, History, Status, }; network::{ - NetworkSettings, NetworkEntry, NetworkInfo as Network, Ipam, NetworkDetails, + NetworkSettings, NetworkEntry, Ipam, NetworkDetails, NetworkContainerDetails, NetworkCreateInfo, }; service::{ diff --git a/src/network.rs b/src/network.rs index ff2c83f..6dd4eb3 100644 --- a/src/network.rs +++ b/src/network.rs @@ -36,7 +36,7 @@ impl<'docker> Networks<'docker> { pub async fn list( &self, opts: &NetworkListOptions, - ) -> Result<Vec<NetworkInfo>> { + ) -> Result<Vec<NetworkDetails>> { let mut path = vec!["/networks".to_owned()]; if let Some(query) = opts.serialize() { path.push(query); @@ -100,7 +100,7 @@ impl<'docker> Network<'docker> { /// Inspects the current docker network instance's details /// /// API Reference: <https://docs.docker.com/engine/api/v1.41/#operation/NetworkInspect> - pub async fn inspect(&self) -> Result<NetworkInfo> { + pub async fn inspect(&self) -> Result<NetworkDetails> { self.docker .get_json(&format!("/networks/{}", self.id)[..]) .await @@ -367,18 +367,6 @@ pub struct EndpointIPAMConfig { } #[derive(Clone, Debug, Serialize, Deserialize)] -pub struct NetworkInfo { - pub rx_dropped: u64, - pub rx_bytes: u64, - pub rx_errors: u64, - pub tx_packets: u64, - pub tx_dropped: u64, - pub rx_packets: u64, - pub tx_errors: u64, - pub tx_bytes: u64, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct Ipam { pub driver: String, |