Skip to content

Commit

Permalink
Merge pull request fussybeaver#98 from fussybeaver/ND-cleanup-8.0
Browse files Browse the repository at this point in the history
Cleanup, 8.0 release
  • Loading branch information
Niel Drummond authored Aug 22, 2020
2 parents b8ff0fa + fb000f0 commit a8b6f17
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 178 deletions.
22 changes: 10 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bollard"
description = "An asynchronous Docker daemon API"
version = "0.7.2"
version = "0.8.0"
authors = [ "Bollard contributors" ]
license = "Apache-2.0"
homepage = "https://github.com/fussybeaver/bollard"
Expand All @@ -18,36 +18,34 @@ test_http = []
test_ssl = []

[dependencies]
arrayvec = "0.5.1"
base64 = "0.12.3"
bollard-stubs = { version = "1.40.5" }
bytes = "0.5.5"
chrono = { version = "0.4.11", features = ["serde"] }
ct-logs = "0.7.0"
dirs = "3.0.0"
env_logger = "0.7.1"
futures-core = "0.3.4"
futures-util = "0.3.4"
hex = "0.4.2"
http = "0.2.1"
hyper = "0.13.6"
hyper-rustls = "0.21.0"
log = "0.4.8"
pin-project = "0.4.22"
rustls = "0.18.0"
rustls-native-certs = "0.4.0"
serde = "1.0.114"
serde_derive = "1.0.114"
serde_json = "1.0.55"
serde_urlencoded = "0.6.1"
tokio = { version = "0.2.17", features = ["time", "fs"] }
url = "2.1.1"
futures-core = "0.3.4"
futures-util = "0.3.4"
tokio-util = { version = "0.3.1", features = ["codec"] }
bollard-stubs = { version = "1.40.3" }
thiserror = "1.0"
rustls = "0.18.0"
rustls-native-certs = "0.4.0"
ct-logs = "0.7.0"
tokio-util = { version = "0.3.1", features = ["codec"] }
url = "2.1.1"
webpki-roots = "0.20.0"

[dev-dependencies]
tokio-executor = "0.2.0-alpha.6"
env_logger = "0.7.1"
flate2 = "1.0.14"
tar = "0.4.29"

Expand Down
61 changes: 15 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Add the following to your `Cargo.toml` file

```nocompile
[dependencies]
bollard = "0.7"
bollard = "0.8"
```

