-
Notifications
You must be signed in to change notification settings - Fork 29
/
aaaBlockLoginProfile_service.go
46 lines (39 loc) · 1.89 KB
/
aaaBlockLoginProfile_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) CreateBlockUserLoginsPolicy(description string, nameAlias string, aaaBlockLoginProfileAttr models.BlockUserLoginsPolicyAttributes) (*models.BlockUserLoginsPolicy, error) {
rn := fmt.Sprintf(models.RnaaaBlockLoginProfile)
parentDn := fmt.Sprintf(models.ParentDnaaaBlockLoginProfile)
aaaBlockLoginProfile := models.NewBlockUserLoginsPolicy(rn, parentDn, description, nameAlias, aaaBlockLoginProfileAttr)
err := sm.Save(aaaBlockLoginProfile)
return aaaBlockLoginProfile, err
}
func (sm *ServiceManager) ReadBlockUserLoginsPolicy() (*models.BlockUserLoginsPolicy, error) {
dn := fmt.Sprintf(models.DnaaaBlockLoginProfile)
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
aaaBlockLoginProfile := models.BlockUserLoginsPolicyFromContainer(cont)
return aaaBlockLoginProfile, nil
}
func (sm *ServiceManager) DeleteBlockUserLoginsPolicy() error {
dn := fmt.Sprintf(models.DnaaaBlockLoginProfile)
return sm.DeleteByDn(dn, models.AaablockloginprofileClassName)
}
func (sm *ServiceManager) UpdateBlockUserLoginsPolicy(description string, nameAlias string, aaaBlockLoginProfileAttr models.BlockUserLoginsPolicyAttributes) (*models.BlockUserLoginsPolicy, error) {
rn := fmt.Sprintf(models.RnaaaBlockLoginProfile)
parentDn := fmt.Sprintf(models.ParentDnaaaBlockLoginProfile)
aaaBlockLoginProfile := models.NewBlockUserLoginsPolicy(rn, parentDn, description, nameAlias, aaaBlockLoginProfileAttr)
aaaBlockLoginProfile.Status = "modified"
err := sm.Save(aaaBlockLoginProfile)
return aaaBlockLoginProfile, err
}
func (sm *ServiceManager) ListBlockUserLoginsPolicy() ([]*models.BlockUserLoginsPolicy, error) {
dnUrl := fmt.Sprintf("%s/uni/userext/aaaBlockLoginProfile.json", models.BaseurlStr)
cont, err := sm.GetViaURL(dnUrl)
list := models.BlockUserLoginsPolicyListFromContainer(cont)
return list, err
}