|
1 | | -# OVHcloud CLI (`ovhcloud`) Documentation |
| 1 | +## ovhcloud |
2 | 2 |
|
3 | | ---- |
| 3 | +CLI to manage your OVHcloud services |
4 | 4 |
|
5 | | -## Overview |
| 5 | +### Options |
6 | 6 |
|
7 | | -`ovhcloud` is a single, unified command‑line interface for managing the full range of OVHcloud products and account resources directly from your terminal. Whether you need to automate provisioning, perform quick look‑ups, or integrate OVHcloud operations into CI/CD pipelines, `ovhcloud` offers fine‑grained commands and consistent output formats (table, JSON, YAML, or custom gval expressions). |
8 | | - |
9 | | ---- |
10 | | - |
11 | | -## Quick Start |
12 | | - |
13 | | -```bash |
14 | | -# Display the top‑level help |
15 | | -ovhcloud --help |
16 | | - |
17 | | -# Log in and create API credentials (interactive) |
18 | | -ovhcloud login |
19 | | - |
20 | | -# List your VPS instances as JSON |
21 | | -ohvcloud vps list --json |
22 | | -``` |
23 | | - |
24 | | -Check out the [authentication page](authentication.md) for further information about the authentication means. |
25 | | - |
26 | | -### Generate Shell Completion |
27 | | - |
28 | | -```bash |
29 | | -# Bash |
30 | | -eval "$(./ovhcloud completion bash)" |
31 | | -# Zsh |
32 | | -eval "$(./ovhcloud completion zsh)" |
33 | | -# Fish |
34 | | -./ovhcloud completion fish | source |
35 | | -# PowerShell |
36 | | -./ovhcloud completion powershell | Out-String | Invoke-Expression |
37 | 7 | ``` |
38 | | - |
39 | | -Add the appropriate line to your shell’s startup file (`~/.bashrc`, `~/.zshrc`, etc.) to enable persistent autocompletion. |
40 | | - |
41 | | ---- |
42 | | - |
43 | | -## Global Usage |
44 | | - |
45 | | -```text |
46 | | -ovhcloud [command] [flags] |
| 8 | + -d, --debug Activate debug mode (will log all HTTP requests details) |
| 9 | + -f, --format string Output value according to given format (expression using https://github.com/PaesslerAG/gval syntax) |
| 10 | + Examples: |
| 11 | + --format 'id' (to extract a single field) |
| 12 | + --format 'nested.field.subfield' (to extract a nested field) |
| 13 | + --format '[id, 'name']' (to extract multiple fields as an array) |
| 14 | + --format '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) |
| 15 | + --format 'name+","+type' (to extract and concatenate fields in a string) |
| 16 | + --format '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) |
| 17 | + -h, --help help for ovhcloud |
| 18 | + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution |
| 19 | + -i, --interactive Interactive output |
| 20 | + -j, --json Output in JSON |
| 21 | + -y, --yaml Output in YAML |
47 | 22 | ``` |
48 | 23 |
|
49 | | -### Global Flags |
50 | | - |
51 | | -| Flag | Description | |
52 | | -| ----------------- | ---------------------------------------------------- | |
53 | | -| `--debug` | Activate debug mode (logs all HTTP‑request details). | |
54 | | -| `--ignore-errors` | Ignore errors of API calls made when listing items. | |
55 | | -| `--format <expr>` | Format output with a [gval] expression. | |
56 | | -| `--filter <expr>` | Filter lists output with a [gval] expression. | |
57 | | -| `-h`, `--help` | Display help for `ovhcloud` or a specific command. | |
58 | | -| `--interactive` | Produce interactive (prompt‑based) output. | |
59 | | -| `--json` | Output data in JSON format. | |
60 | | -| `--yaml` | Output data in YAML format. | |
61 | | - |
62 | | -[gval]: https://github.com/PaesslerAG/gval |
63 | | - |
64 | | -#### Filtering examples |
65 | | - |
66 | | -- Strict string equality: `--filter 'name=="something"'` |
67 | | -- String regexp comparison: `--filter 'name=~"something"'` |
68 | | -- Number comparison: `--filter 'bootId > 1'` |
69 | | - |
70 | | -#### Formatting example |
71 | | - |
72 | | -- Extract only one field: `--format 'ip'` |
73 | | -- Extract an object: `--format '{name: ip}'` |
74 | | - |
75 | | ---- |
76 | | - |
77 | | -## Command Reference |
78 | | - |
79 | | -Below is the full list of primary sub‑commands available at the time of writing. Each can be explored in depth with `ovhcloud <command> --help`. |
| 24 | +### SEE ALSO |
80 | 25 |
|
81 | 26 | * [ovhcloud account](ovhcloud_account.md) - Manage your account |
82 | 27 | * [ovhcloud alldom](ovhcloud_alldom.md) - Retrieve information and manage your AllDom services |
@@ -122,30 +67,3 @@ Below is the full list of primary sub‑commands available at the time of writin |
122 | 67 | * [ovhcloud webhosting](ovhcloud_webhosting.md) - Retrieve information and manage your WebHosting services |
123 | 68 | * [ovhcloud xdsl](ovhcloud_xdsl.md) - Retrieve information and manage your XDSL services |
124 | 69 |
|
125 | | -> **Tip** Use `--json`, `--yaml`, or `--format` with a gval expression to integrate `ovhcloud` into scripts and automation pipelines. |
126 | | -
|
127 | | ---- |
128 | | - |
129 | | -## Examples |
130 | | - |
131 | | -| Task | Command | |
132 | | -| ------------------------------------- | ---------------------------------------------- | |
133 | | -| Log in and save credentials | `ovhcloud login` | |
134 | | -| List VPS instances (tabular) | `ovhcloud vps list` | |
135 | | -| Fetch details of a single VPS in JSON | `ovhcloud vps get <service_id> --json` | |
136 | | -| Reinstall a baremetal interactively | `ovhcloud baremetal reinstall <id> --editor` | |
137 | | - |
138 | | ---- |
139 | | - |
140 | | -## Troubleshooting |
141 | | - |
142 | | -* **Verbose output** — Use `--debug` to inspect raw API calls and responses. |
143 | | -* **Authentication issues** — Run `ovhcloud login` again to regenerate valid API keys. |
144 | | -* **Rate limits** — OVHcloud APIs impose rate limits; plan retries or exponential backoff in scripts. |
145 | | - |
146 | | ---- |
147 | | - |
148 | | -## Further Reading |
149 | | - |
150 | | -* OVHcloud API reference: [https://eu.api.ovh.com/console](https://eu.api.ovh.com/console) |
151 | | -* OVHcloud community guides and tutorials. |
0 commit comments