99 lines
3.4 KiB
Python
99 lines
3.4 KiB
Python
#!/usr/bin/env python3
|
|
# pylint: disable=line-too-long
|
|
"""defines the form for typing in all needed HAL9002 parameters"""
|
|
|
|
from cmk.rulesets.v1 import Help, Title, Label
|
|
from cmk.rulesets.v1.form_specs import (
|
|
DictElement,
|
|
Dictionary,
|
|
String,
|
|
validators,
|
|
BooleanChoice,
|
|
Integer,
|
|
Password,
|
|
migrate_to_password,
|
|
InputHint,
|
|
DefaultValue,
|
|
)
|
|
from cmk.rulesets.v1.rule_specs import SpecialAgent, Topic
|
|
|
|
|
|
def _form_spec_special_agent_mailcow() -> Dictionary:
|
|
return Dictionary(
|
|
title=Title("Mailcow Server Information"),
|
|
help_text=Help("Checking Mailcow systems via API"),
|
|
elements={
|
|
"hostname": DictElement(
|
|
required=True,
|
|
parameter_form=String(
|
|
title=Title("Hostname"),
|
|
help_text=Help(
|
|
"Hostname of Mailcow server (bare FQDN or IP), mandatory, eg. mailcow.yourdomain.tld"
|
|
),
|
|
custom_validate=(validators.LengthInRange(min_value=1),),
|
|
prefill=InputHint("mailcow.yourdomain.tld"),
|
|
),
|
|
),
|
|
"apikey": DictElement(
|
|
required=True,
|
|
parameter_form=Password(
|
|
title=Title("API key"),
|
|
help_text=Help("Specify API key, mandatory"),
|
|
custom_validate=(validators.LengthInRange(min_value=1),),
|
|
migrate=migrate_to_password,
|
|
),
|
|
),
|
|
"port": DictElement(
|
|
required=False,
|
|
parameter_form=Integer(
|
|
title=Title("Port"),
|
|
help_text=Help(
|
|
"Specify port the Mailcow system ist listening on, mandatory"
|
|
),
|
|
prefill=DefaultValue(443),
|
|
custom_validate=(validators.NetworkPort(),),
|
|
),
|
|
),
|
|
"check_version": DictElement(
|
|
required=False,
|
|
parameter_form=BooleanChoice(
|
|
title=Title("Check Mailcow version"),
|
|
help_text=Help(
|
|
"Activate to check version of running Mailcow against actual Github version, optional"
|
|
),
|
|
label=Label(
|
|
"Enable version check (requires access to Github internet site)"
|
|
),
|
|
),
|
|
),
|
|
"no_https": DictElement(
|
|
required=False,
|
|
parameter_form=BooleanChoice(
|
|
title=Title("Disable HTTPS"),
|
|
help_text=Help(
|
|
"Activate to disable encryption (not recommended), optional"
|
|
),
|
|
label=Label("Disable HTTPS"),
|
|
),
|
|
),
|
|
"no_cert_check": DictElement(
|
|
required=False,
|
|
parameter_form=BooleanChoice(
|
|
title=Title("Disable certificate validation"),
|
|
help_text=Help(
|
|
"Activate to disable certificate validation (not recommended), optional"
|
|
),
|
|
label=Label("Disable certificate validation"),
|
|
),
|
|
),
|
|
},
|
|
)
|
|
|
|
|
|
rule_spec_mailcow = SpecialAgent(
|
|
name="mailcow",
|
|
title=Title("Mailcow connection parameters"),
|
|
topic=Topic.APPLICATIONS,
|
|
parameter_form=_form_spec_special_agent_mailcow,
|
|
)
|