summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbc Xyz <rum.274.4@gmail.com>2021-02-22 02:12:21 +0300
committerGitHub <noreply@github.com>2021-02-21 18:12:21 -0500
commit95beb6f2aaf36d38ca1dc3abb7544fb878c45ca0 (patch)
tree9c84d1906a9a1f8c94dedd1376b50bd0e8b660e5
parent4efa39b3ec89cb67c89d635b04fa7fae4682c09b (diff)
Add missing fields to `ImageDetails` and `History` (#264)
* Add missing fields to `ImageDetails` and `History` * Make some fields in `ContainerConfig` required
-rw-r--r--CHANGELOG.md5
-rw-r--r--src/rep.rs103
2 files changed, 82 insertions, 26 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 631142d..c53c86d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,11 @@
# 0.8.0
* `ContainerOptionsBuilder::entrypoint` now correctly takes an `IntoIterator<Item = AsRef<str>>` instead of `&str` [#269](https://github.com/softprops/shiplift/pull/269)
+* make `config` field of `ImageDetails` optional [#264](https://github.com/softprops/shiplift/pull/264)
+* add `container`, `container_config`, `os_version`, `graph_driver`, `root_fs`, `metadata` fields to `ImageDetails` [#264](https://github.com/softprops/shiplift/pull/264)
+* rename `shiplift::rep::Config` to `shiplift::rep::ContainerConfig` [#264](https://github.com/softprops/shiplift/pull/264)
+* add missing fields ([API version 1.41](https://docs.docker.com/engine/api/v1.41/#operation/ImageInspect)) to `ContainerConfig` [#264](https://github.com/softprops/shiplift/pull/264)
+* add missing fields ([API version 1.41](https://docs.docker.com/engine/api/v1.41/#operation/ImageHistory)) to `History` [#264](https://github.com/softprops/shiplift/pull/264)
# 0.7.0
diff --git a/src/rep.rs b/src/rep.rs
index 62b248a..d12faf3 100644
--- a/src/rep.rs
+++ b/src/rep.rs
@@ -33,22 +33,29 @@ pub struct Image {
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ImageDetails {
- pub architecture: String,
- pub author: String,
+ pub id: String,
+ pub repo_tags: Option<Vec<String>>,
+ pub repo_digests: Option<Vec<String>>,
+ pub parent: String,
pub comment: String,
- pub config: Config,
#[cfg(feature = "chrono")]
pub created: DateTime<Utc>,
#[cfg(not(feature = "chrono"))]
pub created: String,
+ pub container: String,
+ pub container_config: Option<ContainerConfig>,
pub docker_version: String,
- pub id: String,
+ pub author: String,
+ pub config: Option<ContainerConfig>,
+ pub architecture: String,
pub os: String,
- pub parent: String,
- pub repo_tags: Option<Vec<String>>,
- pub repo_digests: Option<Vec<String>>,
- pub size: u64,
- pub virtual_size: u64,
+ pub os_version: Option<String>,
+ pub size: i64,
+ pub virtual_size: i64,
+ pub graph_driver: GraphDriverData,
+ #[serde(rename = "RootFS")]
+ pub root_fs: RootFS,
+ pub metadata: Metadata,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
@@ -78,7 +85,7 @@ pub struct Container {
pub struct ContainerDetails {
pub app_armor_profile: String,
pub args: Vec<String>,
- pub config: Config,
+ pub config: ContainerConfig,
#[cfg(feature = "chrono")]
pub created: DateTime<Utc>,
#[cfg(not(feature = "chrono"))]
@@ -194,29 +201,35 @@ pub struct HostConfig {
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
-pub struct Config {
- pub attach_stderr: bool,
+pub struct ContainerConfig {
+ pub hostname: String,
+ pub domainname: String,
+ pub user: String,
pub attach_stdin: bool,
pub attach_stdout: bool,
- pub cmd: Option<Vec<String>>,
- pub domainname: String,
- pub entrypoint: Option<Vec<String>>,
- pub env: Option<Vec<String>>,
+ pub attach_stderr: bool,
pub exposed_ports: Option<HashMap<String, HashMap<String, String>>>,
- pub hostname: String,
- pub image: String,
- pub labels: Option<HashMap<String, String>>,
- // pub MacAddress: String,
- pub on_build: Option<Vec<String>>,
- // pub NetworkDisabled: bool,
+ pub tty: bool,
pub open_stdin: bool,
pub stdin_once: bool,
- pub tty: bool,
- pub user: String,
+ pub env: Option<Vec<String>>,
+ pub cmd: Option<Vec<String>>,
+ pub healtcheck: Option<HealthConfig>,
+ pub args_escaped: Option<bool>,
+ pub image: String,
+ pub volumes: Option<HashMap<String, HashMap<String, String>>>,
pub working_dir: String,
+ pub entrypoint: Option<Vec<String>>,
+ pub network_disabled: Option<bool>,
+ pub mac_address: Option<String>,
+ pub on_build: Option<Vec<String>>,
+ pub labels: Option<HashMap<String, String>>,
+ pub stop_signal: Option<String>,
+ pub stop_timeout: Option<u64>,
+ pub shell: Option<Vec<String>>,
}
-impl Config {
+impl ContainerConfig {
pub fn env(&self) -> HashMap<String, String> {
let mut map = HashMap::new();
if let Some(ref vars) = self.env {
@@ -231,6 +244,41 @@ impl Config {
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
+pub struct HealthConfig {
+ pub test: Option<Vec<String>>,
+ pub interval: Option<u64>,
+ pub timeout: Option<u64>,
+ pub retries: Option<u64>,
+ pub start_period: Option<u64>,
+}
+
+#[derive(Clone, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "PascalCase")]
+pub struct GraphDriverData {
+ pub name: String,
+ pub data: HashMap<String, String>,
+}
+
+#[derive(Clone, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "PascalCase")]
+pub struct RootFS {
+ #[serde(rename = "Type")]
+ pub typ: String,
+ pub layers: Option<Vec<String>>,
+ pub base_layer: Option<String>,
+}
+
+#[derive(Clone, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "PascalCase")]
+pub struct Metadata {
+ #[cfg(feature = "chrono")]
+ pub last_tag_time: DateTime<Utc>,
+ #[cfg(not(feature = "chrono"))]
+ pub last_tag_time: String,
+}
+
+#[derive(Clone, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "PascalCase")]
pub struct Port {
pub ip: Option<String>,
pub private_port: u64,
@@ -460,8 +508,11 @@ pub struct History {
#[serde(deserialize_with = "datetime_from_unix_timestamp")]
pub created: DateTime<Utc>,
#[cfg(not(feature = "chrono"))]
- pub created: u64,
+ pub created: i64,
pub created_by: String,
+ pub tags: Option<Vec<String>>,
+ pub size: i64,
+ pub comment: String,
}
#[derive(Clone, Debug, Serialize, Deserialize)]