Skip to content

Commit

Permalink
Bump models to v1.43
Browse files Browse the repository at this point in the history
  • Loading branch information
vv9k committed Jun 10, 2023
1 parent 5fc3c55 commit 851f709
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 34 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#
- Bump default API version to v1.43

# 0.14.0
- Add `ContainerCreateOptsBuilder::network_config`
- `Docker` initializers like `new`, `tcp`, `unix`, `tls` now create an unversioned connector that will use the server's latest version instead of setting it to `LATEST_API_VERSION`.
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ containers-api = "0.9"
#containers-api = { path = "../containers-api" }
#containers-api = { git = "https://github.com/vv9k/containers-api" }

docker-api-stubs = "0.5"
#docker-api-stubs = { path = "./docker-api-stubs/lib" }
#docker-api-stubs = "0.5"
docker-api-stubs = { path = "./docker-api-stubs/lib" }

log = "0.4"
paste = "1"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Swarm endpoints include:
- Plugins

Latest stable version of this crate supports API version: **v1.42**
Master branch supports: **v1.42**
Master branch supports: **v1.43**

## Features

Expand Down
2 changes: 1 addition & 1 deletion docker-api-stubs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -ex

DOCKER_SWAGGER_URL="https://docs.docker.com/engine/api"
DOCKER_API_VERSION="v1.42"
DOCKER_API_VERSION="v1.43"
DOCKER_SPEC_FILE="${DOCKER_API_VERSION}.yaml"
DOCKER_FULL_URL="${DOCKER_SWAGGER_URL}/${DOCKER_SPEC_FILE}"
RUSTGEN="https://github.com/vv9k/swagger-rustgen.git"
Expand Down
2 changes: 1 addition & 1 deletion docker-api-stubs/lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "docker-api-stubs"
version = "0.5.0"
version = "0.6.0"
authors = [ "Wojciech Kępka <wojciech@wkepka.dev>" ]
description = "Generated Docker API swagger stubs for use in docker-api"
license = "MIT"
Expand Down
65 changes: 40 additions & 25 deletions docker-api-stubs/lib/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ pub struct BuildPrune200Response {
pub space_reclaimed: Option<i64>,
}

