Command line interface for AtaData Job Scheduler Backend API
Project description
AtaData CLI
A comprehensive command-line interface for managing your AtaData Job Scheduler Backend API.
Features
This CLI tool provides full access to all backend operations including:
- Job Management: CRUD operations, enable/disable, manual triggering
- Settings Management: Data source configuration, migrations
- Secret Management: Validation, generation, encryption status
- System Health Monitoring: Health checks and status monitoring
- Authentication Management: API key management and authentication
Installation
From PyPI (Recommended)
pip install atadata-cli
From Source
git clone https://github.com/atadata/atadata-cli.git
cd atadata-cli
pip install -e .
Development Installation
git clone https://github.com/atadata/atadata-cli.git
cd atadata-cli
pip install -e ".[dev]"
Quick Start
1. Authentication
First, authenticate with your AtaData backend:
# Option 1: Use .env file (recommended)
cp env.example .env
# Edit .env file and add your API key:
# ATADATA_API_KEY=your-api-key-here
# ATADATA_BASE_URL=http://localhost:8000
# Option 2: Login interactively
atadata auth login
# Option 3: Set environment variable directly
export ATADATA_API_KEY="your-api-key-here"
# Check authentication status
atadata auth status
2. Basic Usage
# Check backend health
atadata health
# List all jobs
atadata jobs list
# Create a new job
atadata jobs create --id "backup-job" --title "Daily Backup" --cron "0 2 * * *"
# Trigger a job manually
atadata jobs trigger backup-job
# Disable a job
atadata jobs disable backup-job
Commands Reference
Authentication Commands
# Login to the backend
atadata auth login
# Logout from the backend
atadata auth logout
# Show authentication status
atadata auth status
# Create a new API key
atadata auth create-key --name "my-key" --expires-days 30
# List all API keys
atadata auth list-keys
# Revoke an API key
atadata auth revoke-key <api-key-id>
Job Management Commands
# List all jobs
atadata jobs list [--json]
# Get a specific job
atadata jobs get <job-id>
# Create a new job
atadata jobs create --id <job-id> --title <title> --cron <cron-expression> [--description <desc>] [--secrets <secrets>]
# Update an existing job
atadata jobs update <job-id> [--title <title>] [--description <desc>] [--cron <cron>] [--secrets <secrets>] [--enable] [--disable]
# Delete a job
atadata jobs delete <job-id>
# Enable a job
atadata jobs enable <job-id>
# Disable a job
atadata jobs disable <job-id>
# Manually trigger a job
atadata jobs trigger <job-id>
Settings Management Commands
# Get current settings
atadata settings get
# Update data source configuration
atadata settings data-source --type <json|firebase> [--json-file <path>] [--collection <name>]
# Test data source connection
atadata settings test-connection --type <json|firebase> [--collection <name>]
# Migrate data between sources
atadata settings migrate --from <source> --to <target>
Secret Management Commands
# Validate secret strength
atadata secrets validate --secret <secret>
# Generate a secure secret
atadata secrets generate [--length <length>] [--json]
# Check encryption status
atadata secrets encryption-status
System Commands
# Check backend health
atadata health
# Get system status
atadata status
# Configuration management
atadata config get <key>
atadata config set <key> <value>
Configuration
The CLI supports multiple configuration methods (in order of priority):
1. Environment Variables (Recommended)
Create a .env file in your project directory:
# Copy the example file
cp env.example .env
# Edit .env with your values
ATADATA_API_KEY=your-api-key-here
ATADATA_BASE_URL=http://localhost:8000
2. System Environment Variables
export ATADATA_API_KEY="your-api-key-here"
export ATADATA_BASE_URL="http://localhost:8000"
3. Config File
The CLI also stores configuration in ~/.atadata_cli_config.json for interactive login sessions.
Environment Variables
ATADATA_API_KEY: Your API key for authentication (primary)API_KEY_ATADATA: Alternative API key variable name (backward compatibility)ATADATA_BASE_URL: Base URL for the backend API (default: http://localhost:8000)
Examples
Complete Workflow Example
# 1. Set up environment
cp env.example .env
# Edit .env with your API key and base URL
# 2. Authenticate (or use .env file)
atadata auth status
# 3. Check system health
atadata health
# 4. Create a backup job
atadata jobs create \
--id "daily-backup" \
--title "Daily Database Backup" \
--description "Automated daily backup of the database" \
--cron "0 2 * * *" \
--secrets "BACKUP_PASSWORD=secret123"
# 5. List jobs to verify
atadata jobs list
# 6. Test the job manually
atadata jobs trigger daily-backup
# 7. Update job settings
atadata jobs update daily-backup --cron "0 3 * * *"
# 8. Disable the job
atadata jobs disable daily-backup
Batch Operations
# Create multiple jobs from a script
for i in {1..5}; do
atadata jobs create \
--id "job-$i" \
--title "Test Job $i" \
--cron "0 */6 * * *"
done
# List all jobs
atadata jobs list
# Disable all jobs
atadata jobs list --json | jq -r '.jobs[].id' | xargs -I {} atadata jobs disable {}
Development
Running Tests
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run tests with coverage
pytest --cov=atadata_cli
# Run specific test
pytest tests/test_cli.py::test_auth_login
Code Quality
# Format code
black atadata_cli/ tests/
# Lint code
flake8 atadata_cli/ tests/
# Type checking
mypy atadata_cli/
Building the Package
# Build source distribution
python setup.py sdist
# Build wheel
python setup.py bdist_wheel
# Build both
python setup.py sdist bdist_wheel
Sample Script
A sample script is included to test all CLI functions. Run it to verify your installation:
python sample_script.py
This script will test:
- Authentication
- Health checks
- Job management operations
- Settings management
- Secret management
Troubleshooting
Common Issues
- Connection Error: Make sure the backend server is running and accessible
- Authentication Failed: Verify your API key is correct and not expired
- Permission Denied: Check that your API key has the necessary permissions
Debug Mode
Enable debug output by setting the environment variable:
export ATADATA_DEBUG=1
atadata jobs list
Logs
The CLI logs important operations. Check the logs for detailed error information.
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- Documentation: GitHub Wiki
- Issues: GitHub Issues
- Email: support@atadata.com
Changelog
Version 1.0.0
- Initial release
- Full job management functionality
- Authentication system
- Settings and secret management
- Health monitoring
- Comprehensive CLI interface
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file atadata_cli-1.0.1.tar.gz.
File metadata
- Download URL: atadata_cli-1.0.1.tar.gz
- Upload date:
- Size: 28.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c695c05e18f7893fc2a396dbfb2ea10503844a281d6ee818bef2410414d52997
|
|
| MD5 |
f2aa7b1eb59590cc222399c07e2bc46d
|
|
| BLAKE2b-256 |
64b99dffbf90e52308faa81834afe9c04b417f7cdd8df238f8466b8d0d933685
|
File details
Details for the file atadata_cli-1.0.1-py3-none-any.whl.
File metadata
- Download URL: atadata_cli-1.0.1-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a87776f47209db32678dfcd9562d5c7c6064a30d2d1135a8748a7428abc38e5
|
|
| MD5 |
e5fb91d46c9e68210f9a2ac2277331a1
|
|
| BLAKE2b-256 |
fd87832a999d2e05e530303a89be3bc927807954de0efe7d23ad24279ce44c2f
|