-
Notifications
You must be signed in to change notification settings - Fork 29
/
aaaDomainAuth_service.go
46 lines (39 loc) · 2.09 KB
/
aaaDomainAuth_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) CreateAuthenticationMethodfortheDomain(login_domain string, description string, nameAlias string, aaaDomainAuthAttr models.AuthenticationMethodfortheDomainAttributes) (*models.AuthenticationMethodfortheDomain, error) {
rn := fmt.Sprintf(models.RnaaaDomainAuth)
parentDn := fmt.Sprintf(models.ParentDnaaaDomainAuth, login_domain)
aaaDomainAuth := models.NewAuthenticationMethodfortheDomain(rn, parentDn, description, nameAlias, aaaDomainAuthAttr)
err := sm.Save(aaaDomainAuth)
return aaaDomainAuth, err
}
func (sm *ServiceManager) ReadAuthenticationMethodfortheDomain(login_domain string) (*models.AuthenticationMethodfortheDomain, error) {
dn := fmt.Sprintf(models.DnaaaDomainAuth, login_domain)
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
aaaDomainAuth := models.AuthenticationMethodfortheDomainFromContainer(cont)
return aaaDomainAuth, nil
}
func (sm *ServiceManager) DeleteAuthenticationMethodfortheDomain(login_domain string) error {
dn := fmt.Sprintf(models.DnaaaDomainAuth, login_domain)
return sm.DeleteByDn(dn, models.AaadomainauthClassName)
}
func (sm *ServiceManager) UpdateAuthenticationMethodfortheDomain(login_domain string, description string, nameAlias string, aaaDomainAuthAttr models.AuthenticationMethodfortheDomainAttributes) (*models.AuthenticationMethodfortheDomain, error) {
rn := fmt.Sprintf(models.RnaaaDomainAuth)
parentDn := fmt.Sprintf(models.ParentDnaaaDomainAuth, login_domain)
aaaDomainAuth := models.NewAuthenticationMethodfortheDomain(rn, parentDn, description, nameAlias, aaaDomainAuthAttr)
aaaDomainAuth.Status = "modified"
err := sm.Save(aaaDomainAuth)
return aaaDomainAuth, err
}
func (sm *ServiceManager) ListAuthenticationMethodfortheDomain(login_domain string) ([]*models.AuthenticationMethodfortheDomain, error) {
dnUrl := fmt.Sprintf("%s/uni/userext/logindomain-%s/aaaDomainAuth.json", models.BaseurlStr, login_domain)
cont, err := sm.GetViaURL(dnUrl)
list := models.AuthenticationMethodfortheDomainListFromContainer(cont)
return list, err
}