From 7c8c247ae1411754fc5e3bbbf956c3736df88451 Mon Sep 17 00:00:00 2001 From: Matt Brock Date: Thu, 19 Dec 2024 01:06:20 -0600 Subject: [PATCH] Nolinting until upstream PRs --- lib/srv/discovery/fetchers/azure-sync/principals.go | 8 ++++---- .../discovery/fetchers/azure-sync/roleassignments.go | 10 +++------- .../discovery/fetchers/azure-sync/roledefinitions.go | 12 ++++-------- .../discovery/fetchers/azure-sync/virtualmachines.go | 6 +++--- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/lib/srv/discovery/fetchers/azure-sync/principals.go b/lib/srv/discovery/fetchers/azure-sync/principals.go index 850e0cb389f71..f20878e7e3a61 100644 --- a/lib/srv/discovery/fetchers/azure-sync/principals.go +++ b/lib/srv/discovery/fetchers/azure-sync/principals.go @@ -20,9 +20,9 @@ package azure_sync import ( "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "slices" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" //nolint:unused // used in a dependent PR "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/gravitational/trace" "google.golang.org/protobuf/types/known/timestamppb" @@ -30,11 +30,11 @@ import ( accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" ) -const groupType = "#microsoft.graph.group" -const defaultGraphScope = "https://graph.microsoft.com/.default" +const groupType = "#microsoft.graph.group" //nolint:unused // used in a dependent PR +const defaultGraphScope = "https://graph.microsoft.com/.default" //nolint:unused // used in a dependent PR // fetchPrincipals fetches the Azure principals (users, groups, and service principals) using the Graph API -func fetchPrincipals(ctx context.Context, subscriptionID string, cred azcore.TokenCredential) ([]*accessgraphv1alpha.AzurePrincipal, error) { +func fetchPrincipals(ctx context.Context, subscriptionID string, cred azcore.TokenCredential) ([]*accessgraphv1alpha.AzurePrincipal, error) { //nolint:unused // used in a dependent PR // Get the graph client scopes := []string{defaultGraphScope} token, err := cred.GetToken(ctx, policy.TokenRequestOptions{Scopes: scopes}) diff --git a/lib/srv/discovery/fetchers/azure-sync/roleassignments.go b/lib/srv/discovery/fetchers/azure-sync/roleassignments.go index 58cfa89c8ae3e..0844b22a4fc94 100644 --- a/lib/srv/discovery/fetchers/azure-sync/roleassignments.go +++ b/lib/srv/discovery/fetchers/azure-sync/roleassignments.go @@ -20,9 +20,9 @@ package azure_sync import ( "context" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" + "fmt" //nolint:unused // used in a dependent PR + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" "github.com/gravitational/trace" "google.golang.org/protobuf/types/known/timestamppb" @@ -35,11 +35,7 @@ type RoleAssignmentsClient interface { } // fetchRoleAssignments fetches Azure role assignments using the Azure role assignments API -func fetchRoleAssignments( - ctx context.Context, - subscriptionID string, - cli RoleAssignmentsClient, -) ([]*accessgraphv1alpha.AzureRoleAssignment, error) { +func fetchRoleAssignments(ctx context.Context, subscriptionID string, cli RoleAssignmentsClient) ([]*accessgraphv1alpha.AzureRoleAssignment, error) { //nolint:unused // invoked in a dependent PR // List the role definitions roleAssigns, err := cli.ListRoleAssignments(ctx, fmt.Sprintf("/subscriptions/%s", subscriptionID)) if err != nil { diff --git a/lib/srv/discovery/fetchers/azure-sync/roledefinitions.go b/lib/srv/discovery/fetchers/azure-sync/roledefinitions.go index 35dfce444188c..03b5c38f9a056 100644 --- a/lib/srv/discovery/fetchers/azure-sync/roledefinitions.go +++ b/lib/srv/discovery/fetchers/azure-sync/roledefinitions.go @@ -20,9 +20,9 @@ package azure_sync import ( "context" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" + "fmt" //nolint:golint // used in a dependent PR + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" "github.com/gravitational/trace" "google.golang.org/protobuf/types/known/timestamppb" @@ -34,11 +34,7 @@ type RoleDefinitionsClient interface { ListRoleDefinitions(ctx context.Context, scope string) ([]*armauthorization.RoleDefinition, error) } -func fetchRoleDefinitions( - ctx context.Context, - subscriptionID string, - cli RoleDefinitionsClient, -) ([]*accessgraphv1alpha.AzureRoleDefinition, error) { +func fetchRoleDefinitions(ctx context.Context, subscriptionID string, cli RoleDefinitionsClient) ([]*accessgraphv1alpha.AzureRoleDefinition, error) { //nolint:unused // used in a dependent PR // List the role definitions roleDefs, err := cli.ListRoleDefinitions(ctx, fmt.Sprintf("/subscriptions/%s", subscriptionID)) if err != nil { @@ -68,7 +64,7 @@ func fetchRoleDefinitions( return pbRoleDefs, nil } -func ptrsToList(ptrs []*string) []string { +func ptrsToList(ptrs []*string) []string { //nolint:unused // used in a dependent PR strList := make([]string, 0, len(ptrs)) for _, ptr := range ptrs { strList = append(strList, *ptr) diff --git a/lib/srv/discovery/fetchers/azure-sync/virtualmachines.go b/lib/srv/discovery/fetchers/azure-sync/virtualmachines.go index 39477cf096ade..743061b5d0f9a 100644 --- a/lib/srv/discovery/fetchers/azure-sync/virtualmachines.go +++ b/lib/srv/discovery/fetchers/azure-sync/virtualmachines.go @@ -20,22 +20,22 @@ package azure_sync import ( "context" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6" "github.com/gravitational/trace" "google.golang.org/protobuf/types/known/timestamppb" accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" ) -const allResourceGroups = "*" +const allResourceGroups = "*" //nolint:unused // used in a dependent PR // VirtualMachinesClient specifies the methods used to fetch virtual machines from Azure type VirtualMachinesClient interface { ListVirtualMachines(ctx context.Context, resourceGroup string) ([]*armcompute.VirtualMachine, error) } -func fetchVirtualMachines(ctx context.Context, subscriptionID string, cli VirtualMachinesClient) ([]*accessgraphv1alpha.AzureVirtualMachine, error) { +func fetchVirtualMachines(ctx context.Context, subscriptionID string, cli VirtualMachinesClient) ([]*accessgraphv1alpha.AzureVirtualMachine, error) { //nolint:unused // invoked in a dependent PR vms, err := cli.ListVirtualMachines(ctx, allResourceGroups) if err != nil { return nil, trace.Wrap(err)