From 3d15cca7d6eaba33cccb7392c470c0f7180e8f58 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 16 Aug 2019 09:49:22 +0200 Subject: [PATCH] api-test: add a short example shell script for now Signed-off-by: Wolfgang Bumiller --- api-test/example.sh | 22 ++++++++++++++++++++++ api-test/src/bin/api-test.rs | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 api-test/example.sh diff --git a/api-test/example.sh b/api-test/example.sh new file mode 100644 index 00000000..8cea72df --- /dev/null +++ b/api-test/example.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# Example api-test client commands: +echo "Calling /api/1/greet:" +curl -XGET -H 'Content-type: application/json' \ + -d '{"person":"foo","message":"a message"}' \ + 'http://127.0.0.1:3000/api/1/greet' +echo + +echo "Calling /api/1/mount/rootfs" +# without the optional 'ro' field +curl -XPOST -H 'Content-type: application/json' \ + -d '{"entry":{"mount_type":"volume","source":"/source","destination":"/destination"}}' \ + 'http://127.0.0.1:3000/api/1/mount/rootfs' +echo + +echo "Calling /api/1/mount/rootfs again" +# with the optional 'ro' field +curl -XPOST -H 'Content-type: application/json' \ + -d '{"entry":{"mount_type":"volume","source":"/source","destination":"/destination","ro":true}}' \ + 'http://127.0.0.1:3000/api/1/mount/rootfs' +echo diff --git a/api-test/src/bin/api-test.rs b/api-test/src/bin/api-test.rs index 6251f1e5..214bc6e7 100644 --- a/api-test/src/bin/api-test.rs +++ b/api-test/src/bin/api-test.rs @@ -169,10 +169,10 @@ async fn greet_person_with( entry: "The mount point configuration to replace the entry with", }, })] -async fn update_mount_point(id: String, entry: MountEntry) -> Result<(), Error> { +async fn update_mount_point(id: String, entry: MountEntry) -> Result { eprintln!("Got request to update mount point '{}'", id); eprintln!("New configuration: {:?}", entry); - Ok(()) + Ok(format!("Updating '{}' with: {:?}", id, entry)) } //