-
Notifications
You must be signed in to change notification settings - Fork 29
/
pkiEp_service.go
46 lines (39 loc) · 1.55 KB
/
pkiEp_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) CreatePublicKeyManagement(description string, nameAlias string, pkiEpAttr models.PublicKeyManagementAttributes) (*models.PublicKeyManagement, error) {
rn := fmt.Sprintf(models.RnpkiEp)
parentDn := fmt.Sprintf(models.ParentDnpkiEp)
pkiEp := models.NewPublicKeyManagement(rn, parentDn, description, nameAlias, pkiEpAttr)
err := sm.Save(pkiEp)
return pkiEp, err
}
func (sm *ServiceManager) ReadPublicKeyManagement() (*models.PublicKeyManagement, error) {
dn := fmt.Sprintf(models.DnpkiEp)
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
pkiEp := models.PublicKeyManagementFromContainer(cont)
return pkiEp, nil
}
func (sm *ServiceManager) DeletePublicKeyManagement() error {
dn := fmt.Sprintf(models.DnpkiEp)
return sm.DeleteByDn(dn, models.PkiepClassName)
}
func (sm *ServiceManager) UpdatePublicKeyManagement(description string, nameAlias string, pkiEpAttr models.PublicKeyManagementAttributes) (*models.PublicKeyManagement, error) {
rn := fmt.Sprintf(models.RnpkiEp)
parentDn := fmt.Sprintf(models.ParentDnpkiEp)
pkiEp := models.NewPublicKeyManagement(rn, parentDn, description, nameAlias, pkiEpAttr)
pkiEp.Status = "modified"
err := sm.Save(pkiEp)
return pkiEp, err
}
func (sm *ServiceManager) ListPublicKeyManagement() ([]*models.PublicKeyManagement, error) {
dnUrl := fmt.Sprintf("%s/uni/userext/pkiEp.json", models.BaseurlStr)
cont, err := sm.GetViaURL(dnUrl)
list := models.PublicKeyManagementListFromContainer(cont)
return list, err
}