-
Notifications
You must be signed in to change notification settings - Fork 30
/
rtctrlSetComm_service.go
48 lines (39 loc) · 1.98 KB
/
rtctrlSetComm_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
48
package client
import (
"fmt"
"github.com/ciscoecosystem/aci-go-client/models"
)
func (sm *ServiceManager) CreateRtctrlSetComm(action_rule_profile string, tenant string, description string, nameAlias string, rtctrlSetCommAttr models.RtctrlSetCommAttributes) (*models.RtctrlSetComm, error) {
rn := fmt.Sprintf(models.RnrtctrlSetComm)
parentDn := fmt.Sprintf(models.ParentDnrtctrlSetComm, tenant, action_rule_profile)
rtctrlSetComm := models.NewRtctrlSetComm(rn, parentDn, description, nameAlias, rtctrlSetCommAttr)
err := sm.Save(rtctrlSetComm)
return rtctrlSetComm, err
}
func (sm *ServiceManager) ReadRtctrlSetComm(action_rule_profile string, tenant string) (*models.RtctrlSetComm, error) {
dn := fmt.Sprintf(models.DnrtctrlSetComm, tenant, action_rule_profile)
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
rtctrlSetComm := models.RtctrlSetCommFromContainer(cont)
return rtctrlSetComm, nil
}
func (sm *ServiceManager) DeleteRtctrlSetComm(action_rule_profile string, tenant string) error {
dn := fmt.Sprintf(models.DnrtctrlSetComm, tenant, action_rule_profile)
return sm.DeleteByDn(dn, models.RtctrlsetcommClassName)
}
func (sm *ServiceManager) UpdateRtctrlSetComm(action_rule_profile string, tenant string, description string, nameAlias string, rtctrlSetCommAttr models.RtctrlSetCommAttributes) (*models.RtctrlSetComm, error) {
rn := fmt.Sprintf(models.RnrtctrlSetComm)
parentDn := fmt.Sprintf(models.ParentDnrtctrlSetComm, tenant, action_rule_profile)
rtctrlSetComm := models.NewRtctrlSetComm(rn, parentDn, description, nameAlias, rtctrlSetCommAttr)
rtctrlSetComm.Status = "modified"
err := sm.Save(rtctrlSetComm)
return rtctrlSetComm, err
}
func (sm *ServiceManager) ListRtctrlSetComm(action_rule_profile string, tenant string) ([]*models.RtctrlSetComm, error) {
dnUrl := fmt.Sprintf("%s/uni/tn-%s/attr-%s/rtctrlSetComm.json", models.BaseurlStr, tenant, action_rule_profile)
cont, err := sm.GetViaURL(dnUrl)
list := models.RtctrlSetCommListFromContainer(cont)
return list, err
}