| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- """
- Configuration Command Classes
- This module implements commands for configuration management.
- """
- from typing import Optional, Dict, Any
- from dataclasses import dataclass, field
- from .base import TrixyCommand, CommandResponse, ValidationError
- @dataclass
- class ConfigUpdateCommand(TrixyCommand):
- """Command to update configuration settings."""
-
- config_section: str = field(default="")
- config_changes: Dict[str, Any] = field(default_factory=dict)
-
- def validate(self) -> bool:
- if not self.config_section:
- raise ValidationError("ConfigUpdateCommand must have a config_section")
- return True
-
- def get_command_name(self) -> str:
- return "ConfigUpdateCommand"
- @dataclass
- class ConfigRequestCommand(TrixyCommand):
- """Command to request configuration data."""
-
- config_section: str = field(default="all")
-
- def validate(self) -> bool:
- return True
-
- def get_command_name(self) -> str:
- return "ConfigRequestCommand"
- @dataclass
- class ConfigValidateCommand(TrixyCommand):
- """Command to validate configuration."""
-
- config_data: Dict[str, Any] = field(default_factory=dict)
-
- def validate(self) -> bool:
- return True
-
- def get_command_name(self) -> str:
- return "ConfigValidateCommand"
- @dataclass
- class ConfigUpdateResponse(CommandResponse):
- """Response to config update command."""
-
- update_applied: bool = field(default=False)
-
- def validate(self) -> bool:
- return True
-
- def get_response_name(self) -> str:
- return "ConfigUpdateResponse"
- @dataclass
- class ConfigRequestResponse(CommandResponse):
- """Response to config request command."""
-
- config_data: Dict[str, Any] = field(default_factory=dict)
-
- def validate(self) -> bool:
- return True
-
- def get_response_name(self) -> str:
- return "ConfigRequestResponse"
- @dataclass
- class ConfigValidateResponse(CommandResponse):
- """Response to config validate command."""
-
- is_valid: bool = field(default=False)
-
- def validate(self) -> bool:
- return True
-
- def get_response_name(self) -> str:
- return "ConfigValidateResponse"
- __all__ = [
- "ConfigUpdateCommand", "ConfigRequestCommand", "ConfigValidateCommand",
- "ConfigUpdateResponse", "ConfigRequestResponse", "ConfigValidateResponse"
- ]
|