developer-platform-cli 0.2.0__tar.gz → 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.
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/PKG-INFO +2 -2
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/pyproject.toml +5 -1
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/src/platform_cli/__init__.py +1 -1
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/src/platform_cli/__main__.py +28 -0
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/src/platform_cli/api_contract.json +3467 -965
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/src/platform_cli/client.py +4 -0
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/src/platform_cli/commands.py +15 -6
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/src/platform_cli/registry.py +51 -1
- developer_platform_cli-0.3.0/src/platform_cli/tunnel.py +78 -0
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/tests/test_administration.py +158 -0
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/tests/test_client.py +21 -0
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/.gitignore +0 -0
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/README.md +0 -0
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/src/platform_cli/authentication.py +0 -0
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/src/platform_cli/config.py +0 -0
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/src/platform_cli/errors.py +0 -0
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/src/platform_cli/models.py +0 -0
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/src/platform_cli/profiles.py +0 -0
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/tests/test_commands.py +0 -0
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/tests/test_config.py +0 -0
- {developer_platform_cli-0.2.0 → developer_platform_cli-0.3.0}/tests/test_profiles_authentication.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "developer-platform-cli"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
8
8
|
description = "Command-line client for the Developer Platform API"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12"
|
|
@@ -28,6 +28,10 @@ devplat = "platform_cli.__main__:main"
|
|
|
28
28
|
|
|
29
29
|
[tool.hatch.build.targets.wheel]
|
|
30
30
|
packages = ["src/platform_cli"]
|
|
31
|
+
core-metadata-version = "2.4"
|
|
32
|
+
|
|
33
|
+
[tool.hatch.build.targets.sdist]
|
|
34
|
+
core-metadata-version = "2.4"
|
|
31
35
|
|
|
32
36
|
[tool.pytest.ini_options]
|
|
33
37
|
testpaths = ["tests"]
|
|
@@ -19,6 +19,7 @@ from .models import OperationStatus, application_body
|
|
|
19
19
|
from .commands import context_state as _state, emit, fail, register, watch_access
|
|
20
20
|
from .profiles import Profile, ProfileStore, SessionStore
|
|
21
21
|
from .registry import COMMANDS
|
|
22
|
+
from .tunnel import run_tunnel, ssh_command
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
app = typer.Typer(no_args_is_help=True, add_completion=False, help="Developer Platform command-line client.")
|
|
@@ -294,6 +295,33 @@ def _client(ctx: typer.Context) -> PlatformClient:
|
|
|
294
295
|
return client
|
|
295
296
|
|
|
296
297
|
|
|
298
|
+
@_tree(app, ("stores", "access")).command("tunnel")
|
|
299
|
+
def stores_access_tunnel(ctx: typer.Context, credential_id: str,
|
|
300
|
+
identity_file: Annotated[str, typer.Option("--identity-file", help="Private Ed25519 key registered with the platform.")],
|
|
301
|
+
known_hosts: Annotated[str, typer.Option("--known-hosts", help="Verified SSH host key file.")],
|
|
302
|
+
local_port: Annotated[int, typer.Option("--local-port", min=1, max=65535)]):
|
|
303
|
+
"""Forward an active store lease to a local TCP port until interrupted."""
|
|
304
|
+
try:
|
|
305
|
+
from uuid import UUID
|
|
306
|
+
credential_id = str(UUID(credential_id))
|
|
307
|
+
client = _client(ctx)
|
|
308
|
+
try:
|
|
309
|
+
credential, _ = client.request_json("GET", "/v1/store-access/credentials/" + credential_id)
|
|
310
|
+
finally:
|
|
311
|
+
client.close()
|
|
312
|
+
command = ssh_command(credential, identity_file, known_hosts, local_port)
|
|
313
|
+
typer.echo(f"{credential['provider']} tunnel on 127.0.0.1:{local_port}; press Ctrl-C to close.", err=True)
|
|
314
|
+
result = run_tunnel(command)
|
|
315
|
+
if result:
|
|
316
|
+
raise typer.Exit(result)
|
|
317
|
+
except KeyboardInterrupt:
|
|
318
|
+
raise typer.Exit(10) from None
|
|
319
|
+
except typer.Exit:
|
|
320
|
+
raise
|
|
321
|
+
except Exception as error:
|
|
322
|
+
raise fail(error) from None
|
|
323
|
+
|
|
324
|
+
|
|
297
325
|
@app.command("status")
|
|
298
326
|
def status(ctx: typer.Context, project: Annotated[str | None, typer.Option("--project")] = None,
|
|
299
327
|
output: Annotated[str | None, typer.Option("--output")] = None):
|