proxy-platform 0.3.3__tar.gz → 0.3.5__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.
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/PKG-INFO +1 -1
- proxy_platform-0.3.5/README.md +429 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform/__init__.py +1 -1
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform/client.py +16 -6
- proxy_platform-0.3.5/proxy_platform/commands/__init__.py +1 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform/commands/auth.py +2 -2
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform/commands/clusters.py +3 -2
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform/commands/deployments.py +2 -2
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform/commands/feedback.py +17 -17
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform/commands/orders.py +7 -7
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform/commands/products.py +4 -2
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform/commands/support.py +10 -10
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform/config.py +1 -1
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform/main.py +4 -4
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform/main_public.py +1 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform.egg-info/PKG-INFO +1 -1
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/pyproject.toml +1 -1
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/tests/test_main.py +1 -1
- proxy_platform-0.3.3/README.md +0 -378
- proxy_platform-0.3.3/proxy_platform/commands/__init__.py +0 -1
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/README.public.md +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform/commands/firewalls.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform/commands/users.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform.egg-info/SOURCES.txt +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform.egg-info/dependency_links.txt +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform.egg-info/entry_points.txt +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform.egg-info/requires.txt +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/proxy_platform.egg-info/top_level.txt +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/setup.cfg +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/setup.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/tests/test_admin_feedback.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/tests/test_auth.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/tests/test_client.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/tests/test_clusters.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/tests/test_config.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/tests/test_deployments.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/tests/test_dev.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/tests/test_feedback.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/tests/test_firewalls.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/tests/test_orders.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/tests/test_products.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.5}/tests/test_users.py +0 -0
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
# Proxy Platform CLI (internal)
|
|
2
|
+
|
|
3
|
+
A command-line client for interacting with the Proxy Platform.
|
|
4
|
+
|
|
5
|
+
## Distributions
|
|
6
|
+
|
|
7
|
+
This repository produces **two separate packages** from a single codebase. They can be installed side-by-side because they have different package names and CLI commands:
|
|
8
|
+
|
|
9
|
+
| Package | CLI command | Entry point | Audience | Admin commands | Environments |
|
|
10
|
+
|---------|-------------|-------------|----------|----------------|--------------|
|
|
11
|
+
| `proxy-platform-internal` | `proxy-platform-admin` | `proxy_platform.main:app` | Proxy employees | ✅ Included | All (dev/test/acc/prod) |
|
|
12
|
+
| `proxy-platform` (PyPI) | `proxy-platform` | `proxy_platform.main_public:app` | End users / customers | ❌ Excluded | Production only (hardcoded) |
|
|
13
|
+
|
|
14
|
+
As a Proxy employee you can install **both** at the same time — one for your daily work, the other to reproduce what customers see.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- 🔐 **Authentication** - Login, logout, and manage API tokens (with OTP/2FA support)
|
|
19
|
+
- 🌍 **Multi-environment** - Switch between development, test, acceptance, and production
|
|
20
|
+
- 🎯 **Dual API Support** - Separate Admin and User commands for clear access control
|
|
21
|
+
- 🖥️ **Cluster Management** - List, inspect, rename, delete, kubeconfig, and etcd key
|
|
22
|
+
- 🛒 **Orders & Payments** - Guided or fully non-interactive order creation
|
|
23
|
+
- 🔥 **Firewall Management** - Create and manage firewall rules
|
|
24
|
+
- 🎫 **Support Tickets** - Submit and track support requests
|
|
25
|
+
- 💬 **Feedback Portal** - Submit feature requests and vote on community feedback
|
|
26
|
+
- 📊 **Rich Output** - Beautiful tables and formatted output
|
|
27
|
+
- 🚀 **Easy to Use** - Intuitive command structure with shell completion
|
|
28
|
+
- 💾 **Token Storage** - Secure token management in `~/.proxy-platform/`
|
|
29
|
+
- 🐛 **Debug Mode** - Verbose logging with `--verbose` flag
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
### Proxy employees: install the internal CLI
|
|
34
|
+
|
|
35
|
+
The internal CLI lives in this repo and is installed via `dev-env.sh` (or manually):
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Via dev-env.sh (recommended — handles upgrades)
|
|
39
|
+
./dev-env.sh # menu option "Install/update Proxy Platform CLI"
|
|
40
|
+
|
|
41
|
+
# Or manually with pipx (recommended for macOS)
|
|
42
|
+
pipx install -e /path/to/pbd-api-client
|
|
43
|
+
|
|
44
|
+
# Or with pip
|
|
45
|
+
pip install -e /path/to/pbd-api-client
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
After installation the command is `proxy-platform-admin`:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
proxy-platform-admin --help
|
|
52
|
+
proxy-platform-admin login --api admin
|
|
53
|
+
proxy-platform-admin admin clusters
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Proxy employees: also install the public CLI
|
|
57
|
+
|
|
58
|
+
Useful for reproducing what customers see. The PyPI version is locked to production:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pipx install proxy-platform
|
|
62
|
+
proxy-platform-admin --help # no `admin`, no `env` — production only
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
You can have both installed at the same time — different commands, different config (`~/.proxy-platform/` is shared but the public build only writes the `production` environment).
|
|
66
|
+
|
|
67
|
+
### Customers
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pipx install proxy-platform
|
|
71
|
+
proxy-platform login
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Development setup
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
cd pbd-api-client
|
|
78
|
+
pip install -e ".[dev]"
|
|
79
|
+
pre-commit install
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This installs the internal version (with admin) plus all dev tools, and activates the pre-commit hooks.
|
|
83
|
+
|
|
84
|
+
To test the public entry point locally:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
python -m proxy_platform.main_public
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Pre-commit hooks
|
|
91
|
+
|
|
92
|
+
The following checks run automatically on every commit:
|
|
93
|
+
|
|
94
|
+
| Hook | When | What |
|
|
95
|
+
|------|------|------|
|
|
96
|
+
| ruff (lint + format) | Python files changed | Code style and formatting |
|
|
97
|
+
| mypy | Python files changed | Type checking |
|
|
98
|
+
| bandit | `proxy_platform/` files changed | Static security analysis |
|
|
99
|
+
| pip-audit | `pyproject*.toml` changed | Known CVEs in dependencies |
|
|
100
|
+
| conventional-commit | Every commit | Commit message format |
|
|
101
|
+
|
|
102
|
+
If a hook blocks your commit, fix the reported issue and commit again. To run all hooks manually:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pre-commit run --all-files
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Enable Shell Completion (Recommended)
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
proxy-platform-admin --install-completion
|
|
112
|
+
source ~/.zshrc # or ~/.bashrc
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Quick Start
|
|
116
|
+
|
|
117
|
+
### 1. Set Environment
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
proxy-platform-admin env production # Switch to production
|
|
121
|
+
proxy-platform-admin env development # Switch to local dev
|
|
122
|
+
proxy-platform-admin env --show # Show current environment
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 2. Login
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
proxy-platform-admin login
|
|
129
|
+
proxy-platform-admin login --email user@example.com --password mypassword
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
If your account has 2FA enabled, you'll be prompted for your OTP code automatically.
|
|
133
|
+
|
|
134
|
+
### 3. Deploy a Cluster
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Interactive (guided, recommended)
|
|
138
|
+
proxy-platform-admin orders create
|
|
139
|
+
|
|
140
|
+
# Fully non-interactive (all flags provided)
|
|
141
|
+
proxy-platform-admin orders create --tier "Starter Kit" --provider hetzner --region nbg1 --firewall "My firewall" --yes
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
After payment, your cluster is deployed automatically. Check status with:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
proxy-platform-admin clusters list
|
|
148
|
+
proxy-platform-admin clusters get <cluster-id>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Commands Reference
|
|
152
|
+
|
|
153
|
+
### Authentication
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
proxy-platform-admin login [--email EMAIL] [--password PASSWORD] [--api admin|user]
|
|
157
|
+
proxy-platform-admin logout
|
|
158
|
+
proxy-platform-admin whoami [--api admin|user]
|
|
159
|
+
proxy-platform-admin auth switch admin
|
|
160
|
+
proxy-platform-admin auth switch user
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Clusters
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# List your clusters
|
|
167
|
+
proxy-platform-admin clusters list [--limit 10]
|
|
168
|
+
|
|
169
|
+
# Get cluster details
|
|
170
|
+
proxy-platform-admin clusters get <cluster-id>
|
|
171
|
+
|
|
172
|
+
# Rename a cluster (sets display name)
|
|
173
|
+
proxy-platform-admin clusters rename <cluster-id> --name "My cluster"
|
|
174
|
+
|
|
175
|
+
# Delete a cluster (shows what will be deleted, asks confirmation)
|
|
176
|
+
proxy-platform-admin clusters delete <cluster-id>
|
|
177
|
+
proxy-platform-admin clusters delete <cluster-id> --yes # Skip confirmation
|
|
178
|
+
|
|
179
|
+
# Download kubeconfig
|
|
180
|
+
proxy-platform-admin clusters kubeconfig <cluster-id>
|
|
181
|
+
proxy-platform-admin clusters kubeconfig <cluster-id> --output ~/.kube/config
|
|
182
|
+
|
|
183
|
+
# Show etcd encryption key
|
|
184
|
+
proxy-platform-admin clusters etcd-key <cluster-id>
|
|
185
|
+
|
|
186
|
+
# Get deployment info for a cluster
|
|
187
|
+
proxy-platform-admin clusters deployment <cluster-id>
|
|
188
|
+
|
|
189
|
+
# Get firewall attached to a cluster
|
|
190
|
+
proxy-platform-admin clusters firewall <cluster-id>
|
|
191
|
+
|
|
192
|
+
# Assign or change the firewall on a cluster
|
|
193
|
+
proxy-platform-admin clusters assign-firewall <cluster-id> --firewall "My firewall"
|
|
194
|
+
proxy-platform-admin clusters assign-firewall <cluster-id> # interactive selection
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Orders & Payments
|
|
198
|
+
|
|
199
|
+
Deployments are triggered automatically after successful payment.
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# Create an order (interactive when no flags given)
|
|
203
|
+
proxy-platform-admin orders create
|
|
204
|
+
|
|
205
|
+
# Non-interactive (all steps via flags)
|
|
206
|
+
proxy-platform-admin orders create \
|
|
207
|
+
--tier "Starter Kit" \
|
|
208
|
+
--provider hetzner \
|
|
209
|
+
--region nbg1 \
|
|
210
|
+
--firewall "My firewall" \
|
|
211
|
+
--yes
|
|
212
|
+
|
|
213
|
+
# Available flags:
|
|
214
|
+
# --product -p Product ID (auto-selects if only one available)
|
|
215
|
+
# --tier -t Pricing tier name or ID
|
|
216
|
+
# --provider Cloud provider (hetzner)
|
|
217
|
+
# --region -r Region code (nbg1, fsn1, hel1, ash)
|
|
218
|
+
# --firewall -f Firewall name or ID
|
|
219
|
+
# --no-firewall Deploy without firewall
|
|
220
|
+
# --yes -y Accept terms without prompting
|
|
221
|
+
|
|
222
|
+
# List your orders
|
|
223
|
+
proxy-platform-admin orders list [--limit 10]
|
|
224
|
+
|
|
225
|
+
# Get order details
|
|
226
|
+
proxy-platform-admin orders get <order-id>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
In **development mode**, payment is simulated automatically after order creation. In **production**, a Mollie payment URL is shown.
|
|
230
|
+
|
|
231
|
+
### Firewalls
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# List all firewalls
|
|
235
|
+
proxy-platform-admin firewall list
|
|
236
|
+
|
|
237
|
+
# Get firewall details (including rules)
|
|
238
|
+
proxy-platform-admin firewall get <firewall-id>
|
|
239
|
+
|
|
240
|
+
# Get firewall by name
|
|
241
|
+
proxy-platform-admin firewall by-name <firewall-name>
|
|
242
|
+
|
|
243
|
+
# Create a firewall
|
|
244
|
+
proxy-platform-admin firewall create --name my-firewall --description "Production firewall"
|
|
245
|
+
|
|
246
|
+
# Update a firewall
|
|
247
|
+
proxy-platform-admin firewall update <firewall-id> --name new-name
|
|
248
|
+
|
|
249
|
+
# Delete a firewall
|
|
250
|
+
proxy-platform-admin firewall delete <firewall-id>
|
|
251
|
+
proxy-platform-admin firewall delete <firewall-id> --force # Skip confirmation
|
|
252
|
+
|
|
253
|
+
# List clusters using a firewall
|
|
254
|
+
proxy-platform-admin firewall clusters <firewall-id>
|
|
255
|
+
|
|
256
|
+
# Firewall rules
|
|
257
|
+
proxy-platform-admin firewall rules list <firewall-id>
|
|
258
|
+
proxy-platform-admin firewall rules create <firewall-id> --direction inbound --protocol tcp --port-min 443 --port-max 443 --remote-ip 0.0.0.0/0
|
|
259
|
+
proxy-platform-admin firewall rules delete <firewall-id> <rule-id>
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Products
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
proxy-platform-admin products list [--limit 50]
|
|
266
|
+
proxy-platform-admin products get <product-id>
|
|
267
|
+
proxy-platform-admin products get f25bea71 # Partial IDs are resolved automatically
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Users
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
proxy-platform-admin users profile
|
|
274
|
+
proxy-platform-admin users stats
|
|
275
|
+
proxy-platform-admin users activities [--limit 10]
|
|
276
|
+
proxy-platform-admin users orders [--limit 10]
|
|
277
|
+
proxy-platform-admin users verification
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Support
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
proxy-platform-admin support submit --subject "Cannot access cluster" --description "Getting 403 error" --category technical
|
|
284
|
+
proxy-platform-admin support list [--category technical] [--status open]
|
|
285
|
+
proxy-platform-admin support get <ticket-id>
|
|
286
|
+
proxy-platform-admin support reply <ticket-id> --content "Additional info"
|
|
287
|
+
proxy-platform-admin support close <ticket-id> [--yes]
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Valid categories: `general`, `billing`, `technical`, `other`
|
|
291
|
+
Valid statuses: `open`, `in_progress`, `closed`
|
|
292
|
+
|
|
293
|
+
### Feedback
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
proxy-platform-admin feedback submit --title "Feature request" --description "..." --category feature
|
|
297
|
+
proxy-platform-admin feedback list [--category feature] [--status open]
|
|
298
|
+
proxy-platform-admin feedback get <feedback-id>
|
|
299
|
+
proxy-platform-admin feedback vote <feedback-id>
|
|
300
|
+
proxy-platform-admin feedback unvote <feedback-id>
|
|
301
|
+
proxy-platform-admin feedback comment <feedback-id> --content "I need this too"
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Admin Commands (Proxy employees only)
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
proxy-platform-admin admin login
|
|
308
|
+
proxy-platform-admin admin clusters [--limit 10]
|
|
309
|
+
proxy-platform-admin admin users [--limit 50] [--search "email@example.com"]
|
|
310
|
+
proxy-platform-admin admin orders [--limit 50] [--status paid]
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Admin and user sessions are independent — you can be logged in as both simultaneously.
|
|
314
|
+
|
|
315
|
+
### Development Commands (Local only)
|
|
316
|
+
|
|
317
|
+
These commands are blocked outside the `development` environment.
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
proxy-platform-admin dev simulate-payment <order-id> [--status paid|failed]
|
|
321
|
+
proxy-platform-admin dev trigger-deployment <order-id>
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Environment
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
proxy-platform-admin env development
|
|
328
|
+
proxy-platform-admin env test
|
|
329
|
+
proxy-platform-admin env acceptance
|
|
330
|
+
proxy-platform-admin env production
|
|
331
|
+
proxy-platform-admin env --show
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### General
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
proxy-platform-admin version
|
|
338
|
+
proxy-platform-admin --help
|
|
339
|
+
proxy-platform-admin clusters --help
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
## Environment Configuration
|
|
343
|
+
|
|
344
|
+
| Environment | Admin API | User API |
|
|
345
|
+
|-------------|-----------|----------|
|
|
346
|
+
| **development** | http://localhost:8001 | http://localhost:8002 |
|
|
347
|
+
| **test** | https://admin-api.tst.pbd.proxy.nl | https://api.tst.pbd.proxy.nl |
|
|
348
|
+
| **acceptance** | https://admin-api.acc.pbd.proxy.nl | https://api.acc.pbd.proxy.nl |
|
|
349
|
+
| **production** | https://admin-api.prd.pbd.proxy.nl | https://api.platform.proxy.nl |
|
|
350
|
+
|
|
351
|
+
## Configuration
|
|
352
|
+
|
|
353
|
+
Tokens and settings are stored in `~/.proxy-platform/`:
|
|
354
|
+
|
|
355
|
+
```
|
|
356
|
+
~/.proxy-platform/
|
|
357
|
+
├── config.json # Environment and default API settings
|
|
358
|
+
└── tokens.json # Authentication tokens (per environment, 0600)
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
## Project Structure
|
|
362
|
+
|
|
363
|
+
```
|
|
364
|
+
pbd-api-client/
|
|
365
|
+
├── pyproject.toml # Internal distribution (proxy-platform, includes admin)
|
|
366
|
+
├── pyproject.public.toml # Public distribution (proxy-platform-public, no admin)
|
|
367
|
+
└── proxy_platform/
|
|
368
|
+
├── main.py # Internal CLI entry point
|
|
369
|
+
├── main_public.py # Public CLI entry point (no admin)
|
|
370
|
+
├── config.py
|
|
371
|
+
├── client.py
|
|
372
|
+
└── commands/
|
|
373
|
+
├── auth.py
|
|
374
|
+
├── clusters.py
|
|
375
|
+
├── feedback.py
|
|
376
|
+
├── firewalls.py
|
|
377
|
+
├── orders.py
|
|
378
|
+
├── products.py
|
|
379
|
+
├── support.py
|
|
380
|
+
├── users.py
|
|
381
|
+
└── admin/ # Only included in proxy-platform-admin (internal)
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
## Troubleshooting
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
# Debug mode — shows all API calls and responses
|
|
388
|
+
proxy-platform-admin --verbose <command>
|
|
389
|
+
|
|
390
|
+
# Re-authenticate
|
|
391
|
+
proxy-platform-admin logout && proxy-platform-admin login
|
|
392
|
+
|
|
393
|
+
# Check environment
|
|
394
|
+
proxy-platform-admin env --show
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
## Releasing
|
|
398
|
+
|
|
399
|
+
This repo produces two distributions: an internal package (`proxy-platform-internal` → GitLab registry) and a public PyPI package (`proxy-platform`).
|
|
400
|
+
|
|
401
|
+
**Public PyPI release (short version):**
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
# 1. Bump version in pyproject.public.toml and proxy_platform/__init__.py
|
|
405
|
+
|
|
406
|
+
# 2. Build using the public pyproject
|
|
407
|
+
rm -rf dist build *.egg-info
|
|
408
|
+
cp pyproject.toml /tmp/internal.bak
|
|
409
|
+
cp pyproject.public.toml pyproject.toml
|
|
410
|
+
python -m build
|
|
411
|
+
cp /tmp/internal.bak pyproject.toml
|
|
412
|
+
|
|
413
|
+
# 3. Verify (no admin code, clean metadata)
|
|
414
|
+
python -m zipfile -l dist/proxy_platform-*.whl | grep -i admin # must be empty
|
|
415
|
+
python -m twine check dist/*
|
|
416
|
+
|
|
417
|
+
# 4. Upload (needs ~/.pypirc with __token__ + project-scoped PyPI token)
|
|
418
|
+
twine upload dist/proxy_platform-*.whl dist/proxy_platform-*.tar.gz
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
**Full procedure** with pre-release checklist, what to verify, and lessons learned (yes, we've leaked stuff before): see [RELEASING.md](RELEASING.md).
|
|
422
|
+
|
|
423
|
+
## Requirements
|
|
424
|
+
|
|
425
|
+
- Python 3.11+
|
|
426
|
+
|
|
427
|
+
## License
|
|
428
|
+
|
|
429
|
+
Internal use only — Proxy Platform B.V.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
"""HTTP client for
|
|
1
|
+
"""HTTP client for the Proxy Platform APIs."""
|
|
2
2
|
|
|
3
3
|
import base64
|
|
4
4
|
import json
|
|
5
5
|
import logging
|
|
6
|
+
import sys
|
|
6
7
|
from datetime import datetime, timedelta
|
|
8
|
+
from pathlib import Path
|
|
7
9
|
from typing import Any
|
|
8
10
|
|
|
9
11
|
import requests
|
|
@@ -21,8 +23,16 @@ console = Console()
|
|
|
21
23
|
logger = logging.getLogger(__name__)
|
|
22
24
|
|
|
23
25
|
|
|
26
|
+
def _login_hint(api_type: str) -> str:
|
|
27
|
+
"""Return a login-command hint matching the CLI the user actually invoked."""
|
|
28
|
+
script = Path(sys.argv[0]).name if sys.argv and sys.argv[0] else ""
|
|
29
|
+
if script == "proxy-platform":
|
|
30
|
+
return "proxy-platform login"
|
|
31
|
+
return f"proxy-platform-admin login --api {api_type}"
|
|
32
|
+
|
|
33
|
+
|
|
24
34
|
class APIClient:
|
|
25
|
-
"""HTTP client for making authenticated requests to
|
|
35
|
+
"""HTTP client for making authenticated requests to the Proxy Platform APIs."""
|
|
26
36
|
|
|
27
37
|
def __init__(self, api_type: str | None = None):
|
|
28
38
|
"""Initialize the API client.
|
|
@@ -155,12 +165,12 @@ class APIClient:
|
|
|
155
165
|
if require_auth:
|
|
156
166
|
token = get_token(self.api_type)
|
|
157
167
|
if not token:
|
|
158
|
-
raise Exception(f"Not authenticated. Please run '
|
|
168
|
+
raise Exception(f"Not authenticated. Please run '{_login_hint(self.api_type)}' first.")
|
|
159
169
|
|
|
160
170
|
# Check if token is expired and try to refresh
|
|
161
171
|
if self._is_token_expired(token):
|
|
162
172
|
if not self._refresh_access_token():
|
|
163
|
-
raise Exception(f"Token expired. Please run '
|
|
173
|
+
raise Exception(f"Token expired. Please run '{_login_hint(self.api_type)}' to re-authenticate.")
|
|
164
174
|
|
|
165
175
|
url = f"{self.base_url}{endpoint}"
|
|
166
176
|
headers = self._get_headers()
|
|
@@ -240,12 +250,12 @@ class APIClient:
|
|
|
240
250
|
if require_auth:
|
|
241
251
|
token = get_token(self.api_type)
|
|
242
252
|
if not token:
|
|
243
|
-
raise Exception(f"Not authenticated. Please run '
|
|
253
|
+
raise Exception(f"Not authenticated. Please run '{_login_hint(self.api_type)}' first.")
|
|
244
254
|
|
|
245
255
|
# Check if token is expired and try to refresh
|
|
246
256
|
if self._is_token_expired(token):
|
|
247
257
|
if not self._refresh_access_token():
|
|
248
|
-
raise Exception(f"Token expired. Please run '
|
|
258
|
+
raise Exception(f"Token expired. Please run '{_login_hint(self.api_type)}' to re-authenticate.")
|
|
249
259
|
|
|
250
260
|
url = f"{self.base_url}{endpoint}"
|
|
251
261
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Command modules for Proxy Platform CLI."""
|
|
@@ -23,7 +23,7 @@ def login(
|
|
|
23
23
|
password: str | None = typer.Option(None, "--password", "-p", help="Password", hide_input=True),
|
|
24
24
|
api: str = typer.Option("user", "--api", "-a", help="API type (admin or user)"),
|
|
25
25
|
) -> None:
|
|
26
|
-
"""Login to the
|
|
26
|
+
"""Login to the the Proxy Platform API.
|
|
27
27
|
|
|
28
28
|
Authenticate and store the access token for future requests.
|
|
29
29
|
"""
|
|
@@ -79,7 +79,7 @@ def login(
|
|
|
79
79
|
|
|
80
80
|
@app.command()
|
|
81
81
|
def logout() -> None:
|
|
82
|
-
"""Logout from the
|
|
82
|
+
"""Logout from the the Proxy Platform API.
|
|
83
83
|
|
|
84
84
|
Clear stored authentication tokens.
|
|
85
85
|
"""
|
|
@@ -22,7 +22,7 @@ def list_clusters(
|
|
|
22
22
|
"""List your clusters.
|
|
23
23
|
|
|
24
24
|
Shows clusters owned by the authenticated user.
|
|
25
|
-
For admin view of all clusters, use:
|
|
25
|
+
For admin view of all clusters, use: proxy-platform admin clusters
|
|
26
26
|
"""
|
|
27
27
|
if api is None:
|
|
28
28
|
api = get_default_api_type()
|
|
@@ -188,7 +188,8 @@ def delete_cluster(
|
|
|
188
188
|
raise typer.Exit(1)
|
|
189
189
|
|
|
190
190
|
if not yes:
|
|
191
|
-
|
|
191
|
+
console.print("[bold red]This action is irreversible.[/bold red]")
|
|
192
|
+
if not typer.confirm("Continue?"):
|
|
192
193
|
console.print("[yellow]Deletion cancelled.[/yellow]")
|
|
193
194
|
raise typer.Exit(0)
|
|
194
195
|
|
|
@@ -25,7 +25,7 @@ def list_deployments(
|
|
|
25
25
|
"""List user deployments.
|
|
26
26
|
|
|
27
27
|
Deployments are created automatically after successful payment.
|
|
28
|
-
To create a new deployment, use:
|
|
28
|
+
To create a new deployment, use: proxy-platform orders create
|
|
29
29
|
"""
|
|
30
30
|
if api is None:
|
|
31
31
|
api = get_default_api_type()
|
|
@@ -42,7 +42,7 @@ def list_deployments(
|
|
|
42
42
|
console.print("[yellow]No deployments found[/yellow]")
|
|
43
43
|
console.print()
|
|
44
44
|
console.print("[cyan]Tip: Create an order to trigger a deployment:[/cyan]")
|
|
45
|
-
console.print("[cyan]
|
|
45
|
+
console.print("[cyan] proxy-platform orders create-interactive[/cyan]")
|
|
46
46
|
return
|
|
47
47
|
|
|
48
48
|
total = data.get("total", len(deployments))
|
|
@@ -28,8 +28,8 @@ def submit_feedback(
|
|
|
28
28
|
bug_report, feature_request, improvement, other.
|
|
29
29
|
|
|
30
30
|
Examples:
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
proxy-platform feedback submit --title "Login broken" --description "Cannot login" --category bug_report
|
|
32
|
+
proxy-platform feedback submit --title "Dark mode" --description "Please add dark mode" --category feature_request
|
|
33
33
|
"""
|
|
34
34
|
if api is None:
|
|
35
35
|
api = get_default_api_type()
|
|
@@ -93,10 +93,10 @@ def list_feedback(
|
|
|
93
93
|
or --status open to see only open items.
|
|
94
94
|
|
|
95
95
|
Examples:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
proxy-platform feedback list
|
|
97
|
+
proxy-platform feedback list --category bug_report
|
|
98
|
+
proxy-platform feedback list --status solved
|
|
99
|
+
proxy-platform feedback list --limit 50 --page 2
|
|
100
100
|
"""
|
|
101
101
|
if api is None:
|
|
102
102
|
api = get_default_api_type()
|
|
@@ -184,7 +184,7 @@ def get_feedback(
|
|
|
184
184
|
"""Get a single feedback item by ID, including comments and vote status.
|
|
185
185
|
|
|
186
186
|
Examples:
|
|
187
|
-
|
|
187
|
+
proxy-platform feedback get 550e8400-e29b-41d4-a716-446655440000
|
|
188
188
|
"""
|
|
189
189
|
if api is None:
|
|
190
190
|
api = get_default_api_type()
|
|
@@ -259,8 +259,8 @@ def update_feedback(
|
|
|
259
259
|
Status cannot be changed here — that is admin-only.
|
|
260
260
|
|
|
261
261
|
Examples:
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
proxy-platform feedback update <id> --title "Updated title"
|
|
263
|
+
proxy-platform feedback update <id> --category feature_request
|
|
264
264
|
"""
|
|
265
265
|
if api is None:
|
|
266
266
|
api = get_default_api_type()
|
|
@@ -332,8 +332,8 @@ def delete_feedback(
|
|
|
332
332
|
This action cannot be undone.
|
|
333
333
|
|
|
334
334
|
Examples:
|
|
335
|
-
|
|
336
|
-
|
|
335
|
+
proxy-platform feedback delete <id>
|
|
336
|
+
proxy-platform feedback delete <id> --yes
|
|
337
337
|
"""
|
|
338
338
|
if api is None:
|
|
339
339
|
api = get_default_api_type()
|
|
@@ -383,7 +383,7 @@ def vote_feedback(
|
|
|
383
383
|
Returns an error if you have already voted.
|
|
384
384
|
|
|
385
385
|
Examples:
|
|
386
|
-
|
|
386
|
+
proxy-platform feedback vote 550e8400-e29b-41d4-a716-446655440000
|
|
387
387
|
"""
|
|
388
388
|
if api is None:
|
|
389
389
|
api = get_default_api_type()
|
|
@@ -425,7 +425,7 @@ def unvote_feedback(
|
|
|
425
425
|
Returns an error if you have not voted on this item.
|
|
426
426
|
|
|
427
427
|
Examples:
|
|
428
|
-
|
|
428
|
+
proxy-platform feedback unvote 550e8400-e29b-41d4-a716-446655440000
|
|
429
429
|
"""
|
|
430
430
|
if api is None:
|
|
431
431
|
api = get_default_api_type()
|
|
@@ -468,7 +468,7 @@ def add_comment(
|
|
|
468
468
|
"""Add a comment to a feedback item.
|
|
469
469
|
|
|
470
470
|
Examples:
|
|
471
|
-
|
|
471
|
+
proxy-platform feedback comment <id> --content "This is a great idea!"
|
|
472
472
|
"""
|
|
473
473
|
if api is None:
|
|
474
474
|
api = get_default_api_type()
|
|
@@ -514,7 +514,7 @@ def update_comment(
|
|
|
514
514
|
Only the comment owner can edit their comment.
|
|
515
515
|
|
|
516
516
|
Examples:
|
|
517
|
-
|
|
517
|
+
proxy-platform feedback update-comment <feedback-id> <comment-id> --content "Updated comment"
|
|
518
518
|
"""
|
|
519
519
|
if api is None:
|
|
520
520
|
api = get_default_api_type()
|
|
@@ -563,8 +563,8 @@ def delete_comment(
|
|
|
563
563
|
This action cannot be undone.
|
|
564
564
|
|
|
565
565
|
Examples:
|
|
566
|
-
|
|
567
|
-
|
|
566
|
+
proxy-platform feedback delete-comment <feedback-id> <comment-id>
|
|
567
|
+
proxy-platform feedback delete-comment <feedback-id> <comment-id> --yes
|
|
568
568
|
"""
|
|
569
569
|
if api is None:
|
|
570
570
|
api = get_default_api_type()
|
|
@@ -154,8 +154,8 @@ def create_order(
|
|
|
154
154
|
Runs interactively when no flags are given. Supply flags to skip individual steps:
|
|
155
155
|
|
|
156
156
|
Example:
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
proxy-platform orders create
|
|
158
|
+
proxy-platform orders create --product f25bea71 --tier starter --provider hetzner --region nbg1 --no-firewall --yes
|
|
159
159
|
"""
|
|
160
160
|
try:
|
|
161
161
|
if api is None:
|
|
@@ -480,14 +480,14 @@ def create_order(
|
|
|
480
480
|
console.print(f"Deployment ID: [cyan]{deployment_id}[/cyan]")
|
|
481
481
|
console.print(f"Status: [yellow]{deployment_result.get('status', 'pending')}[/yellow]")
|
|
482
482
|
console.print()
|
|
483
|
-
console.print(f"[cyan]Check status:
|
|
484
|
-
console.print("[cyan]List clusters:
|
|
483
|
+
console.print(f"[cyan]Check status: proxy-platform clusters get {deployment_id}[/cyan]")
|
|
484
|
+
console.print("[cyan]List clusters: proxy-platform clusters list[/cyan]")
|
|
485
485
|
else:
|
|
486
486
|
console.print("[yellow]Payment succeeded but deployment not triggered automatically[/yellow]")
|
|
487
|
-
console.print(f"[cyan]Trigger manually:
|
|
487
|
+
console.print(f"[cyan]Trigger manually: proxy-platform dev trigger-deployment {order_id}[/cyan]")
|
|
488
488
|
else:
|
|
489
489
|
console.print(f"[red]Payment simulation failed: {pay_response.status_code}[/red]")
|
|
490
|
-
console.print(f"[cyan]Try manually:
|
|
490
|
+
console.print(f"[cyan]Try manually: proxy-platform dev simulate-payment {order_id}[/cyan]")
|
|
491
491
|
else:
|
|
492
492
|
payment_url = result.get("payment_url")
|
|
493
493
|
if payment_url:
|
|
@@ -498,7 +498,7 @@ def create_order(
|
|
|
498
498
|
console.print()
|
|
499
499
|
console.print("[dim]Your cluster will be deployed automatically after payment.[/dim]")
|
|
500
500
|
elif is_dev:
|
|
501
|
-
console.print(f"[cyan]To simulate payment:
|
|
501
|
+
console.print(f"[cyan]To simulate payment: proxy-platform dev simulate-payment {order_id}[/cyan]")
|
|
502
502
|
|
|
503
503
|
console.print()
|
|
504
504
|
|
|
@@ -64,7 +64,9 @@ def list_products(
|
|
|
64
64
|
console.print()
|
|
65
65
|
console.print(table)
|
|
66
66
|
console.print()
|
|
67
|
-
console.print(
|
|
67
|
+
console.print(
|
|
68
|
+
"[cyan]💡 To see full product ID for ordering, use: proxy-platform products get <partial-id>[/cyan]"
|
|
69
|
+
)
|
|
68
70
|
console.print()
|
|
69
71
|
else:
|
|
70
72
|
console.print(f"[red]Error: {response.status_code}[/red]")
|
|
@@ -134,7 +136,7 @@ def get_product(
|
|
|
134
136
|
|
|
135
137
|
console.print()
|
|
136
138
|
console.print(
|
|
137
|
-
f"[cyan]💡 To order:
|
|
139
|
+
f"[cyan]💡 To order: proxy-platform orders create {product.get('price', 0):.2f} --product {product.get('id')}[/cyan]"
|
|
138
140
|
)
|
|
139
141
|
console.print()
|
|
140
142
|
|
|
@@ -28,8 +28,8 @@ def submit_ticket(
|
|
|
28
28
|
general, billing, technical, other.
|
|
29
29
|
|
|
30
30
|
Examples:
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
proxy-platform support submit --subject "Cannot access cluster" --description "Getting 403 error" --category technical
|
|
32
|
+
proxy-platform support submit --subject "Invoice question" --description "Need clarification on invoice" --category billing
|
|
33
33
|
"""
|
|
34
34
|
if api is None:
|
|
35
35
|
api = get_default_api_type()
|
|
@@ -90,10 +90,10 @@ def list_tickets(
|
|
|
90
90
|
Shows your submitted support tickets. Supports filtering by category and status.
|
|
91
91
|
|
|
92
92
|
Examples:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
proxy-platform support list
|
|
94
|
+
proxy-platform support list --category technical
|
|
95
|
+
proxy-platform support list --status open
|
|
96
|
+
proxy-platform support list --page 2
|
|
97
97
|
"""
|
|
98
98
|
if api is None:
|
|
99
99
|
api = get_default_api_type()
|
|
@@ -176,7 +176,7 @@ def get_ticket(
|
|
|
176
176
|
"""View a support ticket with its full message thread.
|
|
177
177
|
|
|
178
178
|
Examples:
|
|
179
|
-
|
|
179
|
+
proxy-platform support get 550e8400-e29b-41d4-a716-446655440000
|
|
180
180
|
"""
|
|
181
181
|
if api is None:
|
|
182
182
|
api = get_default_api_type()
|
|
@@ -238,7 +238,7 @@ def reply_ticket(
|
|
|
238
238
|
"""Reply to a support ticket.
|
|
239
239
|
|
|
240
240
|
Examples:
|
|
241
|
-
|
|
241
|
+
proxy-platform support reply <id> --content "Here is the additional information you requested"
|
|
242
242
|
"""
|
|
243
243
|
if api is None:
|
|
244
244
|
api = get_default_api_type()
|
|
@@ -283,8 +283,8 @@ def close_ticket(
|
|
|
283
283
|
This marks the ticket as closed. Only the ticket owner can close their ticket.
|
|
284
284
|
|
|
285
285
|
Examples:
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
proxy-platform support close <id>
|
|
287
|
+
proxy-platform support close <id> --yes
|
|
288
288
|
"""
|
|
289
289
|
if api is None:
|
|
290
290
|
api = get_default_api_type()
|
|
@@ -12,8 +12,8 @@ from .commands.admin import app as admin_app
|
|
|
12
12
|
from .config import ENVIRONMENTS, get_current_environment, set_environment
|
|
13
13
|
|
|
14
14
|
app = typer.Typer(
|
|
15
|
-
name="
|
|
16
|
-
help="
|
|
15
|
+
name="proxy-platform-admin",
|
|
16
|
+
help="Proxy Platform CLI (internal) - includes admin commands",
|
|
17
17
|
add_completion=True,
|
|
18
18
|
)
|
|
19
19
|
console = Console()
|
|
@@ -58,7 +58,7 @@ def main_callback(
|
|
|
58
58
|
help="Enable verbose output with debug logging",
|
|
59
59
|
),
|
|
60
60
|
) -> None:
|
|
61
|
-
"""
|
|
61
|
+
"""Proxy Platform CLI (internal) - includes admin commands.
|
|
62
62
|
|
|
63
63
|
Use --verbose to see detailed debug output including API calls and responses.
|
|
64
64
|
"""
|
|
@@ -80,7 +80,7 @@ app.add_typer(admin_app, name="admin", help="Admin commands (for Proxy employees
|
|
|
80
80
|
@app.command()
|
|
81
81
|
def version() -> None:
|
|
82
82
|
"""Show CLI version."""
|
|
83
|
-
console.print(f"
|
|
83
|
+
console.print(f"Proxy Platform CLI version: [bold cyan]{__version__}[/bold cyan]")
|
|
84
84
|
|
|
85
85
|
|
|
86
86
|
@app.command()
|
|
@@ -9,6 +9,7 @@ from rich.logging import RichHandler
|
|
|
9
9
|
from . import __version__, config
|
|
10
10
|
|
|
11
11
|
config.get_current_environment = lambda: "production"
|
|
12
|
+
config.get_default_api_type = lambda: "user"
|
|
12
13
|
|
|
13
14
|
from .commands import auth, clusters, feedback, firewalls, orders, products, support, users # noqa: E402
|
|
14
15
|
|
|
@@ -20,7 +20,7 @@ class TestVersion:
|
|
|
20
20
|
mock_console.print.assert_called_once()
|
|
21
21
|
call_args = mock_console.print.call_args[0][0]
|
|
22
22
|
assert __version__ in call_args
|
|
23
|
-
assert "
|
|
23
|
+
assert "Proxy Platform CLI version:" in call_args
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
class TestEnv:
|
proxy_platform-0.3.3/README.md
DELETED
|
@@ -1,378 +0,0 @@
|
|
|
1
|
-
# PBD API CLI
|
|
2
|
-
|
|
3
|
-
A command-line client for interacting with the PBD platform.
|
|
4
|
-
|
|
5
|
-
## Distributions
|
|
6
|
-
|
|
7
|
-
This repository produces **two separate packages** from a single codebase:
|
|
8
|
-
|
|
9
|
-
| Package | Entry point | Audience | Admin commands |
|
|
10
|
-
|---------|-------------|----------|----------------|
|
|
11
|
-
| `proxy-platform` | `proxy_platform.main:app` | Proxy employees (internal) | ✅ Included |
|
|
12
|
-
| `proxy-platform-public` | `proxy_platform.main_public:app` | End users / customers | ❌ Excluded |
|
|
13
|
-
|
|
14
|
-
Both packages expose the same `pbd` command and share all user-facing functionality. The internal package additionally exposes `pbd admin` commands.
|
|
15
|
-
|
|
16
|
-
## Features
|
|
17
|
-
|
|
18
|
-
- 🔐 **Authentication** - Login, logout, and manage API tokens (with OTP/2FA support)
|
|
19
|
-
- 🌍 **Multi-environment** - Switch between development, test, acceptance, and production
|
|
20
|
-
- 🎯 **Dual API Support** - Separate Admin and User commands for clear access control
|
|
21
|
-
- 🖥️ **Cluster Management** - List, inspect, rename, delete, kubeconfig, and etcd key
|
|
22
|
-
- 🛒 **Orders & Payments** - Guided or fully non-interactive order creation
|
|
23
|
-
- 🔥 **Firewall Management** - Create and manage firewall rules
|
|
24
|
-
- 🎫 **Support Tickets** - Submit and track support requests
|
|
25
|
-
- 💬 **Feedback Portal** - Submit feature requests and vote on community feedback
|
|
26
|
-
- 📊 **Rich Output** - Beautiful tables and formatted output
|
|
27
|
-
- 🚀 **Easy to Use** - Intuitive command structure with shell completion
|
|
28
|
-
- 💾 **Token Storage** - Secure token management in `~/.proxy-platform/`
|
|
29
|
-
- 🐛 **Debug Mode** - Verbose logging with `--verbose` flag
|
|
30
|
-
|
|
31
|
-
## Installation
|
|
32
|
-
|
|
33
|
-
### Internal (Proxy employees)
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
pip install proxy-platform
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Includes all commands including `pbd admin`.
|
|
40
|
-
|
|
41
|
-
### Public (customers)
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
pip install proxy-platform-public
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Identical to the internal package but without `pbd admin`.
|
|
48
|
-
|
|
49
|
-
### Development setup
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
cd pbd-api-client
|
|
53
|
-
pip install -e ".[dev]"
|
|
54
|
-
pre-commit install
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
This installs the internal version (with admin) plus all dev tools, and activates the pre-commit hooks.
|
|
58
|
-
|
|
59
|
-
To test the public entry point locally:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
python -m proxy_platform.main_public
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Pre-commit hooks
|
|
66
|
-
|
|
67
|
-
The following checks run automatically on every commit:
|
|
68
|
-
|
|
69
|
-
| Hook | When | What |
|
|
70
|
-
|------|------|------|
|
|
71
|
-
| ruff (lint + format) | Python files changed | Code style and formatting |
|
|
72
|
-
| mypy | Python files changed | Type checking |
|
|
73
|
-
| bandit | `proxy_platform/` files changed | Static security analysis |
|
|
74
|
-
| pip-audit | `pyproject*.toml` changed | Known CVEs in dependencies |
|
|
75
|
-
| conventional-commit | Every commit | Commit message format |
|
|
76
|
-
|
|
77
|
-
If a hook blocks your commit, fix the reported issue and commit again. To run all hooks manually:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
pre-commit run --all-files
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Enable Shell Completion (Recommended)
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
pbd --install-completion
|
|
87
|
-
source ~/.zshrc # or ~/.bashrc
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Quick Start
|
|
91
|
-
|
|
92
|
-
### 1. Set Environment
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
pbd env production # Switch to production
|
|
96
|
-
pbd env development # Switch to local dev
|
|
97
|
-
pbd env --show # Show current environment
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### 2. Login
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
pbd login
|
|
104
|
-
pbd login --email user@example.com --password mypassword
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
If your account has 2FA enabled, you'll be prompted for your OTP code automatically.
|
|
108
|
-
|
|
109
|
-
### 3. Deploy a Cluster
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
# Interactive (guided, recommended)
|
|
113
|
-
pbd orders create
|
|
114
|
-
|
|
115
|
-
# Fully non-interactive (all flags provided)
|
|
116
|
-
pbd orders create --tier "Starter Kit" --provider hetzner --region nbg1 --firewall "My firewall" --yes
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
After payment, your cluster is deployed automatically. Check status with:
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
pbd clusters list
|
|
123
|
-
pbd clusters get <cluster-id>
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## Commands Reference
|
|
127
|
-
|
|
128
|
-
### Authentication
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
pbd login [--email EMAIL] [--password PASSWORD] [--api admin|user]
|
|
132
|
-
pbd logout
|
|
133
|
-
pbd whoami [--api admin|user]
|
|
134
|
-
pbd auth switch admin
|
|
135
|
-
pbd auth switch user
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Clusters
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
# List your clusters
|
|
142
|
-
pbd clusters list [--limit 10]
|
|
143
|
-
|
|
144
|
-
# Get cluster details
|
|
145
|
-
pbd clusters get <cluster-id>
|
|
146
|
-
|
|
147
|
-
# Rename a cluster (sets display name)
|
|
148
|
-
pbd clusters rename <cluster-id> --name "My cluster"
|
|
149
|
-
|
|
150
|
-
# Delete a cluster (shows what will be deleted, asks confirmation)
|
|
151
|
-
pbd clusters delete <cluster-id>
|
|
152
|
-
pbd clusters delete <cluster-id> --yes # Skip confirmation
|
|
153
|
-
|
|
154
|
-
# Download kubeconfig
|
|
155
|
-
pbd clusters kubeconfig <cluster-id>
|
|
156
|
-
pbd clusters kubeconfig <cluster-id> --output ~/.kube/config
|
|
157
|
-
|
|
158
|
-
# Show etcd encryption key
|
|
159
|
-
pbd clusters etcd-key <cluster-id>
|
|
160
|
-
|
|
161
|
-
# Get deployment info for a cluster
|
|
162
|
-
pbd clusters deployment <cluster-id>
|
|
163
|
-
|
|
164
|
-
# Get firewall attached to a cluster
|
|
165
|
-
pbd clusters firewall <cluster-id>
|
|
166
|
-
|
|
167
|
-
# Assign or change the firewall on a cluster
|
|
168
|
-
pbd clusters assign-firewall <cluster-id> --firewall "My firewall"
|
|
169
|
-
pbd clusters assign-firewall <cluster-id> # interactive selection
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Orders & Payments
|
|
173
|
-
|
|
174
|
-
Deployments are triggered automatically after successful payment.
|
|
175
|
-
|
|
176
|
-
```bash
|
|
177
|
-
# Create an order (interactive when no flags given)
|
|
178
|
-
pbd orders create
|
|
179
|
-
|
|
180
|
-
# Non-interactive (all steps via flags)
|
|
181
|
-
pbd orders create \
|
|
182
|
-
--tier "Starter Kit" \
|
|
183
|
-
--provider hetzner \
|
|
184
|
-
--region nbg1 \
|
|
185
|
-
--firewall "My firewall" \
|
|
186
|
-
--yes
|
|
187
|
-
|
|
188
|
-
# Available flags:
|
|
189
|
-
# --product -p Product ID (auto-selects if only one available)
|
|
190
|
-
# --tier -t Pricing tier name or ID
|
|
191
|
-
# --provider Cloud provider (hetzner)
|
|
192
|
-
# --region -r Region code (nbg1, fsn1, hel1, ash)
|
|
193
|
-
# --firewall -f Firewall name or ID
|
|
194
|
-
# --no-firewall Deploy without firewall
|
|
195
|
-
# --yes -y Accept terms without prompting
|
|
196
|
-
|
|
197
|
-
# List your orders
|
|
198
|
-
pbd orders list [--limit 10]
|
|
199
|
-
|
|
200
|
-
# Get order details
|
|
201
|
-
pbd orders get <order-id>
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
In **development mode**, payment is simulated automatically after order creation. In **production**, a Mollie payment URL is shown.
|
|
205
|
-
|
|
206
|
-
### Firewalls
|
|
207
|
-
|
|
208
|
-
```bash
|
|
209
|
-
# List all firewalls
|
|
210
|
-
pbd firewall list
|
|
211
|
-
|
|
212
|
-
# Get firewall details (including rules)
|
|
213
|
-
pbd firewall get <firewall-id>
|
|
214
|
-
|
|
215
|
-
# Get firewall by name
|
|
216
|
-
pbd firewall by-name <firewall-name>
|
|
217
|
-
|
|
218
|
-
# Create a firewall
|
|
219
|
-
pbd firewall create --name my-firewall --description "Production firewall"
|
|
220
|
-
|
|
221
|
-
# Update a firewall
|
|
222
|
-
pbd firewall update <firewall-id> --name new-name
|
|
223
|
-
|
|
224
|
-
# Delete a firewall
|
|
225
|
-
pbd firewall delete <firewall-id>
|
|
226
|
-
pbd firewall delete <firewall-id> --force # Skip confirmation
|
|
227
|
-
|
|
228
|
-
# List clusters using a firewall
|
|
229
|
-
pbd firewall clusters <firewall-id>
|
|
230
|
-
|
|
231
|
-
# Firewall rules
|
|
232
|
-
pbd firewall rules list <firewall-id>
|
|
233
|
-
pbd firewall rules create <firewall-id> --direction inbound --protocol tcp --port-min 443 --port-max 443 --remote-ip 0.0.0.0/0
|
|
234
|
-
pbd firewall rules delete <firewall-id> <rule-id>
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Products
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
pbd products list [--limit 50]
|
|
241
|
-
pbd products get <product-id>
|
|
242
|
-
pbd products get f25bea71 # Partial IDs are resolved automatically
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
### Users
|
|
246
|
-
|
|
247
|
-
```bash
|
|
248
|
-
pbd users profile
|
|
249
|
-
pbd users stats
|
|
250
|
-
pbd users activities [--limit 10]
|
|
251
|
-
pbd users orders [--limit 10]
|
|
252
|
-
pbd users verification
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### Support
|
|
256
|
-
|
|
257
|
-
```bash
|
|
258
|
-
pbd support submit --subject "Cannot access cluster" --description "Getting 403 error" --category technical
|
|
259
|
-
pbd support list [--category technical] [--status open]
|
|
260
|
-
pbd support get <ticket-id>
|
|
261
|
-
pbd support reply <ticket-id> --content "Additional info"
|
|
262
|
-
pbd support close <ticket-id> [--yes]
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
Valid categories: `general`, `billing`, `technical`, `other`
|
|
266
|
-
Valid statuses: `open`, `in_progress`, `closed`
|
|
267
|
-
|
|
268
|
-
### Feedback
|
|
269
|
-
|
|
270
|
-
```bash
|
|
271
|
-
pbd feedback submit --title "Feature request" --description "..." --category feature
|
|
272
|
-
pbd feedback list [--category feature] [--status open]
|
|
273
|
-
pbd feedback get <feedback-id>
|
|
274
|
-
pbd feedback vote <feedback-id>
|
|
275
|
-
pbd feedback unvote <feedback-id>
|
|
276
|
-
pbd feedback comment <feedback-id> --content "I need this too"
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
### Admin Commands (Proxy employees only)
|
|
280
|
-
|
|
281
|
-
```bash
|
|
282
|
-
pbd admin login
|
|
283
|
-
pbd admin clusters [--limit 10]
|
|
284
|
-
pbd admin users [--limit 50] [--search "email@example.com"]
|
|
285
|
-
pbd admin orders [--limit 50] [--status paid]
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
Admin and user sessions are independent — you can be logged in as both simultaneously.
|
|
289
|
-
|
|
290
|
-
### Development Commands (Local only)
|
|
291
|
-
|
|
292
|
-
These commands are blocked outside the `development` environment.
|
|
293
|
-
|
|
294
|
-
```bash
|
|
295
|
-
pbd dev simulate-payment <order-id> [--status paid|failed]
|
|
296
|
-
pbd dev trigger-deployment <order-id>
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
### Environment
|
|
300
|
-
|
|
301
|
-
```bash
|
|
302
|
-
pbd env development
|
|
303
|
-
pbd env test
|
|
304
|
-
pbd env acceptance
|
|
305
|
-
pbd env production
|
|
306
|
-
pbd env --show
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
### General
|
|
310
|
-
|
|
311
|
-
```bash
|
|
312
|
-
pbd version
|
|
313
|
-
pbd --help
|
|
314
|
-
pbd clusters --help
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
## Environment Configuration
|
|
318
|
-
|
|
319
|
-
| Environment | Admin API | User API |
|
|
320
|
-
|-------------|-----------|----------|
|
|
321
|
-
| **development** | http://localhost:8001 | http://localhost:8002 |
|
|
322
|
-
| **test** | https://admin-api.tst.pbd.proxy.nl | https://api.tst.pbd.proxy.nl |
|
|
323
|
-
| **acceptance** | https://admin-api.acc.pbd.proxy.nl | https://api.acc.pbd.proxy.nl |
|
|
324
|
-
| **production** | https://admin-api.prd.pbd.proxy.nl | https://api.platform.proxy.nl |
|
|
325
|
-
|
|
326
|
-
## Configuration
|
|
327
|
-
|
|
328
|
-
Tokens and settings are stored in `~/.proxy-platform/`:
|
|
329
|
-
|
|
330
|
-
```
|
|
331
|
-
~/.proxy-platform/
|
|
332
|
-
├── config.json # Environment and default API settings
|
|
333
|
-
└── tokens.json # Authentication tokens (per environment, 0600)
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
## Project Structure
|
|
337
|
-
|
|
338
|
-
```
|
|
339
|
-
pbd-api-client/
|
|
340
|
-
├── pyproject.toml # Internal distribution (proxy-platform, includes admin)
|
|
341
|
-
├── pyproject.public.toml # Public distribution (proxy-platform-public, no admin)
|
|
342
|
-
└── proxy_platform/
|
|
343
|
-
├── main.py # Internal CLI entry point
|
|
344
|
-
├── main_public.py # Public CLI entry point (no admin)
|
|
345
|
-
├── config.py
|
|
346
|
-
├── client.py
|
|
347
|
-
└── commands/
|
|
348
|
-
├── auth.py
|
|
349
|
-
├── clusters.py
|
|
350
|
-
├── feedback.py
|
|
351
|
-
├── firewalls.py
|
|
352
|
-
├── orders.py
|
|
353
|
-
├── products.py
|
|
354
|
-
├── support.py
|
|
355
|
-
├── users.py
|
|
356
|
-
└── admin/ # Only included in proxy-platform (internal)
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
## Troubleshooting
|
|
360
|
-
|
|
361
|
-
```bash
|
|
362
|
-
# Debug mode — shows all API calls and responses
|
|
363
|
-
pbd --verbose <command>
|
|
364
|
-
|
|
365
|
-
# Re-authenticate
|
|
366
|
-
pbd logout && pbd login
|
|
367
|
-
|
|
368
|
-
# Check environment
|
|
369
|
-
pbd env --show
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
## Requirements
|
|
373
|
-
|
|
374
|
-
- Python 3.11+
|
|
375
|
-
|
|
376
|
-
## License
|
|
377
|
-
|
|
378
|
-
Internal use only — PBD Development Team
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"""Command modules for PBD CLI."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|