diff --git a/Makefile b/Makefile index b671b1d8..b8ceb5e5 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ FIPS_ENABLED?=true +export RESOURCE_DIR=data/resources ifeq ($(GO),) GO:=$(shell command -v go) diff --git a/data/resources/notification/config.yaml b/data/resources/notification/config.yaml deleted file mode 100644 index 7dad81bb..00000000 --- a/data/resources/notification/config.yaml +++ /dev/null @@ -1,3 +0,0 @@ -resource_type: notifications/integration -resource_reporters: - - NOTIFICATIONS diff --git a/data/resources/notification/integration/config.yaml b/data/resources/notification/integration/config.yaml deleted file mode 100644 index 7dad81bb..00000000 --- a/data/resources/notification/integration/config.yaml +++ /dev/null @@ -1,3 +0,0 @@ -resource_type: notifications/integration -resource_reporters: - - NOTIFICATIONS diff --git a/data/resources/notifications/config.yaml b/data/resources/notifications/config.yaml new file mode 100644 index 00000000..b235b459 --- /dev/null +++ b/data/resources/notifications/config.yaml @@ -0,0 +1,3 @@ +resource_type: notifications-integrations +resource_reporters: + - NOTIFICATIONS diff --git a/data/resources/notifications/integration/config.yaml b/data/resources/notifications/integration/config.yaml new file mode 100644 index 00000000..b235b459 --- /dev/null +++ b/data/resources/notifications/integration/config.yaml @@ -0,0 +1,3 @@ +resource_type: notifications-integrations +resource_reporters: + - NOTIFICATIONS diff --git a/data/resources/notification/integration/reporters/notifications/notifications.json b/data/resources/notifications/integration/reporters/notifications/notifications.json similarity index 100% rename from data/resources/notification/integration/reporters/notifications/notifications.json rename to data/resources/notifications/integration/reporters/notifications/notifications.json diff --git a/go.mod b/go.mod index 72a5c78a..c112fa59 100644 --- a/go.mod +++ b/go.mod @@ -8,13 +8,13 @@ require ( github.com/bufbuild/protovalidate-go v0.9.1 github.com/cloudevents/sdk-go/protocol/kafka_confluent/v2 v2.0.0-20241021120453-70fb95191324 github.com/cloudevents/sdk-go/v2 v2.15.2 - github.com/confluentinc/confluent-kafka-go/v2 v2.8.0 + github.com/confluentinc/confluent-kafka-go/v2 v2.3.0 github.com/coreos/go-oidc/v3 v3.12.0 github.com/go-kratos/kratos/v2 v2.8.3 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/uuid v1.6.0 github.com/patrickmn/go-cache v2.1.0+incompatible - github.com/project-kessel/inventory-client-go v0.0.0-20240918112335-d9c72f85b234 + github.com/project-kessel/inventory-client-go v0.0.0-20250213094514-4b90870d8dcf github.com/project-kessel/relations-api v0.0.0-20241021205601-90db9ba90a73 github.com/prometheus/client_golang v1.20.5 github.com/redhatinsights/app-common-go v1.6.8 diff --git a/go.sum b/go.sum index 6a753b8c..6cf79f3c 100644 --- a/go.sum +++ b/go.sum @@ -80,6 +80,8 @@ github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 h1:QVw89YDxXxEe+l8gU8E github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/compose-spec/compose-go/v2 v2.1.3 h1:bD67uqLuL/XgkAK6ir3xZvNLFPxPScEi1KW7R5esrLE= github.com/compose-spec/compose-go/v2 v2.1.3/go.mod h1:lFN0DrMxIncJGYAXTfWuajfwj5haBJqrBkarHcnjJKc= +github.com/confluentinc/confluent-kafka-go/v2 v2.3.0 h1:icCHutJouWlQREayFwCc7lxDAhws08td+W3/gdqgZts= +github.com/confluentinc/confluent-kafka-go/v2 v2.3.0/go.mod h1:/VTy8iEpe6mD9pkCH5BhijlUl8ulUXymKv1Qig5Rgb8= github.com/confluentinc/confluent-kafka-go/v2 v2.8.0 h1:0HlcSNWg4LpLA9nIjzUMIqWHI+w0S68UN7alXAc3TeA= github.com/confluentinc/confluent-kafka-go/v2 v2.8.0/go.mod h1:hScqtFIGUI1wqHIgM3mjoqEou4VweGGGX7dMpcUKves= github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro= @@ -346,6 +348,8 @@ github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b h1:0LFwY6Q3g github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/project-kessel/inventory-client-go v0.0.0-20240918112335-d9c72f85b234 h1:Ms0bb3nq9slmvRIRhPxTocC/nVJtUrRDlEnmcXgP7as= github.com/project-kessel/inventory-client-go v0.0.0-20240918112335-d9c72f85b234/go.mod h1:ghVJESku3BJcPp3A8RTuHIErM0RptidPKoi0xGTlgrk= +github.com/project-kessel/inventory-client-go v0.0.0-20250213094514-4b90870d8dcf h1:RIKxvHBg98bak8Z58gNOgYbBZsOOLYKNRpLVSNhdNA8= +github.com/project-kessel/inventory-client-go v0.0.0-20250213094514-4b90870d8dcf/go.mod h1:ghVJESku3BJcPp3A8RTuHIErM0RptidPKoi0xGTlgrk= github.com/project-kessel/relations-api v0.0.0-20241021205601-90db9ba90a73 h1:w/VpkTj8lEw4/EoCVjMj7Yiq3qI6jAPJ35vEWpiMKdk= github.com/project-kessel/relations-api v0.0.0-20241021205601-90db9ba90a73/go.mod h1:eFvW2RvCRuvjpfpovZHlgw7JLQLIU0G0GVX0SXd7FUE= github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= diff --git a/internal/middleware/schema_loader.go b/internal/middleware/schema_loader.go index 9c89871f..2d5df849 100644 --- a/internal/middleware/schema_loader.go +++ b/internal/middleware/schema_loader.go @@ -24,7 +24,7 @@ func ValidateCombination(resourceType, reporterType string) error { // LoadResourceSchema finds the resources schema based on the directory structure of data/resources func LoadResourceSchema(resourceType string) (string, error) { - schemaPath := filepath.Join("data/resources", resourceType, resourceType+".json") + schemaPath := filepath.Join(resourceDir, resourceType, resourceType+".json") data, err := os.ReadFile(schemaPath) if err != nil { return "", fmt.Errorf("failed to read schema file for '%s': %w", resourceType, err) @@ -34,7 +34,7 @@ func LoadResourceSchema(resourceType string) (string, error) { // LoadReporterSchema finds the reporters schemas based on the directory structure of data/resources func LoadReporterSchema(resourceType string, reporterType string) (string, error) { - schemaPath := filepath.Join("data/resources", resourceType, "reporters", reporterType, reporterType+".json") + schemaPath := filepath.Join(resourceDir, resourceType, "reporters", reporterType, reporterType+".json") data, err := os.ReadFile(schemaPath) if err != nil { return "", fmt.Errorf("failed to read schema file for '%s' and reporter '%s': %w", resourceType, reporterType, err) @@ -44,7 +44,7 @@ func LoadReporterSchema(resourceType string, reporterType string) (string, error // LoadValidReporters Takes the resource_type from the provided config.yaml and compares it to the defined reporter_types func LoadValidReporters(resourceType string) ([]string, error) { - configPath := filepath.Join("data/resources", resourceType, "config.yaml") + configPath := filepath.Join(resourceDir, resourceType, "config.yaml") data, err := os.ReadFile(configPath) if err != nil { return nil, fmt.Errorf("failed to read config file for '%s': %w", resourceType, err)