/// Kind of change
///
/// Can be one of:
///
/// - `0`: Modified ("C")
/// - `1`: Added ("A")
/// - `2`: Deleted ("D")
pub type ChangeType = u8;

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
/// ClusterInfo represents information about the swarm as is returned by the
/// "/info" endpoint. Join-tokens are not included.
Expand Down Expand Up @@ -660,19 +669,8 @@ pub struct ConfigSpec {
pub templating: Option<Driver>,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
/// change item in response to ContainerChanges operation
pub struct ContainerChangeResponseItem {
#[serde(rename = "Kind")]
/// Kind of change
pub kind: u8,
#[serde(rename = "Path")]
/// Path to file that has changed
pub path: String,
}

/// The list of changes
pub type ContainerChanges200Response = Vec<ContainerChangeResponseItem>;
pub type ContainerChanges200Response = Vec<FilesystemChange>;

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
/// Configuration for a container that is portable between hosts.
Expand Down Expand Up @@ -1111,7 +1109,8 @@ pub struct ContainerState {
pub health: Option<Health>,
#[serde(rename = "OOMKilled")]
#[serde(skip_serializing_if = "Option::is_none")]
/// Whether this container has been killed because it ran out of memory.
/// Whether a process within this container has been killed because it ran
/// out of memory since the container was last started.
pub oom_killed: Option<bool>,
#[serde(rename = "Paused")]
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -1997,6 +1996,16 @@ pub struct ExecStartExecStartConfigParam {
pub tty: Option<bool>,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
/// Change in the container's filesystem.
pub struct FilesystemChange {
#[serde(rename = "Kind")]
pub kind: u8,
#[serde(rename = "Path")]
/// Path to file or directory that has changed.
pub path: String,
}

/// User-defined resources can be either Integer resources (e.g, `SSD=3`) or
/// String resources (e.g, `GPU=UUID1`).
pub type GenericResources = Vec<GenericResourcesInlineItem>;
Expand Down Expand Up @@ -2193,6 +2202,11 @@ pub struct HistoryResponseItem {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
/// Container configuration that depends on the host we are running on
pub struct HostConfig {
#[serde(rename = "Annotations")]
#[serde(skip_serializing_if = "Option::is_none")]
/// Arbitrary non-identifying metadata attached to container and
/// provided to the runtime when the container is started.
pub annotations: Option<HashMap<String, String>>,
#[serde(rename = "AutoRemove")]
#[serde(skip_serializing_if = "Option::is_none")]
/// Automatically remove the container when the container's process
Expand Down Expand Up @@ -2930,12 +2944,12 @@ pub struct ImageInspect {
/// Total size of the image including all layers it is composed of.
///
/// In versions of Docker before v1.10, this field was calculated from
/// the image itself and all of its parent images. Docker v1.10 and up
/// store images self-contained, and no longer use a parent-chain, making
/// this field an equivalent of the Size field.
/// the image itself and all of its parent images. Images are now stored
/// self-contained, and no longer use a parent-chain, making this field
/// an equivalent of the Size field.
///
/// This field is kept for backward compatibility, but may be removed in
/// a future version of the API.
/// > **Deprecated**: this field is kept for backward compatibility, but
/// > will be removed in API v1.44.
pub virtual_size: Option<i64>,
}

Expand Down Expand Up @@ -3065,16 +3079,16 @@ pub struct ImageSummary {
/// Total size of the image including all layers it is composed of.
pub size: i64,
#[serde(rename = "VirtualSize")]
#[serde(skip_serializing_if = "Option::is_none")]
/// Total size of the image including all layers it is composed of.
///
/// In versions of Docker before v1.10, this field was calculated from
/// the image itself and all of its parent images. Docker v1.10 and up
/// store images self-contained, and no longer use a parent-chain, making
/// this field an equivalent of the Size field.
/// the image itself and all of its parent images. Images are now stored
/// self-contained, and no longer use a parent-chain, making this field
/// an equivalent of the Size field.
///
/// This field is kept for backward compatibility, but may be removed in
/// a future version of the API.
pub virtual_size: i64,
/// Deprecated: this field is kept for backward compatibility, and will be removed in API v1.44.
pub virtual_size: Option<i64>,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
Expand Down Expand Up @@ -6649,7 +6663,8 @@ pub struct SystemInfo {
#[serde(rename = "SecurityOptions")]
#[serde(skip_serializing_if = "Option::is_none")]
/// List of security features that are enabled on the daemon, such as
/// apparmor, seccomp, SELinux, user-namespaces (userns), and rootless.
/// apparmor, seccomp, SELinux, user-namespaces (userns), rootless and
/// no-new-privileges.
///
/// Additional configuration options for each security feature may
/// be present, and are included as a comma-separated list of key/value
Expand Down
8 changes: 4 additions & 4 deletions tests/container_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,22 +411,22 @@ async fn container_changes() {
.unwrap();
while exec_stream.next().await.is_some() {}

use docker_api::models::ContainerChangeResponseItem;
use docker_api::models::FilesystemChange;

let changes = container
.changes()
.await
.expect("container changes")
.unwrap_or_default();
assert!(changes.contains(&ContainerChangeResponseItem {
assert!(changes.contains(&FilesystemChange {
kind: 0,
path: "/tmp".into()
}));
assert!(changes.contains(&ContainerChangeResponseItem {
assert!(changes.contains(&FilesystemChange {
kind: 1,
path: "/tmp/test-changes".into()
}));
assert!(changes.contains(&ContainerChangeResponseItem {
assert!(changes.contains(&FilesystemChange {
kind: 2,
path: "/etc/xattr.conf".into()
}));
Expand Down

0 comments on commit 851f709

Please sign in to comment.