- database_commonkey: constr(min_length=1)
- log_level: constr(regex=r"^(INFO|DEBUG)$")
- vca_host: constr(min_length=1)
- vca_port: PositiveInt
- vca_user: constr(min_length=1)
- vca_pubkey: constr(min_length=1)
- vca_password: constr(min_length=1)
- vca_cacert: str
- vca_cloud: constr(min_length=1)
- vca_k8s_cloud: constr(min_length=1)
- vca_apiproxy: Optional[constr(min_length=1)]
+ Args:
+ config_data (Dict[str, Any]): configuration data.
+ relation_data (Dict[str, Any]): relation data.
+ """
+ config_validators = {
+ "database_commonkey": lambda value, _: (
+ isinstance(value, str) and len(value) > 1
+ ),
+ "log_level": lambda value, _: (
+ isinstance(value, str) and value in ("INFO", "DEBUG")
+ ),
+ "vca_host": lambda value, _: isinstance(value, str) and len(value) > 1,
+ "vca_port": lambda value, _: isinstance(value, int) and value > 0,
+ "vca_user": lambda value, _: isinstance(value, str) and len(value) > 1,
+ "vca_pubkey": lambda value, _: isinstance(value, str) and len(value) > 1,
+ "vca_password": lambda value, _: isinstance(value, str) and len(value) > 1,
+ "vca_cacert": lambda value, _: isinstance(value, str),
+ "vca_cloud": lambda value, _: isinstance(value, str) and len(value) > 1,
+ "vca_k8s_cloud": lambda value, _: isinstance(value, str) and len(value) > 1,
+ "vca_apiproxy": lambda value, _: (isinstance(value, str) and len(value) > 1)
+ if value
+ else True,
+ }
+ relation_validators = {
+ "ro_host": lambda value, _: isinstance(value, str) and len(value) > 1,
+ "ro_port": lambda value, _: isinstance(value, int) and value > 0,
+ "message_host": lambda value, _: isinstance(value, str) and len(value) > 1,
+ "message_port": lambda value, _: isinstance(value, int) and value > 0,
+ "database_uri": lambda value, _: isinstance(value, str) and len(value) > 1,
+ }
+ problems = []