Unverified Commit cec467ae authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

symphony/cli: add org management command

parent d649a21a
...@@ -25,6 +25,7 @@ from typing_extensions import Annotated ...@@ -25,6 +25,7 @@ from typing_extensions import Annotated
from simbricks.cli.commands import ( from simbricks.cli.commands import (
audit, audit,
admin, admin,
org,
namespaces, namespaces,
rg, rg,
runs, runs,
...@@ -41,6 +42,7 @@ app.add_typer(namespaces.app, name="ns") ...@@ -41,6 +42,7 @@ app.add_typer(namespaces.app, name="ns")
app.add_typer(runs.app, name="runs") app.add_typer(runs.app, name="runs")
app.add_typer(audit.app, name="audit") app.add_typer(audit.app, name="audit")
app.add_typer(admin.app, name="admin") app.add_typer(admin.app, name="admin")
app.add_typer(org.app, name="org")
app.add_typer(systems.app, name="systems") app.add_typer(systems.app, name="systems")
app.add_typer(simulations.app, name="sims") app.add_typer(simulations.app, name="sims")
app.add_typer(instantiations.app, name="insts") app.add_typer(instantiations.app, name="insts")
......
from typer import Typer, Option
from typing import Annotated
from simbricks.client.provider import client_provider
from ..utils import async_cli, print_table_generic
app = Typer(help="Managing SimBricks organizations.")
organization = ''
@app.callback()
@async_cli()
async def amain(
org: Annotated[str, Option(help="Organization to operate in.")] = "SimBricks",
):
global organization
organization = org
@app.command()
@async_cli()
async def members():
"""List organization members."""
members = await client_provider.org_client.get_members(organization)
print_table_generic(
"Members", members, "username", "first_name", "last_name"
)
@app.command()
@async_cli()
async def invite(email: str, first_name: str, last_name: str):
"""Invite a new user."""
await client_provider.org_client.invite_member(organization, email, first_name, last_name)
@app.command()
@async_cli()
async def guest(email: str, first_name: str, last_name: str):
"""Invite a new user."""
url = await client_provider.org_client.create_guest(organization, email, first_name, last_name)
print("Guest login link: {url}")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment