From 071f1248f99a63547b260303e4309fc21f032b2a Mon Sep 17 00:00:00 2001 From: Mohamad Choupan <mohamadkhoee@aut.ac.ir> Date: Fri, 15 Nov 2024 00:50:18 +0330 Subject: [PATCH] feat: move services from pkg to services --- assets/dex-login/web/templates/login.html | 114 +++++++++++++----- cmd/auth-service/main.go | 4 +- cmd/compliance-report-worker/main.go | 2 +- cmd/compliance-service/main.go | 2 +- cmd/compliance-summarizer/main.go | 2 +- cmd/inventory-service/main.go | 2 +- cmd/metadata-service/main.go | 2 +- cmd/query-runner-worker/main.go | 3 +- pkg/analytics/command.go | 3 +- pkg/analytics/job.go | 17 +-- pkg/describe/api/jobs.go | 5 +- pkg/describe/db/compliance_runner.go | 5 +- pkg/describe/db/compliance_summarizer.go | 5 +- pkg/describe/db/model/compliance_job.go | 7 +- pkg/describe/db/model/query_runner.go | 2 +- pkg/describe/db/query_runner.go | 3 +- pkg/describe/scheduler.go | 21 ++-- pkg/describe/scheduler_analytics.go | 5 +- pkg/describe/scheduler_job_sequencer.go | 7 +- .../schedulers/compliance/consumer.go | 4 +- .../schedulers/compliance/publisher.go | 5 +- pkg/describe/schedulers/compliance/service.go | 5 +- .../schedulers/compliance/summarizer.go | 4 +- pkg/describe/schedulers/compliance/trigger.go | 7 +- pkg/describe/schedulers/discovery/service.go | 3 +- .../schedulers/query-runner/consumer.go | 3 +- .../schedulers/query-runner/publisher.go | 7 +- .../schedulers/query-runner/service.go | 9 +- pkg/describe/server.go | 21 ++-- .../benchmark_summary.go | 7 +- .../opengovernance-sdk/services/compliance.go | 3 +- ...e_opengovernance_api_benchmark_controls.go | 5 +- ...le_opengovernance_api_benchmark_summary.go | 5 +- .../opengovernance/view_sync.go | 13 +- pkg/types/query_run.go | 2 +- {pkg => services}/auth/api/apikey.go | 0 {pkg => services}/auth/api/connector.go | 0 {pkg => services}/auth/api/entity.go | 0 {pkg => services}/auth/cmd.go | 2 +- {pkg => services}/auth/db/db.go | 0 {pkg => services}/auth/db/models.go | 0 {pkg => services}/auth/http.go | 6 +- {pkg => services}/auth/server.go | 4 +- .../auth/utils/authentication.go | 3 +- {pkg => services}/auth/utils/connectors.go | 0 {pkg => services}/compliance/api/benchmark.go | 0 .../compliance/api/compliance_result.go | 0 .../compliance/api/compliance_result_event.go | 0 {pkg => services}/compliance/api/control.go | 5 +- {pkg => services}/compliance/api/dto.go | 5 +- .../compliance/api/resource_findings.go | 0 .../compliance/benchmark_summary.go | 0 .../compliance/client/compliance.go | 7 +- {pkg => services}/compliance/command.go | 0 {pkg => services}/compliance/db/db.go | 0 {pkg => services}/compliance/db/models.go | 5 +- .../compliance/es/benchmark_summary.go | 5 +- .../compliance/es/compliance_result.go | 5 +- .../compliance/es/compliance_result_events.go | 5 +- {pkg => services}/compliance/es/lookup.go | 0 .../compliance/es/resource_finding.go | 7 +- {pkg => services}/compliance/http_handler.go | 7 +- {pkg => services}/compliance/http_routes.go | 35 +++--- .../compliance/http_routes_test.go | 5 +- .../compliance/runner/command.go | 0 .../compliance/runner/compliance_result.go | 11 +- {pkg => services}/compliance/runner/const.go | 0 {pkg => services}/compliance/runner/job.go | 13 +- .../compliance/runner/job_result.go | 0 .../compliance/runner/service.go | 11 +- .../compliance/summarizer/command.go | 0 .../compliance/summarizer/const.go | 0 .../compliance/summarizer/job.go | 5 +- .../compliance/summarizer/job_result.go | 2 +- .../compliance/summarizer/service.go | 4 +- .../summarizer/types/benchmark_summary.go | 0 .../compliance/summarizer/types/job.go | 0 .../compliance/summarizer/types/job_docs.go | 0 {pkg => services}/compliance/utils.go | 9 +- services/demo-importer/cmd.go | 9 +- services/integration/cmd.go | 3 +- {pkg => services}/inventory/api/cost.go | 0 {pkg => services}/inventory/api/dto.go | 0 {pkg => services}/inventory/api/elastic.go | 0 {pkg => services}/inventory/api/metric.go | 0 {pkg => services}/inventory/api/query.go | 0 .../inventory/api/resource_collection.go | 0 .../inventory/api/resource_type.go | 0 .../inventory/client/inventory.go | 7 +- {pkg => services}/inventory/command.go | 5 +- {pkg => services}/inventory/config/service.go | 0 {pkg => services}/inventory/db.go | 0 .../inventory/es/analytics_spend_summary.go | 5 +- .../inventory/es/analytics_summary.go | 7 +- {pkg => services}/inventory/es/lookup.go | 0 .../inventory/es/queryrun_result.go | 3 +- {pkg => services}/inventory/http_handler.go | 5 +- {pkg => services}/inventory/http_routes.go | 23 ++-- .../inventory/internal/downsampler.go | 2 +- {pkg => services}/inventory/models.go | 5 +- .../inventory/query-runner/command.go | 0 .../inventory/query-runner/const.go | 0 .../inventory/query-runner/job.go | 7 +- .../inventory/query-runner/job_result.go | 0 .../inventory/query-runner/service.go | 13 +- .../inventory/query-runner/sql_runner.go | 7 +- .../inventory/query-runner/types.go | 0 .../inventory/rego_runner/resource.go | 0 .../inventory/resource_type_category.go | 0 {pkg => services}/metadata/api/metadata.go | 2 +- .../metadata/api/query_parameter.go | 0 {pkg => services}/metadata/api/views.go | 0 {pkg => services}/metadata/client/metadata.go | 9 +- {pkg => services}/metadata/command.go | 7 +- {pkg => services}/metadata/config/model.go | 0 {pkg => services}/metadata/errors/errors.go | 0 {pkg => services}/metadata/http_handler.go | 11 +- {pkg => services}/metadata/http_routes.go | 23 ++-- .../metadata/http_routes_test.go | 11 +- .../internal/database/config_metadata.go | 2 +- .../metadata/internal/database/db.go | 2 +- .../metadata/internal/database/filter.go | 2 +- .../internal/database/platform_config.go | 2 +- .../internal/database/query_parameter.go | 3 +- .../metadata/internal/src/metadata.go | 4 +- .../metadata/models/config_metadata.go | 0 .../metadata/models/config_metadata_keys.go | 5 +- {pkg => services}/metadata/models/filter.go | 0 {pkg => services}/metadata/models/parse.go | 2 +- .../metadata/models/platform_config.go | 0 .../metadata/models/query_parameter.go | 2 +- .../metadata/models/query_parameter_keys.go | 3 +- .../metadata/models/query_view.go | 0 {pkg => services}/metadata/vault/seal.go | 5 +- services/migrator/job/git.go | 4 +- .../job/migrations/analytics/populate.go | 15 +-- .../job/migrations/auth/create_user.go | 2 +- .../compliance/benchmark_metadata.go | 2 +- .../job/migrations/compliance/git_parser.go | 15 +-- .../job/migrations/compliance/populate.go | 5 +- .../job/migrations/inventory/migrator.go | 9 +- .../job/migrations/metadata/migrator.go | 5 +- .../resource_collection/migration.go | 5 +- .../job/migrations/resource_info/migrator.go | 7 +- 144 files changed, 433 insertions(+), 307 deletions(-) rename {pkg => services}/auth/api/apikey.go (100%) rename {pkg => services}/auth/api/connector.go (100%) rename {pkg => services}/auth/api/entity.go (100%) rename {pkg => services}/auth/cmd.go (99%) rename {pkg => services}/auth/db/db.go (100%) rename {pkg => services}/auth/db/models.go (100%) rename {pkg => services}/auth/http.go (99%) rename {pkg => services}/auth/server.go (98%) rename {pkg => services}/auth/utils/authentication.go (97%) rename {pkg => services}/auth/utils/connectors.go (100%) rename {pkg => services}/compliance/api/benchmark.go (100%) rename {pkg => services}/compliance/api/compliance_result.go (100%) rename {pkg => services}/compliance/api/compliance_result_event.go (100%) rename {pkg => services}/compliance/api/control.go (99%) rename {pkg => services}/compliance/api/dto.go (98%) rename {pkg => services}/compliance/api/resource_findings.go (100%) rename {pkg => services}/compliance/benchmark_summary.go (100%) rename {pkg => services}/compliance/client/compliance.go (99%) rename {pkg => services}/compliance/command.go (100%) rename {pkg => services}/compliance/db/db.go (100%) rename {pkg => services}/compliance/db/models.go (99%) rename {pkg => services}/compliance/es/benchmark_summary.go (99%) rename {pkg => services}/compliance/es/compliance_result.go (99%) rename {pkg => services}/compliance/es/compliance_result_events.go (99%) rename {pkg => services}/compliance/es/lookup.go (100%) rename {pkg => services}/compliance/es/resource_finding.go (99%) rename {pkg => services}/compliance/http_handler.go (95%) rename {pkg => services}/compliance/http_routes.go (99%) rename {pkg => services}/compliance/http_routes_test.go (98%) rename {pkg => services}/compliance/runner/command.go (100%) rename {pkg => services}/compliance/runner/compliance_result.go (98%) rename {pkg => services}/compliance/runner/const.go (100%) rename {pkg => services}/compliance/runner/job.go (98%) rename {pkg => services}/compliance/runner/job_result.go (100%) rename {pkg => services}/compliance/runner/service.go (95%) rename {pkg => services}/compliance/summarizer/command.go (100%) rename {pkg => services}/compliance/summarizer/const.go (100%) rename {pkg => services}/compliance/summarizer/job.go (98%) rename {pkg => services}/compliance/summarizer/job_result.go (86%) rename {pkg => services}/compliance/summarizer/service.go (96%) rename {pkg => services}/compliance/summarizer/types/benchmark_summary.go (100%) rename {pkg => services}/compliance/summarizer/types/job.go (100%) rename {pkg => services}/compliance/summarizer/types/job_docs.go (100%) rename {pkg => services}/compliance/utils.go (98%) rename {pkg => services}/inventory/api/cost.go (100%) rename {pkg => services}/inventory/api/dto.go (100%) rename {pkg => services}/inventory/api/elastic.go (100%) rename {pkg => services}/inventory/api/metric.go (100%) rename {pkg => services}/inventory/api/query.go (100%) rename {pkg => services}/inventory/api/resource_collection.go (100%) rename {pkg => services}/inventory/api/resource_type.go (100%) rename {pkg => services}/inventory/client/inventory.go (99%) rename {pkg => services}/inventory/command.go (96%) rename {pkg => services}/inventory/config/service.go (100%) rename {pkg => services}/inventory/db.go (100%) rename {pkg => services}/inventory/es/analytics_spend_summary.go (99%) rename {pkg => services}/inventory/es/analytics_summary.go (99%) rename {pkg => services}/inventory/es/lookup.go (100%) rename {pkg => services}/inventory/es/queryrun_result.go (96%) rename {pkg => services}/inventory/http_handler.go (94%) rename {pkg => services}/inventory/http_routes.go (99%) rename {pkg => services}/inventory/internal/downsampler.go (97%) rename {pkg => services}/inventory/models.go (99%) rename {pkg => services}/inventory/query-runner/command.go (100%) rename {pkg => services}/inventory/query-runner/const.go (100%) rename {pkg => services}/inventory/query-runner/job.go (96%) rename {pkg => services}/inventory/query-runner/job_result.go (100%) rename {pkg => services}/inventory/query-runner/service.go (95%) rename {pkg => services}/inventory/query-runner/sql_runner.go (92%) rename {pkg => services}/inventory/query-runner/types.go (100%) rename {pkg => services}/inventory/rego_runner/resource.go (100%) rename {pkg => services}/inventory/resource_type_category.go (100%) rename {pkg => services}/metadata/api/metadata.go (95%) rename {pkg => services}/metadata/api/query_parameter.go (100%) rename {pkg => services}/metadata/api/views.go (100%) rename {pkg => services}/metadata/client/metadata.go (97%) rename {pkg => services}/metadata/command.go (96%) rename {pkg => services}/metadata/config/model.go (100%) rename {pkg => services}/metadata/errors/errors.go (100%) rename {pkg => services}/metadata/http_handler.go (96%) rename {pkg => services}/metadata/http_routes.go (98%) rename {pkg => services}/metadata/http_routes_test.go (95%) rename {pkg => services}/metadata/internal/database/config_metadata.go (92%) rename {pkg => services}/metadata/internal/database/db.go (85%) rename {pkg => services}/metadata/internal/database/filter.go (84%) rename {pkg => services}/metadata/internal/database/platform_config.go (92%) rename {pkg => services}/metadata/internal/database/query_parameter.go (95%) rename {pkg => services}/metadata/internal/src/metadata.go (90%) rename {pkg => services}/metadata/models/config_metadata.go (100%) rename {pkg => services}/metadata/models/config_metadata_keys.go (99%) rename {pkg => services}/metadata/models/filter.go (100%) rename {pkg => services}/metadata/models/parse.go (96%) rename {pkg => services}/metadata/models/platform_config.go (100%) rename {pkg => services}/metadata/models/query_parameter.go (88%) rename {pkg => services}/metadata/models/query_parameter_keys.go (95%) rename {pkg => services}/metadata/models/query_view.go (100%) rename {pkg => services}/metadata/vault/seal.go (98%) diff --git a/assets/dex-login/web/templates/login.html b/assets/dex-login/web/templates/login.html index 91c381804..d7a5f77e8 100644 --- a/assets/dex-login/web/templates/login.html +++ b/assets/dex-login/web/templates/login.html @@ -2,37 +2,95 @@ <div class="flex min-h-full flex-1 flex-col justify-center select-connector"> <div class="sm:mx-auto sm:w-full sm:max-w-md connector-body"> <div class="main-logo"> - <svg width="360" height="180" viewBox="0 0 180 76" xmlns="http://www.w3.org/2000/svg"> - <!-- Main Paths for Logo (Blue Shades) --> - <path fill-rule="evenodd" clip-rule="evenodd" d="M78 69.9993H36.925C32.64 69.9993 28.68 67.8884 26.535 64.4566L26 63.602L25.465 62.7429C23.32 59.3157 19.36 57.2002 15.07 57.2002H0L8 44.4011H23.07C25.215 44.4011 27.275 44.9277 29.07 45.8838C30.865 46.8445 32.395 48.2302 33.465 49.9438L34 50.7984L34.535 51.6575C36.68 55.0893 40.64 57.2002 44.925 57.2002H70L74 63.602L78 69.9993Z" fill="url(#paint0_linear)"/> - - <path fill-rule="evenodd" clip-rule="evenodd" d="M77.9934 70L37.9985 6L30 18.8L61.9989 70H77.9934Z" fill="url(#paint1_linear)"/> - - <path fill-rule="evenodd" clip-rule="evenodd" d="M45.9947 18.7991L41.9947 25.2009L37.9947 31.6028L33.9947 38L29.9947 44.4019L29.0697 45.8845C27.2747 44.9284 25.2147 44.4019 23.0697 44.4019H8.21973C11.7947 44.4019 15.0947 42.642 16.8797 39.7829L17.9947 38L21.9947 31.6028L25.9947 25.2009L29.9947 18.7991L33.9947 12.4018L37.9947 6L41.9947 12.4018L45.9947 18.7991Z" fill="url(#paint2_linear)"/> + <svg + width="360" + height="180" + viewBox="0 0 180 76" + xmlns="http://www.w3.org/2000/svg" + > + <!-- Main Paths for Logo (Blue Shades) --> + <path + fill-rule="evenodd" + clip-rule="evenodd" + d="M78 69.9993H36.925C32.64 69.9993 28.68 67.8884 26.535 64.4566L26 63.602L25.465 62.7429C23.32 59.3157 19.36 57.2002 15.07 57.2002H0L8 44.4011H23.07C25.215 44.4011 27.275 44.9277 29.07 45.8838C30.865 46.8445 32.395 48.2302 33.465 49.9438L34 50.7984L34.535 51.6575C36.68 55.0893 40.64 57.2002 44.925 57.2002H70L74 63.602L78 69.9993Z" + fill="url(#paint0_linear)" + /> - <!-- Text --> - <text x="90" y="40" font-family="Lato, sans-serif" font-size="24" letter-spacing="0.5" fill="#0D2239">open</text> - <text x="90" y="65" font-family="Lato, sans-serif" font-size="24" letter-spacing="0.5" fill="#0D2239">comply</text> + <path + fill-rule="evenodd" + clip-rule="evenodd" + d="M77.9934 70L37.9985 6L30 18.8L61.9989 70H77.9934Z" + fill="url(#paint1_linear)" + /> - <!-- Gradients --> - <defs> - <linearGradient id="paint0_linear" x1="7800" y1="1483.58" x2="4042.37" y2="707.509" gradientUnits="userSpaceOnUse"> - <stop offset="0%" stop-color="#2563EA"/> - <stop offset="100%" stop-color="#014BFA"/> - </linearGradient> - <linearGradient id="paint1_linear" x1="1595.35" y1="6.00001" x2="2699.18" y2="3042.53" gradientUnits="userSpaceOnUse"> - <stop offset="0%" stop-color="#2563EA"/> - <stop offset="100%" stop-color="#014BFA"/> - </linearGradient> - <linearGradient id="paint2_linear" x1="3170.4" y1="4816.27" x2="3170.4" y2="6" gradientUnits="userSpaceOnUse"> - <stop offset="0%" stop-color="#1C155C"/> - <stop offset="39.942%" stop-color="#014BFA"/> - <stop offset="99.99%" stop-color="#014BFA"/> - <stop offset="100%" stop-color="#FD7810"/> - </linearGradient> - </defs> -</svg> + <path + fill-rule="evenodd" + clip-rule="evenodd" + d="M45.9947 18.7991L41.9947 25.2009L37.9947 31.6028L33.9947 38L29.9947 44.4019L29.0697 45.8845C27.2747 44.9284 25.2147 44.4019 23.0697 44.4019H8.21973C11.7947 44.4019 15.0947 42.642 16.8797 39.7829L17.9947 38L21.9947 31.6028L25.9947 25.2009L29.9947 18.7991L33.9947 12.4018L37.9947 6L41.9947 12.4018L45.9947 18.7991Z" + fill="url(#paint2_linear)" + /> + <!-- Text --> + <text + x="90" + y="40" + font-family="Lato, sans-serif" + font-size="24" + letter-spacing="0.5" + fill="#0D2239" + > + open + </text> + <text + x="90" + y="65" + font-family="Lato, sans-serif" + font-size="24" + letter-spacing="0.5" + fill="#0D2239" + > + comply + </text> + + <!-- Gradients --> + <defs> + <linearGradient + id="paint0_linear" + x1="7800" + y1="1483.58" + x2="4042.37" + y2="707.509" + gradientUnits="userSpaceOnUse" + > + <stop offset="0%" stop-color="#2563EA" /> + <stop offset="100%" stop-color="#014BFA" /> + </linearGradient> + <linearGradient + id="paint1_linear" + x1="1595.35" + y1="6.00001" + x2="2699.18" + y2="3042.53" + gradientUnits="userSpaceOnUse" + > + <stop offset="0%" stop-color="#2563EA" /> + <stop offset="100%" stop-color="#014BFA" /> + </linearGradient> + <linearGradient + id="paint2_linear" + x1="3170.4" + y1="4816.27" + x2="3170.4" + y2="6" + gradientUnits="userSpaceOnUse" + > + <stop offset="0%" stop-color="#1C155C" /> + <stop offset="39.942%" stop-color="#014BFA" /> + <stop offset="99.99%" stop-color="#014BFA" /> + <stop offset="100%" stop-color="#FD7810" /> + </linearGradient> + </defs> + </svg> </div> <div class="text">Welcome Back to Opengovernance.</div> <div class="connector-buttons"> diff --git a/cmd/auth-service/main.go b/cmd/auth-service/main.go index 055f0307a..f0e119ee9 100644 --- a/cmd/auth-service/main.go +++ b/cmd/auth-service/main.go @@ -3,11 +3,11 @@ package main import ( "context" "fmt" - "github.com/opengovern/opengovernance/pkg/auth" "os" "os/signal" "syscall" - + + "github.com/opengovern/opengovernance/services/auth" ) func main() { diff --git a/cmd/compliance-report-worker/main.go b/cmd/compliance-report-worker/main.go index c9132c009..021143418 100644 --- a/cmd/compliance-report-worker/main.go +++ b/cmd/compliance-report-worker/main.go @@ -7,7 +7,7 @@ import ( "os/signal" "syscall" - "github.com/opengovern/opengovernance/pkg/compliance/runner" + "github.com/opengovern/opengovernance/services/compliance/runner" ) func main() { diff --git a/cmd/compliance-service/main.go b/cmd/compliance-service/main.go index 28d515db2..dd9a91610 100644 --- a/cmd/compliance-service/main.go +++ b/cmd/compliance-service/main.go @@ -7,7 +7,7 @@ import ( "os/signal" "syscall" - "github.com/opengovern/opengovernance/pkg/compliance" + "github.com/opengovern/opengovernance/services/compliance" ) func main() { diff --git a/cmd/compliance-summarizer/main.go b/cmd/compliance-summarizer/main.go index 86f91650c..d2eef8174 100644 --- a/cmd/compliance-summarizer/main.go +++ b/cmd/compliance-summarizer/main.go @@ -7,7 +7,7 @@ import ( "os/signal" "syscall" - "github.com/opengovern/opengovernance/pkg/compliance/summarizer" + "github.com/opengovern/opengovernance/services/compliance/summarizer" ) func main() { diff --git a/cmd/inventory-service/main.go b/cmd/inventory-service/main.go index e6285db8a..37b5b5ca2 100644 --- a/cmd/inventory-service/main.go +++ b/cmd/inventory-service/main.go @@ -7,7 +7,7 @@ import ( "os/signal" "syscall" - "github.com/opengovern/opengovernance/pkg/inventory" + "github.com/opengovern/opengovernance/services/inventory" ) func main() { diff --git a/cmd/metadata-service/main.go b/cmd/metadata-service/main.go index a09b1b1e2..bbecca8e4 100644 --- a/cmd/metadata-service/main.go +++ b/cmd/metadata-service/main.go @@ -7,7 +7,7 @@ import ( "os/signal" "syscall" - "github.com/opengovern/opengovernance/pkg/metadata" + "github.com/opengovern/opengovernance/services/metadata" ) func main() { diff --git a/cmd/query-runner-worker/main.go b/cmd/query-runner-worker/main.go index cb8a94765..0150ab2ba 100644 --- a/cmd/query-runner-worker/main.go +++ b/cmd/query-runner-worker/main.go @@ -3,10 +3,11 @@ package main import ( "context" "fmt" - queryrunner "github.com/opengovern/opengovernance/pkg/inventory/query-runner" "os" "os/signal" "syscall" + + queryrunner "github.com/opengovern/opengovernance/services/inventory/query-runner" ) func main() { diff --git a/pkg/analytics/command.go b/pkg/analytics/command.go index 12d41b145..d35511579 100644 --- a/pkg/analytics/command.go +++ b/pkg/analytics/command.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + esSinkClient "github.com/opengovern/og-util/pkg/es/ingest/client" "github.com/opengovern/og-util/pkg/jq" integrationClient "github.com/opengovern/opengovernance/services/integration/client" @@ -17,7 +18,7 @@ import ( workerConfig "github.com/opengovern/opengovernance/pkg/analytics/config" "github.com/opengovern/opengovernance/pkg/analytics/db" describeClient "github.com/opengovern/opengovernance/pkg/describe/client" - inventoryClient "github.com/opengovern/opengovernance/pkg/inventory/client" + inventoryClient "github.com/opengovern/opengovernance/services/inventory/client" "github.com/spf13/cobra" "go.uber.org/zap" ) diff --git a/pkg/analytics/job.go b/pkg/analytics/job.go index 1a05b587c..3f86c2785 100644 --- a/pkg/analytics/job.go +++ b/pkg/analytics/job.go @@ -5,21 +5,22 @@ import ( "encoding/base64" "encoding/json" "fmt" + "math" + "net/http" + "reflect" + "regexp" + "strings" + "time" + authApi "github.com/opengovern/og-util/pkg/api" shared_entities "github.com/opengovern/og-util/pkg/api/shared-entities" esSinkClient "github.com/opengovern/og-util/pkg/es/ingest/client" "github.com/opengovern/og-util/pkg/httpclient" "github.com/opengovern/og-util/pkg/jq" - inventoryApi "github.com/opengovern/opengovernance/pkg/inventory/api" "github.com/opengovern/opengovernance/pkg/utils" integrationApi "github.com/opengovern/opengovernance/services/integration/api/models" integrationClient "github.com/opengovern/opengovernance/services/integration/client" - "math" - "net/http" - "reflect" - "regexp" - "strings" - "time" + inventoryApi "github.com/opengovern/opengovernance/services/inventory/api" "github.com/opengovern/og-util/pkg/es" "github.com/opengovern/og-util/pkg/steampipe" @@ -30,7 +31,7 @@ import ( "github.com/opengovern/opengovernance/pkg/analytics/es/spend" describeApi "github.com/opengovern/opengovernance/pkg/describe/api" describeClient "github.com/opengovern/opengovernance/pkg/describe/client" - inventoryClient "github.com/opengovern/opengovernance/pkg/inventory/client" + inventoryClient "github.com/opengovern/opengovernance/services/inventory/client" "go.uber.org/zap" ) diff --git a/pkg/describe/api/jobs.go b/pkg/describe/api/jobs.go index 1d17d0a27..7d01bdd89 100644 --- a/pkg/describe/api/jobs.go +++ b/pkg/describe/api/jobs.go @@ -1,9 +1,10 @@ package api import ( - "github.com/opengovern/opengovernance/pkg/analytics/api" - queryrunner "github.com/opengovern/opengovernance/pkg/inventory/query-runner" "time" + + "github.com/opengovern/opengovernance/pkg/analytics/api" + queryrunner "github.com/opengovern/opengovernance/services/inventory/query-runner" ) type JobType string diff --git a/pkg/describe/db/compliance_runner.go b/pkg/describe/db/compliance_runner.go index 67daf09c6..cb994659b 100644 --- a/pkg/describe/db/compliance_runner.go +++ b/pkg/describe/db/compliance_runner.go @@ -2,10 +2,11 @@ package db import ( "errors" - "github.com/opengovern/opengovernance/pkg/compliance/runner" + "time" + "github.com/opengovern/opengovernance/pkg/describe/db/model" + "github.com/opengovern/opengovernance/services/compliance/runner" "gorm.io/gorm" - "time" ) func (db Database) CreateRunnerJobs(tx *gorm.DB, runners []*model.ComplianceRunner) error { diff --git a/pkg/describe/db/compliance_summarizer.go b/pkg/describe/db/compliance_summarizer.go index a1e2618fa..93c1dc067 100644 --- a/pkg/describe/db/compliance_summarizer.go +++ b/pkg/describe/db/compliance_summarizer.go @@ -2,10 +2,11 @@ package db import ( "errors" - "github.com/opengovern/opengovernance/pkg/compliance/summarizer" + "time" + "github.com/opengovern/opengovernance/pkg/describe/db/model" + "github.com/opengovern/opengovernance/services/compliance/summarizer" "gorm.io/gorm" - "time" ) func (db Database) CreateSummarizerJob(summarizer *model.ComplianceSummarizer) error { diff --git a/pkg/describe/db/model/compliance_job.go b/pkg/describe/db/model/compliance_job.go index 2ae6af2d1..ff16ff85f 100644 --- a/pkg/describe/db/model/compliance_job.go +++ b/pkg/describe/db/model/compliance_job.go @@ -3,12 +3,13 @@ package model import ( "encoding/json" "fmt" + "time" + "github.com/lib/pq" - "github.com/opengovern/opengovernance/pkg/compliance/runner" - "github.com/opengovern/opengovernance/pkg/compliance/summarizer" "github.com/opengovern/opengovernance/pkg/describe/api" + "github.com/opengovern/opengovernance/services/compliance/runner" + "github.com/opengovern/opengovernance/services/compliance/summarizer" "gorm.io/gorm" - "time" ) type ComplianceJobStatus string diff --git a/pkg/describe/db/model/query_runner.go b/pkg/describe/db/model/query_runner.go index 4608441ba..e5aa2c5c0 100644 --- a/pkg/describe/db/model/query_runner.go +++ b/pkg/describe/db/model/query_runner.go @@ -1,7 +1,7 @@ package model import ( - queryrunner "github.com/opengovern/opengovernance/pkg/inventory/query-runner" + queryrunner "github.com/opengovern/opengovernance/services/inventory/query-runner" "gorm.io/gorm" ) diff --git a/pkg/describe/db/query_runner.go b/pkg/describe/db/query_runner.go index 522ca0197..ff01080df 100644 --- a/pkg/describe/db/query_runner.go +++ b/pkg/describe/db/query_runner.go @@ -3,8 +3,9 @@ package db import ( "errors" "fmt" + "github.com/opengovern/opengovernance/pkg/describe/db/model" - queryrunner "github.com/opengovern/opengovernance/pkg/inventory/query-runner" + queryrunner "github.com/opengovern/opengovernance/services/inventory/query-runner" "gorm.io/gorm" ) diff --git a/pkg/describe/scheduler.go b/pkg/describe/scheduler.go index 784f9e9be..3743c9aa3 100644 --- a/pkg/describe/scheduler.go +++ b/pkg/describe/scheduler.go @@ -6,16 +6,17 @@ import ( "encoding/json" "errors" "fmt" - "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" - queryrunnerscheduler "github.com/opengovern/opengovernance/pkg/describe/schedulers/query-runner" - queryrunner "github.com/opengovern/opengovernance/pkg/inventory/query-runner" - integration_type "github.com/opengovern/opengovernance/services/integration/integration-type" "net" "net/http" "strconv" "sync" "time" + "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" + queryrunnerscheduler "github.com/opengovern/opengovernance/pkg/describe/schedulers/query-runner" + integration_type "github.com/opengovern/opengovernance/services/integration/integration-type" + queryrunner "github.com/opengovern/opengovernance/services/inventory/query-runner" + envoyAuth "github.com/envoyproxy/go-control-plane/envoy/service/auth/v3" "github.com/nats-io/nats.go/jetstream" authAPI "github.com/opengovern/og-util/pkg/api" @@ -29,20 +30,20 @@ import ( "github.com/opengovern/opengovernance/pkg/analytics" "github.com/opengovern/opengovernance/pkg/checkup" checkupAPI "github.com/opengovern/opengovernance/pkg/checkup/api" - "github.com/opengovern/opengovernance/pkg/compliance/client" - "github.com/opengovern/opengovernance/pkg/compliance/runner" - "github.com/opengovern/opengovernance/pkg/compliance/summarizer" "github.com/opengovern/opengovernance/pkg/describe/api" "github.com/opengovern/opengovernance/pkg/describe/config" "github.com/opengovern/opengovernance/pkg/describe/db" "github.com/opengovern/opengovernance/pkg/describe/db/model" "github.com/opengovern/opengovernance/pkg/describe/schedulers/compliance" "github.com/opengovern/opengovernance/pkg/describe/schedulers/discovery" - inventoryClient "github.com/opengovern/opengovernance/pkg/inventory/client" - metadataClient "github.com/opengovern/opengovernance/pkg/metadata/client" - "github.com/opengovern/opengovernance/pkg/metadata/models" "github.com/opengovern/opengovernance/pkg/utils" + "github.com/opengovern/opengovernance/services/compliance/client" + "github.com/opengovern/opengovernance/services/compliance/runner" + "github.com/opengovern/opengovernance/services/compliance/summarizer" integrationClient "github.com/opengovern/opengovernance/services/integration/client" + inventoryClient "github.com/opengovern/opengovernance/services/inventory/client" + metadataClient "github.com/opengovern/opengovernance/services/metadata/client" + "github.com/opengovern/opengovernance/services/metadata/models" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "go.uber.org/zap" diff --git a/pkg/describe/scheduler_analytics.go b/pkg/describe/scheduler_analytics.go index 2d910d5cc..7aa1c32b2 100644 --- a/pkg/describe/scheduler_analytics.go +++ b/pkg/describe/scheduler_analytics.go @@ -4,17 +4,18 @@ import ( "context" "encoding/json" "fmt" + "time" + "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/httpclient" integrationapi "github.com/opengovern/opengovernance/services/integration/api/models" - "time" "github.com/nats-io/nats.go/jetstream" "github.com/opengovern/og-util/pkg/ticker" "github.com/opengovern/opengovernance/pkg/analytics" analyticsApi "github.com/opengovern/opengovernance/pkg/analytics/api" "github.com/opengovern/opengovernance/pkg/describe/db/model" - inventoryApi "github.com/opengovern/opengovernance/pkg/inventory/api" + inventoryApi "github.com/opengovern/opengovernance/services/inventory/api" "go.uber.org/zap" "gorm.io/gorm" ) diff --git a/pkg/describe/scheduler_job_sequencer.go b/pkg/describe/scheduler_job_sequencer.go index ca6ad5611..1553435dd 100644 --- a/pkg/describe/scheduler_job_sequencer.go +++ b/pkg/describe/scheduler_job_sequencer.go @@ -4,11 +4,12 @@ import ( "context" "encoding/json" "fmt" + "time" + authApi "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/httpclient" - "github.com/opengovern/opengovernance/pkg/compliance/api" - "github.com/opengovern/opengovernance/pkg/compliance/runner" - "time" + "github.com/opengovern/opengovernance/services/compliance/api" + "github.com/opengovern/opengovernance/services/compliance/runner" "github.com/opengovern/og-util/pkg/ticker" describeApi "github.com/opengovern/opengovernance/pkg/describe/api" diff --git a/pkg/describe/schedulers/compliance/consumer.go b/pkg/describe/schedulers/compliance/consumer.go index 4d3f50a15..200f20dc7 100644 --- a/pkg/describe/schedulers/compliance/consumer.go +++ b/pkg/describe/schedulers/compliance/consumer.go @@ -6,8 +6,8 @@ import ( "time" "github.com/nats-io/nats.go/jetstream" - "github.com/opengovern/opengovernance/pkg/compliance/runner" - "github.com/opengovern/opengovernance/pkg/compliance/summarizer" + "github.com/opengovern/opengovernance/services/compliance/runner" + "github.com/opengovern/opengovernance/services/compliance/summarizer" "go.uber.org/zap" ) diff --git a/pkg/describe/schedulers/compliance/publisher.go b/pkg/describe/schedulers/compliance/publisher.go index 26199cb33..46fd70c88 100644 --- a/pkg/describe/schedulers/compliance/publisher.go +++ b/pkg/describe/schedulers/compliance/publisher.go @@ -3,14 +3,15 @@ package compliance import ( "encoding/json" "fmt" + "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/httpclient" "github.com/opengovern/opengovernance/pkg/describe/db/model" integrationapi "github.com/opengovern/opengovernance/services/integration/api/models" "golang.org/x/net/context" - complianceApi "github.com/opengovern/opengovernance/pkg/compliance/api" - "github.com/opengovern/opengovernance/pkg/compliance/runner" + complianceApi "github.com/opengovern/opengovernance/services/compliance/api" + "github.com/opengovern/opengovernance/services/compliance/runner" "go.uber.org/zap" ) diff --git a/pkg/describe/schedulers/compliance/service.go b/pkg/describe/schedulers/compliance/service.go index 5e4cee6bb..a06f47268 100644 --- a/pkg/describe/schedulers/compliance/service.go +++ b/pkg/describe/schedulers/compliance/service.go @@ -2,15 +2,16 @@ package compliance import ( "context" - "github.com/opengovern/og-util/pkg/jq" "time" + "github.com/opengovern/og-util/pkg/jq" + "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" "github.com/opengovern/og-util/pkg/ticker" - "github.com/opengovern/opengovernance/pkg/compliance/client" "github.com/opengovern/opengovernance/pkg/describe/config" "github.com/opengovern/opengovernance/pkg/describe/db" "github.com/opengovern/opengovernance/pkg/utils" + "github.com/opengovern/opengovernance/services/compliance/client" integrationClient "github.com/opengovern/opengovernance/services/integration/client" "go.uber.org/zap" ) diff --git a/pkg/describe/schedulers/compliance/summarizer.go b/pkg/describe/schedulers/compliance/summarizer.go index 9998b08e6..2403a560c 100644 --- a/pkg/describe/schedulers/compliance/summarizer.go +++ b/pkg/describe/schedulers/compliance/summarizer.go @@ -7,10 +7,10 @@ import ( "strings" "time" - "github.com/opengovern/opengovernance/pkg/compliance/summarizer" - types2 "github.com/opengovern/opengovernance/pkg/compliance/summarizer/types" "github.com/opengovern/opengovernance/pkg/describe/db/model" "github.com/opengovern/opengovernance/pkg/types" + "github.com/opengovern/opengovernance/services/compliance/summarizer" + types2 "github.com/opengovern/opengovernance/services/compliance/summarizer/types" "go.uber.org/zap" ) diff --git a/pkg/describe/schedulers/compliance/trigger.go b/pkg/describe/schedulers/compliance/trigger.go index 0c5aa4c42..78e3d3f4f 100644 --- a/pkg/describe/schedulers/compliance/trigger.go +++ b/pkg/describe/schedulers/compliance/trigger.go @@ -1,15 +1,16 @@ package compliance import ( + "time" + "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/httpclient" "github.com/opengovern/og-util/pkg/integration" - complianceApi "github.com/opengovern/opengovernance/pkg/compliance/api" + complianceApi "github.com/opengovern/opengovernance/services/compliance/api" integrationapi "github.com/opengovern/opengovernance/services/integration/api/models" - "time" - "github.com/opengovern/opengovernance/pkg/compliance/runner" "github.com/opengovern/opengovernance/pkg/describe/db/model" + "github.com/opengovern/opengovernance/services/compliance/runner" "go.uber.org/zap" ) diff --git a/pkg/describe/schedulers/discovery/service.go b/pkg/describe/schedulers/discovery/service.go index 9240fda9f..ba7393ef8 100644 --- a/pkg/describe/schedulers/discovery/service.go +++ b/pkg/describe/schedulers/discovery/service.go @@ -2,11 +2,12 @@ package discovery import ( "context" + "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" - "github.com/opengovern/opengovernance/pkg/compliance/client" config2 "github.com/opengovern/opengovernance/pkg/describe/config" "github.com/opengovern/opengovernance/pkg/describe/db" "github.com/opengovern/opengovernance/pkg/utils" + "github.com/opengovern/opengovernance/services/compliance/client" "go.uber.org/zap" ) diff --git a/pkg/describe/schedulers/query-runner/consumer.go b/pkg/describe/schedulers/query-runner/consumer.go index 6cf65f4c6..375ab8bf0 100644 --- a/pkg/describe/schedulers/query-runner/consumer.go +++ b/pkg/describe/schedulers/query-runner/consumer.go @@ -3,8 +3,9 @@ package query_runner import ( "context" "encoding/json" + "github.com/nats-io/nats.go/jetstream" - queryrunner "github.com/opengovern/opengovernance/pkg/inventory/query-runner" + queryrunner "github.com/opengovern/opengovernance/services/inventory/query-runner" "go.uber.org/zap" ) diff --git a/pkg/describe/schedulers/query-runner/publisher.go b/pkg/describe/schedulers/query-runner/publisher.go index 6e030d7e4..29c6fa95c 100644 --- a/pkg/describe/schedulers/query-runner/publisher.go +++ b/pkg/describe/schedulers/query-runner/publisher.go @@ -5,12 +5,13 @@ import ( "context" "encoding/json" "fmt" + "text/template" + "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/httpclient" - inventoryApi "github.com/opengovern/opengovernance/pkg/inventory/api" - queryrunner "github.com/opengovern/opengovernance/pkg/inventory/query-runner" + inventoryApi "github.com/opengovern/opengovernance/services/inventory/api" + queryrunner "github.com/opengovern/opengovernance/services/inventory/query-runner" "go.uber.org/zap" - "text/template" ) func (s *JobScheduler) runPublisher(ctx context.Context) error { diff --git a/pkg/describe/schedulers/query-runner/service.go b/pkg/describe/schedulers/query-runner/service.go index ab24d3758..a1bec5092 100644 --- a/pkg/describe/schedulers/query-runner/service.go +++ b/pkg/describe/schedulers/query-runner/service.go @@ -2,17 +2,18 @@ package query_runner import ( "context" - "github.com/opengovern/og-util/pkg/jq" - metadataClient "github.com/opengovern/opengovernance/pkg/metadata/client" "time" + "github.com/opengovern/og-util/pkg/jq" + metadataClient "github.com/opengovern/opengovernance/services/metadata/client" + "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" "github.com/opengovern/og-util/pkg/ticker" - complianceClient "github.com/opengovern/opengovernance/pkg/compliance/client" "github.com/opengovern/opengovernance/pkg/describe/config" "github.com/opengovern/opengovernance/pkg/describe/db" - inventoryClient "github.com/opengovern/opengovernance/pkg/inventory/client" "github.com/opengovern/opengovernance/pkg/utils" + complianceClient "github.com/opengovern/opengovernance/services/compliance/client" + inventoryClient "github.com/opengovern/opengovernance/services/inventory/client" "go.uber.org/zap" ) diff --git a/pkg/describe/server.go b/pkg/describe/server.go index 1cc0cd2dd..bf54382d2 100644 --- a/pkg/describe/server.go +++ b/pkg/describe/server.go @@ -5,6 +5,13 @@ import ( "encoding/json" "errors" "fmt" + "net/http" + "regexp" + "sort" + "strconv" + "strings" + "time" + "github.com/jackc/pgtype" "github.com/labstack/echo/v4" apiAuth "github.com/opengovern/og-util/pkg/api" @@ -12,25 +19,19 @@ import ( "github.com/opengovern/og-util/pkg/httpclient" "github.com/opengovern/og-util/pkg/httpserver" "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" - runner2 "github.com/opengovern/opengovernance/pkg/compliance/runner" - queryrunner "github.com/opengovern/opengovernance/pkg/inventory/query-runner" "github.com/opengovern/opengovernance/pkg/utils" + runner2 "github.com/opengovern/opengovernance/services/compliance/runner" integrationapi "github.com/opengovern/opengovernance/services/integration/api/models" - "github.com/opengovern/opengovernance/services/integration/integration-type" + integration_type "github.com/opengovern/opengovernance/services/integration/integration-type" + queryrunner "github.com/opengovern/opengovernance/services/inventory/query-runner" "github.com/sony/sonyflake" - "net/http" - "regexp" - "sort" - "strconv" - "strings" - "time" analyticsapi "github.com/opengovern/opengovernance/pkg/analytics/api" - complianceapi "github.com/opengovern/opengovernance/pkg/compliance/api" "github.com/opengovern/opengovernance/pkg/describe/api" "github.com/opengovern/opengovernance/pkg/describe/db" model2 "github.com/opengovern/opengovernance/pkg/describe/db/model" "github.com/opengovern/opengovernance/pkg/describe/es" + complianceapi "github.com/opengovern/opengovernance/services/compliance/api" "go.uber.org/zap" "gorm.io/gorm" k8sclient "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/pkg/steampipe-plugin-opengovernance/opengovernance-client/benchmark_summary.go b/pkg/steampipe-plugin-opengovernance/opengovernance-client/benchmark_summary.go index ec41a6f33..e4f162909 100644 --- a/pkg/steampipe-plugin-opengovernance/opengovernance-client/benchmark_summary.go +++ b/pkg/steampipe-plugin-opengovernance/opengovernance-client/benchmark_summary.go @@ -2,15 +2,16 @@ package opengovernance_client import ( "context" + "runtime" + "time" + "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/httpclient" - complianceApi "github.com/opengovern/opengovernance/pkg/compliance/api" "github.com/opengovern/opengovernance/pkg/steampipe-plugin-opengovernance/opengovernance-sdk/config" "github.com/opengovern/opengovernance/pkg/steampipe-plugin-opengovernance/opengovernance-sdk/services" "github.com/opengovern/opengovernance/pkg/utils" + complianceApi "github.com/opengovern/opengovernance/services/compliance/api" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" - "runtime" - "time" ) func GetBenchmarkSummary(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (any, error) { diff --git a/pkg/steampipe-plugin-opengovernance/opengovernance-sdk/services/compliance.go b/pkg/steampipe-plugin-opengovernance/opengovernance-sdk/services/compliance.go index ed8550dbb..cdff7e763 100644 --- a/pkg/steampipe-plugin-opengovernance/opengovernance-sdk/services/compliance.go +++ b/pkg/steampipe-plugin-opengovernance/opengovernance-sdk/services/compliance.go @@ -3,8 +3,9 @@ package services import ( "context" "errors" - complianceClient "github.com/opengovern/opengovernance/pkg/compliance/client" + "github.com/opengovern/opengovernance/pkg/steampipe-plugin-opengovernance/opengovernance-sdk/config" + complianceClient "github.com/opengovern/opengovernance/services/compliance/client" "github.com/turbot/steampipe-plugin-sdk/v5/connection" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" ) diff --git a/pkg/steampipe-plugin-opengovernance/opengovernance/table_opengovernance_api_benchmark_controls.go b/pkg/steampipe-plugin-opengovernance/opengovernance/table_opengovernance_api_benchmark_controls.go index 42ecf86d5..1d38f843b 100644 --- a/pkg/steampipe-plugin-opengovernance/opengovernance/table_opengovernance_api_benchmark_controls.go +++ b/pkg/steampipe-plugin-opengovernance/opengovernance/table_opengovernance_api_benchmark_controls.go @@ -2,13 +2,14 @@ package opengovernance import ( "context" - compliance "github.com/opengovern/opengovernance/pkg/compliance/api" + "time" + og_client "github.com/opengovern/opengovernance/pkg/steampipe-plugin-opengovernance/opengovernance-client" + compliance "github.com/opengovern/opengovernance/services/compliance/api" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/quals" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" - "time" ) func tablePlatformApiBenchmarkControls(_ context.Context) *plugin.Table { diff --git a/pkg/steampipe-plugin-opengovernance/opengovernance/table_opengovernance_api_benchmark_summary.go b/pkg/steampipe-plugin-opengovernance/opengovernance/table_opengovernance_api_benchmark_summary.go index f3fb450bd..6815af11b 100644 --- a/pkg/steampipe-plugin-opengovernance/opengovernance/table_opengovernance_api_benchmark_summary.go +++ b/pkg/steampipe-plugin-opengovernance/opengovernance/table_opengovernance_api_benchmark_summary.go @@ -2,13 +2,14 @@ package opengovernance import ( "context" - compliance "github.com/opengovern/opengovernance/pkg/compliance/api" + "time" + og_client "github.com/opengovern/opengovernance/pkg/steampipe-plugin-opengovernance/opengovernance-client" + compliance "github.com/opengovern/opengovernance/services/compliance/api" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/quals" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" - "time" ) func tablePlatformApiBenchmarkSummary(_ context.Context) *plugin.Table { diff --git a/pkg/steampipe-plugin-opengovernance/opengovernance/view_sync.go b/pkg/steampipe-plugin-opengovernance/opengovernance/view_sync.go index f0019d3cc..ad7ebc506 100644 --- a/pkg/steampipe-plugin-opengovernance/opengovernance/view_sync.go +++ b/pkg/steampipe-plugin-opengovernance/opengovernance/view_sync.go @@ -2,20 +2,21 @@ package opengovernance import ( "context" + "os" + "strings" + "sync" + "time" + authApi "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/httpclient" steampipesdk "github.com/opengovern/og-util/pkg/steampipe" - "github.com/opengovern/opengovernance/pkg/metadata/client" - "github.com/opengovern/opengovernance/pkg/metadata/models" "github.com/opengovern/opengovernance/pkg/steampipe-plugin-opengovernance/opengovernance-sdk/config" "github.com/opengovern/opengovernance/pkg/steampipe-plugin-opengovernance/opengovernance-sdk/pg" "github.com/opengovern/opengovernance/pkg/steampipe-plugin-opengovernance/utils/dag" "github.com/opengovern/opengovernance/pkg/utils" + "github.com/opengovern/opengovernance/services/metadata/client" + "github.com/opengovern/opengovernance/services/metadata/models" "go.uber.org/zap" - "os" - "strings" - "sync" - "time" ) func newZapLogger() (*zap.Logger, error) { diff --git a/pkg/types/query_run.go b/pkg/types/query_run.go index 598b0ce59..35715ca00 100644 --- a/pkg/types/query_run.go +++ b/pkg/types/query_run.go @@ -1,7 +1,7 @@ package types import ( - "github.com/opengovern/opengovernance/pkg/inventory/api" + "github.com/opengovern/opengovernance/services/inventory/api" ) type QueryRunResult struct { diff --git a/pkg/auth/api/apikey.go b/services/auth/api/apikey.go similarity index 100% rename from pkg/auth/api/apikey.go rename to services/auth/api/apikey.go diff --git a/pkg/auth/api/connector.go b/services/auth/api/connector.go similarity index 100% rename from pkg/auth/api/connector.go rename to services/auth/api/connector.go diff --git a/pkg/auth/api/entity.go b/services/auth/api/entity.go similarity index 100% rename from pkg/auth/api/entity.go rename to services/auth/api/entity.go diff --git a/pkg/auth/cmd.go b/services/auth/cmd.go similarity index 99% rename from pkg/auth/cmd.go rename to services/auth/cmd.go index 81b7b2b94..560dadfe6 100644 --- a/pkg/auth/cmd.go +++ b/services/auth/cmd.go @@ -14,7 +14,7 @@ import ( config2 "github.com/opengovern/og-util/pkg/config" "github.com/opengovern/og-util/pkg/httpserver" "github.com/opengovern/og-util/pkg/postgres" - "github.com/opengovern/opengovernance/pkg/auth/db" + "github.com/opengovern/opengovernance/services/auth/db" "crypto/rand" diff --git a/pkg/auth/db/db.go b/services/auth/db/db.go similarity index 100% rename from pkg/auth/db/db.go rename to services/auth/db/db.go diff --git a/pkg/auth/db/models.go b/services/auth/db/models.go similarity index 100% rename from pkg/auth/db/models.go rename to services/auth/db/models.go diff --git a/pkg/auth/http.go b/services/auth/http.go similarity index 99% rename from pkg/auth/http.go rename to services/auth/http.go index df984ee0e..ac70f6049 100644 --- a/pkg/auth/http.go +++ b/services/auth/http.go @@ -19,17 +19,17 @@ import ( envoyauth "github.com/envoyproxy/go-control-plane/envoy/service/auth/v3" api2 "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/httpserver" - "github.com/opengovern/opengovernance/pkg/auth/utils" + "github.com/opengovern/opengovernance/services/auth/utils" "golang.org/x/crypto/bcrypt" "google.golang.org/grpc" "google.golang.org/grpc/codes" - "github.com/opengovern/opengovernance/pkg/auth/db" + "github.com/opengovern/opengovernance/services/auth/db" "github.com/golang-jwt/jwt" "github.com/labstack/echo/v4" - "github.com/opengovern/opengovernance/pkg/auth/api" + "github.com/opengovern/opengovernance/services/auth/api" "go.uber.org/zap" "gorm.io/gorm" ) diff --git a/pkg/auth/server.go b/services/auth/server.go similarity index 98% rename from pkg/auth/server.go rename to services/auth/server.go index 97026eed6..8a59933b6 100644 --- a/pkg/auth/server.go +++ b/services/auth/server.go @@ -19,8 +19,8 @@ import ( "github.com/labstack/echo/v4" "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/httpserver" - "github.com/opengovern/opengovernance/pkg/auth/db" - "github.com/opengovern/opengovernance/pkg/auth/utils" + "github.com/opengovern/opengovernance/services/auth/db" + "github.com/opengovern/opengovernance/services/auth/utils" "go.uber.org/zap" "google.golang.org/genproto/googleapis/rpc/status" ) diff --git a/pkg/auth/utils/authentication.go b/services/auth/utils/authentication.go similarity index 97% rename from pkg/auth/utils/authentication.go rename to services/auth/utils/authentication.go index d54b84824..345949000 100644 --- a/pkg/auth/utils/authentication.go +++ b/services/auth/utils/authentication.go @@ -2,10 +2,9 @@ package utils import ( "errors" - "github.com/opengovern/opengovernance/pkg/auth/db" "time" - + "github.com/opengovern/opengovernance/services/auth/db" ) type Service struct { diff --git a/pkg/auth/utils/connectors.go b/services/auth/utils/connectors.go similarity index 100% rename from pkg/auth/utils/connectors.go rename to services/auth/utils/connectors.go diff --git a/pkg/compliance/api/benchmark.go b/services/compliance/api/benchmark.go similarity index 100% rename from pkg/compliance/api/benchmark.go rename to services/compliance/api/benchmark.go diff --git a/pkg/compliance/api/compliance_result.go b/services/compliance/api/compliance_result.go similarity index 100% rename from pkg/compliance/api/compliance_result.go rename to services/compliance/api/compliance_result.go diff --git a/pkg/compliance/api/compliance_result_event.go b/services/compliance/api/compliance_result_event.go similarity index 100% rename from pkg/compliance/api/compliance_result_event.go rename to services/compliance/api/compliance_result_event.go diff --git a/pkg/compliance/api/control.go b/services/compliance/api/control.go similarity index 99% rename from pkg/compliance/api/control.go rename to services/compliance/api/control.go index 712e2a201..f74dff704 100644 --- a/pkg/compliance/api/control.go +++ b/services/compliance/api/control.go @@ -1,10 +1,11 @@ package api import ( + "time" + "github.com/opengovern/og-util/pkg/integration" - inventoryApi "github.com/opengovern/opengovernance/pkg/inventory/api" "github.com/opengovern/opengovernance/pkg/types" - "time" + inventoryApi "github.com/opengovern/opengovernance/services/inventory/api" ) type Control struct { diff --git a/pkg/compliance/api/dto.go b/services/compliance/api/dto.go similarity index 98% rename from pkg/compliance/api/dto.go rename to services/compliance/api/dto.go index ec7b173e7..7adc5dad4 100644 --- a/pkg/compliance/api/dto.go +++ b/services/compliance/api/dto.go @@ -1,10 +1,11 @@ package api import ( + "time" + "github.com/opengovern/og-util/pkg/integration" - inventoryApi "github.com/opengovern/opengovernance/pkg/inventory/api" integrationapi "github.com/opengovern/opengovernance/services/integration/api/models" - "time" + inventoryApi "github.com/opengovern/opengovernance/services/inventory/api" ) const ( diff --git a/pkg/compliance/api/resource_findings.go b/services/compliance/api/resource_findings.go similarity index 100% rename from pkg/compliance/api/resource_findings.go rename to services/compliance/api/resource_findings.go diff --git a/pkg/compliance/benchmark_summary.go b/services/compliance/benchmark_summary.go similarity index 100% rename from pkg/compliance/benchmark_summary.go rename to services/compliance/benchmark_summary.go diff --git a/pkg/compliance/client/compliance.go b/services/compliance/client/compliance.go similarity index 99% rename from pkg/compliance/client/compliance.go rename to services/compliance/client/compliance.go index 0551b9053..0984e9556 100644 --- a/pkg/compliance/client/compliance.go +++ b/services/compliance/client/compliance.go @@ -3,13 +3,14 @@ package client import ( "encoding/json" "fmt" - "github.com/labstack/echo/v4" - "github.com/opengovern/og-util/pkg/httpclient" "net/http" "time" + "github.com/labstack/echo/v4" + "github.com/opengovern/og-util/pkg/httpclient" + "github.com/opengovern/og-util/pkg/source" - compliance "github.com/opengovern/opengovernance/pkg/compliance/api" + compliance "github.com/opengovern/opengovernance/services/compliance/api" ) type ComplianceServiceClient interface { diff --git a/pkg/compliance/command.go b/services/compliance/command.go similarity index 100% rename from pkg/compliance/command.go rename to services/compliance/command.go diff --git a/pkg/compliance/db/db.go b/services/compliance/db/db.go similarity index 100% rename from pkg/compliance/db/db.go rename to services/compliance/db/db.go diff --git a/pkg/compliance/db/models.go b/services/compliance/db/models.go similarity index 99% rename from pkg/compliance/db/models.go rename to services/compliance/db/models.go index 75ee9a587..80970a166 100644 --- a/pkg/compliance/db/models.go +++ b/services/compliance/db/models.go @@ -3,6 +3,8 @@ package db import ( "context" "fmt" + "time" + "github.com/jackc/pgtype" "github.com/opengovern/opengovernance/pkg/utils" integration_type "github.com/opengovern/opengovernance/services/integration/integration-type" @@ -10,13 +12,12 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" - "time" "github.com/lib/pq" "github.com/opengovern/og-util/pkg/model" "github.com/opengovern/opengovernance/pkg/types" - "github.com/opengovern/opengovernance/pkg/compliance/api" + "github.com/opengovern/opengovernance/services/compliance/api" "gorm.io/gorm" ) diff --git a/pkg/compliance/es/benchmark_summary.go b/services/compliance/es/benchmark_summary.go similarity index 99% rename from pkg/compliance/es/benchmark_summary.go rename to services/compliance/es/benchmark_summary.go index 0fbbd19d1..845ac889e 100644 --- a/pkg/compliance/es/benchmark_summary.go +++ b/services/compliance/es/benchmark_summary.go @@ -4,13 +4,14 @@ import ( "context" "encoding/json" "fmt" - types2 "github.com/opengovern/opengovernance/pkg/compliance/summarizer/types" - "github.com/opengovern/opengovernance/pkg/types" "sort" "strconv" "strings" "time" + "github.com/opengovern/opengovernance/pkg/types" + types2 "github.com/opengovern/opengovernance/services/compliance/summarizer/types" + "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" "go.uber.org/zap" ) diff --git a/pkg/compliance/es/compliance_result.go b/services/compliance/es/compliance_result.go similarity index 99% rename from pkg/compliance/es/compliance_result.go rename to services/compliance/es/compliance_result.go index 258032a88..684ca93c3 100644 --- a/pkg/compliance/es/compliance_result.go +++ b/services/compliance/es/compliance_result.go @@ -4,10 +4,11 @@ import ( "context" "encoding/json" "fmt" - "github.com/opengovern/opengovernance/pkg/compliance/api" + "time" + "github.com/opengovern/opengovernance/pkg/types" + "github.com/opengovern/opengovernance/services/compliance/api" "go.uber.org/zap" - "time" "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" ) diff --git a/pkg/compliance/es/compliance_result_events.go b/services/compliance/es/compliance_result_events.go similarity index 99% rename from pkg/compliance/es/compliance_result_events.go rename to services/compliance/es/compliance_result_events.go index fa0a8aed1..785e3d467 100644 --- a/pkg/compliance/es/compliance_result_events.go +++ b/services/compliance/es/compliance_result_events.go @@ -4,12 +4,13 @@ import ( "context" "encoding/json" "fmt" + "time" + "github.com/opengovern/og-util/pkg/integration" "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" - "github.com/opengovern/opengovernance/pkg/compliance/api" "github.com/opengovern/opengovernance/pkg/types" + "github.com/opengovern/opengovernance/services/compliance/api" "go.uber.org/zap" - "time" ) type ComplianceResultDriftEventsQueryHit struct { diff --git a/pkg/compliance/es/lookup.go b/services/compliance/es/lookup.go similarity index 100% rename from pkg/compliance/es/lookup.go rename to services/compliance/es/lookup.go diff --git a/pkg/compliance/es/resource_finding.go b/services/compliance/es/resource_finding.go similarity index 99% rename from pkg/compliance/es/resource_finding.go rename to services/compliance/es/resource_finding.go index db689837e..3b2eb0d96 100644 --- a/pkg/compliance/es/resource_finding.go +++ b/services/compliance/es/resource_finding.go @@ -4,14 +4,15 @@ import ( "context" "encoding/json" "fmt" + "strings" + "time" + "github.com/opengovern/og-util/pkg/integration" "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" - "github.com/opengovern/opengovernance/pkg/compliance/api" "github.com/opengovern/opengovernance/pkg/types" "github.com/opengovern/opengovernance/pkg/utils" + "github.com/opengovern/opengovernance/services/compliance/api" "go.uber.org/zap" - "strings" - "time" ) type ResourceFindingsQueryHit struct { diff --git a/pkg/compliance/http_handler.go b/services/compliance/http_handler.go similarity index 95% rename from pkg/compliance/http_handler.go rename to services/compliance/http_handler.go index c4202c6e4..6966726e3 100644 --- a/pkg/compliance/http_handler.go +++ b/services/compliance/http_handler.go @@ -3,9 +3,10 @@ package compliance import ( "context" "fmt" + helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" - metadataClient "github.com/opengovern/opengovernance/pkg/metadata/client" integrationClient "github.com/opengovern/opengovernance/services/integration/client" + metadataClient "github.com/opengovern/opengovernance/services/metadata/client" "github.com/opengovern/opengovernance/services/migrator/db/model" "github.com/sashabaranov/go-openai" v1 "k8s.io/api/batch/v1" @@ -16,9 +17,9 @@ import ( "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" "github.com/opengovern/og-util/pkg/postgres" - "github.com/opengovern/opengovernance/pkg/compliance/db" describeClient "github.com/opengovern/opengovernance/pkg/describe/client" - inventoryClient "github.com/opengovern/opengovernance/pkg/inventory/client" + "github.com/opengovern/opengovernance/services/compliance/db" + inventoryClient "github.com/opengovern/opengovernance/services/inventory/client" "go.uber.org/zap" ) diff --git a/pkg/compliance/http_routes.go b/services/compliance/http_routes.go similarity index 99% rename from pkg/compliance/http_routes.go rename to services/compliance/http_routes.go index 8e3f87ac7..d51ee0856 100644 --- a/pkg/compliance/http_routes.go +++ b/services/compliance/http_routes.go @@ -6,6 +6,15 @@ import ( "encoding/json" "errors" "fmt" + "net/http" + "net/url" + "os" + "regexp" + "sort" + "strconv" + "strings" + "time" + "github.com/aws/aws-sdk-go-v2/aws" "github.com/google/uuid" "github.com/jackc/pgtype" @@ -16,19 +25,19 @@ import ( httpserver2 "github.com/opengovern/og-util/pkg/httpserver" "github.com/opengovern/og-util/pkg/integration" "github.com/opengovern/og-util/pkg/model" - "github.com/opengovern/opengovernance/pkg/compliance/api" - "github.com/opengovern/opengovernance/pkg/compliance/db" - "github.com/opengovern/opengovernance/pkg/compliance/es" - "github.com/opengovern/opengovernance/pkg/compliance/runner" - "github.com/opengovern/opengovernance/pkg/compliance/summarizer/types" model3 "github.com/opengovern/opengovernance/pkg/describe/db/model" - inventoryApi "github.com/opengovern/opengovernance/pkg/inventory/api" - "github.com/opengovern/opengovernance/pkg/metadata/models" opengovernanceTypes "github.com/opengovern/opengovernance/pkg/types" types2 "github.com/opengovern/opengovernance/pkg/types" "github.com/opengovern/opengovernance/pkg/utils" + "github.com/opengovern/opengovernance/services/compliance/api" + "github.com/opengovern/opengovernance/services/compliance/db" + "github.com/opengovern/opengovernance/services/compliance/es" + "github.com/opengovern/opengovernance/services/compliance/runner" + "github.com/opengovern/opengovernance/services/compliance/summarizer/types" integrationapi "github.com/opengovern/opengovernance/services/integration/api/models" - "github.com/opengovern/opengovernance/services/integration/integration-type" + integration_type "github.com/opengovern/opengovernance/services/integration/integration-type" + inventoryApi "github.com/opengovern/opengovernance/services/inventory/api" + "github.com/opengovern/opengovernance/services/metadata/models" model2 "github.com/opengovern/opengovernance/services/migrator/db/model" "github.com/opensearch-project/opensearch-go/v4" "github.com/opensearch-project/opensearch-go/v4/opensearchapi" @@ -40,17 +49,9 @@ import ( "go.uber.org/zap" "gorm.io/gorm" batchv1 "k8s.io/api/batch/v1" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "net/http" - "net/url" - "os" - "regexp" k8sclient "sigs.k8s.io/controller-runtime/pkg/client" - "sort" - "strconv" - "strings" - "time" - corev1 "k8s.io/api/core/v1" ) const ( diff --git a/pkg/compliance/http_routes_test.go b/services/compliance/http_routes_test.go similarity index 98% rename from pkg/compliance/http_routes_test.go rename to services/compliance/http_routes_test.go index caf7fafc3..a01b8184a 100644 --- a/pkg/compliance/http_routes_test.go +++ b/services/compliance/http_routes_test.go @@ -5,12 +5,13 @@ import ( "encoding/json" "errors" "fmt" - "github.com/opengovern/og-util/pkg/httpserver" "io" "net/http/httptest" "testing" "time" + "github.com/opengovern/og-util/pkg/httpserver" + "gorm.io/gorm" idocker "github.com/opengovern/og-util/pkg/dockertest" @@ -18,7 +19,7 @@ import ( "github.com/ory/dockertest/v3" "github.com/labstack/echo/v4" - "github.com/opengovern/opengovernance/pkg/compliance/db" + "github.com/opengovern/opengovernance/services/compliance/db" "github.com/stretchr/testify/suite" "go.uber.org/zap" ) diff --git a/pkg/compliance/runner/command.go b/services/compliance/runner/command.go similarity index 100% rename from pkg/compliance/runner/command.go rename to services/compliance/runner/command.go diff --git a/pkg/compliance/runner/compliance_result.go b/services/compliance/runner/compliance_result.go similarity index 98% rename from pkg/compliance/runner/compliance_result.go rename to services/compliance/runner/compliance_result.go index 85c6d9ffe..ff7670a36 100644 --- a/pkg/compliance/runner/compliance_result.go +++ b/services/compliance/runner/compliance_result.go @@ -2,18 +2,19 @@ package runner import ( "fmt" + "net/http" + "reflect" + "strconv" + "strings" + "github.com/labstack/echo/v4" "github.com/opengovern/og-util/pkg/integration" "github.com/opengovern/og-util/pkg/steampipe" - "github.com/opengovern/opengovernance/pkg/compliance/api" "github.com/opengovern/opengovernance/pkg/types" "github.com/opengovern/opengovernance/pkg/utils" + "github.com/opengovern/opengovernance/services/compliance/api" integration_type "github.com/opengovern/opengovernance/services/integration/integration-type" "go.uber.org/zap" - "net/http" - "reflect" - "strconv" - "strings" ) func GetResourceTypeFromTableName(tableName string, queryIntegrationType []integration.Type) (string, integration.Type, error) { diff --git a/pkg/compliance/runner/const.go b/services/compliance/runner/const.go similarity index 100% rename from pkg/compliance/runner/const.go rename to services/compliance/runner/const.go diff --git a/pkg/compliance/runner/job.go b/services/compliance/runner/job.go similarity index 98% rename from pkg/compliance/runner/job.go rename to services/compliance/runner/job.go index 35f994256..418b151af 100644 --- a/pkg/compliance/runner/job.go +++ b/services/compliance/runner/job.go @@ -5,20 +5,21 @@ import ( "context" "encoding/json" "fmt" - authApi "github.com/opengovern/og-util/pkg/api" - "github.com/opengovern/og-util/pkg/httpclient" - "github.com/opengovern/opengovernance/pkg/compliance/api" - inventoryApi "github.com/opengovern/opengovernance/pkg/inventory/api" "strings" "text/template" "time" + authApi "github.com/opengovern/og-util/pkg/api" + "github.com/opengovern/og-util/pkg/httpclient" + "github.com/opengovern/opengovernance/services/compliance/api" + inventoryApi "github.com/opengovern/opengovernance/services/inventory/api" + "github.com/opengovern/og-util/pkg/es" "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" "github.com/opengovern/og-util/pkg/steampipe" - complianceApi "github.com/opengovern/opengovernance/pkg/compliance/api" - es2 "github.com/opengovern/opengovernance/pkg/compliance/es" "github.com/opengovern/opengovernance/pkg/types" + complianceApi "github.com/opengovern/opengovernance/services/compliance/api" + es2 "github.com/opengovern/opengovernance/services/compliance/es" "go.uber.org/zap" ) diff --git a/pkg/compliance/runner/job_result.go b/services/compliance/runner/job_result.go similarity index 100% rename from pkg/compliance/runner/job_result.go rename to services/compliance/runner/job_result.go diff --git a/pkg/compliance/runner/service.go b/services/compliance/runner/service.go similarity index 95% rename from pkg/compliance/runner/service.go rename to services/compliance/runner/service.go index 8a868843b..9e23307c1 100644 --- a/pkg/compliance/runner/service.go +++ b/services/compliance/runner/service.go @@ -4,10 +4,11 @@ import ( "context" "encoding/json" "fmt" - "github.com/opengovern/og-util/pkg/api" "os" "time" + "github.com/opengovern/og-util/pkg/api" + "github.com/nats-io/nats.go/jetstream" "github.com/opengovern/og-util/pkg/config" esSinkClient "github.com/opengovern/og-util/pkg/es/ingest/client" @@ -16,10 +17,10 @@ import ( "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" "github.com/opengovern/og-util/pkg/source" "github.com/opengovern/og-util/pkg/steampipe" - complianceApi "github.com/opengovern/opengovernance/pkg/compliance/api" - complianceClient "github.com/opengovern/opengovernance/pkg/compliance/client" - inventoryClient "github.com/opengovern/opengovernance/pkg/inventory/client" - metadataClient "github.com/opengovern/opengovernance/pkg/metadata/client" + complianceApi "github.com/opengovern/opengovernance/services/compliance/api" + complianceClient "github.com/opengovern/opengovernance/services/compliance/client" + inventoryClient "github.com/opengovern/opengovernance/services/inventory/client" + metadataClient "github.com/opengovern/opengovernance/services/metadata/client" "go.uber.org/zap" ) diff --git a/pkg/compliance/summarizer/command.go b/services/compliance/summarizer/command.go similarity index 100% rename from pkg/compliance/summarizer/command.go rename to services/compliance/summarizer/command.go diff --git a/pkg/compliance/summarizer/const.go b/services/compliance/summarizer/const.go similarity index 100% rename from pkg/compliance/summarizer/const.go rename to services/compliance/summarizer/const.go diff --git a/pkg/compliance/summarizer/job.go b/services/compliance/summarizer/job.go similarity index 98% rename from pkg/compliance/summarizer/job.go rename to services/compliance/summarizer/job.go index 373a400e1..ca78df4f1 100644 --- a/pkg/compliance/summarizer/job.go +++ b/services/compliance/summarizer/job.go @@ -4,14 +4,15 @@ import ( "context" "encoding/json" "fmt" + "github.com/opengovern/og-util/pkg/api" es2 "github.com/opengovern/og-util/pkg/es" "github.com/opengovern/og-util/pkg/httpclient" "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" - "github.com/opengovern/opengovernance/pkg/compliance/es" - types2 "github.com/opengovern/opengovernance/pkg/compliance/summarizer/types" es3 "github.com/opengovern/opengovernance/pkg/describe/es" "github.com/opengovern/opengovernance/pkg/types" + "github.com/opengovern/opengovernance/services/compliance/es" + types2 "github.com/opengovern/opengovernance/services/compliance/summarizer/types" "go.uber.org/zap" ) diff --git a/pkg/compliance/summarizer/job_result.go b/services/compliance/summarizer/job_result.go similarity index 86% rename from pkg/compliance/summarizer/job_result.go rename to services/compliance/summarizer/job_result.go index b96cf926a..9e9e47a92 100644 --- a/pkg/compliance/summarizer/job_result.go +++ b/services/compliance/summarizer/job_result.go @@ -3,7 +3,7 @@ package summarizer import ( "time" - "github.com/opengovern/opengovernance/pkg/compliance/summarizer/types" + "github.com/opengovern/opengovernance/services/compliance/summarizer/types" ) type ComplianceSummarizerStatus string diff --git a/pkg/compliance/summarizer/service.go b/services/compliance/summarizer/service.go similarity index 96% rename from pkg/compliance/summarizer/service.go rename to services/compliance/summarizer/service.go index ef3993b8c..f0f43f7fc 100644 --- a/pkg/compliance/summarizer/service.go +++ b/services/compliance/summarizer/service.go @@ -13,9 +13,9 @@ import ( esSinkClient "github.com/opengovern/og-util/pkg/es/ingest/client" "github.com/opengovern/og-util/pkg/jq" "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" - "github.com/opengovern/opengovernance/pkg/compliance/summarizer/types" - inventoryClient "github.com/opengovern/opengovernance/pkg/inventory/client" + "github.com/opengovern/opengovernance/services/compliance/summarizer/types" integrationClient "github.com/opengovern/opengovernance/services/integration/client" + inventoryClient "github.com/opengovern/opengovernance/services/inventory/client" "go.uber.org/zap" ) diff --git a/pkg/compliance/summarizer/types/benchmark_summary.go b/services/compliance/summarizer/types/benchmark_summary.go similarity index 100% rename from pkg/compliance/summarizer/types/benchmark_summary.go rename to services/compliance/summarizer/types/benchmark_summary.go diff --git a/pkg/compliance/summarizer/types/job.go b/services/compliance/summarizer/types/job.go similarity index 100% rename from pkg/compliance/summarizer/types/job.go rename to services/compliance/summarizer/types/job.go diff --git a/pkg/compliance/summarizer/types/job_docs.go b/services/compliance/summarizer/types/job_docs.go similarity index 100% rename from pkg/compliance/summarizer/types/job_docs.go rename to services/compliance/summarizer/types/job_docs.go diff --git a/pkg/compliance/utils.go b/services/compliance/utils.go similarity index 98% rename from pkg/compliance/utils.go rename to services/compliance/utils.go index 722bde70c..4a9e72cd4 100644 --- a/pkg/compliance/utils.go +++ b/services/compliance/utils.go @@ -3,14 +3,15 @@ package compliance import ( "context" "fmt" + "regexp" + "time" + "github.com/opengovern/og-util/pkg/model" - "github.com/opengovern/opengovernance/pkg/compliance/api" - "github.com/opengovern/opengovernance/pkg/compliance/es" opengovernanceTypes "github.com/opengovern/opengovernance/pkg/types" + "github.com/opengovern/opengovernance/services/compliance/api" + "github.com/opengovern/opengovernance/services/compliance/es" integration_type "github.com/opengovern/opengovernance/services/integration/integration-type" "go.uber.org/zap" - "regexp" - "time" ) func (h *HttpHandler) getBenchmarkTree(ctx context.Context, benchmarkId string) (*api.NestedBenchmark, error) { diff --git a/services/demo-importer/cmd.go b/services/demo-importer/cmd.go index 80c443213..7d0a298ce 100644 --- a/services/demo-importer/cmd.go +++ b/services/demo-importer/cmd.go @@ -4,22 +4,23 @@ import ( "context" "crypto/tls" "fmt" + "net/http" + "os" + "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/config" "github.com/opengovern/og-util/pkg/httpclient" "github.com/opengovern/og-util/pkg/postgres" - "github.com/opengovern/opengovernance/pkg/metadata/client" - "github.com/opengovern/opengovernance/pkg/metadata/models" db2 "github.com/opengovern/opengovernance/services/demo-importer/db" "github.com/opengovern/opengovernance/services/demo-importer/fetch" "github.com/opengovern/opengovernance/services/demo-importer/types" "github.com/opengovern/opengovernance/services/demo-importer/worker" + "github.com/opengovern/opengovernance/services/metadata/client" + "github.com/opengovern/opengovernance/services/metadata/models" "github.com/opensearch-project/opensearch-go/v4" "github.com/opensearch-project/opensearch-go/v4/opensearchapi" "github.com/spf13/cobra" "go.uber.org/zap" - "net/http" - "os" ) func Command() *cobra.Command { diff --git a/services/integration/cmd.go b/services/integration/cmd.go index 41af0c1ed..2f40a33c0 100644 --- a/services/integration/cmd.go +++ b/services/integration/cmd.go @@ -3,6 +3,7 @@ package integration import ( "errors" "fmt" + api3 "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/httpclient" "github.com/opengovern/og-util/pkg/httpserver" @@ -10,10 +11,10 @@ import ( "github.com/opengovern/og-util/pkg/postgres" "github.com/opengovern/og-util/pkg/steampipe" "github.com/opengovern/og-util/pkg/vault" - metadata "github.com/opengovern/opengovernance/pkg/metadata/client" "github.com/opengovern/opengovernance/services/integration/api" "github.com/opengovern/opengovernance/services/integration/config" "github.com/opengovern/opengovernance/services/integration/db" + metadata "github.com/opengovern/opengovernance/services/metadata/client" "github.com/spf13/cobra" "go.uber.org/zap" ) diff --git a/pkg/inventory/api/cost.go b/services/inventory/api/cost.go similarity index 100% rename from pkg/inventory/api/cost.go rename to services/inventory/api/cost.go diff --git a/pkg/inventory/api/dto.go b/services/inventory/api/dto.go similarity index 100% rename from pkg/inventory/api/dto.go rename to services/inventory/api/dto.go diff --git a/pkg/inventory/api/elastic.go b/services/inventory/api/elastic.go similarity index 100% rename from pkg/inventory/api/elastic.go rename to services/inventory/api/elastic.go diff --git a/pkg/inventory/api/metric.go b/services/inventory/api/metric.go similarity index 100% rename from pkg/inventory/api/metric.go rename to services/inventory/api/metric.go diff --git a/pkg/inventory/api/query.go b/services/inventory/api/query.go similarity index 100% rename from pkg/inventory/api/query.go rename to services/inventory/api/query.go diff --git a/pkg/inventory/api/resource_collection.go b/services/inventory/api/resource_collection.go similarity index 100% rename from pkg/inventory/api/resource_collection.go rename to services/inventory/api/resource_collection.go diff --git a/pkg/inventory/api/resource_type.go b/services/inventory/api/resource_type.go similarity index 100% rename from pkg/inventory/api/resource_type.go rename to services/inventory/api/resource_type.go diff --git a/pkg/inventory/client/inventory.go b/services/inventory/client/inventory.go similarity index 99% rename from pkg/inventory/client/inventory.go rename to services/inventory/client/inventory.go index 7d3042781..c3d6a6b3f 100644 --- a/pkg/inventory/client/inventory.go +++ b/services/inventory/client/inventory.go @@ -3,16 +3,17 @@ package client import ( "encoding/json" "fmt" - "github.com/opengovern/og-util/pkg/httpclient" - "github.com/opengovern/og-util/pkg/integration" "net/http" "net/url" "strconv" "time" + "github.com/opengovern/og-util/pkg/httpclient" + "github.com/opengovern/og-util/pkg/integration" + "github.com/labstack/echo/v4" analyticsDB "github.com/opengovern/opengovernance/pkg/analytics/db" - "github.com/opengovern/opengovernance/pkg/inventory/api" + "github.com/opengovern/opengovernance/services/inventory/api" ) type InventoryServiceClient interface { diff --git a/pkg/inventory/command.go b/services/inventory/command.go similarity index 96% rename from pkg/inventory/command.go rename to services/inventory/command.go index 48d20950a..4b82763b8 100644 --- a/pkg/inventory/command.go +++ b/services/inventory/command.go @@ -3,11 +3,12 @@ package inventory import ( "context" "fmt" - "github.com/opengovern/og-util/pkg/httpserver" "os" + "github.com/opengovern/og-util/pkg/httpserver" + "github.com/opengovern/og-util/pkg/config" - config3 "github.com/opengovern/opengovernance/pkg/inventory/config" + config3 "github.com/opengovern/opengovernance/services/inventory/config" "github.com/spf13/cobra" "go.uber.org/zap" ) diff --git a/pkg/inventory/config/service.go b/services/inventory/config/service.go similarity index 100% rename from pkg/inventory/config/service.go rename to services/inventory/config/service.go diff --git a/pkg/inventory/db.go b/services/inventory/db.go similarity index 100% rename from pkg/inventory/db.go rename to services/inventory/db.go diff --git a/pkg/inventory/es/analytics_spend_summary.go b/services/inventory/es/analytics_spend_summary.go similarity index 99% rename from pkg/inventory/es/analytics_spend_summary.go rename to services/inventory/es/analytics_spend_summary.go index af7e0fe60..e12c50ccd 100644 --- a/pkg/inventory/es/analytics_spend_summary.go +++ b/services/inventory/es/analytics_spend_summary.go @@ -5,13 +5,14 @@ import ( "encoding/json" "errors" "fmt" - "github.com/opengovern/og-util/pkg/integration" "strconv" "time" + "github.com/opengovern/og-util/pkg/integration" + "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" "github.com/opengovern/opengovernance/pkg/analytics/es/spend" - inventoryAPI "github.com/opengovern/opengovernance/pkg/inventory/api" + inventoryAPI "github.com/opengovern/opengovernance/services/inventory/api" "go.uber.org/zap" ) diff --git a/pkg/inventory/es/analytics_summary.go b/services/inventory/es/analytics_summary.go similarity index 99% rename from pkg/inventory/es/analytics_summary.go rename to services/inventory/es/analytics_summary.go index c5d1d4105..e1b85fd85 100644 --- a/pkg/inventory/es/analytics_summary.go +++ b/services/inventory/es/analytics_summary.go @@ -5,14 +5,15 @@ import ( "encoding/json" "errors" "fmt" - "github.com/opengovern/og-util/pkg/integration" - "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" "math" "strconv" "time" + "github.com/opengovern/og-util/pkg/integration" + "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" + "github.com/opengovern/opengovernance/pkg/analytics/es/resource" - inventoryApi "github.com/opengovern/opengovernance/pkg/inventory/api" + inventoryApi "github.com/opengovern/opengovernance/services/inventory/api" "go.uber.org/zap" ) diff --git a/pkg/inventory/es/lookup.go b/services/inventory/es/lookup.go similarity index 100% rename from pkg/inventory/es/lookup.go rename to services/inventory/es/lookup.go diff --git a/pkg/inventory/es/queryrun_result.go b/services/inventory/es/queryrun_result.go similarity index 96% rename from pkg/inventory/es/queryrun_result.go rename to services/inventory/es/queryrun_result.go index 88075db91..54abbcf2c 100644 --- a/pkg/inventory/es/queryrun_result.go +++ b/services/inventory/es/queryrun_result.go @@ -2,9 +2,10 @@ package es import ( "encoding/json" + "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" - "github.com/opengovern/opengovernance/pkg/inventory/api" "github.com/opengovern/opengovernance/pkg/types" + "github.com/opengovern/opengovernance/services/inventory/api" "go.uber.org/zap" "golang.org/x/net/context" ) diff --git a/pkg/inventory/http_handler.go b/services/inventory/http_handler.go similarity index 94% rename from pkg/inventory/http_handler.go rename to services/inventory/http_handler.go index 686d94a0a..f432ea786 100644 --- a/pkg/inventory/http_handler.go +++ b/services/inventory/http_handler.go @@ -2,15 +2,16 @@ package inventory import ( "fmt" + "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" - metadataClient "github.com/opengovern/opengovernance/pkg/metadata/client" integrationClient "github.com/opengovern/opengovernance/services/integration/client" + metadataClient "github.com/opengovern/opengovernance/services/metadata/client" "github.com/opengovern/og-util/pkg/config" "github.com/opengovern/og-util/pkg/postgres" "github.com/opengovern/og-util/pkg/steampipe" - complianceClient "github.com/opengovern/opengovernance/pkg/compliance/client" describeClient "github.com/opengovern/opengovernance/pkg/describe/client" + complianceClient "github.com/opengovern/opengovernance/services/compliance/client" "go.uber.org/zap" ) diff --git a/pkg/inventory/http_routes.go b/services/inventory/http_routes.go similarity index 99% rename from pkg/inventory/http_routes.go rename to services/inventory/http_routes.go index d621364ba..9a0ac67d8 100644 --- a/pkg/inventory/http_routes.go +++ b/services/inventory/http_routes.go @@ -6,15 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/opengovern/og-util/pkg/api" - "github.com/opengovern/og-util/pkg/httpclient" - "github.com/opengovern/og-util/pkg/httpserver" - "github.com/opengovern/og-util/pkg/integration" - queryrunner "github.com/opengovern/opengovernance/pkg/inventory/query-runner" - "github.com/opengovern/opengovernance/pkg/inventory/rego_runner" - "github.com/opengovern/opengovernance/pkg/types" - integration_type "github.com/opengovern/opengovernance/services/integration/integration-type" - "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "math" "net/http" "regexp" @@ -24,6 +15,16 @@ import ( "text/template" "time" + "github.com/opengovern/og-util/pkg/api" + "github.com/opengovern/og-util/pkg/httpclient" + "github.com/opengovern/og-util/pkg/httpserver" + "github.com/opengovern/og-util/pkg/integration" + "github.com/opengovern/opengovernance/pkg/types" + integration_type "github.com/opengovern/opengovernance/services/integration/integration-type" + queryrunner "github.com/opengovern/opengovernance/services/inventory/query-runner" + "github.com/opengovern/opengovernance/services/inventory/rego_runner" + "github.com/turbot/steampipe-plugin-sdk/v5/plugin" + "github.com/labstack/echo/v4" "github.com/open-policy-agent/opa/rego" "github.com/opengovern/og-util/pkg/describe" @@ -32,10 +33,10 @@ import ( "github.com/opengovern/og-util/pkg/source" "github.com/opengovern/og-util/pkg/steampipe" analyticsDB "github.com/opengovern/opengovernance/pkg/analytics/db" - inventoryApi "github.com/opengovern/opengovernance/pkg/inventory/api" - "github.com/opengovern/opengovernance/pkg/inventory/es" "github.com/opengovern/opengovernance/pkg/utils" integrationApi "github.com/opengovern/opengovernance/services/integration/api/models" + inventoryApi "github.com/opengovern/opengovernance/services/inventory/api" + "github.com/opengovern/opengovernance/services/inventory/es" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" diff --git a/pkg/inventory/internal/downsampler.go b/services/inventory/internal/downsampler.go similarity index 97% rename from pkg/inventory/internal/downsampler.go rename to services/inventory/internal/downsampler.go index d3cf8b670..8a10ef753 100644 --- a/pkg/inventory/internal/downsampler.go +++ b/services/inventory/internal/downsampler.go @@ -4,7 +4,7 @@ import ( "time" "github.com/haoel/downsampling/core" - "github.com/opengovern/opengovernance/pkg/inventory/api" + "github.com/opengovern/opengovernance/services/inventory/api" ) func resourceTypeTrendDataPointsToPoints(trendDataPoints []api.ResourceTypeTrendDatapoint) []core.Point { diff --git a/pkg/inventory/models.go b/services/inventory/models.go similarity index 99% rename from pkg/inventory/models.go rename to services/inventory/models.go index d005bde7a..f8f22eb43 100644 --- a/pkg/inventory/models.go +++ b/services/inventory/models.go @@ -1,14 +1,15 @@ package inventory import ( - "github.com/opengovern/og-util/pkg/integration" "time" + "github.com/opengovern/og-util/pkg/integration" + "github.com/jackc/pgtype" "github.com/lib/pq" "github.com/opengovern/og-util/pkg/model" "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" - "github.com/opengovern/opengovernance/pkg/inventory/api" + "github.com/opengovern/opengovernance/services/inventory/api" "gorm.io/gorm" ) diff --git a/pkg/inventory/query-runner/command.go b/services/inventory/query-runner/command.go similarity index 100% rename from pkg/inventory/query-runner/command.go rename to services/inventory/query-runner/command.go diff --git a/pkg/inventory/query-runner/const.go b/services/inventory/query-runner/const.go similarity index 100% rename from pkg/inventory/query-runner/const.go rename to services/inventory/query-runner/const.go diff --git a/pkg/inventory/query-runner/job.go b/services/inventory/query-runner/job.go similarity index 96% rename from pkg/inventory/query-runner/job.go rename to services/inventory/query-runner/job.go index 17839736f..add380092 100644 --- a/pkg/inventory/query-runner/job.go +++ b/services/inventory/query-runner/job.go @@ -3,14 +3,15 @@ package query_runner import ( "context" "fmt" + "strconv" + "time" + authApi "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/es" "github.com/opengovern/og-util/pkg/httpclient" - "github.com/opengovern/opengovernance/pkg/inventory/api" "github.com/opengovern/opengovernance/pkg/types" + "github.com/opengovern/opengovernance/services/inventory/api" "go.uber.org/zap" - "strconv" - "time" ) type Job struct { diff --git a/pkg/inventory/query-runner/job_result.go b/services/inventory/query-runner/job_result.go similarity index 100% rename from pkg/inventory/query-runner/job_result.go rename to services/inventory/query-runner/job_result.go diff --git a/pkg/inventory/query-runner/service.go b/services/inventory/query-runner/service.go similarity index 95% rename from pkg/inventory/query-runner/service.go rename to services/inventory/query-runner/service.go index 27862ce64..b999004e8 100644 --- a/pkg/inventory/query-runner/service.go +++ b/services/inventory/query-runner/service.go @@ -4,6 +4,9 @@ import ( "context" "encoding/json" "fmt" + "strconv" + "time" + "github.com/nats-io/nats.go/jetstream" "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/config" @@ -13,13 +16,11 @@ import ( "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" "github.com/opengovern/og-util/pkg/source" "github.com/opengovern/og-util/pkg/steampipe" - complianceApi "github.com/opengovern/opengovernance/pkg/compliance/api" - complianceClient "github.com/opengovern/opengovernance/pkg/compliance/client" - inventoryClient "github.com/opengovern/opengovernance/pkg/inventory/client" - metadataClient "github.com/opengovern/opengovernance/pkg/metadata/client" + complianceApi "github.com/opengovern/opengovernance/services/compliance/api" + complianceClient "github.com/opengovern/opengovernance/services/compliance/client" + inventoryClient "github.com/opengovern/opengovernance/services/inventory/client" + metadataClient "github.com/opengovern/opengovernance/services/metadata/client" "go.uber.org/zap" - "strconv" - "time" ) type Config struct { diff --git a/pkg/inventory/query-runner/sql_runner.go b/services/inventory/query-runner/sql_runner.go similarity index 92% rename from pkg/inventory/query-runner/sql_runner.go rename to services/inventory/query-runner/sql_runner.go index 04e42c847..e30389bbb 100644 --- a/pkg/inventory/query-runner/sql_runner.go +++ b/services/inventory/query-runner/sql_runner.go @@ -2,12 +2,13 @@ package query_runner import ( "context" + "net/http" + "time" + "github.com/labstack/echo/v4" "github.com/opengovern/og-util/pkg/steampipe" - inventoryApi "github.com/opengovern/opengovernance/pkg/inventory/api" + inventoryApi "github.com/opengovern/opengovernance/services/inventory/api" "go.uber.org/zap" - "net/http" - "time" ) func (w *Worker) RunSQLNamedQuery(ctx context.Context, query string) (*QueryResult, error) { diff --git a/pkg/inventory/query-runner/types.go b/services/inventory/query-runner/types.go similarity index 100% rename from pkg/inventory/query-runner/types.go rename to services/inventory/query-runner/types.go diff --git a/pkg/inventory/rego_runner/resource.go b/services/inventory/rego_runner/resource.go similarity index 100% rename from pkg/inventory/rego_runner/resource.go rename to services/inventory/rego_runner/resource.go diff --git a/pkg/inventory/resource_type_category.go b/services/inventory/resource_type_category.go similarity index 100% rename from pkg/inventory/resource_type_category.go rename to services/inventory/resource_type_category.go diff --git a/pkg/metadata/api/metadata.go b/services/metadata/api/metadata.go similarity index 95% rename from pkg/metadata/api/metadata.go rename to services/metadata/api/metadata.go index fac72c045..ad0bbf0e8 100644 --- a/pkg/metadata/api/metadata.go +++ b/services/metadata/api/metadata.go @@ -3,7 +3,7 @@ package api import ( "time" - authApi "github.com/opengovern/opengovernance/pkg/auth/api" + authApi "github.com/opengovern/opengovernance/services/auth/api" api "github.com/opengovern/opengovernance/services/integration/api/models" "github.com/opengovern/opengovernance/services/migrator/db/model" ) diff --git a/pkg/metadata/api/query_parameter.go b/services/metadata/api/query_parameter.go similarity index 100% rename from pkg/metadata/api/query_parameter.go rename to services/metadata/api/query_parameter.go diff --git a/pkg/metadata/api/views.go b/services/metadata/api/views.go similarity index 100% rename from pkg/metadata/api/views.go rename to services/metadata/api/views.go diff --git a/pkg/metadata/client/metadata.go b/services/metadata/client/metadata.go similarity index 97% rename from pkg/metadata/client/metadata.go rename to services/metadata/client/metadata.go index 6d100eed8..33267103c 100644 --- a/pkg/metadata/client/metadata.go +++ b/services/metadata/client/metadata.go @@ -4,13 +4,14 @@ import ( "encoding/json" "errors" "fmt" - "github.com/labstack/echo/v4" - "github.com/opengovern/og-util/pkg/httpclient" - "github.com/opengovern/opengovernance/pkg/metadata/api" "net/http" "strconv" - "github.com/opengovern/opengovernance/pkg/metadata/models" + "github.com/labstack/echo/v4" + "github.com/opengovern/og-util/pkg/httpclient" + "github.com/opengovern/opengovernance/services/metadata/api" + + "github.com/opengovern/opengovernance/services/metadata/models" ) var ErrConfigNotFound = errors.New("config not found") diff --git a/pkg/metadata/command.go b/services/metadata/command.go similarity index 96% rename from pkg/metadata/command.go rename to services/metadata/command.go index 9d2a7f62d..a814e18ba 100644 --- a/pkg/metadata/command.go +++ b/services/metadata/command.go @@ -3,15 +3,16 @@ package metadata import ( "context" "fmt" + "strings" + dexApi "github.com/dexidp/dex/api/v2" "github.com/opengovern/og-util/pkg/httpserver" "github.com/opengovern/og-util/pkg/koanf" "github.com/opengovern/og-util/pkg/vault" - "github.com/opengovern/opengovernance/pkg/metadata/config" - vault2 "github.com/opengovern/opengovernance/pkg/metadata/vault" + "github.com/opengovern/opengovernance/services/metadata/config" + vault2 "github.com/opengovern/opengovernance/services/metadata/vault" "github.com/spf13/cobra" "go.uber.org/zap" - "strings" ) func Command() *cobra.Command { diff --git a/pkg/metadata/config/model.go b/services/metadata/config/model.go similarity index 100% rename from pkg/metadata/config/model.go rename to services/metadata/config/model.go diff --git a/pkg/metadata/errors/errors.go b/services/metadata/errors/errors.go similarity index 100% rename from pkg/metadata/errors/errors.go rename to services/metadata/errors/errors.go diff --git a/pkg/metadata/http_handler.go b/services/metadata/http_handler.go similarity index 96% rename from pkg/metadata/http_handler.go rename to services/metadata/http_handler.go index c4dd301c7..c463a3e69 100644 --- a/pkg/metadata/http_handler.go +++ b/services/metadata/http_handler.go @@ -4,14 +4,17 @@ import ( "context" "crypto/rand" "fmt" + "strings" + "time" + dexApi "github.com/dexidp/dex/api/v2" helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" api6 "github.com/hashicorp/vault/api" "github.com/opengovern/og-util/pkg/postgres" "github.com/opengovern/og-util/pkg/vault" - "github.com/opengovern/opengovernance/pkg/metadata/config" - "github.com/opengovern/opengovernance/pkg/metadata/internal/database" - "github.com/opengovern/opengovernance/pkg/metadata/models" + "github.com/opengovern/opengovernance/services/metadata/config" + "github.com/opengovern/opengovernance/services/metadata/internal/database" + "github.com/opengovern/opengovernance/services/metadata/models" db2 "github.com/opengovern/opengovernance/services/migrator/db" "github.com/opengovern/opengovernance/services/migrator/db/model" "go.uber.org/zap" @@ -20,8 +23,6 @@ import ( "k8s.io/apimachinery/pkg/runtime" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - "strings" - "time" ) type HttpHandler struct { diff --git a/pkg/metadata/http_routes.go b/services/metadata/http_routes.go similarity index 98% rename from pkg/metadata/http_routes.go rename to services/metadata/http_routes.go index 65c85be75..c8934c097 100644 --- a/pkg/metadata/http_routes.go +++ b/services/metadata/http_routes.go @@ -5,19 +5,25 @@ import ( "encoding/json" "errors" "fmt" + "net/http" + "net/url" + "strconv" + "strings" + "time" + "github.com/aws/aws-sdk-go-v2/aws" dexApi "github.com/dexidp/dex/api/v2" "github.com/jackc/pgtype" api3 "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/httpclient" "github.com/opengovern/og-util/pkg/httpserver" - client4 "github.com/opengovern/opengovernance/pkg/compliance/client" client3 "github.com/opengovern/opengovernance/pkg/describe/client" - inventoryApi "github.com/opengovern/opengovernance/pkg/inventory/api" - client2 "github.com/opengovern/opengovernance/pkg/inventory/client" + client4 "github.com/opengovern/opengovernance/services/compliance/client" model2 "github.com/opengovern/opengovernance/services/demo-importer/db/model" integrationApi "github.com/opengovern/opengovernance/services/integration/api/models" integrationClient "github.com/opengovern/opengovernance/services/integration/client" + inventoryApi "github.com/opengovern/opengovernance/services/inventory/api" + client2 "github.com/opengovern/opengovernance/services/inventory/client" "github.com/opengovern/opengovernance/services/migrator/db/model" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" @@ -30,17 +36,12 @@ import ( batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "net/http" - "net/url" k8sclient "sigs.k8s.io/controller-runtime/pkg/client" - "strconv" - "strings" - "time" "github.com/labstack/echo/v4" - "github.com/opengovern/opengovernance/pkg/metadata/api" - "github.com/opengovern/opengovernance/pkg/metadata/internal/src" - "github.com/opengovern/opengovernance/pkg/metadata/models" + "github.com/opengovern/opengovernance/services/metadata/api" + "github.com/opengovern/opengovernance/services/metadata/internal/src" + "github.com/opengovern/opengovernance/services/metadata/models" ) func (h HttpHandler) Register(r *echo.Echo) { diff --git a/pkg/metadata/http_routes_test.go b/services/metadata/http_routes_test.go similarity index 95% rename from pkg/metadata/http_routes_test.go rename to services/metadata/http_routes_test.go index de6f2fc8c..3e559b824 100644 --- a/pkg/metadata/http_routes_test.go +++ b/services/metadata/http_routes_test.go @@ -4,8 +4,6 @@ import ( "bytes" "encoding/json" "fmt" - api2 "github.com/opengovern/og-util/pkg/api" - "github.com/opengovern/og-util/pkg/httpserver" "io" "io/ioutil" "net/http" @@ -13,12 +11,15 @@ import ( "testing" "time" + api2 "github.com/opengovern/og-util/pkg/api" + "github.com/opengovern/og-util/pkg/httpserver" + idocker "github.com/opengovern/og-util/pkg/dockertest" "github.com/opengovern/og-util/pkg/postgres" - "github.com/opengovern/opengovernance/pkg/metadata/api" - "github.com/opengovern/opengovernance/pkg/metadata/internal/database" - "github.com/opengovern/opengovernance/pkg/metadata/models" + "github.com/opengovern/opengovernance/services/metadata/api" + "github.com/opengovern/opengovernance/services/metadata/internal/database" + "github.com/opengovern/opengovernance/services/metadata/models" "go.uber.org/zap" "github.com/labstack/echo/v4" diff --git a/pkg/metadata/internal/database/config_metadata.go b/services/metadata/internal/database/config_metadata.go similarity index 92% rename from pkg/metadata/internal/database/config_metadata.go rename to services/metadata/internal/database/config_metadata.go index c9fed1476..613d5bb62 100644 --- a/pkg/metadata/internal/database/config_metadata.go +++ b/services/metadata/internal/database/config_metadata.go @@ -1,7 +1,7 @@ package database import ( - "github.com/opengovern/opengovernance/pkg/metadata/models" + "github.com/opengovern/opengovernance/services/metadata/models" "gorm.io/gorm/clause" ) diff --git a/pkg/metadata/internal/database/db.go b/services/metadata/internal/database/db.go similarity index 85% rename from pkg/metadata/internal/database/db.go rename to services/metadata/internal/database/db.go index f6d2106ee..16e723a1a 100644 --- a/pkg/metadata/internal/database/db.go +++ b/services/metadata/internal/database/db.go @@ -1,7 +1,7 @@ package database import ( - "github.com/opengovern/opengovernance/pkg/metadata/models" + "github.com/opengovern/opengovernance/services/metadata/models" "gorm.io/gorm" ) diff --git a/pkg/metadata/internal/database/filter.go b/services/metadata/internal/database/filter.go similarity index 84% rename from pkg/metadata/internal/database/filter.go rename to services/metadata/internal/database/filter.go index 587b9ffcf..c81f14861 100644 --- a/pkg/metadata/internal/database/filter.go +++ b/services/metadata/internal/database/filter.go @@ -1,7 +1,7 @@ package database import ( - "github.com/opengovern/opengovernance/pkg/metadata/models" + "github.com/opengovern/opengovernance/services/metadata/models" ) func (db Database) AddFilter(filter models.Filter) error { diff --git a/pkg/metadata/internal/database/platform_config.go b/services/metadata/internal/database/platform_config.go similarity index 92% rename from pkg/metadata/internal/database/platform_config.go rename to services/metadata/internal/database/platform_config.go index 2f1960c6c..a16cb101a 100644 --- a/pkg/metadata/internal/database/platform_config.go +++ b/services/metadata/internal/database/platform_config.go @@ -1,7 +1,7 @@ package database import ( - "github.com/opengovern/opengovernance/pkg/metadata/models" + "github.com/opengovern/opengovernance/services/metadata/models" ) func (db Database) ListApp() ([]models.PlatformConfiguration, error) { diff --git a/pkg/metadata/internal/database/query_parameter.go b/services/metadata/internal/database/query_parameter.go similarity index 95% rename from pkg/metadata/internal/database/query_parameter.go rename to services/metadata/internal/database/query_parameter.go index a6d585938..6a1dbae71 100644 --- a/pkg/metadata/internal/database/query_parameter.go +++ b/services/metadata/internal/database/query_parameter.go @@ -2,7 +2,8 @@ package database import ( "errors" - "github.com/opengovern/opengovernance/pkg/metadata/models" + + "github.com/opengovern/opengovernance/services/metadata/models" "gorm.io/gorm" "gorm.io/gorm/clause" ) diff --git a/pkg/metadata/internal/src/metadata.go b/services/metadata/internal/src/metadata.go similarity index 90% rename from pkg/metadata/internal/src/metadata.go rename to services/metadata/internal/src/metadata.go index 5e0671e29..cff507f4b 100644 --- a/pkg/metadata/internal/src/metadata.go +++ b/services/metadata/internal/src/metadata.go @@ -1,8 +1,8 @@ package src import ( - "github.com/opengovern/opengovernance/pkg/metadata/internal/database" - "github.com/opengovern/opengovernance/pkg/metadata/models" + "github.com/opengovern/opengovernance/services/metadata/internal/database" + "github.com/opengovern/opengovernance/services/metadata/models" ) const ( diff --git a/pkg/metadata/models/config_metadata.go b/services/metadata/models/config_metadata.go similarity index 100% rename from pkg/metadata/models/config_metadata.go rename to services/metadata/models/config_metadata.go diff --git a/pkg/metadata/models/config_metadata_keys.go b/services/metadata/models/config_metadata_keys.go similarity index 99% rename from pkg/metadata/models/config_metadata_keys.go rename to services/metadata/models/config_metadata_keys.go index e8b72e91d..086046bb7 100644 --- a/pkg/metadata/models/config_metadata_keys.go +++ b/services/metadata/models/config_metadata_keys.go @@ -1,10 +1,11 @@ package models import ( - "github.com/opengovern/og-util/pkg/api" "strings" - "github.com/opengovern/opengovernance/pkg/metadata/errors" + "github.com/opengovern/og-util/pkg/api" + + "github.com/opengovern/opengovernance/services/metadata/errors" ) type ConfigMetadataType string diff --git a/pkg/metadata/models/filter.go b/services/metadata/models/filter.go similarity index 100% rename from pkg/metadata/models/filter.go rename to services/metadata/models/filter.go diff --git a/pkg/metadata/models/parse.go b/services/metadata/models/parse.go similarity index 96% rename from pkg/metadata/models/parse.go rename to services/metadata/models/parse.go index bed520aaf..23dda235b 100644 --- a/pkg/metadata/models/parse.go +++ b/services/metadata/models/parse.go @@ -4,7 +4,7 @@ import ( "encoding/json" "strconv" - metadataErrors "github.com/opengovern/opengovernance/pkg/metadata/errors" + metadataErrors "github.com/opengovern/opengovernance/services/metadata/errors" ) func (t ConfigMetadataType) SerializeValue(value any) (string, error) { diff --git a/pkg/metadata/models/platform_config.go b/services/metadata/models/platform_config.go similarity index 100% rename from pkg/metadata/models/platform_config.go rename to services/metadata/models/platform_config.go diff --git a/pkg/metadata/models/query_parameter.go b/services/metadata/models/query_parameter.go similarity index 88% rename from pkg/metadata/models/query_parameter.go rename to services/metadata/models/query_parameter.go index f3d2e2cdf..21ca2165a 100644 --- a/pkg/metadata/models/query_parameter.go +++ b/services/metadata/models/query_parameter.go @@ -1,6 +1,6 @@ package models -import "github.com/opengovern/opengovernance/pkg/metadata/api" +import "github.com/opengovern/opengovernance/services/metadata/api" type QueryParameter struct { Key string `gorm:"primaryKey"` diff --git a/pkg/metadata/models/query_parameter_keys.go b/services/metadata/models/query_parameter_keys.go similarity index 95% rename from pkg/metadata/models/query_parameter_keys.go rename to services/metadata/models/query_parameter_keys.go index 4416f5004..2d3b29270 100644 --- a/pkg/metadata/models/query_parameter_keys.go +++ b/services/metadata/models/query_parameter_keys.go @@ -1,8 +1,9 @@ package models import ( - "github.com/opengovern/opengovernance/pkg/metadata/errors" "strings" + + "github.com/opengovern/opengovernance/services/metadata/errors" ) type QueryParameterKey string diff --git a/pkg/metadata/models/query_view.go b/services/metadata/models/query_view.go similarity index 100% rename from pkg/metadata/models/query_view.go rename to services/metadata/models/query_view.go diff --git a/pkg/metadata/vault/seal.go b/services/metadata/vault/seal.go similarity index 98% rename from pkg/metadata/vault/seal.go rename to services/metadata/vault/seal.go index 8a9e504be..454169c75 100644 --- a/pkg/metadata/vault/seal.go +++ b/services/metadata/vault/seal.go @@ -3,15 +3,16 @@ package vault import ( "context" "fmt" + "time" + "github.com/opengovern/og-util/pkg/vault" - "github.com/opengovern/opengovernance/pkg/metadata/config" + "github.com/opengovern/opengovernance/services/metadata/config" "go.uber.org/zap" corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" - "time" ) type SealHandler struct { diff --git a/services/migrator/job/git.go b/services/migrator/job/git.go index 0285867ad..111e6490e 100644 --- a/services/migrator/job/git.go +++ b/services/migrator/job/git.go @@ -12,8 +12,8 @@ import ( "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/httpclient" - "github.com/opengovern/opengovernance/pkg/metadata/client" - "github.com/opengovern/opengovernance/pkg/metadata/models" + "github.com/opengovern/opengovernance/services/metadata/client" + "github.com/opengovern/opengovernance/services/metadata/models" "github.com/opengovern/opengovernance/services/migrator/config" "go.uber.org/zap" ) diff --git a/services/migrator/job/migrations/analytics/populate.go b/services/migrator/job/migrations/analytics/populate.go index d0bf2cbfc..10e14c80a 100644 --- a/services/migrator/job/migrations/analytics/populate.go +++ b/services/migrator/job/migrations/analytics/populate.go @@ -4,21 +4,22 @@ import ( "context" "errors" "fmt" + "io/fs" + "os" + "path/filepath" + "regexp" + "strings" + "github.com/goccy/go-yaml" "github.com/opengovern/og-util/pkg/model" "github.com/opengovern/og-util/pkg/postgres" analyticsDB "github.com/opengovern/opengovernance/pkg/analytics/db" - "github.com/opengovern/opengovernance/pkg/inventory" - "github.com/opengovern/opengovernance/pkg/metadata/models" + "github.com/opengovern/opengovernance/services/inventory" + "github.com/opengovern/opengovernance/services/metadata/models" "github.com/opengovern/opengovernance/services/migrator/config" "go.uber.org/zap" "gorm.io/gorm" "gorm.io/gorm/clause" - "io/fs" - "os" - "path/filepath" - "regexp" - "strings" ) var QueryParameters []models.QueryParameter diff --git a/services/migrator/job/migrations/auth/create_user.go b/services/migrator/job/migrations/auth/create_user.go index 69e708886..ff044e971 100644 --- a/services/migrator/job/migrations/auth/create_user.go +++ b/services/migrator/job/migrations/auth/create_user.go @@ -7,7 +7,7 @@ import ( dexApi "github.com/dexidp/dex/api/v2" "github.com/opengovern/og-util/pkg/api" "github.com/opengovern/og-util/pkg/postgres" - "github.com/opengovern/opengovernance/pkg/auth/db" + "github.com/opengovern/opengovernance/services/auth/db" "github.com/opengovern/opengovernance/services/migrator/config" "go.uber.org/zap" "golang.org/x/crypto/bcrypt" diff --git a/services/migrator/job/migrations/compliance/benchmark_metadata.go b/services/migrator/job/migrations/compliance/benchmark_metadata.go index 76adabaad..fc67d35c6 100644 --- a/services/migrator/job/migrations/compliance/benchmark_metadata.go +++ b/services/migrator/job/migrations/compliance/benchmark_metadata.go @@ -1,7 +1,7 @@ package compliance import ( - "github.com/opengovern/opengovernance/pkg/compliance/db" + "github.com/opengovern/opengovernance/services/compliance/db" ) type BenchmarkControlsCache struct { diff --git a/services/migrator/job/migrations/compliance/git_parser.go b/services/migrator/job/migrations/compliance/git_parser.go index ffe42eacf..4d9ff4e56 100644 --- a/services/migrator/job/migrations/compliance/git_parser.go +++ b/services/migrator/job/migrations/compliance/git_parser.go @@ -3,19 +3,20 @@ package compliance import ( "encoding/json" "fmt" + "io/fs" + "os" + "path" + "path/filepath" + "strings" + "github.com/goccy/go-yaml" "github.com/jackc/pgtype" "github.com/opengovern/og-util/pkg/model" - "github.com/opengovern/opengovernance/pkg/compliance/db" - "github.com/opengovern/opengovernance/pkg/metadata/models" "github.com/opengovern/opengovernance/pkg/types" + "github.com/opengovern/opengovernance/services/compliance/db" + "github.com/opengovern/opengovernance/services/metadata/models" "github.com/opengovern/opengovernance/services/migrator/job/git" "go.uber.org/zap" - "io/fs" - "os" - "path" - "path/filepath" - "strings" ) type GitParser struct { diff --git a/services/migrator/job/migrations/compliance/populate.go b/services/migrator/job/migrations/compliance/populate.go index e2b3f8af4..bdbd2d008 100644 --- a/services/migrator/job/migrations/compliance/populate.go +++ b/services/migrator/job/migrations/compliance/populate.go @@ -3,9 +3,10 @@ package compliance import ( "context" "fmt" + "github.com/opengovern/og-util/pkg/postgres" - "github.com/opengovern/opengovernance/pkg/compliance/db" - "github.com/opengovern/opengovernance/pkg/metadata/models" + "github.com/opengovern/opengovernance/services/compliance/db" + "github.com/opengovern/opengovernance/services/metadata/models" "github.com/opengovern/opengovernance/services/migrator/config" "go.uber.org/zap" diff --git a/services/migrator/job/migrations/inventory/migrator.go b/services/migrator/job/migrations/inventory/migrator.go index 3d37638c0..2dc5a75f8 100644 --- a/services/migrator/job/migrations/inventory/migrator.go +++ b/services/migrator/job/migrations/inventory/migrator.go @@ -4,18 +4,19 @@ import ( "context" "encoding/json" "fmt" + "os" + "path" + "strings" + "github.com/opengovern/og-util/pkg/model" "github.com/opengovern/og-util/pkg/postgres" - "github.com/opengovern/opengovernance/pkg/inventory" integration_type "github.com/opengovern/opengovernance/services/integration/integration-type" + "github.com/opengovern/opengovernance/services/inventory" "github.com/opengovern/opengovernance/services/migrator/config" "github.com/opengovern/opengovernance/services/migrator/db" "go.uber.org/zap" "gorm.io/gorm" "gorm.io/gorm/clause" - "os" - "path" - "strings" ) type ResourceType struct { diff --git a/services/migrator/job/migrations/metadata/migrator.go b/services/migrator/job/migrations/metadata/migrator.go index 77df91317..3da05080b 100644 --- a/services/migrator/job/migrations/metadata/migrator.go +++ b/services/migrator/job/migrations/metadata/migrator.go @@ -4,13 +4,14 @@ import ( "context" "encoding/json" "fmt" + "os" + "github.com/opengovern/og-util/pkg/postgres" - "github.com/opengovern/opengovernance/pkg/metadata/models" + "github.com/opengovern/opengovernance/services/metadata/models" "github.com/opengovern/opengovernance/services/migrator/config" "github.com/opengovern/opengovernance/services/migrator/db" "go.uber.org/zap" "gorm.io/gorm/clause" - "os" ) type Migration struct { diff --git a/services/migrator/job/migrations/resource_collection/migration.go b/services/migrator/job/migrations/resource_collection/migration.go index 7e5c730c8..f3b7c18d5 100644 --- a/services/migrator/job/migrations/resource_collection/migration.go +++ b/services/migrator/job/migrations/resource_collection/migration.go @@ -4,17 +4,18 @@ import ( "context" "encoding/json" "fmt" + "time" + "github.com/jackc/pgtype" "github.com/opengovern/og-util/pkg/model" "github.com/opengovern/og-util/pkg/opengovernance-es-sdk" "github.com/opengovern/og-util/pkg/postgres" - "github.com/opengovern/opengovernance/pkg/inventory" + "github.com/opengovern/opengovernance/services/inventory" "github.com/opengovern/opengovernance/services/migrator/config" "github.com/opengovern/opengovernance/services/migrator/db" "go.uber.org/zap" "gorm.io/gorm" "gorm.io/gorm/clause" - "time" ) type ResourceCollection struct { diff --git a/services/migrator/job/migrations/resource_info/migrator.go b/services/migrator/job/migrations/resource_info/migrator.go index 98b195479..32c809b49 100644 --- a/services/migrator/job/migrations/resource_info/migrator.go +++ b/services/migrator/job/migrations/resource_info/migrator.go @@ -4,16 +4,17 @@ import ( "context" "encoding/csv" "fmt" + "os" + "path" + "github.com/opengovern/og-util/pkg/postgres" - "github.com/opengovern/opengovernance/pkg/inventory" integration_type "github.com/opengovern/opengovernance/services/integration/integration-type" + "github.com/opengovern/opengovernance/services/inventory" "github.com/opengovern/opengovernance/services/migrator/config" "github.com/opengovern/opengovernance/services/migrator/db" "go.uber.org/zap" "gorm.io/gorm" "gorm.io/gorm/clause" - "os" - "path" ) type ResourceType struct {