CLI Commands

Späť na zoznam

CLI Commands

This file contains a list of available console commands.

Console Tool

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
      --silent          Do not output any message
  -q, --quiet           Only errors are displayed. All other output is suppressed
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  completion                     Dump the shell completion script
  help                           Display help for a command
  list                           List commands
  action                         Manage and test user actions
  api-test                       Test API endpoints by making HTTP requests
  cleanup-expired-hostnames      Cleans up expired hostnames from the database and Cloudflare.
  connector                      Manage and test target system connectors
  connector-health-check         Run health checks for connectors
  connector:test-config          Test connector configuration management
  manage-users                   Manages users: creates, shows, deletes, and promotes to admin.

## API Test Command

The `api-test` command allows you to test API endpoints directly from the command line.

### Usage:
```bash
php bin/console api:test <endpoint> [options]

Options:

  • --method=METHOD HTTP method (GET, POST, PUT, DELETE) [default: "GET"]
  • --data=DATA POST data as JSON string [default: "{}"]
  • --headers=HEADERS Additional headers as JSON string [default: "{}"]
  • --base-url=BASE-URL Base URL for the API [default: "https://ddns.oit.sk"]
  • -v, --verbose Show detailed response information

Examples:

# Test health endpoint
php bin/console api-test /api/v1/ealth

# Test DDNS update with POST data
php bin/console api-test /api/v1/ddns/update --method=POST --data='{"hostname":"test.com","token":"abc123"}'

# Test with custom headers
php bin/console api-test /api/v1/test --headers='{"Authorization":"Bearer token123"}'

# Verbose output
php bin/console api-test /api/v1/health -v

Action Command

The action command allows you to manage and test user actions from the command line.

Usage:

php bin/console action <action> [options] [arguments]

Actions:

  • list - List user actions
  • inspect - Show detailed information about a specific action
  • test - Execute an action for testing purposes

Options:

  • --user=USER_ID - Filter actions by user ID
  • --hostname=HOSTNAME_ID - Filter actions by hostname ID

Examples:

List all actions for a user:

php bin/console action list --user=123

List actions for a specific hostname:

php bin/console action list --hostname=456

Inspect an action:

php bin/console action inspect 789

Test an action (with confirmation):

php bin/console action test 789

Test Command Features:

  • Real execution: Actually executes the action using the appropriate connector
  • Logging: Creates records in the action_executions table
  • Safety: Requires user confirmation before execution
  • Error handling: Proper error reporting and logging
  • Performance: Measures and reports execution time

Connector Command

The connector command allows you to manage and test target system connectors.

Usage:

php bin/console connector <action> [connector_name] [options]

Actions:

  • list - List all available connectors
  • inspect - Show detailed information about a specific connector
  • test - Test a connector with provided credentials

Options:

  • --credentials=CREDENTIALS - JSON credentials for testing
  • --params=PARAMS - JSON parameters for testing
  • --ip=IP - IP address for testing (default: 192.168.1.100)

Examples:

List all connectors:

php bin/console connector list

Inspect a connector:

php bin/console connector inspect HetznerFirewall

Test a connector:

php bin/console connector test HetznerFirewall \
  --credentials='{"api_token":"your_token"}' \
  --params='{"firewall_id":"123","placeholder_ip":"0.0.0.0/32"}'

Features:

  • Dynamic discovery: Automatically finds all registered connectors
  • Sample data: Provides sample credentials and parameters for each connector
  • Validation: Tests actual connector functionality
  • Documentation: Shows expected parameters and usage examples

Connector Health Check Command

The connector-health-check command allows you to run health checks for target connectors.

Usage:

php bin/console connector-health-check [options]

Options:

  • --target=TARGET_ID, -t - Check specific target by ID
  • --all, -a - Check all targets
  • --overview, -o - Show health overview
  • --needed, -n - Show targets needing health checks

Examples:

Show health overview:

php bin/console connector-health-check --overview

Check all targets:

php bin/console connector-health-check --all

Check specific target:

php bin/console connector-health-check --target=123

Show targets needing checks:

php bin/console connector-health-check --needed

Features:

  • Health monitoring: Check connector connectivity and functionality
  • Performance metrics: Track response times and failure rates
  • Automated scheduling: Identify targets needing health checks
  • Detailed reporting: Comprehensive health status information

Connector Test Config Command

The connector:test-config command allows you to test connector configuration management.

Usage:

php bin/console connector:test-config [options]

Options:

  • --list - List available connectors
  • --validate - Validate a sample configuration
  • --schema=SCHEMA - Show schema for connector type

Examples:

List available connectors:

php bin/console connector:test-config --list

Show schema for a connector:

php bin/console connector:test-config --schema=CLOUDFLARE_DNS

Validate sample configuration:

php bin/console connector:test-config --validate

Features:

  • Configuration validation: Test connector configurations
  • Schema inspection: View required and optional parameters
  • Sample data: Generate and validate sample configurations
  • Error reporting: Detailed validation error messages