# Developer reference and config value validation

**URL:** <https://discuss.elastic.co/t/developer-reference-and-config-value-validation/345016>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [October 13, 2023, 8:46pm UTC](https://discuss.elastic.co/t/developer-reference-and-config-value-validation/345016 "2023-10-13T20:46:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tlinker13](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tlinker13/32/126434_2.png) [@tlinker13](https://discuss.elastic.co/u/tlinker13)\
**Post date:** [October 13, 2023, 8:46pm UTC](https://discuss.elastic.co/t/developer-reference-and-config-value-validation/345016/1 "2023-10-13T20:46:20Z")

</div>

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

MY config.yml shall look somewhat like that:

```yml
- 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:

```go
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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 10, 2023, 10:47pm UTC](https://discuss.elastic.co/t/developer-reference-and-config-value-validation/345016/2 "2023-11-10T22:47:16Z")

</div>

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