-
Notifications
You must be signed in to change notification settings - Fork 29
/
mgmtConnectivityPrefs_service.go
46 lines (39 loc) · 1.98 KB
/
mgmtConnectivityPrefs_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) CreateMgmtconnectivitypreference(description string, nameAlias string, mgmtConnectivityPrefsAttr models.MgmtconnectivitypreferenceAttributes) (*models.Mgmtconnectivitypreference, error) {
rn := fmt.Sprintf(models.RnmgmtConnectivityPrefs)
parentDn := fmt.Sprintf(models.ParentDnmgmtConnectivityPrefs)
mgmtConnectivityPrefs := models.NewMgmtconnectivitypreference(rn, parentDn, description, nameAlias, mgmtConnectivityPrefsAttr)
err := sm.Save(mgmtConnectivityPrefs)
return mgmtConnectivityPrefs, err
}
func (sm *ServiceManager) ReadMgmtconnectivitypreference() (*models.Mgmtconnectivitypreference, error) {
dn := fmt.Sprintf(models.DnmgmtConnectivityPrefs)
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
mgmtConnectivityPrefs := models.MgmtconnectivitypreferenceFromContainer(cont)
return mgmtConnectivityPrefs, nil
}
func (sm *ServiceManager) DeleteMgmtconnectivitypreference() error {
dn := fmt.Sprintf(models.DnmgmtConnectivityPrefs)
return sm.DeleteByDn(dn, models.MgmtconnectivityprefsClassName)
}
func (sm *ServiceManager) UpdateMgmtconnectivitypreference(description string, nameAlias string, mgmtConnectivityPrefsAttr models.MgmtconnectivitypreferenceAttributes) (*models.Mgmtconnectivitypreference, error) {
rn := fmt.Sprintf(models.RnmgmtConnectivityPrefs)
parentDn := fmt.Sprintf(models.ParentDnmgmtConnectivityPrefs)
mgmtConnectivityPrefs := models.NewMgmtconnectivitypreference(rn, parentDn, description, nameAlias, mgmtConnectivityPrefsAttr)
mgmtConnectivityPrefs.Status = "modified"
err := sm.Save(mgmtConnectivityPrefs)
return mgmtConnectivityPrefs, err
}
func (sm *ServiceManager) ListMgmtconnectivitypreference() ([]*models.Mgmtconnectivitypreference, error) {
dnUrl := fmt.Sprintf("%s/uni/fabric/mgmtConnectivityPrefs.json", models.BaseurlStr)
cont, err := sm.GetViaURL(dnUrl)
list := models.MgmtconnectivitypreferenceListFromContainer(cont)
return list, err
}