ibee-cli 0.5.2__tar.gz → 0.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. ibee_cli-0.7.0/PKG-INFO +194 -0
  2. ibee_cli-0.7.0/README.md +168 -0
  3. {ibee_cli-0.5.2 → ibee_cli-0.7.0}/pyproject.toml +3 -3
  4. {ibee_cli-0.5.2 → ibee_cli-0.7.0}/src/ibee_cli/__init__.py +1 -1
  5. ibee_cli-0.7.0/src/ibee_cli/billing_selection.py +67 -0
  6. ibee_cli-0.7.0/src/ibee_cli/commands/__init__.py +22 -0
  7. ibee_cli-0.7.0/src/ibee_cli/commands/block_storage.py +142 -0
  8. ibee_cli-0.7.0/src/ibee_cli/commands/buckets.py +408 -0
  9. ibee_cli-0.7.0/src/ibee_cli/commands/cdn.py +251 -0
  10. ibee_cli-0.7.0/src/ibee_cli/commands/compute.py +110 -0
  11. ibee_cli-0.7.0/src/ibee_cli/commands/firewalls.py +228 -0
  12. ibee_cli-0.7.0/src/ibee_cli/commands/gpus.py +767 -0
  13. ibee_cli-0.7.0/src/ibee_cli/commands/load_balancers.py +206 -0
  14. ibee_cli-0.7.0/src/ibee_cli/commands/ops.py +23 -0
  15. ibee_cli-0.7.0/src/ibee_cli/commands/registries.py +558 -0
  16. ibee_cli-0.7.0/src/ibee_cli/commands/reserved_ips.py +184 -0
  17. ibee_cli-0.7.0/src/ibee_cli/commands/secrets.py +496 -0
  18. ibee_cli-0.7.0/src/ibee_cli/commands/vms.py +767 -0
  19. ibee_cli-0.7.0/src/ibee_cli/commands/vpcs.py +432 -0
  20. {ibee_cli-0.5.2 → ibee_cli-0.7.0}/src/ibee_cli/context.py +20 -24
  21. ibee_cli-0.7.0/src/ibee_cli/helpers.py +73 -0
  22. {ibee_cli-0.5.2 → ibee_cli-0.7.0}/src/ibee_cli/main.py +13 -42
  23. ibee_cli-0.7.0/src/ibee_cli/render.py +427 -0
  24. ibee_cli-0.7.0/src/ibee_cli.egg-info/PKG-INFO +194 -0
  25. {ibee_cli-0.5.2 → ibee_cli-0.7.0}/src/ibee_cli.egg-info/SOURCES.txt +5 -8
  26. {ibee_cli-0.5.2 → ibee_cli-0.7.0}/src/ibee_cli.egg-info/requires.txt +2 -1
  27. {ibee_cli-0.5.2 → ibee_cli-0.7.0}/tests/test_cli_core.py +65 -6
  28. ibee_cli-0.7.0/tests/test_command_behaviour.py +199 -0
  29. ibee_cli-0.7.0/tests/test_contract_commands.py +240 -0
  30. ibee_cli-0.5.2/PKG-INFO +0 -149
  31. ibee_cli-0.5.2/README.md +0 -124
  32. ibee_cli-0.5.2/src/ibee_cli/commands/__init__.py +0 -0
  33. ibee_cli-0.5.2/src/ibee_cli/commands/billing.py +0 -44
  34. ibee_cli-0.5.2/src/ibee_cli/commands/block_storage.py +0 -186
  35. ibee_cli-0.5.2/src/ibee_cli/commands/buckets.py +0 -222
  36. ibee_cli-0.5.2/src/ibee_cli/commands/cdn.py +0 -243
  37. ibee_cli-0.5.2/src/ibee_cli/commands/compute.py +0 -46
  38. ibee_cli-0.5.2/src/ibee_cli/commands/console.py +0 -63
  39. ibee_cli-0.5.2/src/ibee_cli/commands/firewalls.py +0 -220
  40. ibee_cli-0.5.2/src/ibee_cli/commands/gpus.py +0 -8
  41. ibee_cli-0.5.2/src/ibee_cli/commands/load_balancers.py +0 -238
  42. ibee_cli-0.5.2/src/ibee_cli/commands/networking.py +0 -408
  43. ibee_cli-0.5.2/src/ibee_cli/commands/ops.py +0 -53
  44. ibee_cli-0.5.2/src/ibee_cli/commands/reserved_ips.py +0 -120
  45. ibee_cli-0.5.2/src/ibee_cli/commands/secrets.py +0 -581
  46. ibee_cli-0.5.2/src/ibee_cli/commands/vm_lifecycle.py +0 -849
  47. ibee_cli-0.5.2/src/ibee_cli/commands/vms.py +0 -8
  48. ibee_cli-0.5.2/src/ibee_cli/helpers.py +0 -238
  49. ibee_cli-0.5.2/src/ibee_cli/render.py +0 -430
  50. ibee_cli-0.5.2/src/ibee_cli.egg-info/PKG-INFO +0 -149
  51. ibee_cli-0.5.2/tests/test_networking_commands.py +0 -268
  52. ibee_cli-0.5.2/tests/test_secret_store_commands.py +0 -190
  53. ibee_cli-0.5.2/tests/test_storage_commands.py +0 -252
  54. ibee_cli-0.5.2/tests/test_vm_commands.py +0 -201
  55. {ibee_cli-0.5.2 → ibee_cli-0.7.0}/LICENSE +0 -0
  56. {ibee_cli-0.5.2 → ibee_cli-0.7.0}/setup.cfg +0 -0
  57. {ibee_cli-0.5.2 → ibee_cli-0.7.0}/src/ibee_cli.egg-info/dependency_links.txt +0 -0
  58. {ibee_cli-0.5.2 → ibee_cli-0.7.0}/src/ibee_cli.egg-info/entry_points.txt +0 -0
  59. {ibee_cli-0.5.2 → ibee_cli-0.7.0}/src/ibee_cli.egg-info/top_level.txt +0 -0
