refact(action): Make ActionSet behave as a set instead of a list

This switches the implementation of an ActionSet from a slice to a map
to ensure the elements in an ActionSet are unique. This allows for other
packages to perform set operations such as a union or difference without
needing to account for duplicates.
This commit is contained in:
Timothy Messier committed 2023-12-04 16:20:29 +00:00
1 parent bee45dc486
commit c52caae345
52 files changed
+1401 -274

No files matched your search

@@ -153,7 +153,7 @@ func GetListingResourceInformation(
aSet := input.AuthResults.FetchActionSetForType(ctx,
// This is overridden by WithResource
resource.Unknown,
action.ActionSet{action.List},
action.NewActionSet(action.List),
auth.WithResource(&res),
)
switch len(aSet) {
@@ -163,7 +163,7 @@ func GetListingResourceInformation(
// lookup might fail.
deferredScopes = append(deferredScopes, scp)
case 1:
if aSet[0] != action.List {
if !aSet.HasAction(action.List) {
return nil, errors.New(ctx, errors.Internal, op, "unexpected action in set")
}
if output.ScopeResourceMap[scpId] == nil {