-
Notifications
You must be signed in to change notification settings - Fork 29
/
aaaLdapGroupMapRuleRef_service.go
46 lines (39 loc) · 2.18 KB
/
aaaLdapGroupMapRuleRef_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) CreateLDAPGroupMapruleref(name string, ldap_group_map string, description string, nameAlias string, aaaLdapGroupMapRuleRefAttr models.LDAPGroupMaprulerefAttributes) (*models.LDAPGroupMapruleref, error) {
rn := fmt.Sprintf(models.RnaaaLdapGroupMapRuleRef, name)
parentDn := fmt.Sprintf(models.ParentDnaaaLdapGroupMapRuleRef, ldap_group_map)
aaaLdapGroupMapRuleRef := models.NewLDAPGroupMapruleref(rn, parentDn, description, nameAlias, aaaLdapGroupMapRuleRefAttr)
err := sm.Save(aaaLdapGroupMapRuleRef)
return aaaLdapGroupMapRuleRef, err
}
func (sm *ServiceManager) ReadLDAPGroupMapruleref(name string, ldap_group_map string) (*models.LDAPGroupMapruleref, error) {
dn := fmt.Sprintf(models.DnaaaLdapGroupMapRuleRef, ldap_group_map, name)
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
aaaLdapGroupMapRuleRef := models.LDAPGroupMaprulerefFromContainer(cont)
return aaaLdapGroupMapRuleRef, nil
}
func (sm *ServiceManager) DeleteLDAPGroupMapruleref(name string, ldap_group_map string) error {
dn := fmt.Sprintf(models.DnaaaLdapGroupMapRuleRef, ldap_group_map, name)
return sm.DeleteByDn(dn, models.AaaldapgroupmaprulerefClassName)
}
func (sm *ServiceManager) UpdateLDAPGroupMapruleref(name string, ldap_group_map string, description string, nameAlias string, aaaLdapGroupMapRuleRefAttr models.LDAPGroupMaprulerefAttributes) (*models.LDAPGroupMapruleref, error) {
rn := fmt.Sprintf(models.RnaaaLdapGroupMapRuleRef, name)
parentDn := fmt.Sprintf(models.ParentDnaaaLdapGroupMapRuleRef, ldap_group_map)
aaaLdapGroupMapRuleRef := models.NewLDAPGroupMapruleref(rn, parentDn, description, nameAlias, aaaLdapGroupMapRuleRefAttr)
aaaLdapGroupMapRuleRef.Status = "modified"
err := sm.Save(aaaLdapGroupMapRuleRef)
return aaaLdapGroupMapRuleRef, err
}
func (sm *ServiceManager) ListLDAPGroupMapruleref(ldap_group_map string) ([]*models.LDAPGroupMapruleref, error) {
dnUrl := fmt.Sprintf("%s/uni/userext/ldapext/ldapgroupmap-%s/aaaLdapGroupMapRuleRef.json", models.BaseurlStr, ldap_group_map)
cont, err := sm.GetViaURL(dnUrl)
list := models.LDAPGroupMaprulerefListFromContainer(cont)
return list, err
}