From 9e7abf02c24346b8c44c9817408f3b1cc5ef6f1b Mon Sep 17 00:00:00 2001 From: Radoslav Dimitrov Date: Thu, 24 Oct 2024 12:26:07 +0300 Subject: [PATCH] Move ruletypes from internal to pkg Signed-off-by: Radoslav Dimitrov --- internal/controlplane/handlers_evalstatus.go | 2 +- internal/controlplane/handlers_profile.go | 2 +- internal/controlplane/handlers_ruletype.go | 2 +- internal/controlplane/handlers_ruletype_test.go | 2 +- internal/controlplane/server.go | 2 +- internal/engine/rtengine/cache.go | 2 +- internal/marketplaces/factory.go | 2 +- internal/marketplaces/subscriptions/service.go | 2 +- internal/marketplaces/subscriptions/service_test.go | 4 ++-- internal/profiles/validator.go | 2 +- internal/service/service.go | 2 +- {internal => pkg}/ruletypes/mock/fixtures/service.go | 2 +- {internal => pkg}/ruletypes/mock/service.go | 0 {internal => pkg}/ruletypes/service.go | 0 {internal => pkg}/ruletypes/service_test.go | 2 +- {internal => pkg}/ruletypes/util.go | 0 16 files changed, 14 insertions(+), 14 deletions(-) rename {internal => pkg}/ruletypes/mock/fixtures/service.go (95%) rename {internal => pkg}/ruletypes/mock/service.go (100%) rename {internal => pkg}/ruletypes/service.go (100%) rename {internal => pkg}/ruletypes/service_test.go (99%) rename {internal => pkg}/ruletypes/util.go (100%) diff --git a/internal/controlplane/handlers_evalstatus.go b/internal/controlplane/handlers_evalstatus.go index b241411db2..27726ce81b 100644 --- a/internal/controlplane/handlers_evalstatus.go +++ b/internal/controlplane/handlers_evalstatus.go @@ -24,9 +24,9 @@ import ( propSvc "github.com/mindersec/minder/internal/entities/properties/service" "github.com/mindersec/minder/internal/history" ghprop "github.com/mindersec/minder/internal/providers/github/properties" - "github.com/mindersec/minder/internal/ruletypes" "github.com/mindersec/minder/internal/util" minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1" + "github.com/mindersec/minder/pkg/ruletypes" ) const ( diff --git a/internal/controlplane/handlers_profile.go b/internal/controlplane/handlers_profile.go index f5a7c93db0..e4f41af75f 100644 --- a/internal/controlplane/handlers_profile.go +++ b/internal/controlplane/handlers_profile.go @@ -26,9 +26,9 @@ import ( "github.com/mindersec/minder/internal/logger" prof "github.com/mindersec/minder/internal/profiles" ghprop "github.com/mindersec/minder/internal/providers/github/properties" - "github.com/mindersec/minder/internal/ruletypes" "github.com/mindersec/minder/internal/util" minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1" + "github.com/mindersec/minder/pkg/ruletypes" ) // CreateProfile creates a profile for a project diff --git a/internal/controlplane/handlers_ruletype.go b/internal/controlplane/handlers_ruletype.go index 004d714c63..15267853b8 100644 --- a/internal/controlplane/handlers_ruletype.go +++ b/internal/controlplane/handlers_ruletype.go @@ -24,9 +24,9 @@ import ( "github.com/mindersec/minder/internal/db" "github.com/mindersec/minder/internal/engine/engcontext" "github.com/mindersec/minder/internal/logger" - "github.com/mindersec/minder/internal/ruletypes" "github.com/mindersec/minder/internal/util" minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1" + "github.com/mindersec/minder/pkg/ruletypes" ) var ( diff --git a/internal/controlplane/handlers_ruletype_test.go b/internal/controlplane/handlers_ruletype_test.go index acefebfbd9..f36facbab5 100644 --- a/internal/controlplane/handlers_ruletype_test.go +++ b/internal/controlplane/handlers_ruletype_test.go @@ -15,8 +15,8 @@ import ( mockdb "github.com/mindersec/minder/database/mock" df "github.com/mindersec/minder/database/mock/fixtures" db "github.com/mindersec/minder/internal/db" - sf "github.com/mindersec/minder/internal/ruletypes/mock/fixtures" minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1" + sf "github.com/mindersec/minder/pkg/ruletypes/mock/fixtures" ) func TestCreateRuleType(t *testing.T) { diff --git a/internal/controlplane/server.go b/internal/controlplane/server.go index 31e3918f26..9b37e65bdd 100644 --- a/internal/controlplane/server.go +++ b/internal/controlplane/server.go @@ -62,9 +62,9 @@ import ( "github.com/mindersec/minder/internal/providers/session" reposvc "github.com/mindersec/minder/internal/repositories" "github.com/mindersec/minder/internal/roles" - "github.com/mindersec/minder/internal/ruletypes" "github.com/mindersec/minder/internal/util" pb "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1" + "github.com/mindersec/minder/pkg/ruletypes" ) const metricsPath = "/metrics" diff --git a/internal/engine/rtengine/cache.go b/internal/engine/rtengine/cache.go index 3c67690e9d..6023c6aad2 100644 --- a/internal/engine/rtengine/cache.go +++ b/internal/engine/rtengine/cache.go @@ -14,9 +14,9 @@ import ( "github.com/mindersec/minder/internal/db" "github.com/mindersec/minder/internal/engine/ingestcache" eoptions "github.com/mindersec/minder/internal/engine/options" - "github.com/mindersec/minder/internal/ruletypes" rtengine2 "github.com/mindersec/minder/pkg/engine/v1/rtengine" provinfv1 "github.com/mindersec/minder/pkg/providers/v1" + "github.com/mindersec/minder/pkg/ruletypes" ) // Cache contains a set of RuleTypeEngine instances diff --git a/internal/marketplaces/factory.go b/internal/marketplaces/factory.go index 8a1a23576c..32741419ed 100644 --- a/internal/marketplaces/factory.go +++ b/internal/marketplaces/factory.go @@ -11,9 +11,9 @@ import ( "github.com/mindersec/minder/internal/config/server" sub "github.com/mindersec/minder/internal/marketplaces/subscriptions" "github.com/mindersec/minder/internal/profiles" - "github.com/mindersec/minder/internal/ruletypes" "github.com/mindersec/minder/pkg/mindpak" src "github.com/mindersec/minder/pkg/mindpak/sources" + "github.com/mindersec/minder/pkg/ruletypes" ) // NewMarketplaceFromServiceConfig takes the Minder service config and diff --git a/internal/marketplaces/subscriptions/service.go b/internal/marketplaces/subscriptions/service.go index c920e19e72..87592826a2 100644 --- a/internal/marketplaces/subscriptions/service.go +++ b/internal/marketplaces/subscriptions/service.go @@ -16,10 +16,10 @@ import ( "github.com/mindersec/minder/internal/db" profsvc "github.com/mindersec/minder/internal/profiles" - "github.com/mindersec/minder/internal/ruletypes" minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1" "github.com/mindersec/minder/pkg/mindpak" "github.com/mindersec/minder/pkg/mindpak/reader" + "github.com/mindersec/minder/pkg/ruletypes" ) //go:generate go run go.uber.org/mock/mockgen -package mock_$GOPACKAGE -destination=./mock/$GOFILE -source=./$GOFILE diff --git a/internal/marketplaces/subscriptions/service_test.go b/internal/marketplaces/subscriptions/service_test.go index 01eb3e5b5e..ddf733730b 100644 --- a/internal/marketplaces/subscriptions/service_test.go +++ b/internal/marketplaces/subscriptions/service_test.go @@ -19,9 +19,9 @@ import ( "github.com/mindersec/minder/internal/marketplaces/subscriptions" "github.com/mindersec/minder/internal/profiles" psf "github.com/mindersec/minder/internal/profiles/mock/fixtures" - "github.com/mindersec/minder/internal/ruletypes" - rsf "github.com/mindersec/minder/internal/ruletypes/mock/fixtures" "github.com/mindersec/minder/pkg/mindpak/reader" + "github.com/mindersec/minder/pkg/ruletypes" + rsf "github.com/mindersec/minder/pkg/ruletypes/mock/fixtures" ) func TestSubscriptionService_Subscribe(t *testing.T) { diff --git a/internal/profiles/validator.go b/internal/profiles/validator.go index ebc305734e..1e096530ed 100644 --- a/internal/profiles/validator.go +++ b/internal/profiles/validator.go @@ -18,9 +18,9 @@ import ( "github.com/mindersec/minder/internal/db" "github.com/mindersec/minder/internal/engine/selectors" - "github.com/mindersec/minder/internal/ruletypes" "github.com/mindersec/minder/internal/util" minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1" + "github.com/mindersec/minder/pkg/ruletypes" ) // Validator encapsulates the logic for validating profiles diff --git a/internal/service/service.go b/internal/service/service.go index d33505a147..aed60d6cc1 100644 --- a/internal/service/service.go +++ b/internal/service/service.go @@ -51,7 +51,7 @@ import ( "github.com/mindersec/minder/internal/reminderprocessor" "github.com/mindersec/minder/internal/repositories" "github.com/mindersec/minder/internal/roles" - "github.com/mindersec/minder/internal/ruletypes" + "github.com/mindersec/minder/pkg/ruletypes" ) // AllInOneServerService is a helper function that starts the gRPC and HTTP servers, diff --git a/internal/ruletypes/mock/fixtures/service.go b/pkg/ruletypes/mock/fixtures/service.go similarity index 95% rename from internal/ruletypes/mock/fixtures/service.go rename to pkg/ruletypes/mock/fixtures/service.go index ac84042ea6..1d759acdca 100644 --- a/internal/ruletypes/mock/fixtures/service.go +++ b/pkg/ruletypes/mock/fixtures/service.go @@ -10,7 +10,7 @@ package fixtures import ( "errors" - mockrulesvc "github.com/mindersec/minder/internal/ruletypes/mock" + mockrulesvc "github.com/mindersec/minder/pkg/ruletypes/mock" "go.uber.org/mock/gomock" ) diff --git a/internal/ruletypes/mock/service.go b/pkg/ruletypes/mock/service.go similarity index 100% rename from internal/ruletypes/mock/service.go rename to pkg/ruletypes/mock/service.go diff --git a/internal/ruletypes/service.go b/pkg/ruletypes/service.go similarity index 100% rename from internal/ruletypes/service.go rename to pkg/ruletypes/service.go diff --git a/internal/ruletypes/service_test.go b/pkg/ruletypes/service_test.go similarity index 99% rename from internal/ruletypes/service_test.go rename to pkg/ruletypes/service_test.go index e5f8297077..9f190c5763 100644 --- a/internal/ruletypes/service_test.go +++ b/pkg/ruletypes/service_test.go @@ -17,9 +17,9 @@ import ( "github.com/mindersec/minder/internal/db" dbf "github.com/mindersec/minder/internal/db/fixtures" - "github.com/mindersec/minder/internal/ruletypes" "github.com/mindersec/minder/internal/util/ptr" pb "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1" + "github.com/mindersec/minder/pkg/ruletypes" ) // both create and update are bundled together since the testing harness is diff --git a/internal/ruletypes/util.go b/pkg/ruletypes/util.go similarity index 100% rename from internal/ruletypes/util.go rename to pkg/ruletypes/util.go