summaryrefslogtreecommitdiffstats
path: root/examples/services.rs
diff options
context:
space:
mode:
authorWojciech Kępka <46892771+wojciechkepka@users.noreply.github.com>2021-02-09 01:22:26 +0100
committerGitHub <noreply@github.com>2021-02-08 19:22:26 -0500
commit5af822c5691a772cad36bd9a69e94419b03d4511 (patch)
tree761ebc2ac10608a8772d8f7085596ee2ee838b37 /examples/services.rs
parent4e3f69c34a177697af940849fced1a284fc09449 (diff)
Add services api (#263)
* Add initial Services models * Add initial Services controllers * Add ServicesListOptions * Rename ServicesList -> ServiceList * Fix some optional fields on ServiceRep * Add Service::inspect * Add Service::delete * Add Service::logs * Rename example logs -> containerlogs * Add ServiceOptions, ServiceCreateInfo, fix typo * Add a way to pass headers to request, add Payload and Headers for easier types * Add Service::create * Add examples * Fix fmt * Fix example
Diffstat (limited to 'examples/services.rs')
-rw-r--r--examples/services.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/services.rs b/examples/services.rs
new file mode 100644
index 0000000..713c5f8
--- /dev/null
+++ b/examples/services.rs
@@ -0,0 +1,19 @@
+use shiplift::{Docker, ServiceListOptions};
+
+#[tokio::main]
+async fn main() {
+ env_logger::init();
+ let docker = Docker::new();
+ match docker
+ .services()
+ .list(&ServiceListOptions::builder().enable_status().build())
+ .await
+ {
+ Ok(services) => {
+ for s in services {
+ println!("service -> {:#?}", s)
+ }
+ }
+ Err(e) => eprintln!("Error: {}", e),
+ }
+}