Skip to content

Commit

Permalink
Removing ptrToList
Browse files Browse the repository at this point in the history
  • Loading branch information
mvbrock committed Jan 7, 2025
1 parent a20ac6f commit bb4b6fc
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions lib/srv/discovery/fetchers/azure-sync/roledefinitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package azuresync
import (
"context"
"fmt" //nolint:golint // used in a dependent PR
"github.com/gravitational/teleport/lib/utils/slices"

"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2"
"github.com/gravitational/trace"
Expand Down Expand Up @@ -59,8 +60,8 @@ func fetchRoleDefinitions(ctx context.Context, subscriptionID string, cli RoleDe
continue
}
pbPerm := accessgraphv1alpha.AzureRBACPermission{
Actions: ptrsToList(perm.Actions),
NotActions: ptrsToList(perm.NotActions),
Actions: slices.FromPointers(perm.Actions),
NotActions: slices.FromPointers(perm.NotActions),
}
pbPerms = append(pbPerms, &pbPerm)
}
Expand All @@ -75,13 +76,3 @@ func fetchRoleDefinitions(ctx context.Context, subscriptionID string, cli RoleDe
}
return pbRoleDefs, trace.NewAggregate(fetchErrs...)
}

func ptrsToList(ptrs []*string) []string { //nolint:unused // used in a dependent PR
strList := make([]string, 0, len(ptrs))
for _, ptr := range ptrs {
if ptr != nil {
strList = append(strList, *ptr)
}
}
return strList
}

0 comments on commit bb4b6fc

Please sign in to comment.