-
Notifications
You must be signed in to change notification settings - Fork 0
/
entities.go
106 lines (89 loc) · 4.94 KB
/
entities.go
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
Copyright © 2022 ITRS Group
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package geneos
import (
"encoding/xml"
)
type ManagedEntities struct {
XMLName xml.Name `xml:"managedEntities" json:"-" yaml:"-"`
Entities []ManagedEntity `xml:"managedEntity,omitempty" json:",omitempty" yaml:",omitempty" mapstructure:"managedentity"`
ManagedEntityGroups []ManagedEntityGroup `xml:"managedEntityGroup,omitempty" json:",omitempty" yaml:",omitempty" mapstructure:"managedentitygroup"`
}
type ManagedEntityGroup struct {
XMLName xml.Name `xml:"managedEntityGroup" json:"-" yaml:"-"`
Name string `xml:"name,attr"`
Disabled bool `xml:"disabled,attr,omitempty" json:",omitempty" yaml:",omitempty"`
ManagedEntityInfo `yaml:",inline" mapstructure:",squash"`
Entities []ManagedEntity `xml:"managedEntity,omitempty" json:",omitempty" yaml:",omitempty" mapstructure:"managedentity"`
ManagedEntityGroups []ManagedEntityGroup `xml:"managedEntityGroup,omitempty" json:",omitempty" yaml:",omitempty" mapstructure:"managedentitygroup"`
}
type ManagedEntity struct {
XMLName xml.Name `xml:"managedEntity" json:"-" yaml:"-"`
Name string `xml:"name,attr"`
Disabled bool `xml:"disabled,attr,omitempty" json:",omitempty" yaml:",omitempty"`
Probe *Reference `xml:"probe" json:",omitempty" yaml:",omitempty"`
FloatingProbe *Reference `xml:"floatingProbe" json:",omitempty" yaml:",omitempty"`
VirtualProbe *Reference `xml:"virtualProbe" json:",omitempty" yaml:",omitempty"`
Environment *EnvironmentRef `xml:"environment,omitempty" json:",omitempty" yaml:",omitempty"`
ManagedEntityInfo `yaml:",inline" mapstructure:",squash"`
Samplers []SamplerRef `xml:"sampler,omitempty" json:",omitempty" yaml:",omitempty" mapstructure:"sampler"`
}
type ManagedEntityInfo struct {
Attributes []Attribute `xml:"attribute,omitempty" json:",omitempty" yaml:",omitempty" mapstructure:"attribute"`
RemoveTypes *RemoveTypes `xml:"removeTypes,omitempty" json:",omitempty" yaml:",omitempty"`
RemoveSamplers *RemoveSamplers `xml:"removeSamplers,omitempty" json:",omitempty" yaml:",omitempty"`
AddTypes *AddTypes `xml:"addTypes,omitempty" json:",omitempty" yaml:",omitempty"`
Vars []Vars `xml:"var,omitempty" json:",omitempty" yaml:",omitempty" mapstructure:"var"`
ResolvedSamplers map[string]bool `xml:"-" json:",omitempty" yaml:",omitempty"` // map of "type:sampler" that exist at this point
}
type RemoveTypes struct {
XMLName xml.Name `xml:"removeTypes" json:"-" yaml:"-"`
Types []TypeRef `xml:"type,omitempty" json:",omitempty" yaml:",omitempty" mapstructure:"type"`
}
type RemoveSamplers struct {
XMLName xml.Name `xml:"removeSamplers" json:"-" yaml:"-"`
Samplers []SamplerWithType `xml:"sampler,omitempty" json:",omitempty" yaml:",omitempty"`
}
type AddTypes struct {
XMLName xml.Name `xml:"addTypes" json:"-" yaml:"-"`
Types []TypeRefWithEnv `xml:"type,omitempty" json:",omitempty" yaml:",omitempty" mapstructure:"type"`
}
type SamplerWithType struct {
XMLName xml.Name `xml:"sampler" json:"-" yaml:"-"`
Sampler string `xml:"ref,attr"`
Type TypeRef `xml:"type"`
}
type Attribute struct {
XMLName xml.Name `xml:"attribute" json:"-" yaml:"-"`
Name string `xml:"name,attr"`
Value string `xml:",innerxml" mapstructure:"#text"`
}
// GetKey satisfies the KeyedObject interface
func (a Attribute) GetKey() string {
return a.Name
}
type TypeRef struct {
XMLName xml.Name `xml:"type" json:"-" yaml:"-"`
Type string `xml:"ref,attr" json:",omitempty" yaml:",omitempty" mapstructure:"ref"`
}
type TypeRefWithEnv struct {
XMLName xml.Name `xml:"type" json:"-" yaml:"-"`
Type string `xml:"ref,attr" json:",omitempty" yaml:",omitempty" mapstructure:"ref"`
Environment *EnvironmentRef `xml:",omitempty" json:",omitempty" yaml:",omitempty"`
}