-
Notifications
You must be signed in to change notification settings - Fork 29
/
firmwareCtrlrFwP_service.go
48 lines (40 loc) · 1.7 KB
/
firmwareCtrlrFwP_service.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
package client
import (
"fmt"
"github.com/ciscoecosystem/aci-go-client/models"
)
func (sm *ServiceManager) CreateCtrlrFwP(description string, firmwareCtrlrFwPAttr models.CtrlrFwPAttributes) (*models.CtrlrFwP, error) {
rn := "ctrlrfwpol"
parentDn := fmt.Sprintf("uni/controller")
firmwareCtrlrFwP := models.NewCtrlrFwP(rn, parentDn, description, firmwareCtrlrFwPAttr)
err := sm.Save(firmwareCtrlrFwP)
return firmwareCtrlrFwP, err
}
func (sm *ServiceManager) ReadCtrlrFwP(name string) (*models.CtrlrFwP, error) {
dn := fmt.Sprintf("uni/controller/ctrlrfwpol")
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
firmwareCtrlrFwP := models.CtrlrFwPFromContainer(cont)
return firmwareCtrlrFwP, nil
}
func (sm *ServiceManager) DeleteCtrlrFwP() error {
dn := fmt.Sprintf("uni/controller/ctrlrfwpol")
return sm.DeleteByDn(dn, models.FirmwareCtrlrFwPClassName)
}
func (sm *ServiceManager) UpdateCtrlrFwP(description string, firmwareCtrlrFwPAttr models.CtrlrFwPAttributes) (*models.CtrlrFwP, error) {
rn := "ctrlrfwpol"
parentDn := fmt.Sprintf("uni/controller")
firmwareCtrlrFwP := models.NewCtrlrFwP(rn, parentDn, description, firmwareCtrlrFwPAttr)
firmwareCtrlrFwP.Status = "modified"
err := sm.Save(firmwareCtrlrFwP)
return firmwareCtrlrFwP, err
}
func (sm *ServiceManager) ListCtrlrFwP() ([]*models.CtrlrFwP, error) {
baseurlStr := "/api/node/class"
dnUrl := fmt.Sprintf("%s/firmwareCtrlrFwP.json", baseurlStr )
cont, err := sm.GetViaURL(dnUrl)
list := models.CtrlrFwPListFromContainer(cont)
return list, err
}