@@ -35,19 +35,19 @@ import (
35
35
accessgraphv1alpha "github.com/gravitational/teleport/gen/proto/go/accessgraph/v1alpha"
36
36
"github.com/gravitational/teleport/lib/modules"
37
37
"github.com/gravitational/teleport/lib/services"
38
- azure_sync "github.com/gravitational/teleport/lib/srv/discovery/fetchers/azure-sync"
38
+ "github.com/gravitational/teleport/lib/srv/discovery/fetchers/azure-sync"
39
39
)
40
40
41
41
// reconcileAccessGraphAzure fetches Azure resources, creates a set of resources to delete and upsert based on
42
42
// the previous fetch, and then sends the delete and upsert results to the Access Graph stream
43
43
func (s * Server ) reconcileAccessGraphAzure (
44
44
ctx context.Context ,
45
- currentTAGResources * azure_sync .Resources ,
45
+ currentTAGResources * azuresync .Resources ,
46
46
stream accessgraphv1alpha.AccessGraphService_AzureEventsStreamClient ,
47
- features azure_sync .Features ,
47
+ features azuresync .Features ,
48
48
) error {
49
49
type fetcherResult struct {
50
- result * azure_sync .Resources
50
+ result * azuresync .Resources
51
51
err error
52
52
}
53
53
@@ -56,7 +56,7 @@ func (s *Server) reconcileAccessGraphAzure(
56
56
if len (allFetchers ) == 0 {
57
57
// If there are no fetchers, we don't need to continue.
58
58
// We will send a delete request for all resources and return.
59
- upsert , toDel := azure_sync .ReconcileResults (currentTAGResources , & azure_sync .Resources {})
59
+ upsert , toDel := azuresync .ReconcileResults (currentTAGResources , & azuresync .Resources {})
60
60
61
61
if err := azurePush (stream , upsert , toDel ); err != nil {
62
62
s .Log .ErrorContext (ctx , "Error pushing empty resources to TAGs" , "error" , err )
@@ -82,7 +82,7 @@ func (s *Server) reconcileAccessGraphAzure(
82
82
}
83
83
84
84
// Collect the results from all fetchers.
85
- results := make ([]* azure_sync .Resources , 0 , len (allFetchers ))
85
+ results := make ([]* azuresync .Resources , 0 , len (allFetchers ))
86
86
errs := make ([]error , 0 , len (allFetchers ))
87
87
for i := 0 ; i < len (allFetchers ); i ++ {
88
88
// Each fetcher can return an error and a result.
@@ -100,10 +100,10 @@ func (s *Server) reconcileAccessGraphAzure(
100
100
if err != nil {
101
101
s .Log .ErrorContext (ctx , "Error polling TAGs" , "error" , err )
102
102
}
103
- result := azure_sync .MergeResources (results ... )
103
+ result := azuresync .MergeResources (results ... )
104
104
105
105
// Merge all results into a single result
106
- upsert , toDel := azure_sync .ReconcileResults (currentTAGResources , result )
106
+ upsert , toDel := azuresync .ReconcileResults (currentTAGResources , result )
107
107
pushErr := azurePush (stream , upsert , toDel )
108
108
109
109
if pushErr != nil {
@@ -191,8 +191,8 @@ func azurePush(
191
191
}
192
192
193
193
// getAllTAGSyncAzureFetchers returns both static and dynamic TAG Azure fetchers
194
- func (s * Server ) getAllTAGSyncAzureFetchers () []* azure_sync .Fetcher {
195
- allFetchers := make ([]* azure_sync .Fetcher , 0 , len (s .dynamicTAGAzureFetchers ))
194
+ func (s * Server ) getAllTAGSyncAzureFetchers () []* azuresync .Fetcher {
195
+ allFetchers := make ([]* azuresync .Fetcher , 0 , len (s .dynamicTAGAzureFetchers ))
196
196
197
197
s .muDynamicTAGAzureFetchers .RLock ()
198
198
for _ , fetcherSet := range s .dynamicTAGAzureFetchers {
@@ -291,7 +291,7 @@ func (s *Server) initializeAndWatchAzureAccessGraph(ctx context.Context, reloadC
291
291
if len (supportedKinds ) == 0 {
292
292
return trace .BadParameter ("TAG Azure service did not return supported kinds" )
293
293
}
294
- features := azure_sync .BuildFeatures (supportedKinds ... )
294
+ features := azuresync .BuildFeatures (supportedKinds ... )
295
295
296
296
// Cancels the context to stop the event watcher if the access graph connection fails
297
297
var wg sync.WaitGroup
@@ -320,7 +320,7 @@ func (s *Server) initializeAndWatchAzureAccessGraph(ctx context.Context, reloadC
320
320
s .Log .InfoContext (ctx , "Access graph Azure service poll interval" , "poll_interval" , tickerInterval )
321
321
322
322
// Reconciles the resources as they're imported from Azure
323
- azureResources := & azure_sync .Resources {}
323
+ azureResources := & azuresync .Resources {}
324
324
ticker := time .NewTicker (15 * time .Minute )
325
325
defer ticker .Stop ()
326
326
for {
@@ -386,20 +386,20 @@ func (s *Server) initTAGAzureWatchers(ctx context.Context, cfg *Config) error {
386
386
387
387
// accessGraphAzureFetchersFromMatchers converts matcher configuration to fetchers for Azure resource synchronization
388
388
func (s * Server ) accessGraphAzureFetchersFromMatchers (
389
- matchers Matchers , discoveryConfigName string ) ([]* azure_sync .Fetcher , error ) {
390
- var fetchers []* azure_sync .Fetcher
389
+ matchers Matchers , discoveryConfigName string ) ([]* azuresync .Fetcher , error ) {
390
+ var fetchers []* azuresync .Fetcher
391
391
var errs []error
392
392
if matchers .AccessGraph == nil {
393
393
return fetchers , nil
394
394
}
395
395
for _ , matcher := range matchers .AccessGraph .Azure {
396
- fetcherCfg := azure_sync .Config {
396
+ fetcherCfg := azuresync .Config {
397
397
CloudClients : s .CloudClients ,
398
398
SubscriptionID : matcher .SubscriptionID ,
399
399
Integration : matcher .Integration ,
400
400
DiscoveryConfigName : discoveryConfigName ,
401
401
}
402
- fetcher , err := azure_sync .NewFetcher (fetcherCfg , s .ctx )
402
+ fetcher , err := azuresync .NewFetcher (fetcherCfg , s .ctx )
403
403
if err != nil {
404
404
errs = append (errs , err )
405
405
continue
0 commit comments