from cmk.gui.i18n import _ from cmk.gui.plugins.wato import ( CheckParameterRulespecWithItem, rulespec_registry, RulespecGroupCheckParametersOperatingSystem, ) from cmk.gui.valuespec import ( Dictionary, ListChoice, Checkbox, TextAscii, Password, ) from cmk.gui.plugins.wato import ( HostRulespec, ) from cmk.gui.plugins.wato.datasource_programs import RulespecGroupDatasourceProgramsCustom import cmk.gui.watolib as watolib def _valuespec_special_agent_nextcloud(): return Dictionary( title=_("Nextcloud Server Information"), help = _("Checking Nextcloud servers via API"), elements=[ ("hostname", TextAscii(title=_("Hostname"), allow_empty=False, help=_("Hostname of Nextcloud server (bare FQDN or IP, IP not tested), mandatory"))), ("username", TextAscii(title=_("Username"), allow_empty=False, help=_("Username with administrative rights, mandatory"))), ("password", Password(title=_("Password"), allow_empty=True, help=_("Specify password OR token, not both, token recommended"))), ("token", Password(title=_("Token"), allow_empty=True, help=_("Specify password OR token, not both, token recommended"))), ("port", TextAscii(title=_("Port"), allow_empty=True, help=_("Specify port if not listening to HTTPS, optional"))), ("folder", TextAscii(title=_("Folder"), allow_empty=True, help=_("Specify subfolder if your Nextcloud instance is not installed in the web root, no trailing/leading slashes, optional"))), ("no_https", Checkbox(title=_("Disable HTTPS"), help=_("Activate to disable encryption (not recommended), optional"))), ("no_cert_check", Checkbox(title=_("Disable certificate validation"), help=_("Activate to disable certificate validation (not recommended), optional"))), ], optional_keys=[], ) rulespec_registry.register( HostRulespec( factory_default=watolib.Rulespec.FACTORY_DEFAULT_UNUSED, group=RulespecGroupDatasourceProgramsCustom, name="special_agents:nextcloud", valuespec=_valuespec_special_agent_nextcloud, ) )