-
Notifications
You must be signed in to change notification settings - Fork 29
/
synthetic_maint_p_switch_details.go
85 lines (66 loc) · 2.68 KB
/
synthetic_maint_p_switch_details.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
package models
import (
"fmt"
"github.com/ciscoecosystem/aci-go-client/v2/container"
"strconv"
)
const SyntheticMaintPSwitchDetailsClassName = "syntheticMaintPSwitchDetails"
type MaintPSwitchDetails struct {
BaseAttributes
MaintPSwitchDetailsAttributes
}
type MaintPSwitchDetailsAttributes struct {
MaintPName string `json:",omitempty"`
NodeIds string `json:",omitempty"`
TargetVersion string `json:",omitempty"`
}
func NewMaintPSwitchDetails(syntheticMaintPSwitchDetailsRn, parentDn, description string, syntheticMaintPSwitchDetailsattr MaintPSwitchDetailsAttributes) *MaintPSwitchDetails {
dn := fmt.Sprintf("%s/%s", parentDn, syntheticMaintPSwitchDetailsRn)
return &MaintPSwitchDetails{
BaseAttributes: BaseAttributes{
DistinguishedName: dn,
Description: description,
Status: "",
ClassName: SyntheticMaintPSwitchDetailsClassName,
Rn: syntheticMaintPSwitchDetailsRn,
},
MaintPSwitchDetailsAttributes: syntheticMaintPSwitchDetailsattr,
}
}
func (syntheticMaintPSwitchDetails *MaintPSwitchDetails) ToMap() (map[string]string, error) {
syntheticMaintPSwitchDetailsMap, err := syntheticMaintPSwitchDetails.BaseAttributes.ToMap()
if err != nil {
return nil, err
}
A(syntheticMaintPSwitchDetailsMap, "maintPName", syntheticMaintPSwitchDetails.MaintPName)
A(syntheticMaintPSwitchDetailsMap, "nodeIds", syntheticMaintPSwitchDetails.NodeIds)
A(syntheticMaintPSwitchDetailsMap, "targetVersion", syntheticMaintPSwitchDetails.TargetVersion)
return syntheticMaintPSwitchDetailsMap, err
}
func MaintPSwitchDetailsFromContainerList(cont *container.Container, index int) *MaintPSwitchDetails {
MaintPSwitchDetailsCont := cont.S("imdata").Index(index).S(SyntheticMaintPSwitchDetailsClassName, "attributes")
return &MaintPSwitchDetails{
BaseAttributes{
DistinguishedName: G(MaintPSwitchDetailsCont, "dn"),
Status: G(MaintPSwitchDetailsCont, "status"),
ClassName: SyntheticMaintPSwitchDetailsClassName,
Rn: G(MaintPSwitchDetailsCont, "rn"),
},
MaintPSwitchDetailsAttributes{
MaintPName: G(MaintPSwitchDetailsCont, "maintPName"),
NodeIds: G(MaintPSwitchDetailsCont, "nodeIds"),
TargetVersion: G(MaintPSwitchDetailsCont, "targetVersion"),
},
}
}
func MaintPSwitchDetailsFromContainer(cont *container.Container) *MaintPSwitchDetails {
return MaintPSwitchDetailsFromContainerList(cont, 0)
}
func MaintPSwitchDetailsListFromContainer(cont *container.Container) []*MaintPSwitchDetails {
length, _ := strconv.Atoi(G(cont, "totalCount"))
arr := make([]*MaintPSwitchDetails, length)
for i := 0; i < length; i++ {
arr[i] = MaintPSwitchDetailsFromContainerList(cont, i)
}
return arr
}