From 3f7f85a78327a1d7063ef80efa3734beff686fa0 Mon Sep 17 00:00:00 2001 From: Ryan Winter Date: Tue, 19 Nov 2024 15:17:50 -0800 Subject: [PATCH 1/2] state store cli (#109) rename folder, update some wording --------- Signed-off-by: GitHub --- .../generate-credentials.sh | 0 .../readme.md | 56 +++++++++---------- .../yaml/listener-open.yml | 0 .../yaml/listener-x509.yml | 0 4 files changed, 28 insertions(+), 28 deletions(-) rename tools/{state-store-cli => statestore-cli}/generate-credentials.sh (100%) rename tools/{state-store-cli => statestore-cli}/readme.md (79%) rename tools/{state-store-cli => statestore-cli}/yaml/listener-open.yml (100%) rename tools/{state-store-cli => statestore-cli}/yaml/listener-x509.yml (100%) diff --git a/tools/state-store-cli/generate-credentials.sh b/tools/statestore-cli/generate-credentials.sh similarity index 100% rename from tools/state-store-cli/generate-credentials.sh rename to tools/statestore-cli/generate-credentials.sh diff --git a/tools/state-store-cli/readme.md b/tools/statestore-cli/readme.md similarity index 79% rename from tools/state-store-cli/readme.md rename to tools/statestore-cli/readme.md index 18a07ce..1245b89 100644 --- a/tools/state-store-cli/readme.md +++ b/tools/statestore-cli/readme.md @@ -14,16 +14,16 @@ Supported platforms: On the machine where the tool will be run, the following are required: -1. [Install kubectl](https://kubernetes.io/docs/tasks/tools/) which will be used to configure the MQTT Broker +1. [Install kubectl](https://kubernetes.io/docs/tasks/tools/) which is used to configure the MQTT broker 1. Clone the `explore-iot-operations` repository, and enter the state store cli directory: ```shell git clone https://github.com/Azure-Samples/explore-iot-operations - cd explore-iot-operations/tools/state-store-cli + cd explore-iot-operations/tools/statestore-cli ``` -1. Download the state store CLI from the [latest GitHub release](https://github.com/Azure-Samples/explore-iot-operations/releases?q=state-store-cli) and save it in the `state-store-cli` directory +1. Download the state store CLI from the [latest GitHub release](https://github.com/Azure-Samples/explore-iot-operations/releases?q=statestore-cli) and save it in the `statestore-cli` directory 1. **OPTIONAL**: If MQTT broker authentication is required, [install step](https://smallstep.com/docs/step-cli/installation/) to generate the required certificates @@ -68,21 +68,21 @@ If security is a requirement, then you will need to expose the MQTT broker using ``` > [!NOTE] -> The `certs` directory will contain the following files which will be used by the state store cli tool for authenticating with the MQTT broker: +> The `certs` directory will contain the following files which will be used by the state store CLI tool for authenticating with the MQTT broker: > -> * `broker-ca.crt` : The MQTT broker server certificate -> * `client.crt` : The device certificate for authentication with MQTT broker -> * `client.key` : The device private key for authentication with MQTT broker +> * `broker-ca.crt` : The MQTT broker server certificate +> * `client.crt` : The device certificate for authentication with MQTT broker +> * `client.key` : The device private key for authentication with MQTT broker ## Usage -For accessing help directly from the console just type `statestore --help`. +For accessing help directly from the console just type `statestore-cli --help`. ```shell -$ ./statestore --help -Allows managing key/value pairs in the MQ State Store. +$ ./statestore-cli --help +Allows managing key/value pairs in the state store. -Usage: statestore [OPTIONS] +Usage: statestore-cli [OPTIONS] Commands: get Gets the value of an existing key @@ -92,17 +92,17 @@ Commands: Options: -n, --hostname - MQ broker hostname + MQTT broker hostname [default: localhost] -p, --port - MQ broker port number + MQTT broker port number [default: 8883] --notls - Do not use TLS for connection with MQ broker + Do not use TLS for connection with MQTT broker -T, --cafile Trusted certificate bundle for TLS connection @@ -126,13 +126,13 @@ Options: Print version ``` -Help specific to each command can be printed through calling `statestore --help`. +Help specific to each command can be printed through calling `statestore-cli --help`. ```shell -$ ./statestore get --help +$ ./statestore-cli get --help Gets the value of an existing key -Usage: statestore get [OPTIONS] --key +Usage: statestore-cli get [OPTIONS] --key Options: -k, --key @@ -140,11 +140,11 @@ Options: -f, --valuefile File where to write the key value. If not provided, the value is written to stdout -n, --hostname - MQ broker hostname [default: localhost] + MQTT broker hostname [default: localhost] -p, --port - MQ broker port number [default: 8883] + MQTT broker port number [default: 8883] --notls - Do not use TLS for connection with MQ broker + Do not use TLS for connection with MQTT broker -T, --cafile Trusted certificate bundle for TLS connection -C, --certfile @@ -164,15 +164,15 @@ Options: For the examples below, assume: - The MQTT broker is named `mybroker.net`, on port `8883` or `1883` -- The MQTT brokers trusted CA certificate bundle is available locally as saved locally at `./certs/broker-ca.crt` -- Client certificates are set in the AIO MQ Broker, and saved locally at `./certs/client.crt` and `./certs/client.key`. +- The MQTT broker trust bundle is available locally at `./certs/broker-ca.crt` +- Client certificates are saved locally at `./certs/client.crt` and `./certs/client.key` ### X.509 authentication with TLS To retrieve an existing key: ```shell -./statestore get -n "mybroker.net" -k "keyName1" -f "./keyValue1.txt" -T "./certs/broker-ca.crt" -C "./certs/client.crt" -K "./certs/client.key" +./statestore-cli get -n "mybroker.net" -k "keyName1" -f "./keyValue1.txt" -T "./certs/broker-ca.crt" -C "./certs/client.crt" -K "./certs/client.key" ``` ||| @@ -184,7 +184,7 @@ To retrieve an existing key: To set the value of a key: ```shell -./statestore set -n "mybroker.net" -k "keyName1" --value "keyValue1" -T "./certs/broker-ca.crt" -C "./certs/client.crt" -K "./certs/client.key" +./statestore-cli set -n "mybroker.net" -k "keyName1" --value "keyValue1" -T "./certs/broker-ca.crt" -C "./certs/client.crt" -K "./certs/client.key" ``` ||| @@ -196,7 +196,7 @@ To set the value of a key: To delete an existing key: ```shell -./statestore delete -n "mybroker.net" -k "keyName1" -T "./certs/broker-ca.crt" -C "./certs/client.crt" -K "./certs/client.key" +./statestore-cli delete -n "mybroker.net" -k "keyName1" -T "./certs/broker-ca.crt" -C "./certs/client.crt" -K "./certs/client.key" ``` ||| @@ -213,7 +213,7 @@ To delete an existing key: To retrieve an existing key: ```shell -./statestore get -n "mybroker.net" -k "keyName1" -f "./keyValue1.txt" --notls +./statestore-cli get -n "mybroker.net" -k "keyName1" -f "./keyValue1.txt" --notls ``` ||| @@ -225,7 +225,7 @@ To retrieve an existing key: To set the value of a key: ```shell -./statestore set -n "mybroker.net" -k "keyName1" --value "keyValue1" --notls +./statestore-cli set -n "mybroker.net" -k "keyName1" --value "keyValue1" --notls ``` ||| @@ -237,7 +237,7 @@ To set the value of a key: To delete an existing key: ```shell -./statestore delete -n "mybroker.net" -k "keyName1" --notls +./-cli delete -n "mybroker.net" -k "keyName1" --notls ``` ||| diff --git a/tools/state-store-cli/yaml/listener-open.yml b/tools/statestore-cli/yaml/listener-open.yml similarity index 100% rename from tools/state-store-cli/yaml/listener-open.yml rename to tools/statestore-cli/yaml/listener-open.yml diff --git a/tools/state-store-cli/yaml/listener-x509.yml b/tools/statestore-cli/yaml/listener-x509.yml similarity index 100% rename from tools/state-store-cli/yaml/listener-x509.yml rename to tools/statestore-cli/yaml/listener-x509.yml From 070ec28aac167b7213e9adbc5619742f43b7fbf2 Mon Sep 17 00:00:00 2001 From: Ewerton Scaboro da Silva Date: Tue, 19 Nov 2024 16:05:35 -0800 Subject: [PATCH 2/2] Fix a couple of types in statestore-cli/readme.md --- tools/statestore-cli/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/statestore-cli/readme.md b/tools/statestore-cli/readme.md index 1245b89..7ba02be 100644 --- a/tools/statestore-cli/readme.md +++ b/tools/statestore-cli/readme.md @@ -122,7 +122,7 @@ Options: -h, --help Print help (see a summary with '-h') - -V, --version + --version Print version ``` @@ -237,7 +237,7 @@ To set the value of a key: To delete an existing key: ```shell -./-cli delete -n "mybroker.net" -k "keyName1" --notls +./statestore-cli delete -n "mybroker.net" -k "keyName1" --notls ``` |||