-
Notifications
You must be signed in to change notification settings - Fork 30
/
rtctrlSetASPath_service.go
48 lines (39 loc) · 2.07 KB
/
rtctrlSetASPath_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) CreateSetASPath(criteria string, action_rule_profile string, tenant string, description string, nameAlias string, rtctrlSetASPathAttr models.SetASPathAttributes) (*models.SetASPath, error) {
rn := fmt.Sprintf(models.RnrtctrlSetASPath, criteria)
parentDn := fmt.Sprintf(models.ParentDnrtctrlSetASPath, tenant, action_rule_profile)
rtctrlSetASPath := models.NewSetASPath(rn, parentDn, description, nameAlias, rtctrlSetASPathAttr)
err := sm.Save(rtctrlSetASPath)
return rtctrlSetASPath, err
}
func (sm *ServiceManager) ReadSetASPath(criteria string, action_rule_profile string, tenant string) (*models.SetASPath, error) {
dn := fmt.Sprintf(models.DnrtctrlSetASPath, tenant, action_rule_profile, criteria)
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
rtctrlSetASPath := models.SetASPathFromContainer(cont)
return rtctrlSetASPath, nil
}
func (sm *ServiceManager) DeleteSetASPath(criteria string, action_rule_profile string, tenant string) error {
dn := fmt.Sprintf(models.DnrtctrlSetASPath, tenant, action_rule_profile, criteria)
return sm.DeleteByDn(dn, models.RtctrlsetaspathClassName)
}
func (sm *ServiceManager) UpdateSetASPath(criteria string, action_rule_profile string, tenant string, description string, nameAlias string, rtctrlSetASPathAttr models.SetASPathAttributes) (*models.SetASPath, error) {
rn := fmt.Sprintf(models.RnrtctrlSetASPath, criteria)
parentDn := fmt.Sprintf(models.ParentDnrtctrlSetASPath, tenant, action_rule_profile)
rtctrlSetASPath := models.NewSetASPath(rn, parentDn, description, nameAlias, rtctrlSetASPathAttr)
rtctrlSetASPath.Status = "modified"
err := sm.Save(rtctrlSetASPath)
return rtctrlSetASPath, err
}
func (sm *ServiceManager) ListSetASPath(action_rule_profile string, tenant string) ([]*models.SetASPath, error) {
dnUrl := fmt.Sprintf("%s/uni/tn-%s/attr-%s/rtctrlSetASPath.json", models.BaseurlStr, tenant, action_rule_profile)
cont, err := sm.GetViaURL(dnUrl)
list := models.SetASPathListFromContainer(cont)
return list, err
}