@@ -0,0 +1,194 @@
1
+ Metadata-Version: 2.4
2
+ Name: ibee-cli
3
+ Version: 0.7.0
4
+ Summary: Official command-line interface for the IBEE Solutions cloud platform
5
+ Author-email: IBEE Solutions <support@ibee.ai>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://ibee.ai
8
+ Project-URL: Documentation, https://ibee.ai/docs/api-reference
9
+ Project-URL: Repository, https://github.com/devs-ibee/ibee-cli
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Environment :: Console
13
+ Requires-Python: >=3.10
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: ibee<0.8,>=0.7.0
17
+ Requires-Dist: httpx>=0.27
18
+ Requires-Dist: typer>=0.12
19
+ Requires-Dist: click>=8.1
20
+ Requires-Dist: rich>=13.0
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=7.0; extra == "dev"
23
+ Requires-Dist: build; extra == "dev"
24
+ Requires-Dist: pyyaml>=6.0; extra == "dev"
25
+ Dynamic: license-file
26
+
27
+ # IBEE Solutions CLI
28
+
29
+ Object Storage and Container Registry public management operations are temporarily paused.
30
+ Published methods and commands remain available for compatibility. An empty 404
31
+ from these routes reports the pause; it does not prove an existing resource was deleted.
32
+ CDN remains available.
33
+
34
+ Official command-line interface for the IBEE Solutions cloud platform, built on the
35
+ [`ibee` Python SDK](https://github.com/devs-ibee/ibee-python). It has one command per
36
+ operation of the IBEE public API (contract 0.9.0, 229 operations): each command makes
37
+ that operation's one SDK call and prints the server's answer. The server decides
38
+ prices, eligibility, limits and states; the CLI checks nothing before sending.
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ pip install ibee-cli
44
+ ```
45
+
46
+ Requires Python 3.10+.
47
+
48
+ ## Authentication
49
+
50
+ Create an API token in the portal under **Settings > API Tokens**, then:
51
+
52
+ ```bash
53
+ export IBEE_TOKEN="ibee_prod_key_xxxxxxxxxxxx"
54
+ export IBEE_WORKSPACE_ID="710995"
55
+ ```
56
+
57
+ Both can also be passed per command with `--token` and `--workspace`. The workspace is
58
+ sent as every operation's `workspace_id`.
59
+
60
+ ## Commands
61
+
62
+ `ibee --help` lists the groups (`vms`, `gpus`, `ops`, `compute`, `block-storage`,
63
+ `buckets`, `cdn`, `secrets`, `vpcs`, `reserved-ips`, `firewalls`, `load-balancers`,
64
+ `registries`); [COMMANDS.md](COMMANDS.md) lists every command with its API operation,
65
+ and `ibee COMMAND --help` shows each option's description from the contract.
66
+
67
+ Every command follows the contract, field for field:
68
+
69
+ - path parameters are arguments, in path order (`ibee vms get VM_ID`);
70
+ - every query parameter, header and request-body field is an option of the same name
71
+ (`ssh_key_ids` is `--ssh-key-ids`); the contract's required fields are required
72
+ options;
73
+ - booleans are `--name/--no-name`; arrays of strings or numbers repeat the option
74
+ (`--tags a --tags b`); objects and arrays of objects take JSON, and a JSON value of
75
+ `@FILE` reads the file, `@-` standard input (`--rules @rules.json`);
76
+ - `X-Idempotency-Key` (and Container Registry's `Idempotency-Key`) is
77
+ `--idempotency-key`; without it the SDK sends a new random key.
78
+
79
+ ```bash
80
+ ibee compute sites
81
+ ibee compute plans --vm-type cloud --site-id SITE_ID
82
+ ibee compute images --vm-type cloud --site-id SITE_ID
83
+
84
+ ibee vms create --name web-1 --site-id SITE_ID --plan-id PLAN_ID --template-id IMAGE_ID \
85
+ --os-type linux --os-distro ubuntu --cpu 2 --ram-mb 4096 --disk-gb 50 \
86
+ --billing-interval HOURLY --ssh-keys "$(cat ~/.ssh/id_ed25519.pub)"
87
+ ibee ops get OPERATION_ID
88
+ ibee vms list --limit 20
89
+ ibee vms resize VM_ID --cpu 4 --ram-mb 8192
90
+ ibee vms delete VM_ID --public-ip-action release --yes
91
+
92
+ ibee buckets create --name assets --region in-south-2
93
+ ibee buckets cors set assets --rules @cors.json
94
+ ibee buckets credentials create --name ci --permission-type object_rw
95
+ ibee secrets create STORE_ID --secret-name db --value '{"password": "..."}'
96
+ ibee registries tokens create REGISTRY_ID --token-name ci-push --permission PULL_PUSH
97
+ ```
98
+
99
+ ### VM creates: `--billing-interval`
100
+
101
+ `vms create` and `gpus create` need the contract's `billing_catalog` (a
102
+ `ComputeBillingSelection`). Pass it as JSON with `--billing-catalog`, or pass
103
+ `--billing-interval HOURLY|MONTHLY`: the CLI then reads the `--plan-id` plan from
104
+ `GET /compute/plans` (with the create's `vm_type` and `site_id`), copies its
105
+ `billing_catalog` and merges in the whole `billing_options` entry for that interval,
106
+ exactly as the portal does. Nothing else is filled in: CPU, RAM, disk, OS and the
107
+ other fields are sent as you give them. `MONTHLY` is a one-month commitment (the API
108
+ answers `409 VM_COMMITTED` to a delete or resize before it ends).
109
+
110
+ ## Global options
111
+
112
+ | Option | Environment variable | Meaning |
113
+ | --- | --- | --- |
114
+ | `--token` | `IBEE_TOKEN` (or `IBEE_API_TOKEN`) | API token |
115
+ | `--workspace`, `-w` | `IBEE_WORKSPACE_ID` | Workspace ID (`workspace_id`) |
116
+ | `--dev` | `IBEE_ENV=dev` | Use the development environment |
117
+ | `--base-url` | `IBEE_BASE_URL`, `IBEE_ENDPOINT` | Custom API endpoint |
118
+ | `-o`, `--output` | `IBEE_OUTPUT` | `json` (default), `yaml`, `table` or `id` |
119
+ | `--json` | | Same as `-o json` |
120
+ | `--yes`, `-y` | `IBEE_ASSUME_YES=1` | Answer yes to every confirmation |
121
+
122
+ The endpoint is chosen in this order: `--base-url`, `IBEE_BASE_URL`, `IBEE_ENDPOINT`,
123
+ `--dev`, `IBEE_ENV`; the default is production, `https://api.ibee.ai/v1`.
124
+
125
+ ## Output
126
+
127
+ The server's answer is printed as JSON by default. `-o yaml` prints it as YAML,
128
+ `-o table` as a table (one row per item of a list, or one row per field of an
129
+ object) and `-o id` one identifier per line (for a list, the value the API takes for
130
+ each item, such as a bucket's name). An empty answer (HTTP 204) prints nothing.
131
+ `registries sboms download` writes the document to standard output.
132
+
133
+ Destructive commands (every delete, revoke, archive, purge, restore and volume
134
+ detach) ask for confirmation; `--yes` (or the global `--yes`) skips it.
135
+
136
+ ## Errors
137
+
138
+ Every error prints the HTTP status and the server's fields as sent:
139
+
140
+ ```text
141
+ Error: HTTP 409
142
+ code: VM_COMMITTED
143
+ message: ...
144
+ request_id: 6f1c2e...
145
+ ```
146
+
147
+ With `-o json` the same fields, plus the raw `body`, are printed on stderr as
148
+ `{"error": {...}}`. A success answer the SDK cannot read (it does not match the
149
+ contract) is printed the same way, as received, with exit code 1.
150
+
151
+ ## Exit codes
152
+
153
+ | Code | Meaning |
154
+ | --- | --- |
155
+ | 0 | Success |
156
+ | 1 | Declined confirmation, an answer that does not match the contract, or another error |
157
+ | 2 | Usage or configuration error (missing option, token or workspace, bad JSON, unsafe endpoint); nothing was sent |
158
+ | 4 | Network error (no HTTP answer) |
159
+ | 10, 11, 12, 13, 14 | HTTP 400, 401, 402, 403, 404 |
160
+ | 15, 16, 17, 18 | HTTP 409, 422, 423, 429 |
161
+ | 19 | HTTP 5xx |
162
+
163
+ ## Retries and idempotency keys
164
+
165
+ The SDK retries reads on 429, 502, 503 and 504, and writes that carry an idempotency
166
+ key on 429 and 503, never on a billing or admission answer; VM creates are never
167
+ retried. After a retryable failure the CLI prints `Retry safely with:
168
+ --idempotency-key KEY` so the command can be repeated without doing the write twice.
169
+
170
+ ## Development
171
+
172
+ ```bash
173
+ pip install "ibee @ git+https://github.com/devs-ibee/ibee-python@main" # or the SDK branch you need
174
+ pip install -e ".[dev]"
175
+ python scripts/generate_commands.py --check # the commands match contract/ibee-cloud.yaml
176
+ python scripts/check_sdk_calls.py # every SDK method has a command, and only those are called
177
+ pytest -q
178
+ ```
179
+
180
+ The command modules in `src/ibee_cli/commands/` and `COMMANDS.md` are generated from
181
+ `contract/ibee-cloud.yaml` (a copy of the public API contract) by
182
+ `scripts/generate_commands.py`; after updating the contract, run the script and commit
183
+ what it writes. The hand-written parts are the global options (`context.py`), output
184
+ and errors (`render.py`), the shared request helpers (`helpers.py`) and the VM
185
+ `billing_catalog` convenience (`billing_selection.py`).
186
+
187
+ CI runs the tests on Python 3.10-3.12 with the ibee-python branch of the same name (or
188
+ ibee from PyPI), and the "SDK drift" check against ibee from PyPI (once a release in
189
+ the CLI's range exists) and ibee-python `main` (or its branch of the same name).
190
+
191
+ ## Related
192
+
193
+ - [Python SDK](https://github.com/devs-ibee/ibee-python): `pip install ibee`
194
+ - [API documentation](https://ibee.ai/docs/api-reference)
@@ -0,0 +1,168 @@
1
+ # IBEE Solutions CLI
2
+
3
+ Object Storage and Container Registry public management operations are temporarily paused.
4
+ Published methods and commands remain available for compatibility. An empty 404
5
+ from these routes reports the pause; it does not prove an existing resource was deleted.
6
+ CDN remains available.
7
+
8
+ Official command-line interface for the IBEE Solutions cloud platform, built on the
9
+ [`ibee` Python SDK](https://github.com/devs-ibee/ibee-python). It has one command per
10
+ operation of the IBEE public API (contract 0.9.0, 229 operations): each command makes
11
+ that operation's one SDK call and prints the server's answer. The server decides
12
+ prices, eligibility, limits and states; the CLI checks nothing before sending.
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pip install ibee-cli
18
+ ```
19
+
20
+ Requires Python 3.10+.
21
+
22
+ ## Authentication
23
+
24
+ Create an API token in the portal under **Settings > API Tokens**, then:
25
+
26
+ ```bash
27
+ export IBEE_TOKEN="ibee_prod_key_xxxxxxxxxxxx"
28
+ export IBEE_WORKSPACE_ID="710995"
29
+ ```
30
+
31
+ Both can also be passed per command with `--token` and `--workspace`. The workspace is
32
+ sent as every operation's `workspace_id`.
33
+
34
+ ## Commands
35
+
36
+ `ibee --help` lists the groups (`vms`, `gpus`, `ops`, `compute`, `block-storage`,
37
+ `buckets`, `cdn`, `secrets`, `vpcs`, `reserved-ips`, `firewalls`, `load-balancers`,
38
+ `registries`); [COMMANDS.md](COMMANDS.md) lists every command with its API operation,
39
+ and `ibee COMMAND --help` shows each option's description from the contract.
40
+
41
+ Every command follows the contract, field for field:
42
+
43
+ - path parameters are arguments, in path order (`ibee vms get VM_ID`);
44
+ - every query parameter, header and request-body field is an option of the same name
45
+ (`ssh_key_ids` is `--ssh-key-ids`); the contract's required fields are required
46
+ options;
47
+ - booleans are `--name/--no-name`; arrays of strings or numbers repeat the option
48
+ (`--tags a --tags b`); objects and arrays of objects take JSON, and a JSON value of
49
+ `@FILE` reads the file, `@-` standard input (`--rules @rules.json`);
50
+ - `X-Idempotency-Key` (and Container Registry's `Idempotency-Key`) is
51
+ `--idempotency-key`; without it the SDK sends a new random key.
52
+
53
+ ```bash
54
+ ibee compute sites
55
+ ibee compute plans --vm-type cloud --site-id SITE_ID
56
+ ibee compute images --vm-type cloud --site-id SITE_ID
57
+
58
+ ibee vms create --name web-1 --site-id SITE_ID --plan-id PLAN_ID --template-id IMAGE_ID \
59
+ --os-type linux --os-distro ubuntu --cpu 2 --ram-mb 4096 --disk-gb 50 \
60
+ --billing-interval HOURLY --ssh-keys "$(cat ~/.ssh/id_ed25519.pub)"
61
+ ibee ops get OPERATION_ID
62
+ ibee vms list --limit 20
63
+ ibee vms resize VM_ID --cpu 4 --ram-mb 8192
64
+ ibee vms delete VM_ID --public-ip-action release --yes
65
+
66
+ ibee buckets create --name assets --region in-south-2
67
+ ibee buckets cors set assets --rules @cors.json
68
+ ibee buckets credentials create --name ci --permission-type object_rw
69
+ ibee secrets create STORE_ID --secret-name db --value '{"password": "..."}'
70
+ ibee registries tokens create REGISTRY_ID --token-name ci-push --permission PULL_PUSH
71
+ ```
72
+
73
+ ### VM creates: `--billing-interval`
74
+
75
+ `vms create` and `gpus create` need the contract's `billing_catalog` (a
76
+ `ComputeBillingSelection`). Pass it as JSON with `--billing-catalog`, or pass
77
+ `--billing-interval HOURLY|MONTHLY`: the CLI then reads the `--plan-id` plan from
78
+ `GET /compute/plans` (with the create's `vm_type` and `site_id`), copies its
79
+ `billing_catalog` and merges in the whole `billing_options` entry for that interval,
80
+ exactly as the portal does. Nothing else is filled in: CPU, RAM, disk, OS and the
81
+ other fields are sent as you give them. `MONTHLY` is a one-month commitment (the API
82
+ answers `409 VM_COMMITTED` to a delete or resize before it ends).
83
+
84
+ ## Global options
85
+
86
+ | Option | Environment variable | Meaning |
87
+ | --- | --- | --- |
88
+ | `--token` | `IBEE_TOKEN` (or `IBEE_API_TOKEN`) | API token |
89
+ | `--workspace`, `-w` | `IBEE_WORKSPACE_ID` | Workspace ID (`workspace_id`) |
90
+ | `--dev` | `IBEE_ENV=dev` | Use the development environment |
91
+ | `--base-url` | `IBEE_BASE_URL`, `IBEE_ENDPOINT` | Custom API endpoint |
92
+ | `-o`, `--output` | `IBEE_OUTPUT` | `json` (default), `yaml`, `table` or `id` |
93
+ | `--json` | | Same as `-o json` |
94
+ | `--yes`, `-y` | `IBEE_ASSUME_YES=1` | Answer yes to every confirmation |
95
+
96
+ The endpoint is chosen in this order: `--base-url`, `IBEE_BASE_URL`, `IBEE_ENDPOINT`,
97
+ `--dev`, `IBEE_ENV`; the default is production, `https://api.ibee.ai/v1`.
98
+
99
+ ## Output
100
+
101
+ The server's answer is printed as JSON by default. `-o yaml` prints it as YAML,
102
+ `-o table` as a table (one row per item of a list, or one row per field of an
103
+ object) and `-o id` one identifier per line (for a list, the value the API takes for
104
+ each item, such as a bucket's name). An empty answer (HTTP 204) prints nothing.
105
+ `registries sboms download` writes the document to standard output.
106
+
107
+ Destructive commands (every delete, revoke, archive, purge, restore and volume
108
+ detach) ask for confirmation; `--yes` (or the global `--yes`) skips it.
109
+
110
+ ## Errors
111
+
112
+ Every error prints the HTTP status and the server's fields as sent:
113
+
114
+ ```text
115
+ Error: HTTP 409
116
+ code: VM_COMMITTED
117
+ message: ...
118
+ request_id: 6f1c2e...
119
+ ```
120
+
121
+ With `-o json` the same fields, plus the raw `body`, are printed on stderr as
122
+ `{"error": {...}}`. A success answer the SDK cannot read (it does not match the
123
+ contract) is printed the same way, as received, with exit code 1.
124
+
125
+ ## Exit codes
126
+
127
+ | Code | Meaning |
128
+ | --- | --- |
129
+ | 0 | Success |
130
+ | 1 | Declined confirmation, an answer that does not match the contract, or another error |
131
+ | 2 | Usage or configuration error (missing option, token or workspace, bad JSON, unsafe endpoint); nothing was sent |
132
+ | 4 | Network error (no HTTP answer) |
133
+ | 10, 11, 12, 13, 14 | HTTP 400, 401, 402, 403, 404 |
134
+ | 15, 16, 17, 18 | HTTP 409, 422, 423, 429 |
135
+ | 19 | HTTP 5xx |
136
+
137
+ ## Retries and idempotency keys
138
+
139
+ The SDK retries reads on 429, 502, 503 and 504, and writes that carry an idempotency
140
+ key on 429 and 503, never on a billing or admission answer; VM creates are never
141
+ retried. After a retryable failure the CLI prints `Retry safely with:
142
+ --idempotency-key KEY` so the command can be repeated without doing the write twice.
143
+
144
+ ## Development
145
+
146
+ ```bash
147
+ pip install "ibee @ git+https://github.com/devs-ibee/ibee-python@main" # or the SDK branch you need
148
+ pip install -e ".[dev]"
149
+ python scripts/generate_commands.py --check # the commands match contract/ibee-cloud.yaml
150
+ python scripts/check_sdk_calls.py # every SDK method has a command, and only those are called
151
+ pytest -q
152
+ ```
153
+
154
+ The command modules in `src/ibee_cli/commands/` and `COMMANDS.md` are generated from
155
+ `contract/ibee-cloud.yaml` (a copy of the public API contract) by
156
+ `scripts/generate_commands.py`; after updating the contract, run the script and commit
157
+ what it writes. The hand-written parts are the global options (`context.py`), output
158
+ and errors (`render.py`), the shared request helpers (`helpers.py`) and the VM
159
+ `billing_catalog` convenience (`billing_selection.py`).
160
+
161
+ CI runs the tests on Python 3.10-3.12 with the ibee-python branch of the same name (or
162
+ ibee from PyPI), and the "SDK drift" check against ibee from PyPI (once a release in
163
+ the CLI's range exists) and ibee-python `main` (or its branch of the same name).
164
+
165
+ ## Related
166
+
167
+ - [Python SDK](https://github.com/devs-ibee/ibee-python): `pip install ibee`
168
+ - [API documentation](https://ibee.ai/docs/api-reference)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ibee-cli"
7
- version = "0.5.2"
7
+ version = "0.7.0"
8
8
  description = "Official command-line interface for the IBEE Solutions cloud platform"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -18,7 +18,7 @@ classifiers = [
18
18
  "Environment :: Console",
19
19
  ]
20
20
  dependencies = [
21
- "ibee>=0.5.0,<0.6.0",
21
+ "ibee>=0.7.0,<0.8",
22
22
  "httpx>=0.27",
23
23
  "typer>=0.12",
24
24
  "click>=8.1",
@@ -26,7 +26,7 @@ dependencies = [
26
26
  ]
27
27
 
28
28
  [project.optional-dependencies]
29
- dev = ["pytest>=7.0", "build"]
29
+ dev = ["pytest>=7.0", "build", "pyyaml>=6.0"]
30
30
 
31
31
  [project.scripts]
32
32
  ibee = "ibee_cli.main:app"
@@ -1,3 +1,3 @@
1
1
  """IBEE Solutions command-line interface."""
2
2
 
3
- __version__ = "0.5.2"
3
+ __version__ = "0.7.0"
@@ -0,0 +1,67 @@
1
+ """The CLI's one convenience: a VM create's ``billing_catalog`` from ``GET /compute/plans``.
2
+
3
+ The contract's ``ComputeBillingSelection`` (``billing_catalog`` of ``POST
4
+ /compute/cloud-vms`` and ``POST /compute/gpu-vms``) is the chosen plan's
5
+ ``billing_catalog`` with one entry of its ``billing_options`` merged in. With
6
+ ``--billing-interval HOURLY|MONTHLY``, ``vms create`` and ``gpus create`` do that with
7
+ the server's own data, as the portal does: read the ``--plan-id`` plan from ``GET
8
+ /compute/plans`` (``vm_type`` and ``site_id`` of the create), copy its
9
+ ``billing_catalog`` and merge in the whole ``billing_options`` entry whose
10
+ ``billing_interval`` is the one asked for (``billing_interval``, ``committed``,
11
+ ``commitment_period``, ``commitment_months``, ``committed_hours``, ``price_unit``,
12
+ ``unit_price_minor``...), keeping the catalog's ``price_currency``. Nothing is
13
+ invented or checked here: the server validates the selection and decides the price.
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ from typing import Any, Optional
19
+
20
+ from .context import fail_usage
21
+ from .helpers import json_arg
22
+ from .render import items, to_data
23
+
24
+
25
+ def vm_billing_catalog(
26
+ client: Any,
27
+ workspace_id: str,
28
+ vm_type: str,
29
+ plan_id: str,
30
+ site_id: Optional[str],
31
+ billing_catalog: Optional[str],
32
+ billing_interval: Optional[str],
33
+ ) -> Any:
34
+ """The ``billing_catalog`` to send: ``--billing-catalog`` as given, or built for ``--billing-interval``."""
35
+ if billing_catalog is not None and billing_interval is not None:
36
+ fail_usage("Use --billing-catalog or --billing-interval, not both.")
37
+ if billing_catalog is not None:
38
+ return json_arg(billing_catalog, "--billing-catalog")
39
+ if billing_interval is None:
40
+ fail_usage(
41
+ "billing_catalog is required: pass --billing-interval HOURLY|MONTHLY (built from the plan in "
42
+ "GET /compute/plans) or --billing-catalog JSON."
43
+ )
44
+ interval = str(billing_interval).strip().upper()
45
+ answer = client.compute_catalog.list_compute_plans(
46
+ workspace_id=workspace_id, vm_type=vm_type, **({"site_id": site_id} if site_id else {})
47
+ )
48
+ plans = items(to_data(answer), "plans") or []
49
+ plan = next((p for p in plans if isinstance(p, dict) and str(p.get("plan_id")) == str(plan_id)), None)
50
+ where = f"GET /compute/plans?vm_type={vm_type}" + (f"&site_id={site_id}" if site_id else "")
51
+ if plan is None:
52
+ fail_usage(f"Plan {plan_id} is not in {where}, so its billing_catalog cannot be read.")
53
+ catalog = plan.get("billing_catalog")
54
+ if not isinstance(catalog, dict):
55
+ fail_usage(f"Plan {plan_id} in {where} has no billing_catalog.")
56
+ options = [o for o in catalog.get("billing_options") or [] if isinstance(o, dict)]
57
+ option = next((o for o in options if str(o.get("billing_interval")).upper() == interval), None)
58
+ if option is None:
59
+ offered = ", ".join(str(o.get("billing_interval")) for o in options) or "none"
60
+ fail_usage(f"Plan {plan_id} has no {interval} entry in billing_catalog.billing_options (offered: {offered}).")
61
+ selection = {**catalog, **option}
62
+ if "price_currency" in catalog:
63
+ selection["price_currency"] = catalog["price_currency"]
64
+ return selection
65
+
66
+
67
+ __all__ = ["vm_billing_catalog"]
@@ -0,0 +1,22 @@
1
+ # Generated by scripts/generate_commands.py from contract/ibee-cloud.yaml (IBEE Solutions API 0.9.0).
2
+ # Do not edit by hand: change the contract or the generator and run the script again.
3
+ """The command groups, in `ibee --help` order."""
4
+
5
+ from . import block_storage, buckets, cdn, compute, firewalls, gpus, load_balancers, ops, registries, reserved_ips, secrets, vms, vpcs
6
+
7
+ #: (CLI name, Typer app) of every command group.
8
+ GROUPS = [
9
+ ('vms', vms.app),
10
+ ('gpus', gpus.app),
11
+ ('ops', ops.app),
12
+ ('compute', compute.app),
13
+ ('block-storage', block_storage.app),
14
+ ('buckets', buckets.app),
15
+ ('cdn', cdn.app),
16
+ ('secrets', secrets.app),
17
+ ('vpcs', vpcs.app),
18
+ ('reserved-ips', reserved_ips.app),
19
+ ('firewalls', firewalls.app),
20
+ ('load-balancers', load_balancers.app),
21
+ ('registries', registries.app),
22
+ ]
@@ -0,0 +1,142 @@
1
+ # Generated by scripts/generate_commands.py from contract/ibee-cloud.yaml (IBEE Solutions API 0.9.0).
2
+ # Do not edit by hand: change the contract or the generator and run the script again.
3
+ """``ibee block-storage``: Block Storage volumes and plans (one command per contract operation)."""
4
+
5
+ from __future__ import annotations
6
+
7
+ from typing import Optional
8
+
9
+ import typer
10
+
11
+ from ..helpers import compact, confirm, sdk, workspace
12
+ from ..render import emit, handle_api_errors
13
+
14
+ app = typer.Typer(help='Block Storage volumes and plans', no_args_is_help=True)
15
+
16
+
17
+ @app.command('plans', help="List block storage plans.\n\nReturns the block storage plans with their sizes, performance and prices, as the portal's Create Volume page shows them. Pick a `sku_code` for createBlockVolume. Requires scope: block-storage.read.\n\nAPI: GET /block-storage/plans (listBlockStoragePlans).", short_help='List block storage plans')
18
+ @handle_api_errors
19
+ def list_block_storage_plans(
20
+ ctx: typer.Context,
21
+ site_id: Optional[str] = typer.Option(None, '--site-id', show_default=False, help='Return only plans offered at this site.'),
22
+ currency: Optional[str] = typer.Option(None, '--currency', show_default=False, help='Price currency. Default `INR`.'),
23
+ billing_interval: Optional[str] = typer.Option(None, '--billing-interval', show_default=False, help='Billing interval of the listed prices. Default `MONTHLY`. One of: HOURLY, MONTHLY.'),
24
+ ) -> None:
25
+ client = sdk(ctx)
26
+ result = client.block_storage.list_block_storage_plans(
27
+ **compact(
28
+ workspace_id=workspace(ctx),
29
+ site_id=site_id,
30
+ currency=currency,
31
+ billing_interval=billing_interval,
32
+ ),
33
+ )
34
+ emit(result, collection='items')
35
+
36
+
37
+ @app.command('list', help='List block-storage volumes.\n\nLists the block storage volumes in a workspace, with their size, status, and attached VM. Requires scope: block-storage.read.\n\nAPI: GET /block-storage/volumes (listBlockVolumes).', short_help='List block-storage volumes')
38
+ @handle_api_errors
39
+ def list_block_volumes(
40
+ ctx: typer.Context,
41
+ ) -> None:
42
+ client = sdk(ctx)
43
+ result = client.block_storage.list_block_volumes(**compact(workspace_id=workspace(ctx)))
44
+ emit(result, id_field='id')
45
+
46
+
47
+ @app.command('create', help='Create block-storage volume.\n\nThe public edge resolves authoritative pricing from the server-owned product catalog and validates billing before forwarding this request to the existing portal volume flow. Client-supplied price or billing catalog objects are not accepted. Asynchronous: the response carries the volume operation; poll `GET /block-storage/volumes/{volume_id}/operations` until its `status` is `succeeded` or `failed`.\n\nAPI: POST /block-storage/volumes (createBlockVolume).', short_help='Create block-storage volume')
48
+ @handle_api_errors
49
+ def create_block_volume(
50
+ ctx: typer.Context,
51
+ name: str = typer.Option(..., '--name', show_default=False, help='Display name of the volume (1-255 characters).'),
52
+ size_gb: int = typer.Option(..., '--size-gb', show_default=False, help='Size in GB (1-10000).'),
53
+ site_id: str = typer.Option(..., '--site-id', show_default=False, help='Site to create the volume at.'),
54
+ site_name: Optional[str] = typer.Option(None, '--site-name', show_default=False, help='Display name of that site, as shown in the portal.'),
55
+ sku_code: Optional[str] = typer.Option(None, '--sku-code', show_default=False, help='Optional public selector returned by the server-owned Block Storage catalog. The edge resolves all price and catalog metadata; callers cannot submit pricing.'),
56
+ volume_class: Optional[str] = typer.Option(None, '--volume-class', show_default=False, help='Performance class of the volume. - `capacity`: lowest cost per GB. - `balanced`: general purpose. - `performance`: highest throughput and IOPS. Default `balanced`.'),
57
+ replica_count: Optional[int] = typer.Option(None, '--replica-count', show_default=False, help='Number of synchronous replicas kept for the volume (1-5). Default 2.'),
58
+ backup_enabled: Optional[bool] = typer.Option(None, '--backup-enabled/--no-backup-enabled', show_default=False, help='Whether volume backups are enabled. Default true.'),
59
+ idempotency_key: Optional[str] = typer.Option(None, '--idempotency-key', show_default=False, help='Caller-chosen key that makes a retried request return the original operation instead of starting a new one.'),
60
+ ) -> None:
61
+ client = sdk(ctx)
62
+ result = client.block_storage.create_block_volume(
63
+ **compact(
64
+ workspace_id=workspace(ctx),
65
+ name=name,
66
+ size_gb=size_gb,
67
+ site_id=site_id,
68
+ site_name=site_name,
69
+ sku_code=sku_code,
70
+ volume_class=volume_class,
71
+ replica_count=replica_count,
72
+ backup_enabled=backup_enabled,
73
+ idempotency_key=idempotency_key,
74
+ ),
75
+ )
76
+ emit(result)
77
+
78
+
79
+ @app.command('get', help='Get block-storage volume.\n\nReturns a block storage volume, including its size, status, and the VM it is attached to. Requires scope: block-storage.read.\n\nAPI: GET /block-storage/volumes/{volume_id} (getBlockVolume).', short_help='Get block-storage volume')
80
+ @handle_api_errors
81
+ def get_block_volume(
82
+ ctx: typer.Context,
83
+ volume_id: str = typer.Argument(..., metavar='VOLUME_ID', show_default=False, help='Workspace-owned block-volume ID.'),
84
+ ) -> None:
85
+ client = sdk(ctx)
86
+ result = client.block_storage.get_block_volume(volume_id, **compact(workspace_id=workspace(ctx)))
87
+ emit(result)
88
+
89
+
90
+ @app.command('delete', help='Delete block-storage volume.\n\nPermanently deletes a block storage volume and its data. Asynchronous: the response carries the volume operation; poll `GET /block-storage/volumes/{volume_id}/operations` until its `status` is `succeeded` or `failed`. Requires scope: block-storage.write.\n\nAPI: DELETE /block-storage/volumes/{volume_id} (deleteBlockVolume).', short_help='Delete block-storage volume')
91
+ @handle_api_errors
92
+ def delete_block_volume(
93
+ ctx: typer.Context,
94
+ volume_id: str = typer.Argument(..., metavar='VOLUME_ID', show_default=False, help='Workspace-owned block-volume ID.'),
95
+ force: Optional[bool] = typer.Option(None, '--force/--no-force', show_default=False, help='Delete the volume even if it is still attached. Default false.'),
96
+ yes: bool = typer.Option(False, '--yes', '-y', help='Do not ask for confirmation.'),
97
+ ) -> None:
98
+ confirm(ctx, yes, f'Delete block-storage volume {volume_id}?')
99
+ client = sdk(ctx)
100
+ result = client.block_storage.delete_block_volume(
101
+ volume_id,
102
+ **compact(
103
+ workspace_id=workspace(ctx),
104
+ force=force,
105
+ ),
106
+ )
107
+ emit(result)
108
+
109
+
110
+ @app.command('operations', help='List block-volume operations.\n\nLists the operations run on a block storage volume and their status. Requires scope: block-storage.read.\n\nAPI: GET /block-storage/volumes/{volume_id}/operations (listBlockVolumeOperations).', short_help='List block-volume operations')
111
+ @handle_api_errors
112
+ def list_block_volume_operations(
113
+ ctx: typer.Context,
114
+ volume_id: str = typer.Argument(..., metavar='VOLUME_ID', show_default=False, help='Workspace-owned block-volume ID.'),
115
+ ) -> None:
116
+ client = sdk(ctx)
117
+ result = client.block_storage.list_block_volume_operations(volume_id, **compact(workspace_id=workspace(ctx)))
118
+ emit(result)
119
+
120
+
121
+ @app.command('resize', help='Resize block-storage volume.\n\nBlock volumes can only be increased in size. Asynchronous: the response carries the volume operation; poll `GET /block-storage/volumes/{volume_id}/operations` until its `status` is `succeeded` or `failed`.\n\nAPI: POST /block-storage/volumes/{volume_id}/resize (resizeBlockVolume).', short_help='Resize block-storage volume')
122
+ @handle_api_errors
123
+ def resize_block_volume(
124
+ ctx: typer.Context,
125
+ volume_id: str = typer.Argument(..., metavar='VOLUME_ID', show_default=False, help='Workspace-owned block-volume ID.'),
126
+ new_size_gb: int = typer.Option(..., '--new-size-gb', show_default=False, help='New size in GB.'),
127
+ vm_state: Optional[str] = typer.Option(None, '--vm-state', show_default=False, help='Current power state of the VM, when the caller knows it. - `running` - `stopped` - `suspended`'),
128
+ allow_online: Optional[bool] = typer.Option(None, '--allow-online/--no-allow-online', show_default=False, help='Permit the resize while the volume is attached to a running VM. Default false.'),
129
+ idempotency_key: Optional[str] = typer.Option(None, '--idempotency-key', show_default=False, help='Caller-chosen key that makes a retried request return the original operation instead of starting a new one.'),
130
+ ) -> None:
131
+ client = sdk(ctx)
132
+ result = client.block_storage.resize_block_volume(
133
+ volume_id,
134
+ **compact(
135
+ workspace_id=workspace(ctx),
136
+ new_size_gb=new_size_gb,
137
+ vm_state=vm_state,
138
+ allow_online=allow_online,
139
+ idempotency_key=idempotency_key,
140
+ ),
141
+ )
142
+ emit(result)