dinemic-cli 0.0.19__py3-none-any.whl
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.
- dinemic_cli/__init__.py +1 -0
- dinemic_cli/__main__.py +16 -0
- dinemic_cli/client.py +75 -0
- dinemic_cli/commands/__init__.py +0 -0
- dinemic_cli/commands/auth.py +31 -0
- dinemic_cli/commands/caa.py +11 -0
- dinemic_cli/commands/cert.py +29 -0
- dinemic_cli/commands/cert_peer.py +37 -0
- dinemic_cli/commands/dns_entry.py +57 -0
- dinemic_cli/commands/dns_value.py +43 -0
- dinemic_cli/commands/dns_zone.py +98 -0
- dinemic_cli/commands/endpoint.py +39 -0
- dinemic_cli/commands/healthcheck.py +40 -0
- dinemic_cli/commands/loadbalancer.py +39 -0
- dinemic_cli/commands/loadbalancer_backend.py +44 -0
- dinemic_cli/commands/loadbalancer_host.py +37 -0
- dinemic_cli/commands/loadbalancer_route.py +42 -0
- dinemic_cli/commands/network.py +34 -0
- dinemic_cli/commands/node.py +29 -0
- dinemic_cli/commands/peer.py +33 -0
- dinemic_cli/commands/peer_config.py +33 -0
- dinemic_cli/commands/project.py +58 -0
- dinemic_cli/commands/quota.py +22 -0
- dinemic_cli/main.py +68 -0
- dinemic_cli/output.py +25 -0
- dinemic_cli-0.0.19.dist-info/METADATA +13 -0
- dinemic_cli-0.0.19.dist-info/RECORD +63 -0
- dinemic_cli-0.0.19.dist-info/WHEEL +5 -0
- dinemic_cli-0.0.19.dist-info/entry_points.txt +2 -0
- dinemic_cli-0.0.19.dist-info/licenses/LICENSE +696 -0
- dinemic_cli-0.0.19.dist-info/top_level.txt +2 -0
- tests/01-cli-fixes.patch +418 -0
- tests/02-tests-after-fixes.patch +208 -0
- tests/api_samples.py +214 -0
- tests/cert_peer.py +37 -0
- tests/cli_runner.py +113 -0
- tests/command_matrix.py +612 -0
- tests/conftest.py +235 -0
- tests/dns_entry.py +41 -0
- tests/dns_value.py +43 -0
- tests/dns_zone.py +38 -0
- tests/endpoint.py +39 -0
- tests/healthcheck.py +40 -0
- tests/loadbalancer.py +36 -0
- tests/loadbalancer_backend.py +44 -0
- tests/loadbalancer_host.py +37 -0
- tests/loadbalancer_route.py +42 -0
- tests/network.py +34 -0
- tests/network_node.py +74 -0
- tests/node.py +23 -0
- tests/peer.py +33 -0
- tests/project.py +58 -0
- tests/support.py +246 -0
- tests/test_auth.py +114 -0
- tests/test_columns.py +58 -0
- tests/test_commands.py +98 -0
- tests/test_confirmations.py +71 -0
- tests/test_envvars.py +119 -0
- tests/test_error_handling.py +83 -0
- tests/test_lifecycle.py +188 -0
- tests/test_network_node.py +116 -0
- tests/test_option_contract.py +335 -0
- tests/test_smoke.py +83 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
|
|
3
|
+
from dinemic_cli.output import render
|
|
4
|
+
|
|
5
|
+
app = typer.Typer(no_args_is_help=True)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@app.command("list")
|
|
9
|
+
def list_routes(
|
|
10
|
+
ctx: typer.Context,
|
|
11
|
+
loadbalancer_id: str = typer.Option(..., "--loadbalancer", "-l", help="Loadbalancer ID", envvar="DINEMIC_LB"),
|
|
12
|
+
host_id: str = typer.Option(..., "--host", "-H", help="Host ID", envvar="DINEMIC_HOST")
|
|
13
|
+
):
|
|
14
|
+
data = ctx.obj["client"].get(f"/loadbalancer/{loadbalancer_id}/host/{host_id}/route/")
|
|
15
|
+
render(data, ctx.obj["output"], columns=["id", "path", "host", "healthcheck", "priority"])
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.command("create")
|
|
19
|
+
def create_route(
|
|
20
|
+
ctx: typer.Context,
|
|
21
|
+
loadbalancer_id: str = typer.Option(..., "--loadbalancer", "-l", help="Loadbalancer ID", envvar="DINEMIC_LB"),
|
|
22
|
+
host_id: str = typer.Option(..., "--host", "-H", help="Host ID", envvar="DINEMIC_HOST"),
|
|
23
|
+
path: str = typer.Option(..., "--path", "-p", help="Path"),
|
|
24
|
+
priority: int = typer.Option(..., "--priority", "-P", help="Priority"),
|
|
25
|
+
healthcheck_id: str = typer.Option(..., "--healthcheck", "-k", help="Health check ID"),
|
|
26
|
+
):
|
|
27
|
+
data = ctx.obj["client"].post(f"/loadbalancer/{loadbalancer_id}/host/{host_id}/route/", {"path": path, "priority": priority, "healthcheck": healthcheck_id})
|
|
28
|
+
typer.secho(f"Created route {data['id']} (for host {host_id} in loadbalancer {loadbalancer_id})", fg="green")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@app.command("delete")
|
|
32
|
+
def delete_route(
|
|
33
|
+
ctx: typer.Context,
|
|
34
|
+
loadbalancer_id: str = typer.Option(..., "--loadbalancer", "-l", help="Loadbalancer ID", envvar="DINEMIC_LB"),
|
|
35
|
+
host_id: str = typer.Option(..., "--host", "-H", help="Host ID", envvar="DINEMIC_HOST"),
|
|
36
|
+
route_id: str = typer.Option(..., "--route", "-r", help="Route ID", envvar="DINEMIC_ROUTE"),
|
|
37
|
+
yes: bool = typer.Option(False, "--yes", "-y", help="Don't ask for confirmation"),
|
|
38
|
+
):
|
|
39
|
+
if not yes:
|
|
40
|
+
typer.confirm(f"Remove route {route_id} and all its backends?", abort=True)
|
|
41
|
+
ctx.obj["client"].delete(f"/loadbalancer/{loadbalancer_id}/host/{host_id}/route/{route_id}/")
|
|
42
|
+
typer.secho("Removed.", fg="green")
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
|
|
3
|
+
from dinemic_cli.output import render
|
|
4
|
+
|
|
5
|
+
app = typer.Typer(no_args_is_help=True)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@app.command("list")
|
|
9
|
+
def list_networks(ctx: typer.Context,
|
|
10
|
+
project: str = typer.Option(None, "--project", "-p", help="Project ID", envvar="DINEMIC_PROJECT")):
|
|
11
|
+
data = ctx.obj["client"].get("/network/", project=project)
|
|
12
|
+
render(data, ctx.obj["output"], columns=["id", "name", "project", "ip_address", "ip_netmask"])
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@app.command("create")
|
|
16
|
+
def create_network(
|
|
17
|
+
ctx: typer.Context,
|
|
18
|
+
project: str = typer.Option(..., "--project", "-p", help="Project ID", envvar="DINEMIC_PROJECT"),
|
|
19
|
+
name: str = typer.Option(..., "--name", "-n", help="Network name"),
|
|
20
|
+
ip_address: str = typer.Option(..., "--ip", "-i", help="IPv4 address"),
|
|
21
|
+
ip_netmask: str = typer.Option(..., "--netmask", "-m", help="IPv4 netmask"),
|
|
22
|
+
):
|
|
23
|
+
data = ctx.obj["client"].post("/network/", {"project": project, "name": name, "ip_address": ip_address, "ip_netmask": ip_netmask})
|
|
24
|
+
typer.secho(f"Created network {data['name']} ({data['id']})", fg="green")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@app.command("delete")
|
|
28
|
+
def delete_network(ctx: typer.Context,
|
|
29
|
+
network_id: str = typer.Option(..., "--network", "-n", help="Network ID", envvar="DINEMIC_NETWORK"),
|
|
30
|
+
yes: bool = typer.Option(False, "--yes", "-y", help="Don't ask for confirmation"),):
|
|
31
|
+
if not yes:
|
|
32
|
+
typer.confirm(f"Remove network {network_id}?", abort=True)
|
|
33
|
+
ctx.obj["client"].delete(f"/network/{network_id}/")
|
|
34
|
+
typer.secho("Removed.", fg="green")
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
|
|
3
|
+
from dinemic_cli.output import render
|
|
4
|
+
|
|
5
|
+
app = typer.Typer(no_args_is_help=True)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@app.command("list")
|
|
9
|
+
def list_nodes(
|
|
10
|
+
ctx: typer.Context,
|
|
11
|
+
project: str = typer.Option(None, "--project", "-p", help="Project ID", envvar="DINEMIC_PROJECT")):
|
|
12
|
+
data = ctx.obj["client"].get("/node/", project=project)
|
|
13
|
+
render(data, ctx.obj["output"], columns=["id", "project", "public_key", "description", "created", "sync_time", "state", "ipv4_address", "ipv6_address", "continent_code", "country_code", "city_name"])
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@app.command("accept")
|
|
17
|
+
def activate_node(ctx: typer.Context, node_id: str = typer.Option(..., "--node", "-n", help="Node ID")):
|
|
18
|
+
ctx.obj["client"].post(f"/node/{node_id}/accept/", data=None)
|
|
19
|
+
typer.secho("Accepted.", fg="green")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@app.command("delete")
|
|
23
|
+
def delete_node(ctx: typer.Context,
|
|
24
|
+
node_id: str = typer.Option(..., "--node", "-n", help="Node ID"),
|
|
25
|
+
yes: bool = typer.Option(False, "--yes", "-y", help="Don't ask for confirmation"),):
|
|
26
|
+
if not yes:
|
|
27
|
+
typer.confirm(f"Remove node {node_id} and all peers assigned to it?", abort=True)
|
|
28
|
+
ctx.obj["client"].delete(f"/node/{node_id}/")
|
|
29
|
+
typer.secho("Removed.", fg="green")
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
|
|
3
|
+
from dinemic_cli.output import render
|
|
4
|
+
|
|
5
|
+
app = typer.Typer(no_args_is_help=True)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@app.command("list")
|
|
9
|
+
def list_peers(ctx: typer.Context,
|
|
10
|
+
project: str = typer.Option(None, "--project", "-p", help="Project ID", envvar="DINEMIC_PROJECT")):
|
|
11
|
+
data = ctx.obj["client"].get("/peer/", project=project)
|
|
12
|
+
render(data, ctx.obj["output"], columns=["id", "node", "network", "ip_address", "service_port", "role"])
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@app.command("create")
|
|
16
|
+
def create_peer(
|
|
17
|
+
ctx: typer.Context,
|
|
18
|
+
node: str = typer.Option(..., "--node", "-N", help="Node ID"),
|
|
19
|
+
network: str = typer.Option(..., "--network", "-n", help="Network ID", envvar="DINEMIC_NETWORK"),
|
|
20
|
+
config: str = typer.Option(..., "--config", "-c", help="Config ID (endpoint, load balancer or dns zone)"),
|
|
21
|
+
):
|
|
22
|
+
data = ctx.obj["client"].post("/peer/", {"network": network, "node": node, "config": config})
|
|
23
|
+
typer.secho(f"Created peer {data['id']}", fg="green")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@app.command("delete")
|
|
27
|
+
def delete_peer(ctx: typer.Context,
|
|
28
|
+
peer_id: str = typer.Option(..., "--peer", "-p", help="Peer ID"),
|
|
29
|
+
yes: bool = typer.Option(False, "--yes", "-y", help="Don't ask for confirmation"),):
|
|
30
|
+
if not yes:
|
|
31
|
+
typer.confirm(f"Remove peer {peer_id}", abort=True)
|
|
32
|
+
ctx.obj["client"].delete(f"/peer/{peer_id}/")
|
|
33
|
+
typer.secho("Removed.", fg="green")
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
|
|
3
|
+
from dinemic_cli.output import render
|
|
4
|
+
|
|
5
|
+
app = typer.Typer(no_args_is_help=True)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@app.command("list")
|
|
9
|
+
def list_peer_configs(ctx: typer.Context,
|
|
10
|
+
peer_id: str = typer.Option(..., "--peer", "-p", help="Peer ID", envvar="DINEMIC_PEER")):
|
|
11
|
+
data = ctx.obj["client"].get(f"/peer/{peer_id}/config/")
|
|
12
|
+
render(data, ctx.obj["output"], columns=["configuration", "name", "role"])
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@app.command("create")
|
|
16
|
+
def attach_config(
|
|
17
|
+
ctx: typer.Context,
|
|
18
|
+
peer_id: str = typer.Option(..., "--peer", "-p", help="Peer ID", envvar="DINEMIC_PEER"),
|
|
19
|
+
config: str = typer.Option(..., "--config", "-c", help="Config ID of the same type as the peer's (e.g. another DNS zone)"),
|
|
20
|
+
):
|
|
21
|
+
ctx.obj["client"].post(f"/peer/{peer_id}/config/", {"configuration": config})
|
|
22
|
+
typer.secho(f"Attached config {config} to peer {peer_id}", fg="green")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@app.command("delete")
|
|
26
|
+
def detach_config(ctx: typer.Context,
|
|
27
|
+
peer_id: str = typer.Option(..., "--peer", "-p", help="Peer ID", envvar="DINEMIC_PEER"),
|
|
28
|
+
config: str = typer.Option(..., "--config", "-c", help="Config ID"),
|
|
29
|
+
yes: bool = typer.Option(False, "--yes", "-y", help="Don't ask for confirmation"),):
|
|
30
|
+
if not yes:
|
|
31
|
+
typer.confirm(f"Detach config {config} from peer {peer_id}", abort=True)
|
|
32
|
+
ctx.obj["client"].delete(f"/peer/{peer_id}/config/{config}/")
|
|
33
|
+
typer.secho("Detached.", fg="green")
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
|
|
3
|
+
from dinemic_cli.output import render
|
|
4
|
+
|
|
5
|
+
app = typer.Typer(no_args_is_help=True)
|
|
6
|
+
|
|
7
|
+
member_app = typer.Typer(no_args_is_help=True, help="Members of project")
|
|
8
|
+
app.add_typer(member_app, name="member")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@app.command("list")
|
|
12
|
+
def list_projects(ctx: typer.Context):
|
|
13
|
+
data = ctx.obj["client"].get("/project/")
|
|
14
|
+
render(data, ctx.obj["output"], columns=["id", "name", "public_key", "auto_accept_nodes"])
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@app.command("create")
|
|
18
|
+
def create_project(ctx: typer.Context,
|
|
19
|
+
name: str = typer.Option(..., "--name", "-n", help="Project name")):
|
|
20
|
+
data = ctx.obj["client"].post("/project/", {"name": name})
|
|
21
|
+
typer.secho(f"Created project {data['name']} ({data['id']})", fg="green")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@app.command("delete")
|
|
25
|
+
def delete_project(ctx: typer.Context,
|
|
26
|
+
project_id: str = typer.Option(..., "--project", "-p", help="Project ID"),
|
|
27
|
+
yes: bool = typer.Option(False, "--yes", "-y", help="Don't ask for confirmation"),):
|
|
28
|
+
if not yes:
|
|
29
|
+
typer.confirm(f"Remove project {project_id} and all its resources?", abort=True)
|
|
30
|
+
ctx.obj["client"].delete(f"/project/{project_id}/")
|
|
31
|
+
typer.secho("Removed.", fg="green")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@app.command("configure")
|
|
35
|
+
def configure_node(ctx: typer.Context,
|
|
36
|
+
project_id: str = typer.Option(..., "--project", "-p", help="Project ID", envvar="DINEMIC_PROJECT"),
|
|
37
|
+
log_level: str = typer.Option("info", "--log-level", "-L", help="Agent log level (error, warn, info, debug, trace)"),
|
|
38
|
+
debug: bool = typer.Option(False, "--debug", "-D", help="Enable agent debug mode"),
|
|
39
|
+
):
|
|
40
|
+
"""Print the command that registers an agent in this project."""
|
|
41
|
+
data = ctx.obj["client"].get(f"/project/{project_id}/")
|
|
42
|
+
env = [f"RUST_LOG={log_level}"]
|
|
43
|
+
if debug:
|
|
44
|
+
env.append("RUST_DEBUG=True")
|
|
45
|
+
typer.secho(
|
|
46
|
+
f"sudo {' '.join(env)} ./dinemic-agent -p '{data['public_key']}'",
|
|
47
|
+
fg="green",
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
###########
|
|
52
|
+
# Members #
|
|
53
|
+
###########
|
|
54
|
+
|
|
55
|
+
# @member_app.command("list")
|
|
56
|
+
# def list_members(ctx: typer.Context, project_id: str = typer.Argument()):
|
|
57
|
+
# data = ctx.obj["client"].get(f"/project/{project_id}/members/")
|
|
58
|
+
# render(data, ctx.obj["output"], columns=["project_id", "record", "type", "ttl"])
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
|
|
3
|
+
from dinemic_cli.output import render
|
|
4
|
+
|
|
5
|
+
app = typer.Typer(no_args_is_help=True)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@app.command("global-resources")
|
|
9
|
+
def list_global_resource_quotas(ctx: typer.Context):
|
|
10
|
+
data = ctx.obj["client"].get("/global-quota/")
|
|
11
|
+
render(data, ctx.obj["output"], columns=["resource", "quota"])
|
|
12
|
+
|
|
13
|
+
@app.command("project-resources")
|
|
14
|
+
def list_resource_quotas(ctx: typer.Context, project_id: str = typer.Option(..., "--project", "-p", help="Project ID"),):
|
|
15
|
+
data = ctx.obj["client"].get(f"/project/{project_id}/quota/")
|
|
16
|
+
render(data, ctx.obj["output"], columns=["resource", "quota"])
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@app.command("user-projects")
|
|
20
|
+
def list_project_quotas(ctx: typer.Context):
|
|
21
|
+
data = ctx.obj["client"].get("/project-quota/")
|
|
22
|
+
render(data, ctx.obj["output"], columns=["quota"])
|
dinemic_cli/main.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
|
|
5
|
+
from dinemic_cli.client import Client, get_token
|
|
6
|
+
from dinemic_cli.commands import (
|
|
7
|
+
auth,
|
|
8
|
+
caa,
|
|
9
|
+
cert,
|
|
10
|
+
cert_peer,
|
|
11
|
+
dns_entry,
|
|
12
|
+
dns_value,
|
|
13
|
+
dns_zone,
|
|
14
|
+
endpoint,
|
|
15
|
+
healthcheck,
|
|
16
|
+
loadbalancer,
|
|
17
|
+
loadbalancer_backend,
|
|
18
|
+
loadbalancer_host,
|
|
19
|
+
loadbalancer_route,
|
|
20
|
+
network,
|
|
21
|
+
node,
|
|
22
|
+
peer,
|
|
23
|
+
peer_config,
|
|
24
|
+
project,
|
|
25
|
+
quota,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
app = typer.Typer(no_args_is_help=True, help="Dinemic CLI")
|
|
29
|
+
app.add_typer(auth.app, name="auth", help="Login and tokens")
|
|
30
|
+
app.add_typer(caa.app, name="caa", help="CAA")
|
|
31
|
+
app.add_typer(cert.app, name="cert", help="Certificates")
|
|
32
|
+
app.add_typer(cert_peer.app, name="cert-peer", help="Certificate peers")
|
|
33
|
+
app.add_typer(endpoint.app, name="endpoint", help="Endpoints")
|
|
34
|
+
app.add_typer(healthcheck.app, name="healthcheck", help="Healthchecks")
|
|
35
|
+
app.add_typer(dns_zone.app, name="dns-zone", help="DNS Zones")
|
|
36
|
+
app.add_typer(dns_entry.app, name="dns-record", help="Records for DNS zones")
|
|
37
|
+
app.add_typer(dns_value.app, name="dns-value", help="Values for records in DNS zones")
|
|
38
|
+
app.add_typer(loadbalancer.app, name="lb", help="Load balancers")
|
|
39
|
+
app.add_typer(loadbalancer_backend.app, name="lb-backend", help="Backends in load balancers")
|
|
40
|
+
app.add_typer(loadbalancer_host.app, name="lb-host", help="Hosts for load balancers")
|
|
41
|
+
app.add_typer(loadbalancer_route.app, name="lb-route", help="Routes for hosts in load balancers")
|
|
42
|
+
app.add_typer(network.app, name="network", help="Networks")
|
|
43
|
+
app.add_typer(node.app, name="node", help="Nodes")
|
|
44
|
+
app.add_typer(peer.app, name="peer", help="Peers")
|
|
45
|
+
app.add_typer(peer_config.app, name="peer-config", help="Peer configs")
|
|
46
|
+
app.add_typer(project.app, name="project", help="Projects")
|
|
47
|
+
app.add_typer(quota.app, name="quota", help="Quota")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class Output(str, Enum):
|
|
51
|
+
table = "table"
|
|
52
|
+
json = "json"
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@app.callback()
|
|
56
|
+
def main(
|
|
57
|
+
ctx: typer.Context,
|
|
58
|
+
endpoint: str = typer.Option(
|
|
59
|
+
"https://console.dinemic.com/", envvar="DINEMIC_ENDPOINT", help="Dinemic control plane"
|
|
60
|
+
),
|
|
61
|
+
output: Output = typer.Option(Output.table, "--output", "-o", help="Output format"),
|
|
62
|
+
):
|
|
63
|
+
|
|
64
|
+
ctx.obj = {
|
|
65
|
+
"client": Client(endpoint, get_token()),
|
|
66
|
+
"output": output,
|
|
67
|
+
}
|
|
68
|
+
|
dinemic_cli/output.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
from rich.console import Console
|
|
5
|
+
from rich.table import Table
|
|
6
|
+
|
|
7
|
+
console = Console()
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def render(data, output: str, columns: list[str]) -> None:
|
|
11
|
+
if output == "json":
|
|
12
|
+
typer.echo(json.dumps(data, indent=2))
|
|
13
|
+
return
|
|
14
|
+
|
|
15
|
+
rows = data if isinstance(data, list) else [data]
|
|
16
|
+
if not rows:
|
|
17
|
+
console.print("[dim]No results.[/dim]")
|
|
18
|
+
return
|
|
19
|
+
|
|
20
|
+
table = Table(box=None, header_style="bold cyan")
|
|
21
|
+
for col in columns:
|
|
22
|
+
table.add_column(col)
|
|
23
|
+
for row in rows:
|
|
24
|
+
table.add_row(*[str(row.get(c, "")) for c in columns])
|
|
25
|
+
console.print(table)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dinemic-cli
|
|
3
|
+
Version: 0.0.19
|
|
4
|
+
Summary: CLI for the Dinemic control plane
|
|
5
|
+
License-Expression: AGPL-3.0 OR LicenseRef-CloudOver-Commercial
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: typer>=0.27
|
|
10
|
+
Requires-Dist: rich>=15
|
|
11
|
+
Requires-Dist: httpx>=0.28
|
|
12
|
+
Requires-Dist: keyring>=24.0
|
|
13
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
dinemic_cli/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
2
|
+
dinemic_cli/__main__.py,sha256=eYQ9x0BwHtoACxMELDAS3ZLNkCkvF5uY0xUN3BrXDZo,266
|
|
3
|
+
dinemic_cli/client.py,sha256=DMz0LABkl1kz5rvf2OKGGiLAsk952AysvZS-eFHfB18,2343
|
|
4
|
+
dinemic_cli/main.py,sha256=BBg9IRcNNihUzwg0pWRYqajJzvhfqetTqY9bWE30uMc,2207
|
|
5
|
+
dinemic_cli/output.py,sha256=Urq93Ipe8Xg_7CcbVW7A_IN4gRSk4KsByHuLvqgBoFQ,610
|
|
6
|
+
dinemic_cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
dinemic_cli/commands/auth.py,sha256=5EeoPTwQDyzggzVtoytFbXd0XeCOu02cYjqEAgygoG0,950
|
|
8
|
+
dinemic_cli/commands/caa.py,sha256=1IeIkXVCxNcaM-RtWX7_R-Fy2F76-k3AVpYXIVwe19E,253
|
|
9
|
+
dinemic_cli/commands/cert.py,sha256=yFbupxmz4jdAm6lABFTuQtsLwhYEurExnqV027m54uI,1673
|
|
10
|
+
dinemic_cli/commands/cert_peer.py,sha256=vzSioXP6XHgq_bfT2yk1octBU6qyk_aYumuXSCtQ3EU,1746
|
|
11
|
+
dinemic_cli/commands/dns_entry.py,sha256=l4DDfO3mak6bv-lNZAFd82M8FvOovN5xyC9YUXHxtvQ,2217
|
|
12
|
+
dinemic_cli/commands/dns_value.py,sha256=GWSsZFCBbQrTa-f4MJ8WwO2f32wSOSqvSV4GsSFkhic,1748
|
|
13
|
+
dinemic_cli/commands/dns_zone.py,sha256=ajkZJHaaSg24u5YPx3SnuxRv1Bl1o5P2IROMylvrf0g,3783
|
|
14
|
+
dinemic_cli/commands/endpoint.py,sha256=yI7LfRwEjPI-FVOxmuABQsQsvMuP4oQFx4Ebx2-ctNM,1557
|
|
15
|
+
dinemic_cli/commands/healthcheck.py,sha256=gx-M-r1MDDk9L73ziZZUOyubTEzN_T19AbHUktB0pJY,1725
|
|
16
|
+
dinemic_cli/commands/loadbalancer.py,sha256=ZWMngornjPthmCqbhyRNNoERXwaeQYgHbYBYKkpyKeU,1729
|
|
17
|
+
dinemic_cli/commands/loadbalancer_backend.py,sha256=VTQHReYRBeJqURpSTqYH9FKLZewf0WFn2jAJai-p0jk,2264
|
|
18
|
+
dinemic_cli/commands/loadbalancer_host.py,sha256=ym8GBl-zHTwmEAN9cZfGnbw1saIMMQP0acYJupM0ZvI,1465
|
|
19
|
+
dinemic_cli/commands/loadbalancer_route.py,sha256=h4-J_kVtdcAYIekAI6-JzWJas243n3dFrSS3LFWaiuE,2038
|
|
20
|
+
dinemic_cli/commands/network.py,sha256=aKBhZeJtu19EASGAStyYfvc8ai-rLlnxNvR5MJzAVjw,1517
|
|
21
|
+
dinemic_cli/commands/node.py,sha256=UtM1mzPHoGAnuP-HlW72yH6cJxfK7aXzj7wO_mvcHEs,1223
|
|
22
|
+
dinemic_cli/commands/peer.py,sha256=ptojfEPwjUycZflnylUKA9pUSQ_WRe834ulF0d5PDZ8,1350
|
|
23
|
+
dinemic_cli/commands/peer_config.py,sha256=UvyIIsdvYMKmWAdQ5ZK2qQcKGvFdKqqccz3PhpUlcAQ,1422
|
|
24
|
+
dinemic_cli/commands/project.py,sha256=fbZMrsMZhG2qJr4KtQ7kT5AUp4xiS1phAnSzRUcbpe0,2254
|
|
25
|
+
dinemic_cli/commands/quota.py,sha256=9d-n5i16KXH18Jlr0eZ5XsfsM61xXlfT2JmY5v-dsgE,773
|
|
26
|
+
dinemic_cli-0.0.19.dist-info/licenses/LICENSE,sha256=He4r-Bu8a3q-WWWAiqgKPrbDRL5BFcXXzxJyqoQ132s,35655
|
|
27
|
+
tests/01-cli-fixes.patch,sha256=RSOkgGQv6MSo9i1XUaH6l3yCIV2RWhPQ17IyM7qaVCg,20426
|
|
28
|
+
tests/02-tests-after-fixes.patch,sha256=Bh3s1a75Vt2Dp9qYHH4CKss6Xd9ze0Ie3tT5s8SgNq4,6505
|
|
29
|
+
tests/api_samples.py,sha256=XFFsnYT-v69hBvwNaLNGomMfkyymDoLS8Gu05Uvqbec,6760
|
|
30
|
+
tests/cert_peer.py,sha256=vzSioXP6XHgq_bfT2yk1octBU6qyk_aYumuXSCtQ3EU,1746
|
|
31
|
+
tests/cli_runner.py,sha256=_8XjoNDgXCfFM3LK4gpuhIneXWMLJyOZS9cfUWOe08o,3406
|
|
32
|
+
tests/command_matrix.py,sha256=1HREjTZBIE1EE-ch1tdM0aL1YmJYMLlWw7XXQq2D8NQ,16359
|
|
33
|
+
tests/conftest.py,sha256=p2n5fQfRxnLr0WqpE9eOMrNjNrOWSkwoDSQkk1MEJlY,7413
|
|
34
|
+
tests/dns_entry.py,sha256=Cy3IanpnYohlK1E6ltb7WALW5vB-olErvaBfUNrXcSI,1587
|
|
35
|
+
tests/dns_value.py,sha256=GWSsZFCBbQrTa-f4MJ8WwO2f32wSOSqvSV4GsSFkhic,1748
|
|
36
|
+
tests/dns_zone.py,sha256=n6S98b6SpIQbkYXS4uUed0qrrgXoWowaCe4vkY9-qSE,1408
|
|
37
|
+
tests/endpoint.py,sha256=yI7LfRwEjPI-FVOxmuABQsQsvMuP4oQFx4Ebx2-ctNM,1557
|
|
38
|
+
tests/healthcheck.py,sha256=gx-M-r1MDDk9L73ziZZUOyubTEzN_T19AbHUktB0pJY,1725
|
|
39
|
+
tests/loadbalancer.py,sha256=osxHgRzbKo-eGwQlOs-inVTVJJDQn6td_gk0q9KyUMQ,1340
|
|
40
|
+
tests/loadbalancer_backend.py,sha256=VTQHReYRBeJqURpSTqYH9FKLZewf0WFn2jAJai-p0jk,2264
|
|
41
|
+
tests/loadbalancer_host.py,sha256=ym8GBl-zHTwmEAN9cZfGnbw1saIMMQP0acYJupM0ZvI,1465
|
|
42
|
+
tests/loadbalancer_route.py,sha256=h4-J_kVtdcAYIekAI6-JzWJas243n3dFrSS3LFWaiuE,2038
|
|
43
|
+
tests/network.py,sha256=aKBhZeJtu19EASGAStyYfvc8ai-rLlnxNvR5MJzAVjw,1517
|
|
44
|
+
tests/network_node.py,sha256=C3gzEcicAnPYzSr7yCIkQgR4z1l9hbcbg_pVfUKH7mI,2833
|
|
45
|
+
tests/node.py,sha256=5YfqxApNDrF0OmvFwBH1KZIozkKugbLKk4YaeW5e0Is,997
|
|
46
|
+
tests/peer.py,sha256=zjSiV285j6jCV4sSgGgx6z8921hzZ5CJctTpBt3NRKk,1368
|
|
47
|
+
tests/project.py,sha256=fbZMrsMZhG2qJr4KtQ7kT5AUp4xiS1phAnSzRUcbpe0,2254
|
|
48
|
+
tests/support.py,sha256=UgPDv4FNUKsJ5nIoDRK3Clc9oQ3EH7YbDuudcvBWobc,8443
|
|
49
|
+
tests/test_auth.py,sha256=xd1ZrrtDFizvFdlXIWXXLLpvBkt1r__fl5aLP6n1UWU,3712
|
|
50
|
+
tests/test_columns.py,sha256=obxHsJGNX5uhAtgIhOl9RGFpPjyVqNqjbnAN49spTP8,2189
|
|
51
|
+
tests/test_commands.py,sha256=lSAxS9qFFUL2L0oIoVLwHFQL6pD5MAAdJaB-CoBQWbU,3548
|
|
52
|
+
tests/test_confirmations.py,sha256=Xd7MvOEMNYad0wFhUbj_5i4XI24mT54hrzlT_Dem59g,2652
|
|
53
|
+
tests/test_envvars.py,sha256=F91KYryniyGuER9JD2SsVf8kxzDD5VPuMYYZTg6yEkQ,4338
|
|
54
|
+
tests/test_error_handling.py,sha256=n8QT-5TuIeINYuDcmPyAG1SAqIytwWJwKI2nQzQYUwA,2692
|
|
55
|
+
tests/test_lifecycle.py,sha256=jew1wzTRctrKNGseToFhHn9tRkz-GkoeSQuZYua0cuk,8754
|
|
56
|
+
tests/test_network_node.py,sha256=gDK7YrRkVN2dwRtq0-0G5Vrn7di-r6BvzqAzXLJfvi0,4321
|
|
57
|
+
tests/test_option_contract.py,sha256=HQrcllvMi1lSR_kqHVnLydpR2CHzcD7AmQDHgp6ddUU,12173
|
|
58
|
+
tests/test_smoke.py,sha256=-PS3j5Tl5AW8V9XVyb4LvQ9eXrVf7NmW9O1ha4gGIxA,2960
|
|
59
|
+
dinemic_cli-0.0.19.dist-info/METADATA,sha256=r50GD2XydhmKXjPCItoQzPD2Y6X1A14a5wcQp1eEwgQ,378
|
|
60
|
+
dinemic_cli-0.0.19.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
61
|
+
dinemic_cli-0.0.19.dist-info/entry_points.txt,sha256=1ktFN7zW5EN2thNBoP3DKAhpU86I2aBLguFECNyeOoU,53
|
|
62
|
+
dinemic_cli-0.0.19.dist-info/top_level.txt,sha256=uMzz5YhD2jvyugmHjXsjluIx-XdRis7hIqnqsiLhcR4,18
|
|
63
|
+
dinemic_cli-0.0.19.dist-info/RECORD,,
|