Skip to content

Commit

Permalink
Nolinting until upstream PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
mvbrock committed Dec 20, 2024
1 parent 5c89fc7 commit 7c8c247
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
8 changes: 4 additions & 4 deletions lib/srv/discovery/fetchers/azure-sync/principals.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ 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"

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})
Expand Down
10 changes: 3 additions & 7 deletions lib/srv/discovery/fetchers/azure-sync/roleassignments.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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 {
Expand Down
12 changes: 4 additions & 8 deletions lib/srv/discovery/fetchers/azure-sync/roledefinitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions lib/srv/discovery/fetchers/azure-sync/virtualmachines.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7c8c247

Please sign in to comment.