-
Notifications
You must be signed in to change notification settings - Fork 29
/
aaaLoginDomain_service.go
46 lines (39 loc) · 1.69 KB
/
aaaLoginDomain_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) CreateLoginDomain(name string, description string, nameAlias string, aaaLoginDomainAttr models.LoginDomainAttributes) (*models.LoginDomain, error) {
rn := fmt.Sprintf(models.RnaaaLoginDomain, name)
parentDn := fmt.Sprintf(models.ParentDnaaaLoginDomain)
aaaLoginDomain := models.NewLoginDomain(rn, parentDn, description, nameAlias, aaaLoginDomainAttr)
err := sm.Save(aaaLoginDomain)
return aaaLoginDomain, err
}
func (sm *ServiceManager) ReadLoginDomain(name string) (*models.LoginDomain, error) {
dn := fmt.Sprintf(models.DnaaaLoginDomain, name)
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
aaaLoginDomain := models.LoginDomainFromContainer(cont)
return aaaLoginDomain, nil
}
func (sm *ServiceManager) DeleteLoginDomain(name string) error {
dn := fmt.Sprintf(models.DnaaaLoginDomain, name)
return sm.DeleteByDn(dn, models.AaalogindomainClassName)
}
func (sm *ServiceManager) UpdateLoginDomain(name string, description string, nameAlias string, aaaLoginDomainAttr models.LoginDomainAttributes) (*models.LoginDomain, error) {
rn := fmt.Sprintf(models.RnaaaLoginDomain, name)
parentDn := fmt.Sprintf(models.ParentDnaaaLoginDomain)
aaaLoginDomain := models.NewLoginDomain(rn, parentDn, description, nameAlias, aaaLoginDomainAttr)
aaaLoginDomain.Status = "modified"
err := sm.Save(aaaLoginDomain)
return aaaLoginDomain, err
}
func (sm *ServiceManager) ListLoginDomain() ([]*models.LoginDomain, error) {
dnUrl := fmt.Sprintf("%s/uni/userext/aaaLoginDomain.json", models.BaseurlStr)
cont, err := sm.GetViaURL(dnUrl)
list := models.LoginDomainListFromContainer(cont)
return list, err
}