proxy-platform 0.3.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.
Potentially problematic release.
This version of proxy-platform might be problematic. Click here for more details.
- proxy_platform-0.3.0/PKG-INFO +400 -0
- proxy_platform-0.3.0/README.md +378 -0
- proxy_platform-0.3.0/proxy_platform/__init__.py +3 -0
- proxy_platform-0.3.0/proxy_platform/client.py +324 -0
- proxy_platform-0.3.0/proxy_platform/commands/__init__.py +1 -0
- proxy_platform-0.3.0/proxy_platform/commands/auth.py +151 -0
- proxy_platform-0.3.0/proxy_platform/commands/clusters.py +472 -0
- proxy_platform-0.3.0/proxy_platform/commands/deployments.py +124 -0
- proxy_platform-0.3.0/proxy_platform/commands/feedback.py +603 -0
- proxy_platform-0.3.0/proxy_platform/commands/firewalls.py +894 -0
- proxy_platform-0.3.0/proxy_platform/commands/orders.py +509 -0
- proxy_platform-0.3.0/proxy_platform/commands/products.py +143 -0
- proxy_platform-0.3.0/proxy_platform/commands/support.py +323 -0
- proxy_platform-0.3.0/proxy_platform/commands/users.py +221 -0
- proxy_platform-0.3.0/proxy_platform/config.py +224 -0
- proxy_platform-0.3.0/proxy_platform/main.py +155 -0
- proxy_platform-0.3.0/proxy_platform/main_public.py +135 -0
- proxy_platform-0.3.0/proxy_platform.egg-info/PKG-INFO +400 -0
- proxy_platform-0.3.0/proxy_platform.egg-info/SOURCES.txt +37 -0
- proxy_platform-0.3.0/proxy_platform.egg-info/dependency_links.txt +1 -0
- proxy_platform-0.3.0/proxy_platform.egg-info/entry_points.txt +2 -0
- proxy_platform-0.3.0/proxy_platform.egg-info/requires.txt +13 -0
- proxy_platform-0.3.0/proxy_platform.egg-info/top_level.txt +1 -0
- proxy_platform-0.3.0/pyproject.toml +151 -0
- proxy_platform-0.3.0/setup.cfg +4 -0
- proxy_platform-0.3.0/setup.py +23 -0
- proxy_platform-0.3.0/tests/test_admin_feedback.py +710 -0
- proxy_platform-0.3.0/tests/test_auth.py +344 -0
- proxy_platform-0.3.0/tests/test_client.py +403 -0
- proxy_platform-0.3.0/tests/test_clusters.py +467 -0
- proxy_platform-0.3.0/tests/test_config.py +322 -0
- proxy_platform-0.3.0/tests/test_deployments.py +318 -0
- proxy_platform-0.3.0/tests/test_dev.py +114 -0
- proxy_platform-0.3.0/tests/test_feedback.py +1555 -0
- proxy_platform-0.3.0/tests/test_firewalls.py +1523 -0
- proxy_platform-0.3.0/tests/test_main.py +194 -0
- proxy_platform-0.3.0/tests/test_orders.py +1340 -0
- proxy_platform-0.3.0/tests/test_products.py +460 -0
- proxy_platform-0.3.0/tests/test_users.py +619 -0
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: proxy-platform
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: CLI client for the Proxy Platform
|
|
5
|
+
Author: Proxy Platform Team
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: typer[all]>=0.15.0
|
|
10
|
+
Requires-Dist: rich==13.7.1
|
|
11
|
+
Requires-Dist: requests>=2.33.0
|
|
12
|
+
Requires-Dist: python-dotenv>=1.2.2
|
|
13
|
+
Provides-Extra: dev
|
|
14
|
+
Requires-Dist: pytest>=9.0.3; extra == "dev"
|
|
15
|
+
Requires-Dist: pytest-cov==6.0.0; extra == "dev"
|
|
16
|
+
Requires-Dist: pytest-mock==3.14.0; extra == "dev"
|
|
17
|
+
Requires-Dist: httpx==0.28.1; extra == "dev"
|
|
18
|
+
Requires-Dist: ruff==0.14.1; extra == "dev"
|
|
19
|
+
Requires-Dist: mypy==1.14.0; extra == "dev"
|
|
20
|
+
Requires-Dist: types-requests==2.32.4.20250913; extra == "dev"
|
|
21
|
+
Dynamic: requires-python
|
|
22
|
+
|
|
23
|
+
# PBD API CLI
|
|
24
|
+
|
|
25
|
+
A command-line client for interacting with the PBD platform.
|
|
26
|
+
|
|
27
|
+
## Distributions
|
|
28
|
+
|
|
29
|
+
This repository produces **two separate packages** from a single codebase:
|
|
30
|
+
|
|
31
|
+
| Package | Entry point | Audience | Admin commands |
|
|
32
|
+
|---------|-------------|----------|----------------|
|
|
33
|
+
| `proxy-platform` | `proxy_platform.main:app` | Proxy employees (internal) | ✅ Included |
|
|
34
|
+
| `proxy-platform-public` | `proxy_platform.main_public:app` | End users / customers | ❌ Excluded |
|
|
35
|
+
|
|
36
|
+
Both packages expose the same `pbd` command and share all user-facing functionality. The internal package additionally exposes `pbd admin` commands.
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- 🔐 **Authentication** - Login, logout, and manage API tokens (with OTP/2FA support)
|
|
41
|
+
- 🌍 **Multi-environment** - Switch between development, test, acceptance, and production
|
|
42
|
+
- 🎯 **Dual API Support** - Separate Admin and User commands for clear access control
|
|
43
|
+
- 🖥️ **Cluster Management** - List, inspect, rename, delete, kubeconfig, and etcd key
|
|
44
|
+
- 🛒 **Orders & Payments** - Guided or fully non-interactive order creation
|
|
45
|
+
- 🔥 **Firewall Management** - Create and manage firewall rules
|
|
46
|
+
- 🎫 **Support Tickets** - Submit and track support requests
|
|
47
|
+
- 💬 **Feedback Portal** - Submit feature requests and vote on community feedback
|
|
48
|
+
- 📊 **Rich Output** - Beautiful tables and formatted output
|
|
49
|
+
- 🚀 **Easy to Use** - Intuitive command structure with shell completion
|
|
50
|
+
- 💾 **Token Storage** - Secure token management in `~/.proxy-platform/`
|
|
51
|
+
- 🐛 **Debug Mode** - Verbose logging with `--verbose` flag
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
### Internal (Proxy employees)
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install proxy-platform
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Includes all commands including `pbd admin`.
|
|
62
|
+
|
|
63
|
+
### Public (customers)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install proxy-platform-public
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Identical to the internal package but without `pbd admin`.
|
|
70
|
+
|
|
71
|
+
### Development setup
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
cd pbd-api-client
|
|
75
|
+
pip install -e ".[dev]"
|
|
76
|
+
pre-commit install
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
This installs the internal version (with admin) plus all dev tools, and activates the pre-commit hooks.
|
|
80
|
+
|
|
81
|
+
To test the public entry point locally:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
python -m proxy_platform.main_public
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Pre-commit hooks
|
|
88
|
+
|
|
89
|
+
The following checks run automatically on every commit:
|
|
90
|
+
|
|
91
|
+
| Hook | When | What |
|
|
92
|
+
|------|------|------|
|
|
93
|
+
| ruff (lint + format) | Python files changed | Code style and formatting |
|
|
94
|
+
| mypy | Python files changed | Type checking |
|
|
95
|
+
| bandit | `proxy_platform/` files changed | Static security analysis |
|
|
96
|
+
| pip-audit | `pyproject*.toml` changed | Known CVEs in dependencies |
|
|
97
|
+
| conventional-commit | Every commit | Commit message format |
|
|
98
|
+
|
|
99
|
+
If a hook blocks your commit, fix the reported issue and commit again. To run all hooks manually:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pre-commit run --all-files
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Enable Shell Completion (Recommended)
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pbd --install-completion
|
|
109
|
+
source ~/.zshrc # or ~/.bashrc
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Quick Start
|
|
113
|
+
|
|
114
|
+
### 1. Set Environment
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pbd env production # Switch to production
|
|
118
|
+
pbd env development # Switch to local dev
|
|
119
|
+
pbd env --show # Show current environment
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 2. Login
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
pbd login
|
|
126
|
+
pbd login --email user@example.com --password mypassword
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
If your account has 2FA enabled, you'll be prompted for your OTP code automatically.
|
|
130
|
+
|
|
131
|
+
### 3. Deploy a Cluster
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Interactive (guided, recommended)
|
|
135
|
+
pbd orders create
|
|
136
|
+
|
|
137
|
+
# Fully non-interactive (all flags provided)
|
|
138
|
+
pbd orders create --tier "Starter Kit" --provider hetzner --region nbg1 --firewall "My firewall" --yes
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
After payment, your cluster is deployed automatically. Check status with:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
pbd clusters list
|
|
145
|
+
pbd clusters get <cluster-id>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Commands Reference
|
|
149
|
+
|
|
150
|
+
### Authentication
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
pbd login [--email EMAIL] [--password PASSWORD] [--api admin|user]
|
|
154
|
+
pbd logout
|
|
155
|
+
pbd whoami [--api admin|user]
|
|
156
|
+
pbd auth switch admin
|
|
157
|
+
pbd auth switch user
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Clusters
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# List your clusters
|
|
164
|
+
pbd clusters list [--limit 10]
|
|
165
|
+
|
|
166
|
+
# Get cluster details
|
|
167
|
+
pbd clusters get <cluster-id>
|
|
168
|
+
|
|
169
|
+
# Rename a cluster (sets display name)
|
|
170
|
+
pbd clusters rename <cluster-id> --name "My cluster"
|
|
171
|
+
|
|
172
|
+
# Delete a cluster (shows what will be deleted, asks confirmation)
|
|
173
|
+
pbd clusters delete <cluster-id>
|
|
174
|
+
pbd clusters delete <cluster-id> --yes # Skip confirmation
|
|
175
|
+
|
|
176
|
+
# Download kubeconfig
|
|
177
|
+
pbd clusters kubeconfig <cluster-id>
|
|
178
|
+
pbd clusters kubeconfig <cluster-id> --output ~/.kube/config
|
|
179
|
+
|
|
180
|
+
# Show etcd encryption key
|
|
181
|
+
pbd clusters etcd-key <cluster-id>
|
|
182
|
+
|
|
183
|
+
# Get deployment info for a cluster
|
|
184
|
+
pbd clusters deployment <cluster-id>
|
|
185
|
+
|
|
186
|
+
# Get firewall attached to a cluster
|
|
187
|
+
pbd clusters firewall <cluster-id>
|
|
188
|
+
|
|
189
|
+
# Assign or change the firewall on a cluster
|
|
190
|
+
pbd clusters assign-firewall <cluster-id> --firewall "My firewall"
|
|
191
|
+
pbd clusters assign-firewall <cluster-id> # interactive selection
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Orders & Payments
|
|
195
|
+
|
|
196
|
+
Deployments are triggered automatically after successful payment.
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Create an order (interactive when no flags given)
|
|
200
|
+
pbd orders create
|
|
201
|
+
|
|
202
|
+
# Non-interactive (all steps via flags)
|
|
203
|
+
pbd orders create \
|
|
204
|
+
--tier "Starter Kit" \
|
|
205
|
+
--provider hetzner \
|
|
206
|
+
--region nbg1 \
|
|
207
|
+
--firewall "My firewall" \
|
|
208
|
+
--yes
|
|
209
|
+
|
|
210
|
+
# Available flags:
|
|
211
|
+
# --product -p Product ID (auto-selects if only one available)
|
|
212
|
+
# --tier -t Pricing tier name or ID
|
|
213
|
+
# --provider Cloud provider (hetzner)
|
|
214
|
+
# --region -r Region code (nbg1, fsn1, hel1, ash)
|
|
215
|
+
# --firewall -f Firewall name or ID
|
|
216
|
+
# --no-firewall Deploy without firewall
|
|
217
|
+
# --yes -y Accept terms without prompting
|
|
218
|
+
|
|
219
|
+
# List your orders
|
|
220
|
+
pbd orders list [--limit 10]
|
|
221
|
+
|
|
222
|
+
# Get order details
|
|
223
|
+
pbd orders get <order-id>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
In **development mode**, payment is simulated automatically after order creation. In **production**, a Mollie payment URL is shown.
|
|
227
|
+
|
|
228
|
+
### Firewalls
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# List all firewalls
|
|
232
|
+
pbd firewall list
|
|
233
|
+
|
|
234
|
+
# Get firewall details (including rules)
|
|
235
|
+
pbd firewall get <firewall-id>
|
|
236
|
+
|
|
237
|
+
# Get firewall by name
|
|
238
|
+
pbd firewall by-name <firewall-name>
|
|
239
|
+
|
|
240
|
+
# Create a firewall
|
|
241
|
+
pbd firewall create --name my-firewall --description "Production firewall"
|
|
242
|
+
|
|
243
|
+
# Update a firewall
|
|
244
|
+
pbd firewall update <firewall-id> --name new-name
|
|
245
|
+
|
|
246
|
+
# Delete a firewall
|
|
247
|
+
pbd firewall delete <firewall-id>
|
|
248
|
+
pbd firewall delete <firewall-id> --force # Skip confirmation
|
|
249
|
+
|
|
250
|
+
# List clusters using a firewall
|
|
251
|
+
pbd firewall clusters <firewall-id>
|
|
252
|
+
|
|
253
|
+
# Firewall rules
|
|
254
|
+
pbd firewall rules list <firewall-id>
|
|
255
|
+
pbd firewall rules create <firewall-id> --direction inbound --protocol tcp --port-min 443 --port-max 443 --remote-ip 0.0.0.0/0
|
|
256
|
+
pbd firewall rules delete <firewall-id> <rule-id>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Products
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
pbd products list [--limit 50]
|
|
263
|
+
pbd products get <product-id>
|
|
264
|
+
pbd products get f25bea71 # Partial IDs are resolved automatically
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Users
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
pbd users profile
|
|
271
|
+
pbd users stats
|
|
272
|
+
pbd users activities [--limit 10]
|
|
273
|
+
pbd users orders [--limit 10]
|
|
274
|
+
pbd users verification
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Support
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
pbd support submit --subject "Cannot access cluster" --description "Getting 403 error" --category technical
|
|
281
|
+
pbd support list [--category technical] [--status open]
|
|
282
|
+
pbd support get <ticket-id>
|
|
283
|
+
pbd support reply <ticket-id> --content "Additional info"
|
|
284
|
+
pbd support close <ticket-id> [--yes]
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Valid categories: `general`, `billing`, `technical`, `other`
|
|
288
|
+
Valid statuses: `open`, `in_progress`, `closed`
|
|
289
|
+
|
|
290
|
+
### Feedback
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
pbd feedback submit --title "Feature request" --description "..." --category feature
|
|
294
|
+
pbd feedback list [--category feature] [--status open]
|
|
295
|
+
pbd feedback get <feedback-id>
|
|
296
|
+
pbd feedback vote <feedback-id>
|
|
297
|
+
pbd feedback unvote <feedback-id>
|
|
298
|
+
pbd feedback comment <feedback-id> --content "I need this too"
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Admin Commands (Proxy employees only)
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
pbd admin login
|
|
305
|
+
pbd admin clusters [--limit 10]
|
|
306
|
+
pbd admin users [--limit 50] [--search "email@example.com"]
|
|
307
|
+
pbd admin orders [--limit 50] [--status paid]
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Admin and user sessions are independent — you can be logged in as both simultaneously.
|
|
311
|
+
|
|
312
|
+
### Development Commands (Local only)
|
|
313
|
+
|
|
314
|
+
These commands are blocked outside the `development` environment.
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
pbd dev simulate-payment <order-id> [--status paid|failed]
|
|
318
|
+
pbd dev trigger-deployment <order-id>
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Environment
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
pbd env development
|
|
325
|
+
pbd env test
|
|
326
|
+
pbd env acceptance
|
|
327
|
+
pbd env production
|
|
328
|
+
pbd env --show
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### General
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
pbd version
|
|
335
|
+
pbd --help
|
|
336
|
+
pbd clusters --help
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## Environment Configuration
|
|
340
|
+
|
|
341
|
+
| Environment | Admin API | User API |
|
|
342
|
+
|-------------|-----------|----------|
|
|
343
|
+
| **development** | http://localhost:8001 | http://localhost:8002 |
|
|
344
|
+
| **test** | https://admin-api.tst.pbd.proxy.nl | https://api.tst.pbd.proxy.nl |
|
|
345
|
+
| **acceptance** | https://admin-api.acc.pbd.proxy.nl | https://api.acc.pbd.proxy.nl |
|
|
346
|
+
| **production** | https://admin-api.prd.pbd.proxy.nl | https://api.platform.proxy.nl |
|
|
347
|
+
|
|
348
|
+
## Configuration
|
|
349
|
+
|
|
350
|
+
Tokens and settings are stored in `~/.proxy-platform/`:
|
|
351
|
+
|
|
352
|
+
```
|
|
353
|
+
~/.proxy-platform/
|
|
354
|
+
├── config.json # Environment and default API settings
|
|
355
|
+
└── tokens.json # Authentication tokens (per environment, 0600)
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## Project Structure
|
|
359
|
+
|
|
360
|
+
```
|
|
361
|
+
pbd-api-client/
|
|
362
|
+
├── pyproject.toml # Internal distribution (proxy-platform, includes admin)
|
|
363
|
+
├── pyproject.public.toml # Public distribution (proxy-platform-public, no admin)
|
|
364
|
+
└── proxy_platform/
|
|
365
|
+
├── main.py # Internal CLI entry point
|
|
366
|
+
├── main_public.py # Public CLI entry point (no admin)
|
|
367
|
+
├── config.py
|
|
368
|
+
├── client.py
|
|
369
|
+
└── commands/
|
|
370
|
+
├── auth.py
|
|
371
|
+
├── clusters.py
|
|
372
|
+
├── feedback.py
|
|
373
|
+
├── firewalls.py
|
|
374
|
+
├── orders.py
|
|
375
|
+
├── products.py
|
|
376
|
+
├── support.py
|
|
377
|
+
├── users.py
|
|
378
|
+
└── admin/ # Only included in proxy-platform (internal)
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
## Troubleshooting
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
# Debug mode — shows all API calls and responses
|
|
385
|
+
pbd --verbose <command>
|
|
386
|
+
|
|
387
|
+
# Re-authenticate
|
|
388
|
+
pbd logout && pbd login
|
|
389
|
+
|
|
390
|
+
# Check environment
|
|
391
|
+
pbd env --show
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
## Requirements
|
|
395
|
+
|
|
396
|
+
- Python 3.11+
|
|
397
|
+
|
|
398
|
+
## License
|
|
399
|
+
|
|
400
|
+
Internal use only — PBD Development Team
|