Crates.io | service-bindings |
lib.rs | service-bindings |
version | 1.0.0 |
source | src |
created_at | 2021-08-28 01:57:34.719884 |
updated_at | 2021-08-28 01:57:34.719884 |
description | A library to access [Service Binding Specification for Kubernetes](https://k8s-service-bindings.github.io/spec/) conformant Service Binding [Workload Projections](https://k8s-service-bindings.github.io/spec/#workload-projection) |
homepage | https://github.com/nebhale/client-rust |
repository | https://github.com/nebhale/client-rust |
max_upload_size | |
id | 443308 |
size | 45,660 |
client-rust
is a library to access Service Binding Specification for Kubernetes conformant Service Binding Workload Projections.
use postgres::{Client, NoTls};
use service_bindings::binding::Binding;
use service_bindings::bindings;
fn main() {
let b = bindings::from_service_binding_root();
let c = bindings::filter(b, "postgresql");
if c.len() != 1 {
panic!("Incorrect number of PostgreSQL bindings: {}", c.len())
}
let u = c[0].get("url");
let conn = match u {
None => panic!("No URL in binding"),
Some(u) => Client::connect(u, NoTls),
};
// ...
}
Apache License v2.0: see LICENSE for details.