From 4568fb7f636cc6953d35244d75bf9153d4c0ebad Mon Sep 17 00:00:00 2001 From: Marco Dinis Date: Fri, 29 Nov 2024 14:08:51 +0000 Subject: [PATCH] use discovery rule --- lib/web/integrations.go | 8 ++++---- lib/web/{intgrations_test.go => integrations_test.go} | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) rename lib/web/{intgrations_test.go => integrations_test.go} (98%) diff --git a/lib/web/integrations.go b/lib/web/integrations.go index 89f52a7ec00d6..6705afcf8dc48 100644 --- a/lib/web/integrations.go +++ b/lib/web/integrations.go @@ -343,7 +343,7 @@ func (h *Handler) integrationDiscoveryRules(w http.ResponseWriter, r *http.Reque return nil, trace.Wrap(err) } - rules, err := collectAutoDiscoverRules(r.Context(), ig.GetName(), startKey, resourceType, clt.DiscoveryConfigClient()) + rules, err := collectAutoDiscoveryRules(r.Context(), ig.GetName(), startKey, resourceType, clt.DiscoveryConfigClient()) if err != nil { return nil, trace.Wrap(err) } @@ -351,11 +351,11 @@ func (h *Handler) integrationDiscoveryRules(w http.ResponseWriter, r *http.Reque return rules, nil } -// collectAutoDiscoverRules will iterate over all DiscoveryConfigs's Matchers and collect the Discover Rules that exist in them for the given integration. +// collectAutoDiscoveryRules will iterate over all DiscoveryConfigs's Matchers and collect the Discovery Rules that exist in them for the given integration. // It can also be filtered by Matcher Type (eg ec2, rds, eks) -// A Discover Rule is a close match to a DiscoveryConfig's Matcher, except that it will count as many rules as regions exist. +// A Discovery Rule is a close match to a DiscoveryConfig's Matcher, except that it will count as many rules as regions exist. // Eg if a DiscoveryConfig's Matcher has two regions, then it will output two (almost equal) Rules, one for each Region. -func collectAutoDiscoverRules( +func collectAutoDiscoveryRules( ctx context.Context, integrationName string, nextPage string, diff --git a/lib/web/intgrations_test.go b/lib/web/integrations_test.go similarity index 98% rename from lib/web/intgrations_test.go rename to lib/web/integrations_test.go index 25a31490dfcad..9719de251d0ec 100644 --- a/lib/web/intgrations_test.go +++ b/lib/web/integrations_test.go @@ -215,7 +215,7 @@ func TestCollectAWSOIDCAutoDiscoverStats(t *testing.T) { }) } -func TestCollectAutoDiscoverRules(t *testing.T) { +func TestCollectAutoDiscoveryRules(t *testing.T) { ctx := context.Background() integrationName := "my-integration" @@ -224,7 +224,7 @@ func TestCollectAutoDiscoverRules(t *testing.T) { discoveryConfigs: make([]*discoveryconfig.DiscoveryConfig, 0), } - gotRules, err := collectAutoDiscoverRules(ctx, integrationName, "", "", clt) + gotRules, err := collectAutoDiscoveryRules(ctx, integrationName, "", "", clt) require.NoError(t, err) expectedRules := ui.IntegrationDiscoveryRules{} require.Equal(t, expectedRules, gotRules) @@ -296,7 +296,7 @@ func TestCollectAutoDiscoverRules(t *testing.T) { }, } - got, err := collectAutoDiscoverRules(ctx, integrationName, "", "", clt) + got, err := collectAutoDiscoveryRules(ctx, integrationName, "", "", clt) require.NoError(t, err) expectedRules := []ui.IntegrationDiscoveryRule{ {