from minio import Minio
import logging

# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

def test_minio_connection():
    try:
        # Initialize MinIO client
        minio_client = Minio(
            "192.168.3.143:9000",
            access_key="citu-dataops-acc-key",
            secret_key="citu-dataops-secret-key",
            secure=False
        )
        
        # List buckets
        buckets = minio_client.list_buckets()
        logger.info("Successfully connected to MinIO server")
        logger.info("Available buckets:")
        for bucket in buckets:
            logger.info(f"- {bucket.name}")
            
        return True
    except Exception as e:
        logger.error(f"Failed to connect to MinIO server: {str(e)}")
        return False

if __name__ == "__main__":
    test_minio_connection() 