1
0
Fork 0
mirror of https://github.com/kyverno/policy-reporter.git synced 2024-12-15 17:50:58 +00:00

ADD: json tags to the configuration structure (#470)

this is needed to allow external programs to programatically
generate the policy-reporter config file.

Viper does not have a config marshal method same with the mapstructure
library.

Signed-off-by: Jesus Carrillo <jesuscarrillo8@gmail.com>
This commit is contained in:
Jesus Carrillo 2024-08-23 00:57:47 -07:00 committed by GitHub
parent 35175775bb
commit 16bcc214a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,41 +3,41 @@ package config
import "github.com/kyverno/policy-reporter/pkg/target" import "github.com/kyverno/policy-reporter/pkg/target"
type ValueFilter struct { type ValueFilter struct {
Include []string `mapstructure:"include"` Include []string `mapstructure:"include" json:"include,omitempty"`
Exclude []string `mapstructure:"exclude"` Exclude []string `mapstructure:"exclude" json:"exclude,omitempty"`
} }
type EmailReportFilter struct { type EmailReportFilter struct {
DisableClusterReports bool `mapstructure:"disableClusterReports"` DisableClusterReports bool `mapstructure:"disableClusterReports" json: "disableClusterReports,omitempty"`
Namespaces ValueFilter `mapstructure:"namespaces"` Namespaces ValueFilter `mapstructure:"namespaces" json:"namespaces,omitempty"`
Sources ValueFilter `mapstructure:"sources"` Sources ValueFilter `mapstructure:"sources" json:"sources,omitempty"`
} }
type TargetFilter struct { type TargetFilter struct {
Namespaces ValueFilter `mapstructure:"namespaces"` Namespaces ValueFilter `mapstructure:"namespaces" json:"namespaces,omitempty"`
Priorities ValueFilter `mapstructure:"priorities"` Priorities ValueFilter `mapstructure:"priorities" json:"priorities,omitempty"`
Policies ValueFilter `mapstructure:"policies"` Policies ValueFilter `mapstructure:"policies" json:"policies,omitempty"`
ReportLabels ValueFilter `mapstructure:"reportLabels"` ReportLabels ValueFilter `mapstructure:"reportLabels" json:"reportLabels,omitempty"`
} }
type MetricsFilter struct { type MetricsFilter struct {
Namespaces ValueFilter `mapstructure:"namespaces"` Namespaces ValueFilter `mapstructure:"namespaces" json:"namespaces,omitempty"`
Policies ValueFilter `mapstructure:"policies"` Policies ValueFilter `mapstructure:"policies" json:"policies,omitempty"`
Severities ValueFilter `mapstructure:"severities"` Severities ValueFilter `mapstructure:"severities" json:"severities,omitempty"`
Status ValueFilter `mapstructure:"status"` Status ValueFilter `mapstructure:"status" json:"status,omitempty"`
Sources ValueFilter `mapstructure:"sources"` Sources ValueFilter `mapstructure:"sources" json:"sources,omitempty"`
Kinds ValueFilter `mapstructure:"kinds"` Kinds ValueFilter `mapstructure:"kinds" json: "kinds,omitempty"`
} }
type TargetBaseOptions struct { type TargetBaseOptions struct {
Name string `mapstructure:"name"` Name string `mapstructure:"name" json:"name,omitempty"`
MinimumPriority string `mapstructure:"minimumPriority"` MinimumPriority string `mapstructure:"minimumPriority" json: "minimumPriority,omitempty"`
Filter TargetFilter `mapstructure:"filter"` Filter TargetFilter `mapstructure:"filter" json: "filter,omitempty"`
SecretRef string `mapstructure:"secretRef"` SecretRef string `mapstructure:"secretRef" json: "secretRef,omitempty"`
MountedSecret string `mapstructure:"mountedSecret"` MountedSecret string `mapstructure:"mountedSecret" json: "mountedSecret,omitempty"`
Sources []string `mapstructure:"sources"` Sources []string `mapstructure:"sources" json: "sources,omitempty"`
CustomFields map[string]string `mapstructure:"customFields"` CustomFields map[string]string `mapstructure:"customFields" json: "customFields,omitempty"`
SkipExisting bool `mapstructure:"skipExistingOnStartup"` SkipExisting bool `mapstructure:"skipExistingOnStartup", json: "skipExistingOnStartup,omitempty"`
} }
func (config *TargetBaseOptions) MapBaseParent(parent TargetBaseOptions) { func (config *TargetBaseOptions) MapBaseParent(parent TargetBaseOptions) {
@ -60,10 +60,10 @@ func (config *TargetBaseOptions) ClientOptions() target.ClientOptions {
} }
type AWSConfig struct { type AWSConfig struct {
AccessKeyID string `mapstructure:"accessKeyID"` AccessKeyID string `mapstructure:"accessKeyID" json: "accessKeyID,omitempty"`
SecretAccessKey string `mapstructure:"secretAccessKey"` SecretAccessKey string `mapstructure:"secretAccessKey" json: "secretAccessKey,omitempty"`
Region string `mapstructure:"region"` Region string `mapstructure:"region" json: "region,omitempty"`
Endpoint string `mapstructure:"endpoint"` Endpoint string `mapstructure:"endpoint" json: "endpoint,omitempty"`
} }
func (config *AWSConfig) MapAWSParent(parent AWSConfig) { func (config *AWSConfig) MapAWSParent(parent AWSConfig) {
@ -90,78 +90,78 @@ type TargetOption interface {
// Loki configuration // Loki configuration
type Loki struct { type Loki struct {
TargetBaseOptions `mapstructure:",squash"` TargetBaseOptions `mapstructure:",squash" json:",inline"`
CustomLabels map[string]string `mapstructure:"customLabels"` CustomLabels map[string]string `mapstructure:"customLabels" json:"customLabels,omitempty"`
Headers map[string]string `mapstructure:"headers"` Headers map[string]string `mapstructure:"headers" json:"headers,omitempty"`
Host string `mapstructure:"host"` Host string `mapstructure:"host" json:"host,omitempty"`
SkipTLS bool `mapstructure:"skipTLS"` SkipTLS bool `mapstructure:"skipTLS" json:"skipTLS,omitempty"`
Certificate string `mapstructure:"certificate"` Certificate string `mapstructure:"certificate" json:"certificate,omitempty"`
Path string `mapstructure:"path"` Path string `mapstructure:"path" json:"path,omitempty"`
Channels []*Loki `mapstructure:"channels"` Channels []*Loki `mapstructure:"channels" json:"channels,omitempty"`
Username string `mapstructure:"username"` Username string `mapstructure:"username" json:"username,omitempty"`
Password string `mapstructure:"password"` Password string `mapstructure:"password" json:"password,omitempty"`
} }
// Elasticsearch configuration // Elasticsearch configuration
type Elasticsearch struct { type Elasticsearch struct {
TargetBaseOptions `mapstructure:",squash"` TargetBaseOptions `mapstructure:",squash" json:",inline"`
Host string `mapstructure:"host"` Host string `mapstructure:"host" json:"host,omitempty"`
SkipTLS bool `mapstructure:"skipTLS"` SkipTLS bool `mapstructure:"skipTLS" json:"skipTLS,omitempty"`
Certificate string `mapstructure:"certificate"` Certificate string `mapstructure:"certificate" json:"certificate,omitempty"`
Index string `mapstructure:"index"` Index string `mapstructure:"index" json:"index,omitempty"`
Rotation string `mapstructure:"rotation"` Rotation string `mapstructure:"rotation" json:"rotation,omitempty"`
Username string `mapstructure:"username"` Username string `mapstructure:"username" json:"username,omitempty"`
Password string `mapstructure:"password"` Password string `mapstructure:"password" json:"password,omitempty"`
APIKey string `mapstructure:"apiKey"` APIKey string `mapstructure:"apiKey" json:"apiKey,omitempty"`
Channels []*Elasticsearch `mapstructure:"channels"` Channels []*Elasticsearch `mapstructure:"channels" json:"channels,omitempty"`
TypelessAPI bool `mapstructure:"typelessApi"` TypelessAPI bool `mapstructure:"typelessApi" json:"typelessApi,omitempty"`
} }
// Slack configuration // Slack configuration
type Slack struct { type Slack struct {
TargetBaseOptions `mapstructure:",squash"` TargetBaseOptions `mapstructure:",squash" json:",inline"`
Webhook string `mapstructure:"webhook"` Webhook string `mapstructure:"webhook" json:"webhook,omitempty"`
Channel string `mapstructure:"channel"` Channel string `mapstructure:"channel" json:"channel,omitempty"`
Channels []*Slack `mapstructure:"channels"` Channels []*Slack `mapstructure:"channels" json:"channels,omitempty"`
} }
// Discord configuration // Discord configuration
type Discord struct { type Discord struct {
TargetBaseOptions `mapstructure:",squash"` TargetBaseOptions `mapstructure:",squash" json:",inline"`
Webhook string `mapstructure:"webhook"` Webhook string `mapstructure:"webhook" json:"webhook,omitempty"`
Channels []*Discord `mapstructure:"channels"` Channels []*Discord `mapstructure:"channels" json:"channels,omitempty"`
} }
// Teams configuration // Teams configuration
type Teams struct { type Teams struct {
TargetBaseOptions `mapstructure:",squash"` TargetBaseOptions `mapstructure:",squash" json:",inline"`
Webhook string `mapstructure:"webhook"` Webhook string `mapstructure:"webhook" json:"webhook,omitempty"`
SkipTLS bool `mapstructure:"skipTLS"` SkipTLS bool `mapstructure:"skipTLS" json:"skipTLS,omitempty"`
Certificate string `mapstructure:"certificate"` Certificate string `mapstructure:"certificate" json:"certificate,omitempty"`
Channels []*Teams `mapstructure:"channels"` Channels []*Teams `mapstructure:"channels" json:"channels,omitempty"`
} }
// UI configuration // UI configuration
type UI struct { type UI struct {
TargetBaseOptions `mapstructure:",squash"` TargetBaseOptions `mapstructure:",squash" json:",inline"`
Host string `mapstructure:"host"` Host string `mapstructure:"host" json:"host,omitempty"`
SkipTLS bool `mapstructure:"skipTLS"` SkipTLS bool `mapstructure:"skipTLS" json:"skipTLS,omitempty"`
Certificate string `mapstructure:"certificate"` Certificate string `mapstructure:"certificate" json:"certificate,omitempty"`
} }
// Webhook configuration // Webhook configuration
type Webhook struct { type Webhook struct {
TargetBaseOptions `mapstructure:",squash"` TargetBaseOptions `mapstructure:",squash" json:",inline"`
Host string `mapstructure:"host"` Host string `mapstructure:"host" json:"host,omitempty"`
SkipTLS bool `mapstructure:"skipTLS"` SkipTLS bool `mapstructure:"skipTLS" json:"skipTLS,omitempty"`
Certificate string `mapstructure:"certificate"` Certificate string `mapstructure:"certificate" json:"certificate,omitempty"`
Headers map[string]string `mapstructure:"headers"` Headers map[string]string `mapstructure:"headers" json:"headers,omitempty"`
Channels []*Webhook `mapstructure:"channels"` Channels []*Webhook `mapstructure:"channels" json:"channels,omitempty"`
} }
// Telegram configuration // Telegram configuration
type Telegram struct { type Telegram struct {
TargetBaseOptions `mapstructure:",squash"` TargetBaseOptions `mapstructure:",squash" json:",inline"`
Host string `mapstructure:"host"` Host string `mapstructure:"host"`
Token string `mapstructure:"token"` Token string `mapstructure:"token"`
ChatID string `mapstructure:"chatID"` ChatID string `mapstructure:"chatID"`
@ -173,108 +173,108 @@ type Telegram struct {
// GoogleChat configuration // GoogleChat configuration
type GoogleChat struct { type GoogleChat struct {
TargetBaseOptions `mapstructure:",squash"` TargetBaseOptions `mapstructure:",squash" json:",inline"`
Webhook string `mapstructure:"webhook"` Webhook string `mapstructure:"webhook" json:"webhook,omitempty"`
SkipTLS bool `mapstructure:"skipTLS"` SkipTLS bool `mapstructure:"skipTLS" json:"skipTLS,omitempty"`
Certificate string `mapstructure:"certificate"` Certificate string `mapstructure:"certificate" json:"certificate,omitempty"`
Headers map[string]string `mapstructure:"headers"` Headers map[string]string `mapstructure:"headers" json:"headers,omitempty"`
Channels []*GoogleChat `mapstructure:"channels"` Channels []*GoogleChat `mapstructure:"channels" json:"channels,omitempty"`
} }
// S3 configuration // S3 configuration
type S3 struct { type S3 struct {
TargetBaseOptions `mapstructure:",squash"` TargetBaseOptions `mapstructure:",squash" json:",inline"`
AWSConfig `mapstructure:",squash"` AWSConfig `mapstructure:",squash" json:",inline"`
Prefix string `mapstructure:"prefix"` Prefix string `mapstructure:"prefix" json:"prefix,omitempty"`
Bucket string `mapstructure:"bucket"` Bucket string `mapstructure:"bucket" json:"bucket,omitempty"`
BucketKeyEnabled bool `mapstructure:"bucketKeyEnabled"` BucketKeyEnabled bool `mapstructure:"bucketKeyEnabled" json:"bucketKeyEnabled,omitempty"`
KmsKeyID string `mapstructure:"kmsKeyId"` KmsKeyID string `mapstructure:"kmsKeyId" json:"kmsKeyId,omitempty"`
ServerSideEncryption string `mapstructure:"serverSideEncryption"` ServerSideEncryption string `mapstructure:"serverSideEncryption" json:"serverSideEncryption,omitempty"`
PathStyle bool `mapstructure:"pathStyle"` PathStyle bool `mapstructure:"pathStyle" json:"pathStyle,omitempty"`
Channels []*S3 `mapstructure:"channels"` Channels []*S3 `mapstructure:"channels" json:"channels,omitempty"`
} }
// Kinesis configuration // Kinesis configuration
type Kinesis struct { type Kinesis struct {
TargetBaseOptions `mapstructure:",squash"` TargetBaseOptions `mapstructure:",squash" json:",inline"`
AWSConfig `mapstructure:",squash"` AWSConfig `mapstructure:",squash" json:",inline"`
StreamName string `mapstructure:"streamName"` StreamName string `mapstructure:"streamName" json:"streamName,omitempty"`
Channels []*Kinesis `mapstructure:"channels"` Channels []*Kinesis `mapstructure:"channels" json:"channels,omitempty"`
} }
// SecurityHub configuration // SecurityHub configuration
type SecurityHub struct { type SecurityHub struct {
TargetBaseOptions `mapstructure:",squash"` TargetBaseOptions `mapstructure:",squash" json:",inline"`
AWSConfig `mapstructure:",squash"` AWSConfig `mapstructure:",squash" json:",inline"`
AccountID string `mapstructure:"accountId"` AccountID string `mapstructure:"accountId" json:"accountId,omitempty"`
ProductName string `mapstructure:"productName"` ProductName string `mapstructure:"productName" json:"productName,omitempty"`
CompanyName string `mapstructure:"companyName"` CompanyName string `mapstructure:"companyName" json:"companyName,omitempty"`
DelayInSeconds int `mapstructure:"delayInSeconds"` DelayInSeconds int `mapstructure:"delayInSeconds" json:"delayInSeconds,omitempty"`
Cleanup bool `mapstructure:"cleanup"` Cleanup bool `mapstructure:"cleanup" json:"cleanup,omitempty"`
Channels []*SecurityHub `mapstructure:"channels"` Channels []*SecurityHub `mapstructure:"channels" json:"channels,omitempty"`
} }
// GCS configuration // GCS configuration
type GCS struct { type GCS struct {
TargetBaseOptions `mapstructure:",squash"` TargetBaseOptions `mapstructure:",squash" json:",inline"`
Credentials string `mapstructure:"credentials"` Credentials string `mapstructure:"credentials" json:"customLabels,omitempty"`
Prefix string `mapstructure:"prefix"` Prefix string `mapstructure:"prefix" json:"credentials,omitempty"`
Bucket string `mapstructure:"bucket"` Bucket string `mapstructure:"bucket" json:"bucket,omitempty"`
Sources []string `mapstructure:"sources"` Sources []string `mapstructure:"sources" json:"sources,omitempty"`
Channels []*GCS `mapstructure:"channels"` Channels []*GCS `mapstructure:"channels" json:"channels,omitempty"`
} }
// SMTP configuration // SMTP configuration
type SMTP struct { type SMTP struct {
Host string `mapstructure:"host"` Host string `mapstructure:"host" json:"host,omitempty"`
Port int `mapstructure:"port"` Port int `mapstructure:"port" json:"port,omitempty"`
Username string `mapstructure:"username"` Username string `mapstructure:"username" json:"username,omitempty"`
Password string `mapstructure:"password"` Password string `mapstructure:"password" json:"password,omitempty"`
From string `mapstructure:"from"` From string `mapstructure:"from" json:"from,omitempty"`
Encryption string `mapstructure:"encryption"` Encryption string `mapstructure:"encryption" json:"encryption,omitempty"`
SkipTLS bool `mapstructure:"skipTLS"` SkipTLS bool `mapstructure:"skipTLS" json:"skipTLS,omitempty"`
Certificate string `mapstructure:"certificate"` Certificate string `mapstructure:"certificate" json:"certificate,omitempty"`
} }
// EmailReport configuration // EmailReport configuration
type EmailReport struct { type EmailReport struct {
To []string `mapstructure:"to"` To []string `mapstructure:"to" json:"to,omitempty"`
Format string `mapstructure:"format"` Format string `mapstructure:"format" json:"format,omitempty"`
Filter EmailReportFilter `mapstructure:"filter"` Filter EmailReportFilter `mapstructure:"filter" json:"filter,omitempty"`
Channels []EmailReport `mapstructure:"channels"` Channels []EmailReport `mapstructure:"channels" json:"channels,omitempty"`
} }
// EmailReport configuration // EmailReport configuration
type Templates struct { type Templates struct {
Dir string `mapstructure:"dir"` Dir string `mapstructure:"dir" json:"dir,omitempty"`
} }
// EmailReports configuration // EmailReports configuration
type EmailReports struct { type EmailReports struct {
SMTP SMTP `mapstructure:"smtp"` SMTP SMTP `mapstructure:"smtp" json:"smtp,omitempty"`
Summary EmailReport `mapstructure:"summary"` Summary EmailReport `mapstructure:"summary" json:"summary,omitempty"`
Violations EmailReport `mapstructure:"violations"` Violations EmailReport `mapstructure:"violations" json:"violations,omitempty"`
ClusterName string `mapstructure:"clusterName"` ClusterName string `mapstructure:"clusterName" json:"clusterName,omitempty"`
TitlePrefix string `mapstructure:"titlePrefix"` TitlePrefix string `mapstructure:"titlePrefix" json:"titlePrefix,omitempty"`
} }
// BasicAuth configuration // BasicAuth configuration
type BasicAuth struct { type BasicAuth struct {
Username string `mapstructure:"username"` Username string `mapstructure:"username" json:"username,omitempty"`
Password string `mapstructure:"password"` Password string `mapstructure:"password" json:"password,omitempty"`
SecretRef string `mapstructure:"secretRef"` SecretRef string `mapstructure:"secretRef" json:"secretRef,omitempty"`
} }
// API configuration // API configuration
type API struct { type API struct {
Port int `mapstructure:"port"` Port int `mapstructure:"port" json:"port,omitempty"`
Logging bool `mapstructure:"logging"` Logging bool `mapstructure:"logging" json:"logging,omitempty"`
BasicAuth BasicAuth `mapstructure:"basicAuth"` BasicAuth BasicAuth `mapstructure:"basicAuth" json:"basicAuth,omitempty"`
} }
// REST configuration // REST configuration
type REST struct { type REST struct {
Enabled bool `mapstructure:"enabled"` Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"`
} }
// Metrics configuration // Metrics configuration
@ -287,106 +287,106 @@ type Metrics struct {
// Profiling configuration // Profiling configuration
type Profiling struct { type Profiling struct {
Enabled bool `mapstructure:"enabled"` Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"`
} }
// ClusterReportFilter configuration // ClusterReportFilter configuration
type ClusterReportFilter struct { type ClusterReportFilter struct {
Disabled bool `mapstructure:"disabled"` Disabled bool `mapstructure:"disabled" json:"disabled,omitempty"`
} }
// ReportFilter configuration // ReportFilter configuration
type ReportFilter struct { type ReportFilter struct {
Namespaces ValueFilter `mapstructure:"namespaces"` Namespaces ValueFilter `mapstructure:"namespaces" json:"namespaces,omitempty"`
ClusterReports ClusterReportFilter `mapstructure:"clusterReports"` ClusterReports ClusterReportFilter `mapstructure:"clusterReports" json:"clusterReports,omitempty"`
} }
// Redis configuration // Redis configuration
type Redis struct { type Redis struct {
Enabled bool `mapstructure:"enabled"` Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"`
Address string `mapstructure:"address"` Address string `mapstructure:"address" json:"address,omitempty"`
Prefix string `mapstructure:"prefix"` Prefix string `mapstructure:"prefix" json:"prefix,omitempty"`
Username string `mapstructure:"username"` Username string `mapstructure:"username" json:"username,omitempty"`
Password string `mapstructure:"password"` Password string `mapstructure:"password" json:"password,omitempty"`
Database int `mapstructure:"database"` Database int `mapstructure:"database" json:"database,omitempty"`
} }
// LeaderElection configuration // LeaderElection configuration
type LeaderElection struct { type LeaderElection struct {
LockName string `mapstructure:"lockName"` LockName string `mapstructure:"lockName" json:"lockName,omitempty"`
PodName string `mapstructure:"podName"` PodName string `mapstructure:"podName" json:"podName,omitempty"`
Namespace string `mapstructure:"namespace"` Namespace string `mapstructure:"namespace" json:"namespace,omitempty"`
LeaseDuration int `mapstructure:"leaseDuration"` LeaseDuration int `mapstructure:"leaseDuration" json:"leaseDuration,omitempty"`
RenewDeadline int `mapstructure:"renewDeadline"` RenewDeadline int `mapstructure:"renewDeadline" json:"renewDeadline,omitempty"`
RetryPeriod int `mapstructure:"retryPeriod"` RetryPeriod int `mapstructure:"retryPeriod" json:"retryPeriod,omitempty"`
ReleaseOnCancel bool `mapstructure:"releaseOnCancel"` ReleaseOnCancel bool `mapstructure:"releaseOnCancel" json:"releaseOnCancel,omitempty"`
Enabled bool `mapstructure:"enabled"` Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"`
} }
// K8sClient config struct // K8sClient config struct
type K8sClient struct { type K8sClient struct {
QPS float32 `mapstructure:"qps"` QPS float32 `mapstructure:"qps" json:"qps,omitempty"`
Burst int `mapstructure:"burst"` Burst int `mapstructure:"burst" json:"burst,omitempty"`
Kubeconfig string `mapstructure:"kubeconfig"` Kubeconfig string `mapstructure:"kubeconfig" json:"kubeconfig,omitempty"`
} }
type Logging struct { type Logging struct {
LogLevel int8 `mapstructure:"logLevel"` LogLevel int8 `mapstructure:"logLevel" json:"logLevel,omitempty"`
Encoding string `mapstructure:"encoding"` Encoding string `mapstructure:"encoding" json:"encoding,omitempty"`
Development bool `mapstructure:"development"` Development bool `mapstructure:"development" json:"development,omitempty"`
} }
type Database struct { type Database struct {
Type string `mapstructure:"type"` Type string `mapstructure:"type" json:"type,omitempty"`
DSN string `mapstructure:"dsn"` DSN string `mapstructure:"dsn" json:"dsn,omitempty"`
Username string `mapstructure:"username"` Username string `mapstructure:"username" json:"username,omitempty"`
Password string `mapstructure:"password"` Password string `mapstructure:"password" json:"password,omitempty"`
Database string `mapstructure:"database"` Database string `mapstructure:"database" json:"database,omitempty"`
Host string `mapstructure:"host"` Host string `mapstructure:"host" json:"host,omitempty"`
EnableSSL bool `mapstructure:"enableSSL"` EnableSSL bool `mapstructure:"enableSSL" json:"enableSSL,omitempty"`
SecretRef string `mapstructure:"secretRef"` SecretRef string `mapstructure:"secretRef" json:"secretRef,omitempty"`
MountedSecret string `mapstructure:"mountedSecret"` MountedSecret string `mapstructure:"mountedSecret" json:"mountedSecret,omitempty"`
} }
type CustomID struct { type CustomID struct {
Enabled bool `mapstructure:"enabled"` Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"`
Fields []string `mapstructure:"fields"` Fields []string `mapstructure:"fields" json:"fields,omitempty"`
} }
type SourceConfig struct { type SourceConfig struct {
CustomID `mapstructure:"customID"` CustomID `mapstructure:"customID" json:"customID,omitempty"`
} }
// Config of the PolicyReporter // Config of the PolicyReporter
type Config struct { type Config struct {
Version string Version string `json:"version,omitempty"`
Namespace string `mapstructure:"namespace"` Namespace string `mapstructure:"namespace" json:"namespace,omitempty"`
Loki *Loki `mapstructure:"loki"` Loki *Loki `mapstructure:"loki" json:"loki,omitempty"`
Elasticsearch *Elasticsearch `mapstructure:"elasticsearch"` Elasticsearch *Elasticsearch `mapstructure:"elasticsearch" json:"elasticsearch,omitempty"`
Slack *Slack `mapstructure:"slack"` Slack *Slack `mapstructure:"slack" json:"slack,omitempty"`
Discord *Discord `mapstructure:"discord"` Discord *Discord `mapstructure:"discord" json:"discord,omitempty"`
Teams *Teams `mapstructure:"teams"` Teams *Teams `mapstructure:"teams" json:"teams,omitempty"`
S3 *S3 `mapstructure:"s3"` S3 *S3 `mapstructure:"s3" json:"s3,omitempty"`
Kinesis *Kinesis `mapstructure:"kinesis"` Kinesis *Kinesis `mapstructure:"kinesis" json:"kinesis,omitempty"`
SecurityHub *SecurityHub `mapstructure:"securityHub"` SecurityHub *SecurityHub `mapstructure:"securityHub" json:"securityHub,omitempty"`
GCS *GCS `mapstructure:"gcs"` GCS *GCS `mapstructure:"gcs" json:"gcs,omitempty"`
UI *UI `mapstructure:"ui"` UI *UI `mapstructure:"ui" json:"ui,omitempty"`
Webhook *Webhook `mapstructure:"webhook"` Webhook *Webhook `mapstructure:"webhook" json:"webhook,omitempty"`
Telegram *Telegram `mapstructure:"telegram"` Telegram *Telegram `mapstructure:"telegram" json:"telegram,omitempty"`
GoogleChat *GoogleChat `mapstructure:"googleChat"` GoogleChat *GoogleChat `mapstructure:"googleChat" json:"googleChat,omitempty"`
API API `mapstructure:"api"` API API `mapstructure:"api" json:"api,omitempty"`
WorkerCount int `mapstructure:"worker"` WorkerCount int `mapstructure:"worker" json:"worker,omitempty"`
DBFile string `mapstructure:"dbfile"` DBFile string `mapstructure:"dbfile" json:"dbfile,omitempty"`
Metrics Metrics `mapstructure:"metrics"` Metrics Metrics `mapstructure:"metrics" json:"metrics,omitempty"`
REST REST `mapstructure:"rest"` REST REST `mapstructure:"rest" json:"rest,omitempty"`
ReportFilter ReportFilter `mapstructure:"reportFilter"` ReportFilter ReportFilter `mapstructure:"reportFilter" json:"reportFilter,omitempty"`
Redis Redis `mapstructure:"redis"` Redis Redis `mapstructure:"redis" json:"redis,omitempty"`
Profiling Profiling `mapstructure:"profiling"` Profiling Profiling `mapstructure:"profiling" json:"profiling,omitempty"`
EmailReports EmailReports `mapstructure:"emailReports"` EmailReports EmailReports `mapstructure:"emailReports" json:"emailReports,omitempty"`
LeaderElection LeaderElection `mapstructure:"leaderElection"` LeaderElection LeaderElection `mapstructure:"leaderElection" json:"leaderElection,omitempty"`
K8sClient K8sClient `mapstructure:"k8sClient"` K8sClient K8sClient `mapstructure:"k8sClient" json:"k8sClient,omitempty"`
Logging Logging `mapstructure:"logging"` Logging Logging `mapstructure:"logging" json:"logging,omitempty"`
Database Database `mapstructure:"database"` Database Database `mapstructure:"database" json:"database,omitempty"`
SourceConfig map[string]SourceConfig `mapstructure:"sourceConfig"` SourceConfig map[string]SourceConfig `mapstructure:"sourceConfig" json:"sourceConfig,omitempty"`
Templates Templates `mapstructure:"templates"` Templates Templates `mapstructure:"templates" json:"templates,omitempty"`
} }