User Session

Login

The BOMnipotent Client offers several global optional arguments. To avoid having to provide these time and time again, you can use the login command to store them in a user session. This will create a file in the local user folder which stores the provided parameters:

Input (long variant)
bomnipotent_client --domain=bomnipotent_server_of_your_choice --user=user@example.com --output-mode=normal --secret-key=/home/some_secret_key.pem session login
Input (short variant)
bomnipotent_client -d bomnipotent_server_of_your_choice -u user@example.com -o normal -s /home/some_secret_key.pem session login
Output
[INFO] Storing session data in /root/.config/bomnipotent/session.toml

Whenever you call the BOMnipotent Client from now on, it will use these parameters automatically.

Any relative filepaths you provide will be resolved to absolute paths before storing them. This way, the session data can be used from anywhere on your computer.

Overriding and Overwriting

If you are logged in and provide any of the global optional parameters to a BOMnipotent Client call, it will use these instead:

Input (long variant)
bomnipotent_client --domain=bomnipotent.wwh-soft.com health # Will contact the other server
Input (short variant)
bomnipotent_client -d bomnipotent.wwh-soft.com health # Will contact the other server
Output
[INFO] Service is healthy

To permanently change the data stored in the session, simply login again with the new parameters.

This can also be used to remove parameters, simply by not providing them:

Input (long variant)
bomnipotent_client --domain=some_other_bomnipotent_server --user=other_user@example.com session login # Will set secret-key and other non-specified options to none.
Input (short variant)
bomnipotent_client -d some_other_bomnipotent_server -u other_user@example.com session login # Will set secret-key and other non-specified options to none.
Output
[INFO] Storing session data in /root/.config/bomnipotent/session.toml

Status

To print the current parameters of your session, call “session status”. The output is in TOML format (which is also how it is stored on your filesystem):

Input
bomnipotent_client session status
Output
domain = "bomnipotent_server_of_your_choice"
user = "user@example.com"
output_mode = "Normal"
secret_key_path = "/home/some_secret_key.pem"

If you prefer JSON, merely append the “–json” option:

Input (long variant)
bomnipotent_client session status --json
Input (short variant)
bomnipotent_client session status -j
Output
{
  "domain": "bomnipotent_server_of_your_choice",
  "user": "user@example.com",
  "output_mode": "Normal",
  "secret_key_path": "/home/some_secret_key.pem"
}

If you are not logged in, you get an informational log and an empty TOML/JSON output:

Input
bomnipotent_client session status
Output
[INFO] No session data is currently stored
Input (long variant)
bomnipotent_client session status --json
Input (short variant)
bomnipotent_client session status -j
Output
[INFO] No session data is currently stored
{}

If you would like to use this command to programatically check if session data exists, you can for example use the “raw” output mode to avoid the info trace, and check if the return value is empty:

#!/bin/bash

output=$(bomnipotent_client --output-mode raw session status)
if [ -n "$output" ]; then
    echo "Found session data:"
    echo "$output"
else
    echo "Session not logged in."
fi
$output = bomnipotent_client --output-mode raw session status
if ($output) {
    Write-Output "Found session data:"
    Write-Output $output
} else {
    Write-Output "Session not logged in."
}

Logout

To remove all parameters, call logout:

Input
bomnipotent_client session logout

This will remove the session file.