- π Documentation: Variable usage
- π§ͺ Nightly builds: Latest AppImage
- π€ Discussions & Feedback: Discord
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).
- 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)
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.rb
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
Download oapi-cli-x86_64-windows.zip
from Releases.
Extract and run oapi-cli.exe
.
β οΈ Config is read from.\config.json
in the current directory.
oapi-cli <Operation> [OPTIONS]
Get general help:
oapi-cli --help
Get help for a specific operation:
oapi-cli --help DeleteTags
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
oapi-cli CreatePolicy --PolicyName please \
--Document --jsonstr-file ./policy.json
source <(oapi-cli-x86_64.AppImage --bash-completion)
Or source oapi-cli-completion.bash
.
autoload bashcompinit
bashcompinit
source ~/oapi-cli-completion.bash
autoload -Uz compinit && compinit # if not already in .zshrc
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
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
# 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://...
- 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
.
oapi-cli is licensed under BSD-3-Clause.
Β© Outscale SAS