-
Notifications
You must be signed in to change notification settings - Fork 30
/
rtctrlSetNh_service.go
48 lines (39 loc) · 1.91 KB
/
rtctrlSetNh_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) CreateRtctrlSetNh(action_rule_profile string, tenant string, description string, nameAlias string, rtctrlSetNhAttr models.RtctrlSetNhAttributes) (*models.RtctrlSetNh, error) {
rn := fmt.Sprintf(models.RnrtctrlSetNh)
parentDn := fmt.Sprintf(models.ParentDnrtctrlSetNh, tenant, action_rule_profile)
rtctrlSetNh := models.NewRtctrlSetNh(rn, parentDn, description, nameAlias, rtctrlSetNhAttr)
err := sm.Save(rtctrlSetNh)
return rtctrlSetNh, err
}
func (sm *ServiceManager) ReadRtctrlSetNh(action_rule_profile string, tenant string) (*models.RtctrlSetNh, error) {
dn := fmt.Sprintf(models.DnrtctrlSetNh, tenant, action_rule_profile)
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
rtctrlSetNh := models.RtctrlSetNhFromContainer(cont)
return rtctrlSetNh, nil
}
func (sm *ServiceManager) DeleteRtctrlSetNh(action_rule_profile string, tenant string) error {
dn := fmt.Sprintf(models.DnrtctrlSetNh, tenant, action_rule_profile)
return sm.DeleteByDn(dn, models.RtctrlsetnhClassName)
}
func (sm *ServiceManager) UpdateRtctrlSetNh(action_rule_profile string, tenant string, description string, nameAlias string, rtctrlSetNhAttr models.RtctrlSetNhAttributes) (*models.RtctrlSetNh, error) {
rn := fmt.Sprintf(models.RnrtctrlSetNh)
parentDn := fmt.Sprintf(models.ParentDnrtctrlSetNh, tenant, action_rule_profile)
rtctrlSetNh := models.NewRtctrlSetNh(rn, parentDn, description, nameAlias, rtctrlSetNhAttr)
rtctrlSetNh.Status = "modified"
err := sm.Save(rtctrlSetNh)
return rtctrlSetNh, err
}
func (sm *ServiceManager) ListRtctrlSetNh(action_rule_profile string, tenant string) ([]*models.RtctrlSetNh, error) {
dnUrl := fmt.Sprintf("%s/uni/tn-%s/attr-%s/rtctrlSetNh.json", models.BaseurlStr, tenant, action_rule_profile)
cont, err := sm.GetViaURL(dnUrl)
list := models.RtctrlSetNhListFromContainer(cont)
return list, err
}