def list_tenants(): """ List available tenants """ client = Client() try: tenants = client.get_available_tenants() except AuthorizationError: raise TerminalError( "You are not authenticated. Use `prefect auth login` first.") output = [] for item in tenants: active = None if item.id == client.tenant_id: active = "*" output.append([item.name, item.slug, item.id, active]) click.echo( tabulate( output, headers=["NAME", "SLUG", "ID", ""], tablefmt="plain", numalign="left", stralign="left", ))
def list_tenants(): """ List available tenants """ check_override_auth_token() client = Client() tenants = client.get_available_tenants() active_tenant_id = client._active_tenant_id output = [] for item in tenants: active = None if item.id == active_tenant_id: active = "*" output.append([item.name, item.slug, item.id, active]) click.echo( tabulate( output, headers=["NAME", "SLUG", "ID", ""], tablefmt="plain", numalign="left", stralign="left", ) )
def list_tenants(): """ List available tenants """ client = Client() tenants = client.get_available_tenants() output = [] for item in tenants: active = None if item.id == (client.tenant_id or client.get_default_tenant()): active = "*" output.append([item.name, item.slug, item.id, active]) click.echo( tabulate( output, headers=["NAME", "SLUG", "ID", ""], tablefmt="plain", numalign="left", stralign="left", ))