ibee-cli 0.7.0__tar.gz → 0.10.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.
- {ibee_cli-0.7.0/src/ibee_cli.egg-info → ibee_cli-0.10.0}/PKG-INFO +54 -16
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/README.md +52 -14
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/pyproject.toml +2 -2
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/__init__.py +1 -1
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/billing_selection.py +7 -3
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/commands/__init__.py +3 -2
- ibee_cli-0.10.0/src/ibee_cli/commands/billing.py +42 -0
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/commands/block_storage.py +1 -1
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/commands/buckets.py +110 -27
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/commands/cdn.py +1 -1
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/commands/compute.py +1 -1
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/commands/firewalls.py +2 -2
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/commands/gpus.py +17 -11
- ibee_cli-0.10.0/src/ibee_cli/commands/load_balancers.py +191 -0
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/commands/ops.py +1 -1
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/commands/registries.py +27 -47
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/commands/reserved_ips.py +2 -2
- ibee_cli-0.10.0/src/ibee_cli/commands/secrets.py +354 -0
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/commands/vms.py +17 -11
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/commands/vpcs.py +5 -5
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/helpers.py +13 -1
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/render.py +10 -1
- {ibee_cli-0.7.0 → ibee_cli-0.10.0/src/ibee_cli.egg-info}/PKG-INFO +54 -16
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli.egg-info/SOURCES.txt +2 -0
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli.egg-info/requires.txt +1 -1
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/tests/test_cli_core.py +8 -4
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/tests/test_command_behaviour.py +54 -7
- ibee_cli-0.10.0/tests/test_contract_014_commands.py +104 -0
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/tests/test_contract_commands.py +11 -4
- ibee_cli-0.7.0/src/ibee_cli/commands/load_balancers.py +0 -206
- ibee_cli-0.7.0/src/ibee_cli/commands/secrets.py +0 -496
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/LICENSE +0 -0
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/setup.cfg +0 -0
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/context.py +0 -0
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli/main.py +0 -0
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli.egg-info/dependency_links.txt +0 -0
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli.egg-info/entry_points.txt +0 -0
- {ibee_cli-0.7.0 → ibee_cli-0.10.0}/src/ibee_cli.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ibee-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.0
|
|
4
4
|
Summary: Official command-line interface for the IBEE Solutions cloud platform
|
|
5
5
|
Author-email: IBEE Solutions <support@ibee.ai>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -13,7 +13,7 @@ Classifier: Environment :: Console
|
|
|
13
13
|
Requires-Python: >=3.10
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
License-File: LICENSE
|
|
16
|
-
Requires-Dist: ibee<0.
|
|
16
|
+
Requires-Dist: ibee<0.11,>=0.10.0
|
|
17
17
|
Requires-Dist: httpx>=0.27
|
|
18
18
|
Requires-Dist: typer>=0.12
|
|
19
19
|
Requires-Dist: click>=8.1
|
|
@@ -26,17 +26,19 @@ Dynamic: license-file
|
|
|
26
26
|
|
|
27
27
|
# IBEE Solutions CLI
|
|
28
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
29
|
Official command-line interface for the IBEE Solutions cloud platform, built on the
|
|
35
30
|
[`ibee` Python SDK](https://github.com/devs-ibee/ibee-python). It has one command per
|
|
36
|
-
operation of the IBEE public API (contract 0.
|
|
31
|
+
operation of the IBEE public API (contract 0.14.3, 222 operations): each command makes
|
|
37
32
|
that operation's one SDK call and prints the server's answer. The server decides
|
|
38
33
|
prices, eligibility, limits and states; the CLI checks nothing before sending.
|
|
39
34
|
|
|
35
|
+
The API manages resources. Data stays on each product's own endpoint, with the
|
|
36
|
+
clients that already exist for it: files over the S3 API
|
|
37
|
+
(`<workspace>.blob.ibeestorage.com`, any S3 tool such as `aws s3` or `rclone`, or one
|
|
38
|
+
file at a time with `ibee buckets objects upload` and an upload or download link),
|
|
39
|
+
container images with `docker` at `registry.ibee.ai`, and secret values with `bao` or
|
|
40
|
+
`vault` at your Secret Manager endpoint.
|
|
41
|
+
|
|
40
42
|
## Installation
|
|
41
43
|
|
|
42
44
|
```bash
|
|
@@ -61,7 +63,7 @@ sent as every operation's `workspace_id`.
|
|
|
61
63
|
|
|
62
64
|
`ibee --help` lists the groups (`vms`, `gpus`, `ops`, `compute`, `block-storage`,
|
|
63
65
|
`buckets`, `cdn`, `secrets`, `vpcs`, `reserved-ips`, `firewalls`, `load-balancers`,
|
|
64
|
-
`registries`); [COMMANDS.md](COMMANDS.md) lists every command with its API operation,
|
|
66
|
+
`registries`, `billing`); [COMMANDS.md](COMMANDS.md) lists every command with its API operation,
|
|
65
67
|
and `ibee COMMAND --help` shows each option's description from the contract.
|
|
66
68
|
|
|
67
69
|
Every command follows the contract, field for field:
|
|
@@ -86,13 +88,20 @@ ibee vms create --name web-1 --site-id SITE_ID --plan-id PLAN_ID --template-id I
|
|
|
86
88
|
--billing-interval HOURLY --ssh-keys "$(cat ~/.ssh/id_ed25519.pub)"
|
|
87
89
|
ibee ops get OPERATION_ID
|
|
88
90
|
ibee vms list --limit 20
|
|
89
|
-
ibee vms resize VM_ID --cpu 4 --ram-mb 8192
|
|
91
|
+
ibee vms resize VM_ID --cpu 4 --ram-mb 8192 --disk-gb 80 --plan-id PLAN_ID --billing-interval HOURLY
|
|
92
|
+
ibee billing wallet
|
|
90
93
|
ibee vms delete VM_ID --public-ip-action release --yes
|
|
91
94
|
|
|
92
95
|
ibee buckets create --name assets --region in-south-2
|
|
93
96
|
ibee buckets cors set assets --rules @cors.json
|
|
94
97
|
ibee buckets credentials create --name ci --permission-type object_rw
|
|
95
|
-
ibee
|
|
98
|
+
ibee buckets objects upload assets docs/report.pdf ./report.pdf --content-type application/pdf
|
|
99
|
+
ibee buckets objects metadata assets docs/report.pdf
|
|
100
|
+
ibee buckets objects download-link assets docs/report.pdf --expires 600 --disposition attachment
|
|
101
|
+
ibee load-balancers list --include-deleted
|
|
102
|
+
ibee secrets credentials create --name ci --access read --folder apps
|
|
103
|
+
ibee secrets update apps/billing/db --custom-metadata '{"owner": "billing"}'
|
|
104
|
+
ibee load-balancers regions
|
|
96
105
|
ibee registries tokens create REGISTRY_ID --token-name ci-push --permission PULL_PUSH
|
|
97
106
|
```
|
|
98
107
|
|
|
@@ -107,6 +116,23 @@ exactly as the portal does. Nothing else is filled in: CPU, RAM, disk, OS and th
|
|
|
107
116
|
other fields are sent as you give them. `MONTHLY` is a one-month commitment (the API
|
|
108
117
|
answers `409 VM_COMMITTED` to a delete or resize before it ends).
|
|
109
118
|
|
|
119
|
+
`vms resize` and `gpus resize` move a VM to another plan. Send the target plan's exact
|
|
120
|
+
`--cpu`, `--ram-mb` and `--disk-gb`, and its `billing_catalog`: `--billing-catalog JSON`,
|
|
121
|
+
or `--plan-id PLAN_ID --billing-interval HOURLY|MONTHLY` to build it the same way from
|
|
122
|
+
`GET /compute/plans`. A resize body has no plan field, so `--plan-id` is only used for
|
|
123
|
+
this lookup and is not sent.
|
|
124
|
+
|
|
125
|
+
### One file: `buckets objects upload`
|
|
126
|
+
|
|
127
|
+
`ibee buckets objects upload BUCKET_NAME OBJECT_PATH FILE` (`-` reads stdin) uploads
|
|
128
|
+
one file with an upload link: the SDK's `upload_file` computes the file's size and
|
|
129
|
+
SHA-256, asks for the link (`createObjectUploadLink`) and PUTs the file to it on the
|
|
130
|
+
workspace's S3 host; the API token is not sent there. It prints the key, size, SHA-256
|
|
131
|
+
and ETag; `buckets objects metadata` shows what was stored. One link carries one whole
|
|
132
|
+
file of at most 80,000,000 bytes (the server's limit); use an S3 tool for larger
|
|
133
|
+
files. `buckets objects upload-link`, `download-link` and `metadata` are the plain
|
|
134
|
+
operations.
|
|
135
|
+
|
|
110
136
|
## Global options
|
|
111
137
|
|
|
112
138
|
| Option | Environment variable | Meaning |
|
|
@@ -128,10 +154,9 @@ The server's answer is printed as JSON by default. `-o yaml` prints it as YAML,
|
|
|
128
154
|
`-o table` as a table (one row per item of a list, or one row per field of an
|
|
129
155
|
object) and `-o id` one identifier per line (for a list, the value the API takes for
|
|
130
156
|
each item, such as a bucket's name). An empty answer (HTTP 204) prints nothing.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
detach) ask for confirmation; `--yes` (or the global `--yes`) skips it.
|
|
157
|
+
Destructive commands (every delete and revoke, `buckets credentials revoke`, `cdn purge`,
|
|
158
|
+
VM restores and volume detach, `secrets versions destroy` and `secrets workspace enable`,
|
|
159
|
+
which can't be undone) ask for confirmation; `--yes` (or the global `--yes`) skips it.
|
|
135
160
|
|
|
136
161
|
## Errors
|
|
137
162
|
|
|
@@ -144,6 +169,18 @@ Error: HTTP 409
|
|
|
144
169
|
request_id: 6f1c2e...
|
|
145
170
|
```
|
|
146
171
|
|
|
172
|
+
A Billing refusal adds `reason` (`billing_reason`) and, with
|
|
173
|
+
`initial_topup_required`, Billing's first top-up minimum:
|
|
174
|
+
|
|
175
|
+
```text
|
|
176
|
+
Error: HTTP 402
|
|
177
|
+
code: billing_denied
|
|
178
|
+
reason: initial_topup_required
|
|
179
|
+
required_topup_minor: 50000
|
|
180
|
+
billing_currency: INR
|
|
181
|
+
message: Add at least ₹500 to your wallet ...
|
|
182
|
+
```
|
|
183
|
+
|
|
147
184
|
With `-o json` the same fields, plus the raw `body`, are printed on stderr as
|
|
148
185
|
`{"error": {...}}`. A success answer the SDK cannot read (it does not match the
|
|
149
186
|
contract) is printed the same way, as received, with exit code 1.
|
|
@@ -182,7 +219,8 @@ The command modules in `src/ibee_cli/commands/` and `COMMANDS.md` are generated
|
|
|
182
219
|
`scripts/generate_commands.py`; after updating the contract, run the script and commit
|
|
183
220
|
what it writes. The hand-written parts are the global options (`context.py`), output
|
|
184
221
|
and errors (`render.py`), the shared request helpers (`helpers.py`) and the VM
|
|
185
|
-
`billing_catalog` convenience (`billing_selection.py`).
|
|
222
|
+
`billing_catalog` convenience (`billing_selection.py`). `buckets objects upload` is
|
|
223
|
+
generated too; it calls the SDK's `upload_file`.
|
|
186
224
|
|
|
187
225
|
CI runs the tests on Python 3.10-3.12 with the ibee-python branch of the same name (or
|
|
188
226
|
ibee from PyPI), and the "SDK drift" check against ibee from PyPI (once a release in
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
# IBEE Solutions CLI
|
|
2
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
3
|
Official command-line interface for the IBEE Solutions cloud platform, built on the
|
|
9
4
|
[`ibee` Python SDK](https://github.com/devs-ibee/ibee-python). It has one command per
|
|
10
|
-
operation of the IBEE public API (contract 0.
|
|
5
|
+
operation of the IBEE public API (contract 0.14.3, 222 operations): each command makes
|
|
11
6
|
that operation's one SDK call and prints the server's answer. The server decides
|
|
12
7
|
prices, eligibility, limits and states; the CLI checks nothing before sending.
|
|
13
8
|
|
|
9
|
+
The API manages resources. Data stays on each product's own endpoint, with the
|
|
10
|
+
clients that already exist for it: files over the S3 API
|
|
11
|
+
(`<workspace>.blob.ibeestorage.com`, any S3 tool such as `aws s3` or `rclone`, or one
|
|
12
|
+
file at a time with `ibee buckets objects upload` and an upload or download link),
|
|
13
|
+
container images with `docker` at `registry.ibee.ai`, and secret values with `bao` or
|
|
14
|
+
`vault` at your Secret Manager endpoint.
|
|
15
|
+
|
|
14
16
|
## Installation
|
|
15
17
|
|
|
16
18
|
```bash
|
|
@@ -35,7 +37,7 @@ sent as every operation's `workspace_id`.
|
|
|
35
37
|
|
|
36
38
|
`ibee --help` lists the groups (`vms`, `gpus`, `ops`, `compute`, `block-storage`,
|
|
37
39
|
`buckets`, `cdn`, `secrets`, `vpcs`, `reserved-ips`, `firewalls`, `load-balancers`,
|
|
38
|
-
`registries`); [COMMANDS.md](COMMANDS.md) lists every command with its API operation,
|
|
40
|
+
`registries`, `billing`); [COMMANDS.md](COMMANDS.md) lists every command with its API operation,
|
|
39
41
|
and `ibee COMMAND --help` shows each option's description from the contract.
|
|
40
42
|
|
|
41
43
|
Every command follows the contract, field for field:
|
|
@@ -60,13 +62,20 @@ ibee vms create --name web-1 --site-id SITE_ID --plan-id PLAN_ID --template-id I
|
|
|
60
62
|
--billing-interval HOURLY --ssh-keys "$(cat ~/.ssh/id_ed25519.pub)"
|
|
61
63
|
ibee ops get OPERATION_ID
|
|
62
64
|
ibee vms list --limit 20
|
|
63
|
-
ibee vms resize VM_ID --cpu 4 --ram-mb 8192
|
|
65
|
+
ibee vms resize VM_ID --cpu 4 --ram-mb 8192 --disk-gb 80 --plan-id PLAN_ID --billing-interval HOURLY
|
|
66
|
+
ibee billing wallet
|
|
64
67
|
ibee vms delete VM_ID --public-ip-action release --yes
|
|
65
68
|
|
|
66
69
|
ibee buckets create --name assets --region in-south-2
|
|
67
70
|
ibee buckets cors set assets --rules @cors.json
|
|
68
71
|
ibee buckets credentials create --name ci --permission-type object_rw
|
|
69
|
-
ibee
|
|
72
|
+
ibee buckets objects upload assets docs/report.pdf ./report.pdf --content-type application/pdf
|
|
73
|
+
ibee buckets objects metadata assets docs/report.pdf
|
|
74
|
+
ibee buckets objects download-link assets docs/report.pdf --expires 600 --disposition attachment
|
|
75
|
+
ibee load-balancers list --include-deleted
|
|
76
|
+
ibee secrets credentials create --name ci --access read --folder apps
|
|
77
|
+
ibee secrets update apps/billing/db --custom-metadata '{"owner": "billing"}'
|
|
78
|
+
ibee load-balancers regions
|
|
70
79
|
ibee registries tokens create REGISTRY_ID --token-name ci-push --permission PULL_PUSH
|
|
71
80
|
```
|
|
72
81
|
|
|
@@ -81,6 +90,23 @@ exactly as the portal does. Nothing else is filled in: CPU, RAM, disk, OS and th
|
|
|
81
90
|
other fields are sent as you give them. `MONTHLY` is a one-month commitment (the API
|
|
82
91
|
answers `409 VM_COMMITTED` to a delete or resize before it ends).
|
|
83
92
|
|
|
93
|
+
`vms resize` and `gpus resize` move a VM to another plan. Send the target plan's exact
|
|
94
|
+
`--cpu`, `--ram-mb` and `--disk-gb`, and its `billing_catalog`: `--billing-catalog JSON`,
|
|
95
|
+
or `--plan-id PLAN_ID --billing-interval HOURLY|MONTHLY` to build it the same way from
|
|
96
|
+
`GET /compute/plans`. A resize body has no plan field, so `--plan-id` is only used for
|
|
97
|
+
this lookup and is not sent.
|
|
98
|
+
|
|
99
|
+
### One file: `buckets objects upload`
|
|
100
|
+
|
|
101
|
+
`ibee buckets objects upload BUCKET_NAME OBJECT_PATH FILE` (`-` reads stdin) uploads
|
|
102
|
+
one file with an upload link: the SDK's `upload_file` computes the file's size and
|
|
103
|
+
SHA-256, asks for the link (`createObjectUploadLink`) and PUTs the file to it on the
|
|
104
|
+
workspace's S3 host; the API token is not sent there. It prints the key, size, SHA-256
|
|
105
|
+
and ETag; `buckets objects metadata` shows what was stored. One link carries one whole
|
|
106
|
+
file of at most 80,000,000 bytes (the server's limit); use an S3 tool for larger
|
|
107
|
+
files. `buckets objects upload-link`, `download-link` and `metadata` are the plain
|
|
108
|
+
operations.
|
|
109
|
+
|
|
84
110
|
## Global options
|
|
85
111
|
|
|
86
112
|
| Option | Environment variable | Meaning |
|
|
@@ -102,10 +128,9 @@ The server's answer is printed as JSON by default. `-o yaml` prints it as YAML,
|
|
|
102
128
|
`-o table` as a table (one row per item of a list, or one row per field of an
|
|
103
129
|
object) and `-o id` one identifier per line (for a list, the value the API takes for
|
|
104
130
|
each item, such as a bucket's name). An empty answer (HTTP 204) prints nothing.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
detach) ask for confirmation; `--yes` (or the global `--yes`) skips it.
|
|
131
|
+
Destructive commands (every delete and revoke, `buckets credentials revoke`, `cdn purge`,
|
|
132
|
+
VM restores and volume detach, `secrets versions destroy` and `secrets workspace enable`,
|
|
133
|
+
which can't be undone) ask for confirmation; `--yes` (or the global `--yes`) skips it.
|
|
109
134
|
|
|
110
135
|
## Errors
|
|
111
136
|
|
|
@@ -118,6 +143,18 @@ Error: HTTP 409
|
|
|
118
143
|
request_id: 6f1c2e...
|
|
119
144
|
```
|
|
120
145
|
|
|
146
|
+
A Billing refusal adds `reason` (`billing_reason`) and, with
|
|
147
|
+
`initial_topup_required`, Billing's first top-up minimum:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
Error: HTTP 402
|
|
151
|
+
code: billing_denied
|
|
152
|
+
reason: initial_topup_required
|
|
153
|
+
required_topup_minor: 50000
|
|
154
|
+
billing_currency: INR
|
|
155
|
+
message: Add at least ₹500 to your wallet ...
|
|
156
|
+
```
|
|
157
|
+
|
|
121
158
|
With `-o json` the same fields, plus the raw `body`, are printed on stderr as
|
|
122
159
|
`{"error": {...}}`. A success answer the SDK cannot read (it does not match the
|
|
123
160
|
contract) is printed the same way, as received, with exit code 1.
|
|
@@ -156,7 +193,8 @@ The command modules in `src/ibee_cli/commands/` and `COMMANDS.md` are generated
|
|
|
156
193
|
`scripts/generate_commands.py`; after updating the contract, run the script and commit
|
|
157
194
|
what it writes. The hand-written parts are the global options (`context.py`), output
|
|
158
195
|
and errors (`render.py`), the shared request helpers (`helpers.py`) and the VM
|
|
159
|
-
`billing_catalog` convenience (`billing_selection.py`).
|
|
196
|
+
`billing_catalog` convenience (`billing_selection.py`). `buckets objects upload` is
|
|
197
|
+
generated too; it calls the SDK's `upload_file`.
|
|
160
198
|
|
|
161
199
|
CI runs the tests on Python 3.10-3.12 with the ibee-python branch of the same name (or
|
|
162
200
|
ibee from PyPI), and the "SDK drift" check against ibee from PyPI (once a release in
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ibee-cli"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.10.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.
|
|
21
|
+
"ibee>=0.10.0,<0.11",
|
|
22
22
|
"httpx>=0.27",
|
|
23
23
|
"typer>=0.12",
|
|
24
24
|
"click>=8.1",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""The CLI's one convenience: a VM create's ``billing_catalog`` from ``GET /compute/plans``.
|
|
1
|
+
"""The CLI's one convenience: a VM create's or resize's ``billing_catalog`` from ``GET /compute/plans``.
|
|
2
2
|
|
|
3
3
|
The contract's ``ComputeBillingSelection`` (``billing_catalog`` of ``POST
|
|
4
4
|
/compute/cloud-vms`` and ``POST /compute/gpu-vms``) is the chosen plan's
|
|
@@ -9,8 +9,10 @@ the server's own data, as the portal does: read the ``--plan-id`` plan from ``GE
|
|
|
9
9
|
``billing_catalog`` and merge in the whole ``billing_options`` entry whose
|
|
10
10
|
``billing_interval`` is the one asked for (``billing_interval``, ``committed``,
|
|
11
11
|
``commitment_period``, ``commitment_months``, ``committed_hours``, ``price_unit``,
|
|
12
|
-
``unit_price_minor``...), keeping the catalog's ``price_currency``.
|
|
13
|
-
|
|
12
|
+
``unit_price_minor``...), keeping the catalog's ``price_currency``. ``vms resize`` and
|
|
13
|
+
``gpus resize`` (contract 0.10.0) do the same for the target plan named by their
|
|
14
|
+
CLI-only ``--plan-id``, read from ``GET /compute/plans`` without a site filter. Nothing
|
|
15
|
+
is invented or checked here: the server validates the selection and decides the price.
|
|
14
16
|
"""
|
|
15
17
|
|
|
16
18
|
from __future__ import annotations
|
|
@@ -41,6 +43,8 @@ def vm_billing_catalog(
|
|
|
41
43
|
"billing_catalog is required: pass --billing-interval HOURLY|MONTHLY (built from the plan in "
|
|
42
44
|
"GET /compute/plans) or --billing-catalog JSON."
|
|
43
45
|
)
|
|
46
|
+
if not plan_id:
|
|
47
|
+
fail_usage("--billing-interval needs --plan-id: the plan whose billing_catalog is sent.")
|
|
44
48
|
interval = str(billing_interval).strip().upper()
|
|
45
49
|
answer = client.compute_catalog.list_compute_plans(
|
|
46
50
|
workspace_id=workspace_id, vm_type=vm_type, **({"site_id": site_id} if site_id else {})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Generated by scripts/generate_commands.py from contract/ibee-cloud.yaml (IBEE Solutions API 0.
|
|
1
|
+
# Generated by scripts/generate_commands.py from contract/ibee-cloud.yaml (IBEE Solutions API 0.14.3).
|
|
2
2
|
# Do not edit by hand: change the contract or the generator and run the script again.
|
|
3
3
|
"""The command groups, in `ibee --help` order."""
|
|
4
4
|
|
|
5
|
-
from . import block_storage, buckets, cdn, compute, firewalls, gpus, load_balancers, ops, registries, reserved_ips, secrets, vms, vpcs
|
|
5
|
+
from . import billing, block_storage, buckets, cdn, compute, firewalls, gpus, load_balancers, ops, registries, reserved_ips, secrets, vms, vpcs
|
|
6
6
|
|
|
7
7
|
#: (CLI name, Typer app) of every command group.
|
|
8
8
|
GROUPS = [
|
|
@@ -19,4 +19,5 @@ GROUPS = [
|
|
|
19
19
|
('firewalls', firewalls.app),
|
|
20
20
|
('load-balancers', load_balancers.app),
|
|
21
21
|
('registries', registries.app),
|
|
22
|
+
('billing', billing.app),
|
|
22
23
|
]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Generated by scripts/generate_commands.py from contract/ibee-cloud.yaml (IBEE Solutions API 0.14.3).
|
|
2
|
+
# Do not edit by hand: change the contract or the generator and run the script again.
|
|
3
|
+
"""``ibee billing``: Organization wallet balance and top-ups (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, sdk, workspace
|
|
12
|
+
from ..render import emit, handle_api_errors
|
|
13
|
+
|
|
14
|
+
app = typer.Typer(help='Organization wallet balance and top-ups', no_args_is_help=True)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@app.command('wallet', help="Get the organization wallet.\n\nReturns the wallet balance of the API token's organization. Amounts are integers in the currency's minor unit (paise for INR, cents for USD). The wallet belongs to the organization, so any workspace of the organization returns the same wallet. Read-only: an organization without a wallet gets 404 `wallet_not_found` and nothing is created. The token's principal also needs permission to view the organization's billing. Requires scope: billing.read.\n\nAPI: GET /billing/wallet (getBillingWallet).", short_help='Get the organization wallet')
|
|
18
|
+
@handle_api_errors
|
|
19
|
+
def get_billing_wallet(
|
|
20
|
+
ctx: typer.Context,
|
|
21
|
+
) -> None:
|
|
22
|
+
client = sdk(ctx)
|
|
23
|
+
result = client.billing.get_billing_wallet(**compact(workspace_id=workspace(ctx)))
|
|
24
|
+
emit(result)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@app.command('topup', help="Create a wallet top-up link.\n\nCreates a hosted payment page (Stripe Checkout or a Razorpay Payment Link) that adds `amount_minor` to the API token's organization wallet once the customer pays. Open `checkout_url` in a browser; nothing is charged until the customer pays there, and the wallet is credited only after the payment succeeds (poll `GET /billing/wallet` to confirm). The gateway and currency follow the organization's billing profile. Billing applies its minimums and refuses a frozen or closed wallet, an organization that is not billed, or (first top-up) an amount below the first top-up minimum: 422 `topup_rejected` with Billing's `message`. An organization without a wallet gets 404 `wallet_not_found`; no wallet is created. The token's principal also needs permission to manage the organization's billing; a restricted or suspended organization can still top up. Requires scope: billing.topup.\n\nAPI: POST /billing/topups (createBillingTopup).", short_help='Create a wallet top-up link')
|
|
28
|
+
@handle_api_errors
|
|
29
|
+
def create_billing_topup(
|
|
30
|
+
ctx: typer.Context,
|
|
31
|
+
amount_minor: int = typer.Option(..., '--amount-minor', show_default=False, help="Amount to add, an integer in the wallet currency's minor unit (paise for INR, cents for USD). Billing applies its minimum."),
|
|
32
|
+
idempotency_key: Optional[str] = typer.Option(None, '--idempotency-key', show_default=False, help="Retry key for this top-up, scoped to the organization's wallet. A repeated key returns the payment link (and amount) it first created. Without a key, every call creates a new payment link."),
|
|
33
|
+
) -> None:
|
|
34
|
+
client = sdk(ctx)
|
|
35
|
+
result = client.billing.create_billing_topup(
|
|
36
|
+
**compact(
|
|
37
|
+
workspace_id=workspace(ctx),
|
|
38
|
+
amount_minor=amount_minor,
|
|
39
|
+
idempotency_key=idempotency_key,
|
|
40
|
+
),
|
|
41
|
+
)
|
|
42
|
+
emit(result)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Generated by scripts/generate_commands.py from contract/ibee-cloud.yaml (IBEE Solutions API 0.
|
|
1
|
+
# Generated by scripts/generate_commands.py from contract/ibee-cloud.yaml (IBEE Solutions API 0.14.3).
|
|
2
2
|
# Do not edit by hand: change the contract or the generator and run the script again.
|
|
3
3
|
"""``ibee block-storage``: Block Storage volumes and plans (one command per contract operation)."""
|
|
4
4
|
|