A Rust client for EDC.
Install from crates.io
[dependencies]
edc-connector-client = "0.1"
Fetching an asset with id 1
and reading the description
property as string.
use edc_connector_client::{Auth, EdcConnectorClient};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = EdcConnectorClient::builder()
.management_url("http://myedc")
.with_auth(Auth::api_token("password"))
.build()?;
let asset = client.assets().get("1").await?;
println!("Got {:?}", asset);
println!(
"Property description: {:?}",
asset.property::<String>("description").unwrap()
);
Ok(())
}
git clone /~https://github.com/wolf4ood/edc-rs.git
cd edc-rs
cargo build
Some tests run against a running instance of EDC.
You can use docker compose to start an instance for testing.
docker compose -f testing/docker-compose.yml up -d
cargo test
The tests setup was mostly derived by the Typescript client edc-connector-client
Fetch a latest release here
or install with cargo
cargo install edc-connector-tui
The TUI client can either run with a single connector configured via cli args:
edc-connector-tui connector --url http://localhost:29193/management --token 123456
or if no args provided it will try to read connectors configuration from the file at ~/.config/edc-connector-tui/config.toml
The file should contain the list of configured connectors:
[[connectors]]
name="FirstConnector"
address="http://localhost:29193/management"
auth= { type = "token", token_alias = "connector_alias" }
[[connectors]]
name="SecondConnector"
address="http://myconnector.xyz/management"
The token_alias
is used to fetch the actual token from the system keyring for the service edc-connector-tui
.
For configuration above the token
could be set with secret-tool
on Linux:
secret-tool store --label="FirstConnector" service edc-connector-tui username connector_alias
Altough
edc-connector-tui
builds for OSX and Windows are available, it has been only tested on Linux. Contributions are welcome for multiplatform support/testing