-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckCommand.go
More file actions
50 lines (35 loc) · 1.02 KB
/
CheckCommand.go
File metadata and controls
50 lines (35 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package icingadsl
import (
"strings"
)
// https://icinga.com/docs/icinga-2/latest/doc/09-object-types/#checkcommand
type CheckCommand struct {
Name string
Command Array
Imports []*CheckCommand
Env map[string]string
Vars Dictionary
Timeout Duration
Arguments []CheckCommandArgument
}
// String returns the CheckCommand Object as string with proper indentation
func (cc *CheckCommand) String() string {
var bla strings.Builder
bla.WriteString("object CheckCommand \"" + cc.Name + "\" {\n")
indentation++
for _, cci := range cc.Imports {
bla.WriteString(indentString() + "import \"" + cci.Name + "\"\n")
}
bla.WriteString(indentString() + "command = " + cc.Command.String() + "\n")
bla.WriteString(indentString() + "arguments = {\n")
indentation++
for i := range cc.Arguments {
bla.WriteString(cc.Arguments[i].String(cc.Name))
bla.WriteString("\n")
}
indentation--
bla.WriteString(indentString() + "}\n")
indentation--
bla.WriteString(indentString() + "}\n")
return bla.String()
}