## API
Expand All @@ -28,8 +28,9 @@ bollard = "0.7"
[API docs](https://docs.rs/bollard/).

As of version 0.6, this project now generates API stubs from the upstream Docker-maintained
Swagger OpenAPI specification. The generated models are committed to this repository, but
packaged in a separate crate [bollard-stubs](https://crates.io/crates/bollard-stubs).
[Swagger OpenAPI specification](https://docs.docker.com/engine/api/v1.40.yaml). The generated
models are committed to this repository, but packaged in a separate crate
[bollard-stubs](https://crates.io/crates/bollard-stubs).

### Version

Expand All @@ -47,8 +48,7 @@ Connect to the docker server according to your architecture and security remit.
#### Unix socket

The client will connect to the standard unix socket location `/var/run/docker.sock`. Use the
`Docker::connect_with_unix` method API to parameterise the
interface.
`Docker::connect_with_unix` method API to parameterise the interface.

```rust
use bollard::Docker;
Expand Down Expand Up @@ -112,33 +112,31 @@ Docker::connect_with_ssl_defaults();
### Examples

Note: all these examples need a [Tokio
Runtime](https://tokio.rs/docs/getting-started/runtime/). A small example about how to use
Tokio is further below.
Runtime](https://tokio.rs/).

#### Version

First, check that the API is working with your server:

```rust, no_run
```rust
use bollard::Docker;

use futures_util::future::FutureExt;

// Use a connection function described above
// let docker = Docker::connect_...;
## let docker = Docker::connect_with_local_defaults().unwrap();

async move {
let version = docker.version().await.unwrap();
println!("{:?}", version);
};
```rust
```

### Listing images
#### Listing images

To list docker images available on the Docker server:

```rust,no_run
```rust
use bollard::Docker;
use bollard::image::ListImagesOptions;

Expand Down Expand Up @@ -193,42 +191,13 @@ async move {

## Examples

Further examples are available in the examples folder, or the integration/unit tests.

### A Primer on the Tokio Runtime

In order to use the API effectively, you will need to be familiar with the [Tokio
Runtime](https://tokio.rs/docs/getting-started/runtime/).

Create a Tokio Runtime:

```rust
use tokio::runtime::Runtime;

let rt = Runtime::new().unwrap();
```

Subsequently, use the docker API:
Further examples are available in the [examples
folder](https://github.com/fussybeaver/bollard/tree/master/examples), or the [integration/unit
tests](https://github.com/fussybeaver/bollard/tree/master/tests).

```rust
// Use a connection function described above
// let docker = Docker::connect_...;
let future = async move {
&docker.list_images(None::<ListImagesOptions<String>>).await;
};
```

Execute the future aynchronously:
## Development

```rust
rt.spawn(future);
```

Or, to execute and receive the result:

```rust
let result = rt.block_on(future);
```
Contributions are welcome, please observe the following advice.

## Building the stubs

Expand Down
6 changes: 3 additions & 3 deletions codegen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>bollard</groupId>
<artifactId>bollard-codegen</artifactId>
<version>0.1.1-SNAPSHOT</version>
<version>0.1.2-SNAPSHOT</version>
<name>bollard</name>

<!-- build with: mvn clean compiler:compile generate-resources -->
Expand All @@ -27,7 +27,7 @@
<supportingFilesToGenerate>models.rs,lib.rs,Cargo.toml,config,README.md</supportingFilesToGenerate>
<configOptions>
<packageName>bollard-stubs</packageName>
<packageVersion>3</packageVersion>
<packageVersion>5</packageVersion>
</configOptions>
</configuration>
</execution>
Expand All @@ -36,7 +36,7 @@
<dependency>
<groupId>bollard</groupId>
<artifactId>bollard-codegen</artifactId>
<version>0.1.1-SNAPSHOT</version>
<version>0.1.2-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
Expand Down
2 changes: 2 additions & 0 deletions codegen/src/main/java/bollard/BollardCodegen.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
prop.name = prop.name.replace("i_pv6", "ipv6");
} else if (prop.name.contains("i_pv4")) {
prop.name = prop.name.replace("i_pv4", "ipv4");
} else if (prop.name.equals("_type")) {
prop.name = "typ";
}
if (prop.dataFormat != null && prop.dataFormat.equals("dateTime")) {
// set DateTime format on properties where appropriate
Expand Down
13 changes: 2 additions & 11 deletions codegen/src/main/resources/bollard/Cargo.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@ edition = "2018"

[dependencies]
chrono = { version = "0.4", features = ["serde"] }
lazy_static = "0.2"
log = "0.3.0"
percent-encoding = {version = "1.0.0", optional = true}
regex = {version = "0.2", optional = true}
serde = "1.0"
serde_derive = "1.0"
serde_ignored = {version = "0.0.4", optional = true}
serde_json = {version = "1.0", optional = true}
serde_urlencoded = {version = "0.5.1", optional = true}
serde = { version = "1.0", features = ["derive"] }

serde_with = "1.4"
url = {version = "1.5", optional = true}
uuid = {version = "0.5", optional = true, features = ["serde", "v4"]}
6 changes: 0 additions & 6 deletions codegen/src/main/resources/bollard/lib.mustache
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;

use std::io::Error;

Expand Down
1 change: 1 addition & 0 deletions codegen/src/main/resources/bollard/models.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![allow(unused_imports, unused_qualifications, unused_extern_crates)]

use serde::{Deserialize, Serialize};
use serde::ser::Serializer;
use serde::de::{DeserializeOwned, Deserializer};

Expand Down
15 changes: 3 additions & 12 deletions codegen/target/generated-sources/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
[package]
name = "bollard-stubs"
version = "1.40.3"
version = "1.40.5"
authors = [ "Bollard contributors" ]
description = "Stubs used for the Bollard rust async Docker client API"
license = "Apache-2.0"
edition = "2018"

[dependencies]
chrono = { version = "0.4", features = ["serde"] }
lazy_static = "1.0.0"
log = "0.4.0"
percent-encoding = {version = "2.0.0", optional = true}
regex = {version = "1.3.0", optional = true}
serde = "1.0"
serde_derive = "1.0"
serde_ignored = {version = "0.1.0", optional = true}
serde_json = {version = "1.0", optional = true}
serde_urlencoded = {version = "0.6.0", optional = true}
serde = { version = "1.0", features = ["derive"] }

serde_with = "1.4"
url = {version = "2.0.0", optional = true}
uuid = {version = "0.8.0", optional = true, features = ["serde", "v4"]}
6 changes: 3 additions & 3 deletions codegen/target/generated-sources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ To see how to make this your own, look here:

[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 1.40.3
- Code generation suffix: 3
- Build date: 2020-08-05T11:07:40.265+01:00
- API version: 1.40.5
- Code generation suffix: 5
- Build date: 2020-08-22T14:37:57.263+01:00

This autogenerated project defines an API crate `bollard-stubs` which contains:
* Data types representing the underlying data model.
Expand Down
6 changes: 0 additions & 6 deletions codegen/target/generated-sources/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;

use std::io::Error;

Expand Down
Loading

0 comments on commit a8b6f17

Please sign in to comment.