-
Notifications
You must be signed in to change notification settings - Fork 29
/
aaaDuoProviderGroup_service.go
46 lines (39 loc) · 1.87 KB
/
aaaDuoProviderGroup_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) CreateDuoProviderGroup(name string, description string, nameAlias string, aaaDuoProviderGroupAttr models.DuoProviderGroupAttributes) (*models.DuoProviderGroup, error) {
rn := fmt.Sprintf(models.RnaaaDuoProviderGroup, name)
parentDn := fmt.Sprintf(models.ParentDnaaaDuoProviderGroup)
aaaDuoProviderGroup := models.NewDuoProviderGroup(rn, parentDn, description, nameAlias, aaaDuoProviderGroupAttr)
err := sm.Save(aaaDuoProviderGroup)
return aaaDuoProviderGroup, err
}
func (sm *ServiceManager) ReadDuoProviderGroup(name string) (*models.DuoProviderGroup, error) {
dn := fmt.Sprintf(models.DnaaaDuoProviderGroup, name)
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
aaaDuoProviderGroup := models.DuoProviderGroupFromContainer(cont)
return aaaDuoProviderGroup, nil
}
func (sm *ServiceManager) DeleteDuoProviderGroup(name string) error {
dn := fmt.Sprintf(models.DnaaaDuoProviderGroup, name)
return sm.DeleteByDn(dn, models.AaaduoprovidergroupClassName)
}
func (sm *ServiceManager) UpdateDuoProviderGroup(name string, description string, nameAlias string, aaaDuoProviderGroupAttr models.DuoProviderGroupAttributes) (*models.DuoProviderGroup, error) {
rn := fmt.Sprintf(models.RnaaaDuoProviderGroup, name)
parentDn := fmt.Sprintf(models.ParentDnaaaDuoProviderGroup)
aaaDuoProviderGroup := models.NewDuoProviderGroup(rn, parentDn, description, nameAlias, aaaDuoProviderGroupAttr)
aaaDuoProviderGroup.Status = "modified"
err := sm.Save(aaaDuoProviderGroup)
return aaaDuoProviderGroup, err
}
func (sm *ServiceManager) ListDuoProviderGroup() ([]*models.DuoProviderGroup, error) {
dnUrl := fmt.Sprintf("%s/uni/userext/duoext/aaaDuoProviderGroup.json", models.BaseurlStr)
cont, err := sm.GetViaURL(dnUrl)
list := models.DuoProviderGroupListFromContainer(cont)
return list, err
}