proxy-platform 0.3.3__tar.gz → 0.3.4__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.4}/PKG-INFO +1 -1
- proxy_platform-0.3.4/README.md +429 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/__init__.py +1 -1
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/commands/clusters.py +2 -1
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/main.py +4 -4
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform.egg-info/PKG-INFO +1 -1
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/pyproject.toml +1 -1
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/tests/test_main.py +1 -1
- proxy_platform-0.3.3/README.md +0 -378
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/README.public.md +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/client.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/commands/__init__.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/commands/auth.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/commands/deployments.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/commands/feedback.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/commands/firewalls.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/commands/orders.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/commands/products.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/commands/support.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/commands/users.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/config.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform/main_public.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform.egg-info/SOURCES.txt +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform.egg-info/dependency_links.txt +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform.egg-info/entry_points.txt +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform.egg-info/requires.txt +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/proxy_platform.egg-info/top_level.txt +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/setup.cfg +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/setup.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/tests/test_admin_feedback.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/tests/test_auth.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/tests/test_client.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/tests/test_clusters.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/tests/test_config.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/tests/test_deployments.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/tests/test_dev.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/tests/test_feedback.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/tests/test_firewalls.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/tests/test_orders.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/tests/test_products.py +0 -0
- {proxy_platform-0.3.3 → proxy_platform-0.3.4}/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.
|
|
@@ -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
|
|
|
@@ -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()
|
|
@@ -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
|
|
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
|
|
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
|