Skip to content

Commit

Permalink
cache manager list access requests (#565)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsjohns9 authored Oct 6, 2022
1 parent 8ba3f30 commit 33a40f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/agent/cache/accessrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,14 @@ func (c *cacheManager) GetAccessRequest(id string) *v1.ResourceInstance {
func (c *cacheManager) DeleteAccessRequest(id string) error {
return c.accessRequestMap.Delete(id)
}

func (c *cacheManager) ListAccessRequests() []*v1.ResourceInstance {
list := make([]*v1.ResourceInstance, 0)
for _, key := range c.accessRequestMap.GetKeys() {
item, _ := c.accessRequestMap.Get(key)
if v, ok := item.(*v1.ResourceInstance); ok && v != nil {
list = append(list, v)
}
}
return list
}
1 change: 1 addition & 0 deletions pkg/agent/cache/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ type Manager interface {
GetAccessRequest(id string) *v1.ResourceInstance
GetAccessRequestsByApp(managedAppName string) []*v1.ResourceInstance
DeleteAccessRequest(id string) error
ListAccessRequests() []*v1.ResourceInstance

GetWatchResourceCacheKeys(group, kind string) []string
AddWatchResource(resource *v1.ResourceInstance)
Expand Down

0 comments on commit 33a40f9

Please sign in to comment.