Samples
We will try to fill this page with good samples for cli usage moving forward.
Start and stop cloud broker
Simple script that starts a broker, extracts its url and api-key and then lists available signals on it and finally shuts it down.
Replace my-organisation and my-project with your own.
start-and-stop-cloud-broker.sh
#!/usr/bin/env bash
set -e
export REMOTIVE_CLOUD_ORGANISATION=my-organisation
export REMOTIVE_CLOUD_PROJECT=my-project
export BROKER_NAME=my-broker
# If you already logged on you can omit this
remotive cloud auth login
remotive cloud brokers create "$BROKER_NAME"
#
# Use jq can be used to extract fields from the result
#
broker_details=$(remotive cloud brokers describe $BROKER_NAME)
broker_name="$(echo "$broker_details" | jq --raw-output .name)"
broker_url="$(echo "$broker_details" | jq --raw-output .url)"
echo "$broker_url"
for key in $(echo "${broker_details}" | jq -r '.keys[]'); do
echo "Broker $broker_name has API-KEY: $key"
done
the_key=$(echo "$broker_details" | jq -r '.keys[0]')
echo "$the_key"
# List available signals
remotive broker signals signal-names --url "$broker_url" --api-key "$the_key" | jq .
# Stop broker
#echo "Stopping broker $broker_name"
remotive cloud brokers delete "$broker_name"
remotive broker discover
When a broker device, like RemotiveBox, is connected to your network with a LAN cable, the device is assigned a random IP address.
The command enables easy discovery of broker devices connected on your network.