Skip to content

Commit

Permalink
v0.10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
blazzy committed Jul 23, 2024
1 parent 5ffae2c commit 869e791
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 34 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
members = [".", "podman-autogen-api"]

[workspace.package]
version = "0.10.0"
version = "0.10.1"
license = "MIT OR Apache-2.0"
edition = "2021"
repository = "https://github.com/blazzy/podman-rest-client"
Expand All @@ -27,7 +27,7 @@ http = "1.1.0"
hyper = { workspace = true }
hyper-util = { version = "0.1.5", features = ["client-legacy", "http1"] }
nix = { version = "0.29.0", features = ["user"] }
podman-autogen-api = { version = "=0.7.0", path="podman-autogen-api" }
podman-autogen-api = { version = "=0.8.0", path="podman-autogen-api" }
russh = "0.43.0"
russh-keys = "0.43.0"
serde = { version = "1.0.203", features = ["derive"] }
Expand Down
49 changes: 31 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,67 +14,80 @@ ssh are commonly necessary on macOs where the container runtime runs in a virtu
accessible over ssh.


### API Compatibility
## API Compatibility

This crate currently only works with version 5 of the podman API. There are suffucient
differences between version 3, 4, and 5 that a lot of calls will not work in an older version.
`podman --version` will reveal what version you are using.

### Podman Socket
## Podman Socket

Note that podman does not run in a client/server model like docker does so there usually isn't
a socket you can connect to by default. You would need to enable the socket for the library to
a socket you can connect to by default. You might need to enable the socket for the library to
connect to. For example on linux you might need to run something like this:

```sh
systemctl --user enable --now podman.socket
```

### Usage
## Usage

### Linux

On linux you might initialize a client like this

```rust
use podman_rest_client::PodmanRestClient;
use podman_rest_client::Config;

let ssh_client = PodmanRestClient::new(Config {
uri: "ssh://core@127.0.0.1:63169/run/user/501/podman/podman.sock".to_string(),
identity_file: Some("/path/to/identity_file".into()),
}).await.unwrap();

let unix_client = PodmanRestClient::new(Config {
// Initialize a client
let client = PodmanRestClient::new(Config {
uri: "unix:///run/user/501/podman/podman.sock".to_string(),
identity_file: None,
}).await.unwrap();

// Fetch a list of container images
let images = client.images_api().image_list_libpod(None,None).await.unwrap();
```
### MacOs

On macOs you might initialize a client like this with an ssh url and identity file

```rust
let client = PodmanRestClient::new(Config {
uri: "ssh://core@127.0.0.1:63169/run/user/501/podman/podman.sock".to_string(),
identity_file: Some("/path/to/identity_file".into()),
}).await.unwrap();
```

### Config::guess

You can also use `Config::guess()` which tries to find the default path to the podman
socket depending on the platform you are on.

```rust
use podman_rest_client::PodmanRestClient;
use podman_rest_client::Config;

// Setup the default configuration
let config = Config::guess().await.unwrap();

// Initialize a client
let client = PodmanRestClient::new(config).await.unwrap();

// Fetch a list of container images
let images = client.images_api().image_list_libpod(None,None).await.unwrap();
```

<!-- cargo-rdme end -->

## Changelog

### v0.10.1

* Fix issue creating containers with mounted volumes [#12](https://github.com/blazzy/podman-rest-client/pull/12)

### v0.10.0

* Parse error bodies whe encountering API errors https://github.com/blazzy/podman-rest-client/pull/11
* Parse error bodies whe encountering API errors [#11](https://github.com/blazzy/podman-rest-client/pull/11)

### v0.9.1

* Fix for Config::guess on Linux https://github.com/blazzy/podman-rest-client/pull/7
* Fix for Config::guess on Linux [#7](https://github.com/blazzy/podman-rest-client/pull/7)

### v0.9.0

Expand Down
2 changes: 1 addition & 1 deletion podman-autogen-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "podman-autogen-api"
description = "Podman REST API client generated from the official swagger file using openapi-generator"
readme = "README.md"
version = "0.7.0"
version = "0.8.0"
license.workspace = true
edition.workspace = true
repository.workspace = true
Expand Down
40 changes: 27 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//! ## Podman Socket
//!
//! Note that podman does not run in a client/server model like docker does so there usually isn't
//! a socket you can connect to by default. You would need to enable the socket for the library to
//! a socket you can connect to by default. You might need to enable the socket for the library to
//! connect to. For example on linux you might need to run something like this:
//!
//! ```sh
Expand All @@ -23,39 +23,53 @@
//!
//! ## Usage
//!
//! ### Linux
//!
//! On linux you might initialize a client like this
//!
//! ```no_run
//! # tokio_test::block_on(async {
//! use podman_rest_client::PodmanRestClient;
//! use podman_rest_client::Config;
//!
//! let ssh_client = PodmanRestClient::new(Config {
//! uri: "ssh://core@127.0.0.1:63169/run/user/501/podman/podman.sock".to_string(),
//! identity_file: Some("/path/to/identity_file".into()),
//! }).await.unwrap();
//!
//! let unix_client = PodmanRestClient::new(Config {
//! // Initialize a client
//! let client = PodmanRestClient::new(Config {
//! uri: "unix:///run/user/501/podman/podman.sock".to_string(),
//! identity_file: None,
//! }).await.unwrap();
//!
//! // Fetch a list of container images
//! let images = client.images_api().image_list_libpod(None,None).await.unwrap();
//! # })
//! ```
//! ### MacOs
//!
//! On macOs you might initialize a client like this with an ssh url and identity file
//!
//! ```no_run
//! # tokio_test::block_on(async {
//! # use podman_rest_client::PodmanRestClient;
//! # use podman_rest_client::Config;
//! let client = PodmanRestClient::new(Config {
//! uri: "ssh://core@127.0.0.1:63169/run/user/501/podman/podman.sock".to_string(),
//! identity_file: Some("/path/to/identity_file".into()),
//! }).await.unwrap();
//! ```
//!
//! ### Config::guess
//!
//! You can also use `Config::guess()` which tries to find the default path to the podman
//! socket depending on the platform you are on.
//!
//! ```no_run
//! # tokio_test::block_on(async {
//! use podman_rest_client::PodmanRestClient;
//! use podman_rest_client::Config;
//!
//! # use podman_rest_client::PodmanRestClient;
//! # use podman_rest_client::Config;
//! // Setup the default configuration
//! let config = Config::guess().await.unwrap();
//!
//! // Initialize a client
//! let client = PodmanRestClient::new(config).await.unwrap();
//!
//! // Fetch a list of container images
//! let images = client.images_api().image_list_libpod(None,None).await.unwrap();
//! # })
//! ```

Expand Down

0 comments on commit 869e791

Please sign in to comment.