def validation_operator_list(directory): """List known Validation Operators.""" try: context = DataContext(directory) except ge_exceptions.ConfigNotFoundError as err: cli_message(f"<red>{err.message}</red>") return try: validation_operators = context.list_validation_operators() if len(validation_operators) == 0: cli_message("No Validation Operators found") return elif len(validation_operators) == 1: list_intro_string = "1 Validation Operator found:" else: list_intro_string = "{} Validation Operators found:".format( len(validation_operators) ) cli_message(list_intro_string) for validation_operator in validation_operators: cli_message("") cli_message_dict(validation_operator) toolkit.send_usage_message( data_context=context, event="cli.validation_operator.list", success=True ) except Exception as e: toolkit.send_usage_message( data_context=context, event="cli.validation_operator.list", success=False ) raise e
def store_list(directory): """List known Stores.""" context = toolkit.load_data_context_with_error_handling(directory) try: stores = context.list_stores() if len(stores) == 0: cli_message("No Stores found") toolkit.send_usage_message(data_context=context, event="cli.store.list", success=True) return elif len(stores) == 1: list_intro_string = "1 Store found:" else: list_intro_string = "{} Stores found:".format(len(stores)) cli_message(list_intro_string) for store in stores: cli_message("") cli_message_dict(store) toolkit.send_usage_message(data_context=context, event="cli.store.list", success=True) except Exception as e: toolkit.send_usage_message(data_context=context, event="cli.store.list", success=False) raise e