-
Notifications
You must be signed in to change notification settings - Fork 29
/
fabricRsOosPath_service.go
46 lines (39 loc) · 1.75 KB
/
fabricRsOosPath_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
package client
import (
"fmt"
"github.com/ciscoecosystem/aci-go-client/models"
)
func (sm *ServiceManager) CreateOutofServiceFabricPath(tDn string, fabricRsOosPathAttr models.OutofServiceFabricPathAttributes) (*models.OutofServiceFabricPath, error) {
rn := fmt.Sprintf(models.RnfabricRsOosPath, tDn)
parentDn := fmt.Sprintf(models.ParentDnfabricRsOosPath)
fabricRsOosPath := models.NewOutofServiceFabricPath(rn, parentDn, fabricRsOosPathAttr)
err := sm.Save(fabricRsOosPath)
return fabricRsOosPath, err
}
func (sm *ServiceManager) ReadOutofServiceFabricPath(tDn string) (*models.OutofServiceFabricPath, error) {
dn := fmt.Sprintf(models.DnfabricRsOosPath, tDn)
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
fabricRsOosPath := models.OutofServiceFabricPathFromContainer(cont)
return fabricRsOosPath, nil
}
func (sm *ServiceManager) DeleteOutofServiceFabricPath(tDn string) error {
dn := fmt.Sprintf(models.DnfabricRsOosPath, tDn)
return sm.DeleteByDn(dn, models.FabricrsoospathClassName)
}
func (sm *ServiceManager) UpdateOutofServiceFabricPath(tDn string, fabricRsOosPathAttr models.OutofServiceFabricPathAttributes) (*models.OutofServiceFabricPath, error) {
rn := fmt.Sprintf(models.RnfabricRsOosPath, tDn)
parentDn := fmt.Sprintf(models.ParentDnfabricRsOosPath)
fabricRsOosPath := models.NewOutofServiceFabricPath(rn, parentDn, fabricRsOosPathAttr)
fabricRsOosPath.Status = "modified"
err := sm.Save(fabricRsOosPath)
return fabricRsOosPath, err
}
func (sm *ServiceManager) ListOutofServiceFabricPath() ([]*models.OutofServiceFabricPath, error) {
dnUrl := fmt.Sprintf("%s/uni/fabric/outofsvc/fabricRsOosPath.json", models.BaseurlStr)
cont, err := sm.GetViaURL(dnUrl)
list := models.OutofServiceFabricPathListFromContainer(cont)
return list, err
}