remove hello-lambda example script
This commit is contained in:
parent
514d85628f
commit
5c558120ba
20
README.md
20
README.md
|
@ -125,26 +125,6 @@ or using the CLI:
|
|||
|
||||
curl -X GET http://<docker-host>:10001/api/swagger.json | python -mjson.tool
|
||||
|
||||
### Examining the API
|
||||
|
||||
In [examples](examples/) folder you can find a script that examines available API endpoints.
|
||||
|
||||
Note that this script depends on the following env vars:
|
||||
|
||||
* `PICASSO_API_URL` - Picasso API endpoint
|
||||
* `OS_AUTH_URL` - OpenStack Auth URL
|
||||
* `OS_PROJECT_ID` - it can be found in OpenStack Dashboard or in CLI
|
||||
* `OS_USERNAME` - OpenStack project-aligned username
|
||||
* `OS_PASSWORD` - OpenStack project-aligned user password
|
||||
* `OS_DOMAIN` - OpenStack project domain name
|
||||
* `OS_PROJECT_NAME` - OpenStack project name
|
||||
|
||||
To run the script:
|
||||
|
||||
OS_AUTH_URL=http://192.168.0.112:5000/v3 OS_PROJECT_ID=8fb76785313a4500ac5367eb44a31677 OS_USERNAME=admin OS_PASSWORD=root OS_DOMAIN=default OS_PROJECT_NAME=admin ./examples/hello-lambda.sh
|
||||
|
||||
Please note that values provided are project-specific, so they can't be reused.
|
||||
|
||||
### API docs
|
||||
|
||||
API docs are discoverable via Swagger. Just launch the Picasso API and browse to:
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set +x
|
||||
set +e
|
||||
|
||||
export LAOS_API_URL=${LAOS_API_URL:-http://localhost:10001}
|
||||
|
||||
export OS_AUTH_URL=${OS_AUTH_URL:-http://localhost:5000/v3}
|
||||
export OS_USERNAME=${OS_USERNAME:-admin}
|
||||
export OS_PASSOWRD=${OS_PASSWORD:-root}
|
||||
export OS_DOMAIN=${OS_DOMAIN:-default}
|
||||
export OS_PROJECT_ID=${OS_PROJECT_ID:-"dummy_project_id"}
|
||||
|
||||
|
||||
rm -fr examples/token_request.json
|
||||
echo -e "{
|
||||
\"auth\": {
|
||||
\"identity\": {
|
||||
\"methods\": [\"password\"],
|
||||
\"password\": {
|
||||
\"user\": {
|
||||
\"name\": \"${OS_USERNAME:-admin}\",
|
||||
\"domain\": { \"id\": \"${OS_DOMAIN:-default}\" },
|
||||
\"password\": \"${OS_PASSWORD:-root}\"
|
||||
}
|
||||
}
|
||||
},
|
||||
\"scope\": {
|
||||
\"project\": {
|
||||
\"name\": \"${OS_PROJECT_NAME:-admin}\",
|
||||
\"domain\": {\"id\": \"${OS_DOMAIN:-default}\" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}" >> examples/token_request.json
|
||||
|
||||
|
||||
export OS_TOKEN=`curl -si -d @examples/token_request.json -H "Content-type: application/json" ${OS_AUTH_URL}/auth/tokens | awk '/X-Subject-Token/ {print $2}'`
|
||||
|
||||
echo -e "Listing apps\n"
|
||||
curl ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Creating app\n"
|
||||
curl -X POST -d '{"app":{"name": "testapp"}}' ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Listing apps\n"
|
||||
curl ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Showing app info\n"
|
||||
export raw_app_info=`curl localhost:10001/v1/${OS_PROJECT_ID}/apps -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool | grep name | awk '{print $2}'`
|
||||
export app_name=${raw_app_info:1:30}
|
||||
curl ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps/${app_name} -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Listing app routes\n"
|
||||
curl ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps/${app_name}/routes -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Creating app sync private route\n"
|
||||
curl -X POST -d '{"route":{"type": "sync", "path": "/hello-sync-private", "image": "iron/hello", "is_public": "false" }}' ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps/${APP_NAME}/routes -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Creating app sync public route\n"
|
||||
curl -X POST -d '{"route":{"type": "sync", "path": "/hello-sync-public", "image": "iron/hello", "is_public": "true" }}' ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps/${APP_NAME}/routes -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Listing app routes\n"
|
||||
curl ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps/${app_name}/routes -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Show app private route\n"
|
||||
curl ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps/${app_name}/routes/hello-sync-private -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Show app public route\n"
|
||||
curl ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps/${app_name}/routes/hello-sync-public -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Running app sync private route\n"
|
||||
curl -X POST -d '{"name": "Johnny"}' ${LAOS_API_URL}/v1/r/${OS_PROJECT_ID}/${app_name}/hello-sync-private -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Running app sync public route\n"
|
||||
curl -X POST -d '{"name": "Johnny"}' ${LAOS_API_URL}/r/${app_name}/hello-sync-public -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Creating app async route\n"
|
||||
curl -X POST -d '{"route":{"type": "async", "path": "/hello-async-private", "image": "iron/hello", "is_public": "false"}}' ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps/${app_name}/routes -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Running app async route\n"
|
||||
curl -X POST -d '{"name": "Johnny"}' ${LAOS_API_URL}/v1/r/${OS_PROJECT_ID}/${app_name}/hello-async-private -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Deleting app route\n"
|
||||
curl -X DELETE ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps/${app_name}/routes/hello-sync-public -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
curl -X DELETE ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps/${app_name}/routes/hello-sync-private -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
curl -X DELETE ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps/${app_name}/routes/hello-async-private -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Listing app routes\n"
|
||||
curl ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps/${app_name}/routes -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Deleting app\n"
|
||||
curl -X DELETE ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps/${app_name} -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
||||
|
||||
echo -e "Listing apps\n"
|
||||
curl ${LAOS_API_URL}/v1/${OS_PROJECT_ID}/apps -H "X-Auth-Token:${OS_TOKEN}" -H "Content-Type: application/json" | python3 -mjson.tool
|
Loading…
Reference in New Issue