Skip to content
/ cli Public

The command line tool for interacting with OpsLevel

License

Notifications You must be signed in to change notification settings

OpsLevel/cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4b9b087 · May 18, 2023
May 18, 2023
Oct 4, 2021
May 15, 2023
Oct 2, 2021
May 18, 2023
Oct 22, 2022
Oct 22, 2022
Apr 12, 2022
May 18, 2023
Jul 18, 2022
Aug 20, 2021
Sep 22, 2022
Jun 21, 2022

Repository files navigation

Overall

The CLI for interacting with OpsLevel

Prerequisite

  • jq
  • OpsLevel API Token
    • Generate token by clicking Create API Token and providing a description
    • Export the API Token for cli access:
      > export OPSLEVEL_API_TOKEN=<api_token>

Installation

MacOS

brew install opslevel/tap/cli

Docker

The docker container is hosted on AWS Public ECR

Quickstart

# 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
This tool is still in beta.

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:

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

echo "autoload -U compinit; compinit" >> ~/.zshrc

Troubleshooting

List all my tier 1 services

> 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"
  }
]