๐ Links
- ๐ Documentation: Variable usage
- ๐งช Nightly builds: Latest AppImage
- ๐ค Discussions & Feedback: Discord
๐ Table of Contents
๐งญ Overview
oapi-cli is a command-line interface for interacting with OUTSCALE APIs. It supports advanced argument syntax, response chaining, JSON file inputs, and a built-in variable system to streamline complex workflows.
The CLI is fully self-contained, with prebuilt packages for Linux (AppImage), macOS (Homebrew), and Windows (zip archive).
โ Requirements
- Outscale API access (AK/SK or login/password)
- Config file or environment variables for authentication
- AppImage support (Linux only, see notes if FUSE is not installed)
๐ป Installation
macOS
brew tap outscale/tap brew install outscale/tap/oapi-cli
Or manually:
git clone https://github.com/outscale/homebrew-tap
cd homebrew-tap
brew install Formula/oapi-cli.rbLinux
Download the AppImage from the nightly build.
chmod a+x ./oapi-cli-x86_64.AppImage ./oapi-cli-x86_64.AppImage
Optional installation:
sudo mv oapi-cli-x86_64.AppImage /usr/local/bin/oapi-cli
Note: If you see FUSE-related errors, use:
./oapi-cli-x86_64.AppImage --appimage-extract-and-run ReadImages
Windows
Download oapi-cli-x86_64-windows.zip from Releases.
Extract and run oapi-cli.exe.
โ ๏ธ Config is read from
.\config.jsonin the current directory.
๐ Usage
๐งพ Command Syntax
oapi-cli <Operation> [OPTIONS]
Get general help:
Get help for a specific operation:
oapi-cli --help DeleteTags
Examples
Complex arguments
oapi-cli DeleteTags --ResourceIds '["ID0", "ID1"]' --Tags '[{"Key": "k0", "Value": "v0"}, {"Key": "k1", "Value": "v1"}]'
Alternative syntax:
oapi-cli --color DeleteTags \ --ResourceIds[] "ID0" --ResourceIds[] "ID1" \ --Tags.0.Key k0 --Tags.0.Value v0 \ --Tags.1.Key k1 --Tags.1.Value v1
Zsh workaround (for brackets):
oapi-cli --color DeleteTags '--ResourceIds[]' "ID0" '--ResourceIds[]' "ID1" ...
Verbose mode:
oapi-cli --verbose ReadVms
Use --file to pass argument from a file:
echo -n false > false.txt oapi-cli ReadVms --DryRun --file false.txt
CreatePolicy with JSON string
oapi-cli CreatePolicy --PolicyName please \ --Document --jsonstr-file ./policy.json
๐งฉ Autocompletion
Bash
source <(oapi-cli-x86_64.AppImage --bash-completion)
Or source oapi-cli-completion.bash.
Zsh
autoload bashcompinit bashcompinit source ~/oapi-cli-completion.bash autoload -Uz compinit && compinit # if not already in .zshrc
๐ Variable System
oapi-cli supports internal variables between chained calls.
oapi-cli CreateVms --ImageId IMG_ID --set-var vm_id=Vms.0.VmId \
CreateTags --ResourceIds[] --var vm_id --Tags.0.Key Name ..Value "my vm"This captures the VmId from the first call and reuses it in the second.
More examples in variable.md
๐ Configuration
๐ Config File
Located at:
- Unix/macOS:
~/.osc/config.json - Windows:
.\\config.json(same folder as binary)
Example:
{
"default": {
"access_key": "MYACCESSKEY",
"secret_key": "MYSECRETKEY",
"region": "eu-west-2"
},
"us": {
"access_key": "MYACCESSKEY",
"secret_key": "MYSECRETKEY",
"region": "us-east-2"
}
}Supported keys: access_key, secret_key, region, x509_client_cert, client_certificate, x509_client_sslkey, proxy, endpoint, endpoints
๐ Environment Variables
# AK/SK authentication export OSC_ACCESS_KEY=... export OSC_SECRET_KEY=... # Login/password authentication export OSC_LOGIN=... export OSC_PASSWORD=... # Region (default: eu-west-2) export OSC_REGION=... # Profile export OSC_PROFILE=default # Override endpoint export OSC_ENDPOINT_API=https://...
๐ Notes
- The CLI supports multiple argument styles (cascaded, OSC-style, JSON).
- SDK is generated from COGNAC using osc-api.
- If AppImage FUSE fails, try
--appimage-extract-and-run.
๐ License
oapi-cli is licensed under BSD-3-Clause.
ยฉ Outscale SAS