Skip to content

max-bytes/omnikeeper-client-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

omnikeeper CLI GraphQL client

Small CLI application for interacting with an omnikeeper instance via GraphQL queries and mutations. Can be used to automate the configuration of an omnikeeper instance.

Requirements

Installation

wget https://github.com/max-bytes/omnikeeper-client-cli/releases/latest/download/okql.rpm
# either:
sudo rpm -i okql.rpm
# or:
sudo yum localinstall okql.rpm
# or:
sudo alien -i okql.rpm

Notes

In terms of authentication, only the oauth flow "Resource Owner Password Credentials Grant" is supported. Other modes, such as the "Device Authorization Flow" are not (yet) supported. That means it is necessary to supply username+password of the user to authenticate.

Docker image

For certain usecases like CICD pipelines, a docker image is provided that contains a runnable okql binary.

docker run ghcr.io/max-bytes/omnikeeper-client-cli:0.5.2 okql ...

Examples

Note: to run from source instead, replace okql with go run cmd/main.go

Login (password via prompt):

okql -o https://10.0.0.43:45455 -u username

Login (password via parameter):

okql -o https://10.0.0.43:45455 -u username -p password

Run query from parameter:

okql -o https://10.0.0.43:45455 -q "query { activeTraits { id } }"

Run query from stdin:

cat <<'EOF' | okql -o https://10.0.0.43:45455 --stdin
query {
  activeTraits {
    id
  }
}
EOF

Run query from file:

okql -o https://10.0.0.43:45455 --stdin < file.graphql

Only fetch token:

okql -o https://10.0.0.43:45455 -u username -p password -k -i