summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColvin Wellborn <39858617+colvin@users.noreply.github.com>2019-12-26 22:15:06 -0500
committerDoug Tangren <d.tangren@gmail.com>2019-12-26 22:15:06 -0500
commit3580c29b349585ae7de500ccb510659e9caf1500 (patch)
treefaf62cb787674526ff1125b0929ac61f60fd8016
parent6e4fe40ff249a158cfac33e840f6103a2478d3e4 (diff)
Expand rep::Version (#212)
* expand the fields of Version Expands `shiplift::rep::Version` to contain fields for the following elements of the `/version` API: - `min_api_version` (`MinAPIVersion`) - `os` (`Os`) - `arch` (`Arch`) - `kernel_version` (`KernelVersion`) - `build_time` (`BuildTime`) Adds a new example program to display version information. * order version fields according to api docs * remove min_api_version For backwards compat with older engines, remove the `min_api_version` field. It was apparently added in API version `1.25.0` (circa 2017).
-rw-r--r--examples/version.rs13
-rw-r--r--src/rep.rs9
2 files changed, 21 insertions, 1 deletions
diff --git a/examples/version.rs b/examples/version.rs
new file mode 100644
index 0000000..6125e56
--- /dev/null
+++ b/examples/version.rs
@@ -0,0 +1,13 @@
+use shiplift::Docker;
+use tokio::prelude::Future;
+
+fn main() {
+ env_logger::init();
+ let docker = Docker::new();
+ let fut = docker
+ .version()
+ .map(|ver| println!("version -> {:#?}", ver))
+ .map_err(|e| eprintln!("Error: {}", e));
+
+ tokio::run(fut);
+}
diff --git a/src/rep.rs b/src/rep.rs
index 7a96367..67b1028 100644
--- a/src/rep.rs
+++ b/src/rep.rs
@@ -404,10 +404,17 @@ pub struct Top {
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Version {
- pub api_version: String,
pub version: String,
+ pub api_version: String,
pub git_commit: String,
pub go_version: String,
+ pub os: String,
+ pub arch: String,
+ pub kernel_version: String,
+ #[cfg(feature = "chrono")]
+ pub build_time: DateTime<Utc>,
+ #[cfg(not(feature = "chrono"))]
+ pub build_time: String,
}
#[derive(Clone, Debug, Serialize, Deserialize)]