summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/modules/dockerhub/init.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/go/collectors/go.d.plugin/modules/dockerhub/init.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/go/collectors/go.d.plugin/modules/dockerhub/init.go b/src/go/collectors/go.d.plugin/modules/dockerhub/init.go
new file mode 100644
index 000000000..245bee1cb
--- /dev/null
+++ b/src/go/collectors/go.d.plugin/modules/dockerhub/init.go
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+package dockerhub
+
+import (
+ "errors"
+ "github.com/netdata/netdata/go/go.d.plugin/pkg/web"
+)
+
+func (dh *DockerHub) validateConfig() error {
+ if dh.URL == "" {
+ return errors.New("url not set")
+ }
+ if len(dh.Repositories) == 0 {
+ return errors.New("repositories not set")
+ }
+ return nil
+}
+
+func (dh *DockerHub) initApiClient() (*apiClient, error) {
+ client, err := web.NewHTTPClient(dh.Client)
+ if err != nil {
+ return nil, err
+ }
+ return newAPIClient(client, dh.Request), nil
+}