summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonas Pommerening <jonas.pommerening@gmail.com>2021-04-01 14:45:56 +0200
committerJonas Pommerening <jonas.pommerening@gmail.com>2021-04-12 16:01:40 +0200
commit7cd30b1bc167eb7b6baf1a893c484f40d84cb5a7 (patch)
tree371bb1c17e0205ddd83052f00a3dffeb8f5a051f /src
parent9750d29614776e1372ef8b6580e0ae0eedc6801f (diff)
Fix incorrect return type of Networks::list
Moved and renamed NetworkInfo nee rep::Network to container::NetworkStats
Diffstat (limited to 'src')
-rw-r--r--src/container.rs16
-rw-r--r--src/lib.rs4
-rw-r--r--src/network.rs16
3 files changed, 18 insertions, 18 deletions
diff --git a/src/container.rs b/src/container.rs
index 24c41d6..f92811a 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},
};
@@ -1288,13 +1288,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,
diff --git a/src/lib.rs b/src/lib.rs
index 14c8559..4d60523 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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,