Developer reference and config value validation

Hey all,
Background:
I have to implement a new module and metricset to search LDAP directories.

MY config.yml shall look somewhat like that:

- module: ldap
  metricsets: ["ldapsearch"]
  enabled: true
  period: 10s
  # When ssl is enabled metricset 'ldapsearch" only can contact one host,
  # which should be named here aswell
  hosts: ["localhost"]

  # Optional SSL. By default is off.
  #ssl.enabled: true

  # List of root certificates for TLS server verifications
  # When ssl is enabled metricset 'ldapsearch" only can contact one host
  #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]

  # configure 'ldapsearch' metricset's searches. `Every search needs an unique name`
  #ldapsearch.searches:
  #  - name: "some unique name"
  #    url: "ldaps://your.ldap.host:636/cn=search,o=base?some,return,attributes,list?sub?(objectClass=inetOrgPerson)#never#10#60#false"
  #    cert_path: "some path" ## to be replaced with module's ssl.certificate_authorities
  #    bind_dn: "${LDAP_USER}"
  #    bind_pw: "${LDAP_PWD}"

for ldapsearch.searches.name I would like a validation like the following:

type search struct {
  Namespace string `config:"name" validate:"required,nonzero,**unique**"`
}

Is there any validate option like 'unique' or where can I find a developer's reference for configuration and validation?

Thanks in advance and best regards

BR
T

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.