58 lines
1.5 KiB
Python
58 lines
1.5 KiB
Python
import importlib.metadata
|
|
|
|
import click
|
|
import pyfiglet
|
|
|
|
from anaxi.logging import get_anaxi_logger
|
|
from anaxi.processes import (
|
|
run_cosmos_db_healthcheck_process,
|
|
run_postgres_healthcheck_process,
|
|
run_sync_process,
|
|
)
|
|
|
|
logger = get_anaxi_logger(__name__)
|
|
|
|
|
|
@click.group()
|
|
def cli():
|
|
logger.info(pyfiglet.figlet_format("\nWelcome to anaxi", font="big"))
|
|
logger.info(f"Running anaxi version: {importlib.metadata.version('anaxi')}")
|
|
|
|
|
|
@cli.command()
|
|
def smoke_test():
|
|
print("Oink oink!")
|
|
print(
|
|
"""
|
|
__,---.__
|
|
,-' `-.__
|
|
&/ `._\ _\\
|
|
/ ''._
|
|
| , (")
|
|
|__,'`-..--|__|--''
|
|
"""
|
|
)
|
|
|
|
|
|
@cli.command()
|
|
@click.option("--cosmos-db-id", type=click.STRING, required=True)
|
|
def cosmos_db_healthcheck(cosmos_db_id):
|
|
logger.info("Starting a Cosmos DB healthcheck.")
|
|
run_cosmos_db_healthcheck_process(cosmos_db_id)
|
|
logger.info("Finished the Cosmos DB healthcheck.")
|
|
|
|
|
|
@cli.command()
|
|
@click.option("--postgres-database", type=click.STRING, required=True)
|
|
def postgres_healthcheck(postgres_database):
|
|
logger.info("Starting a Postgres healthcheck.")
|
|
run_postgres_healthcheck_process(postgres_database)
|
|
logger.info("Finished the Postgres healthcheck.")
|
|
|
|
|
|
@cli.command()
|
|
@click.option("--stream-id", type=click.STRING, required=True)
|
|
def sync_stream(stream_id):
|
|
logger.info("Starting a sync.")
|
|
run_sync_process(stream_id)
|
|
logger.info("Finished sync.")
|