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