-
Notifications
You must be signed in to change notification settings - Fork 30
/
rtctrlSetDamp_service.go
48 lines (39 loc) · 1.98 KB
/
rtctrlSetDamp_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) CreateRtctrlSetDamp(action_rule_profile string, tenant string, description string, nameAlias string, rtctrlSetDampAttr models.RtctrlSetDampAttributes) (*models.RtctrlSetDamp, error) {
rn := fmt.Sprintf(models.RnrtctrlSetDamp)
parentDn := fmt.Sprintf(models.ParentDnrtctrlSetDamp, tenant, action_rule_profile)
rtctrlSetDamp := models.NewRtctrlSetDamp(rn, parentDn, description, nameAlias, rtctrlSetDampAttr)
err := sm.Save(rtctrlSetDamp)
return rtctrlSetDamp, err
}
func (sm *ServiceManager) ReadRtctrlSetDamp(action_rule_profile string, tenant string) (*models.RtctrlSetDamp, error) {
dn := fmt.Sprintf(models.DnrtctrlSetDamp, tenant, action_rule_profile)
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
rtctrlSetDamp := models.RtctrlSetDampFromContainer(cont)
return rtctrlSetDamp, nil
}
func (sm *ServiceManager) DeleteRtctrlSetDamp(action_rule_profile string, tenant string) error {
dn := fmt.Sprintf(models.DnrtctrlSetDamp, tenant, action_rule_profile)
return sm.DeleteByDn(dn, models.RtctrlsetdampClassName)
}
func (sm *ServiceManager) UpdateRtctrlSetDamp(action_rule_profile string, tenant string, description string, nameAlias string, rtctrlSetDampAttr models.RtctrlSetDampAttributes) (*models.RtctrlSetDamp, error) {
rn := fmt.Sprintf(models.RnrtctrlSetDamp)
parentDn := fmt.Sprintf(models.ParentDnrtctrlSetDamp, tenant, action_rule_profile)
rtctrlSetDamp := models.NewRtctrlSetDamp(rn, parentDn, description, nameAlias, rtctrlSetDampAttr)
rtctrlSetDamp.Status = "modified"
err := sm.Save(rtctrlSetDamp)
return rtctrlSetDamp, err
}
func (sm *ServiceManager) ListRtctrlSetDamp(action_rule_profile string, tenant string) ([]*models.RtctrlSetDamp, error) {
dnUrl := fmt.Sprintf("%s/uni/tn-%s/attr-%s/rtctrlSetDamp.json", models.BaseurlStr, tenant, action_rule_profile)
cont, err := sm.GetViaURL(dnUrl)
list := models.RtctrlSetDampListFromContainer(cont)
return list, err
}