https://github.com/opslevel/cli
The command line tool for interacting with OpsLevel
https://github.com/opslevel/cli
cli go golang
Last synced: 9 months ago
JSON representation
The command line tool for interacting with OpsLevel
- Host: GitHub
- URL: https://github.com/opslevel/cli
- Owner: OpsLevel
- License: mit
- Created: 2021-06-19T18:27:59.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-04-14T17:07:58.000Z (about 1 year ago)
- Last Synced: 2025-04-14T18:24:31.187Z (about 1 year ago)
- Topics: cli, go, golang
- Language: Go
- Homepage: https://opslevel.com
- Size: 15.3 MB
- Stars: 6
- Watchers: 11
- Forks: 3
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://app.opslevel.com/services/opslevel_cli/maturity-report)
# The CLI for interacting with [OpsLevel](https://www.opslevel.com/)
### Prerequisite
- [jq version 1.7](https://stedolan.github.io/jq/download/)
- [OpsLevel API Token](https://app.opslevel.com/api_tokens)
- Generate token by clicking `Create API Token` and providing a description
- Export the API Token for cli access:
```sh
> export OPSLEVEL_API_TOKEN=
```
### Installation
#### MacOS
```sh
brew install opslevel/tap/cli
```
#### Curl Download
```sh
# Note: you can also run without `sudo` and move the binary yourself
curl -sLS https://raw.githubusercontent.com/OpsLevel/cli/main/install.sh | sudo sh
```
#### Docker
The docker container is hosted on [AWS Public ECR](https://gallery.ecr.aws/opslevel/cli)
### Quickstart
```sh
# Create
> opslevel create category Chaos
Z2lkOi8vb3BzbGV2ZWwvQ2F0ZWdvcnkvOTY8
# Get
> opslevel get category Z2lkOi8vb3BzbGV2ZWwvQ2F0ZWdvcnkvOTY8
{
"id": "Z2lkOi8vb3BzbGV2ZWwvQ2F0ZWdvcnkvOTY8",
"Name": "Chaos"
}
# List
> opslevel list category
NAME ID
Performance Z2lkOi8vb3BzbGV2ZWwvQ2F0ZWdvcnkvOTY1
Infrastructure Z2lkOi8vb3BzbGV2ZWwvQ2F0ZWdvcnkvOTY2
Observability Z2lkOi8vb3BzbGV2ZWwvQ2F0ZWdvcnkvOTY3
Reliability Z2lkOi8vb3BzbGV2ZWwvQ2F0ZWdvcnkvOTY4
Scalability Z2lkOi8vb3BzbGV2ZWwvQ2F0ZWdvcnkvOTY5
Security Z2lkOi8vb3BzbGV2ZWwvQ2F0ZWdvcnkvOTY6
Quality Z2lkOi8vb3BzbGV2ZWwvQ2F0ZWdvcnkvOTY7
Chaos Z2lkOi8vb3BzbGV2ZWwvQ2F0ZWdvcnkvOTY8
# Delete
> opslevel delete category Z2lkOi8vb3BzbGV2ZWwvQ2F0ZWdvcnkvOTY8
```
### Enable shell autocompletion
We have the ability to generate autocompletion scripts for the shell's `bash`, `zsh`, `fish` and `powershell`. To generate
the completion script for macOS zsh:
```sh
opslevel completion zsh > /usr/local/share/zsh/site-functions/_opslevel
```
Make sure you have `zsh` completion turned on by having the following as one of the first few lines in your `.zshrc` file
```sh
echo "autoload -U compinit; compinit" >> ~/.zshrc
```
## Troubleshooting
### List all my tier 1 services
```sh
> opslevel list services -o json | jq '[.[] | if .tier.Alias == "tier_1" then {(.name) : (.tier.Alias)} else empty end]'
[
{
"Catalog Service": "tier_1"
},
{
"Shopping Cart Service": "tier_1"
},
{
"Website Aggregator": "tier_1"
}
]
```