From dae5182b688c85821c32cf5522ab0af78b67ab3b Mon Sep 17 00:00:00 2001 From: Matt Brock Date: Mon, 18 Nov 2024 15:26:28 -0600 Subject: [PATCH] Fix imports --- lib/cloud/azure/roleassignments.go | 1 + lib/cloud/azure/roledefinitions.go | 1 + lib/srv/discovery/access_graph_azure.go | 14 ++++++++------ lib/srv/discovery/discovery.go | 2 +- lib/srv/discovery/fetchers/aws-sync/merge_test.go | 3 ++- lib/srv/discovery/fetchers/aws-sync/reconcile.go | 2 +- .../discovery/fetchers/azure-sync/azure-sync.go | 8 +++++--- .../fetchers/azure-sync/azure-sync_test.go | 3 ++- .../fetchers/azure-sync/msggraphclient.go | 3 ++- .../discovery/fetchers/azure-sync/principals.go | 6 ++++-- lib/srv/discovery/fetchers/azure-sync/reconcile.go | 4 +++- .../fetchers/azure-sync/reconcile_test.go | 6 ++++-- .../fetchers/azure-sync/roleassignments.go | 4 +++- .../fetchers/azure-sync/roledefinitions.go | 4 +++- .../fetchers/azure-sync/virtualmachines.go | 4 +++- 15 files changed, 43 insertions(+), 22 deletions(-) diff --git a/lib/cloud/azure/roleassignments.go b/lib/cloud/azure/roleassignments.go index 94af4dbbbd4d4..c381e11d47aeb 100644 --- a/lib/cloud/azure/roleassignments.go +++ b/lib/cloud/azure/roleassignments.go @@ -2,6 +2,7 @@ package azure import ( "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" diff --git a/lib/cloud/azure/roledefinitions.go b/lib/cloud/azure/roledefinitions.go index 45b90a06dc688..668f3d4456d3c 100644 --- a/lib/cloud/azure/roledefinitions.go +++ b/lib/cloud/azure/roledefinitions.go @@ -2,6 +2,7 @@ package azure import ( "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" diff --git a/lib/srv/discovery/access_graph_azure.go b/lib/srv/discovery/access_graph_azure.go index 5916e6f79dc54..d504f49a2f904 100644 --- a/lib/srv/discovery/access_graph_azure.go +++ b/lib/srv/discovery/access_graph_azure.go @@ -3,6 +3,14 @@ package discovery import ( "context" "errors" + "io" + "sync" + "time" + + "github.com/gravitational/trace" + "google.golang.org/grpc" + "google.golang.org/grpc/connectivity" + "github.com/gravitational/teleport/api/types" "github.com/gravitational/teleport/api/utils/retryutils" "github.com/gravitational/teleport/entitlements" @@ -10,12 +18,6 @@ import ( "github.com/gravitational/teleport/lib/modules" "github.com/gravitational/teleport/lib/services" azure_sync "github.com/gravitational/teleport/lib/srv/discovery/fetchers/azure-sync" - "github.com/gravitational/trace" - "google.golang.org/grpc" - "google.golang.org/grpc/connectivity" - "io" - "sync" - "time" ) func (s *Server) reconcileAccessGraphAzure( diff --git a/lib/srv/discovery/discovery.go b/lib/srv/discovery/discovery.go index 1cf95e108d623..247b70db2694a 100644 --- a/lib/srv/discovery/discovery.go +++ b/lib/srv/discovery/discovery.go @@ -23,7 +23,6 @@ import ( "crypto/tls" "errors" "fmt" - azure_sync "github.com/gravitational/teleport/lib/srv/discovery/fetchers/azure-sync" "log/slog" "slices" "strings" @@ -61,6 +60,7 @@ import ( "github.com/gravitational/teleport/lib/srv/discovery/common" "github.com/gravitational/teleport/lib/srv/discovery/fetchers" aws_sync "github.com/gravitational/teleport/lib/srv/discovery/fetchers/aws-sync" + azure_sync "github.com/gravitational/teleport/lib/srv/discovery/fetchers/azure-sync" "github.com/gravitational/teleport/lib/srv/discovery/fetchers/db" "github.com/gravitational/teleport/lib/srv/server" logutils "github.com/gravitational/teleport/lib/utils/log" diff --git a/lib/srv/discovery/fetchers/aws-sync/merge_test.go b/lib/srv/discovery/fetchers/aws-sync/merge_test.go index be19486e567c8..614828aae61b6 100644 --- a/lib/srv/discovery/fetchers/aws-sync/merge_test.go +++ b/lib/srv/discovery/fetchers/aws-sync/merge_test.go @@ -19,13 +19,14 @@ package aws_sync import ( - "github.com/gravitational/teleport/lib/srv/discovery/common" "testing" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/stretchr/testify/require" "google.golang.org/protobuf/testing/protocmp" + + "github.com/gravitational/teleport/lib/srv/discovery/common" ) func TestMergeResources(t *testing.T) { diff --git a/lib/srv/discovery/fetchers/aws-sync/reconcile.go b/lib/srv/discovery/fetchers/aws-sync/reconcile.go index 753f1d1ca3bc3..553a1edcd129a 100644 --- a/lib/srv/discovery/fetchers/aws-sync/reconcile.go +++ b/lib/srv/discovery/fetchers/aws-sync/reconcile.go @@ -20,11 +20,11 @@ package aws_sync import ( "fmt" - "github.com/gravitational/teleport/lib/srv/discovery/common" "google.golang.org/protobuf/proto" accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" + "github.com/gravitational/teleport/lib/srv/discovery/common" ) func newResourceList() *accessgraphv1alpha.AWSResourceList { diff --git a/lib/srv/discovery/fetchers/azure-sync/azure-sync.go b/lib/srv/discovery/fetchers/azure-sync/azure-sync.go index bc62e439ff248..98c431282f323 100644 --- a/lib/srv/discovery/fetchers/azure-sync/azure-sync.go +++ b/lib/srv/discovery/fetchers/azure-sync/azure-sync.go @@ -20,16 +20,18 @@ package azure_sync import ( "context" + "sync" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v3" + "github.com/gravitational/trace" + "golang.org/x/sync/errgroup" + accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" "github.com/gravitational/teleport/lib/cloud" "github.com/gravitational/teleport/lib/cloud/azure" "github.com/gravitational/teleport/lib/srv/discovery/common" - "github.com/gravitational/trace" - "golang.org/x/sync/errgroup" - "sync" ) const ( diff --git a/lib/srv/discovery/fetchers/azure-sync/azure-sync_test.go b/lib/srv/discovery/fetchers/azure-sync/azure-sync_test.go index ce8edb7f4588e..2c4c47bfb2f3a 100644 --- a/lib/srv/discovery/fetchers/azure-sync/azure-sync_test.go +++ b/lib/srv/discovery/fetchers/azure-sync/azure-sync_test.go @@ -3,10 +3,11 @@ package azure_sync import ( "context" "fmt" + "testing" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v3" "github.com/stretchr/testify/require" - "testing" ) type testRoleDefCli struct { diff --git a/lib/srv/discovery/fetchers/azure-sync/msggraphclient.go b/lib/srv/discovery/fetchers/azure-sync/msggraphclient.go index bb46b7464f94e..2785ebf17658d 100644 --- a/lib/srv/discovery/fetchers/azure-sync/msggraphclient.go +++ b/lib/srv/discovery/fetchers/azure-sync/msggraphclient.go @@ -23,12 +23,13 @@ import ( "context" "encoding/json" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "io" "net/http" "net/url" "strings" "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // GraphClient represents generic MS API client diff --git a/lib/srv/discovery/fetchers/azure-sync/principals.go b/lib/srv/discovery/fetchers/azure-sync/principals.go index be01af350bb76..59ebac5f55284 100644 --- a/lib/srv/discovery/fetchers/azure-sync/principals.go +++ b/lib/srv/discovery/fetchers/azure-sync/principals.go @@ -2,11 +2,13 @@ package azure_sync import ( "context" + "slices" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" "github.com/gravitational/trace" "google.golang.org/protobuf/types/known/timestamppb" - "slices" + + accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" ) const groupType = "#microsoft.graph.group" diff --git a/lib/srv/discovery/fetchers/azure-sync/reconcile.go b/lib/srv/discovery/fetchers/azure-sync/reconcile.go index 5d80878504eb3..a184c34972e57 100644 --- a/lib/srv/discovery/fetchers/azure-sync/reconcile.go +++ b/lib/srv/discovery/fetchers/azure-sync/reconcile.go @@ -20,9 +20,11 @@ package azure_sync import ( "fmt" + + "google.golang.org/protobuf/proto" + accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" "github.com/gravitational/teleport/lib/srv/discovery/common" - "google.golang.org/protobuf/proto" ) func MergeResources(results ...*Resources) *Resources { diff --git a/lib/srv/discovery/fetchers/azure-sync/reconcile_test.go b/lib/srv/discovery/fetchers/azure-sync/reconcile_test.go index d337a0fcaaa92..28b293bcf1f8d 100644 --- a/lib/srv/discovery/fetchers/azure-sync/reconcile_test.go +++ b/lib/srv/discovery/fetchers/azure-sync/reconcile_test.go @@ -18,9 +18,11 @@ package azure_sync import ( - accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" - "github.com/stretchr/testify/require" "testing" + + "github.com/stretchr/testify/require" + + accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" ) func TestReconcileResults(t *testing.T) { diff --git a/lib/srv/discovery/fetchers/azure-sync/roleassignments.go b/lib/srv/discovery/fetchers/azure-sync/roleassignments.go index c497ca8baabdd..f45275368debe 100644 --- a/lib/srv/discovery/fetchers/azure-sync/roleassignments.go +++ b/lib/srv/discovery/fetchers/azure-sync/roleassignments.go @@ -21,9 +21,11 @@ package azure_sync import ( "context" "fmt" - accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" + "github.com/gravitational/trace" "google.golang.org/protobuf/types/known/timestamppb" + + accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" ) func (a *Fetcher) fetchRoleAssignments(ctx context.Context) ([]*accessgraphv1alpha.AzureRoleAssignment, error) { diff --git a/lib/srv/discovery/fetchers/azure-sync/roledefinitions.go b/lib/srv/discovery/fetchers/azure-sync/roledefinitions.go index e24f65804d253..b598587ff74d8 100644 --- a/lib/srv/discovery/fetchers/azure-sync/roledefinitions.go +++ b/lib/srv/discovery/fetchers/azure-sync/roledefinitions.go @@ -21,9 +21,11 @@ package azure_sync import ( "context" "fmt" - accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" + "github.com/gravitational/trace" "google.golang.org/protobuf/types/known/timestamppb" + + accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" ) func (a *Fetcher) fetchRoleDefinitions(ctx context.Context) ([]*accessgraphv1alpha.AzureRoleDefinition, error) { diff --git a/lib/srv/discovery/fetchers/azure-sync/virtualmachines.go b/lib/srv/discovery/fetchers/azure-sync/virtualmachines.go index c9c02c948881e..bc1c279a8b416 100644 --- a/lib/srv/discovery/fetchers/azure-sync/virtualmachines.go +++ b/lib/srv/discovery/fetchers/azure-sync/virtualmachines.go @@ -20,9 +20,11 @@ package azure_sync import ( "context" - accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" + "github.com/gravitational/trace" "google.golang.org/protobuf/types/known/timestamppb" + + accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha" ) func (a *Fetcher) fetchVirtualMachines(ctx context.Context) ([]*accessgraphv1alpha.AzureVirtualMachine, error) {