An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          



License


Go Report Card


Release


Stability: Experimental


Contributors


Activity


Downloads

[![Overall](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fapp.opslevel.com%2Fapi%2Fservice_level%2FEaWapOq9VQj5FvymQEgCPNJcbF-TOibHn89Arw7d_OY)](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"
}
]
```