Documentation
¶
Index ¶
- func ClearDiscoveryCache()
- func FileExists(path string) bool
- func GetFileInfo(path string) (os.FileInfo, error)
- func GetGVK(spec scanner.KubernetesInputSpec) schema.GroupVersionKind
- func GetGVKWithConfig(spec scanner.KubernetesInputSpec, config *ResourceMappingConfig, ...) schema.GroupVersionKind
- func IsDirectory(path string) bool
- func IsNamespaced(spec scanner.KubernetesInputSpec) bool
- func IsNamespacedWithConfig(spec scanner.KubernetesInputSpec, discoveryClient discovery.DiscoveryInterface, ...) bool
- func IsNamespacedWithDiscovery(spec scanner.KubernetesInputSpec, discoveryClient discovery.DiscoveryInterface) bool
- func ListDirectories(dirPath string) ([]string, error)
- func ListFiles(dirPath string) ([]string, error)
- func ReadFileAsString(path string) (string, error)
- func ValidateFileInputSpec(spec scanner.FileInputSpec) error
- func ValidateKubernetesInputSpec(spec scanner.KubernetesInputSpec) error
- func ValidateKubernetesInputSpecWithDiscovery(spec scanner.KubernetesInputSpec, discoveryClient discovery.DiscoveryInterface) error
- type CelVariable
- type CompositeFetcher
- func (c *CompositeFetcher) FetchInputs(inputs []scanner.Input, variables []scanner.CelVariable) (map[string]interface{}, error)
- func (c *CompositeFetcher) FetchResources(ctx context.Context, rule scanner.Rule, variables []scanner.CelVariable) (map[string]interface{}, []string, error)
- func (c *CompositeFetcher) GetSupportedInputTypes() []scanner.InputType
- func (c *CompositeFetcher) RegisterCustomFetcher(inputType scanner.InputType, fetcher scanner.InputFetcher)
- func (c *CompositeFetcher) SetFilesystemFetcher(fetcher *FilesystemFetcher)
- func (c *CompositeFetcher) SetKubernetesFetcher(fetcher *KubernetesFetcher)
- func (c *CompositeFetcher) SupportsInputType(inputType scanner.InputType) bool
- func (c *CompositeFetcher) ValidateInputs(inputs []scanner.Input) error
- type CompositeFetcherBuilder
- func (b *CompositeFetcherBuilder) Build() *CompositeFetcher
- func (b *CompositeFetcherBuilder) WithCustomFetcher(inputType scanner.InputType, fetcher scanner.InputFetcher) *CompositeFetcherBuilder
- func (b *CompositeFetcherBuilder) WithFilesystem(basePath string) *CompositeFetcherBuilder
- func (b *CompositeFetcherBuilder) WithKubernetes(client runtimeclient.Client, clientset kubernetes.Interface) *CompositeFetcherBuilder
- func (b *CompositeFetcherBuilder) WithKubernetesFiles(apiResourcePath string) *CompositeFetcherBuilder
- type FilesystemFetcher
- type KubernetesFetcher
- func (k *KubernetesFetcher) FetchInputs(inputs []scanner.Input, variables []scanner.CelVariable) (map[string]interface{}, error)
- func (k *KubernetesFetcher) GetResourceScope(spec scanner.KubernetesInputSpec) bool
- func (k *KubernetesFetcher) SupportsInputType(inputType scanner.InputType) bool
- func (k *KubernetesFetcher) ValidateInputSpec(spec scanner.KubernetesInputSpec) error
- func (k *KubernetesFetcher) WithConfig(config *ResourceMappingConfig) *KubernetesFetcher
- type ResourceDiscoveryCache
- type ResourceMappingConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearDiscoveryCache ¶
func ClearDiscoveryCache()
ClearDiscoveryCache clears the discovery cache (useful for testing)
func GetFileInfo ¶
GetFileInfo returns file information
func GetGVK ¶
func GetGVK(spec scanner.KubernetesInputSpec) schema.GroupVersionKind
GetGVK returns the GroupVersionKind for a Kubernetes input spec using dynamic discovery
func GetGVKWithConfig ¶
func GetGVKWithConfig(spec scanner.KubernetesInputSpec, config *ResourceMappingConfig, discoveryClient discovery.DiscoveryInterface) schema.GroupVersionKind
GetGVKWithConfig returns the GroupVersionKind using configuration and discovery
func IsNamespaced ¶
func IsNamespaced(spec scanner.KubernetesInputSpec) bool
IsNamespaced returns true if the resource is namespaced using dynamic discovery
func IsNamespacedWithConfig ¶
func IsNamespacedWithConfig(spec scanner.KubernetesInputSpec, discoveryClient discovery.DiscoveryInterface, config *ResourceMappingConfig) bool
IsNamespacedWithConfig returns true if the resource is namespaced using configuration and discovery
func IsNamespacedWithDiscovery ¶
func IsNamespacedWithDiscovery(spec scanner.KubernetesInputSpec, discoveryClient discovery.DiscoveryInterface) bool
IsNamespacedWithDiscovery returns true if the resource is namespaced using API discovery
func ListDirectories ¶
ListDirectories lists directories in a directory
func ReadFileAsString ¶
ReadFileAsString reads a file as a string
func ValidateFileInputSpec ¶
func ValidateFileInputSpec(spec scanner.FileInputSpec) error
ValidateFileInputSpec validates a file input specification
func ValidateKubernetesInputSpec ¶
func ValidateKubernetesInputSpec(spec scanner.KubernetesInputSpec) error
ValidateKubernetesInputSpec validates a Kubernetes input specification
func ValidateKubernetesInputSpecWithDiscovery ¶
func ValidateKubernetesInputSpecWithDiscovery(spec scanner.KubernetesInputSpec, discoveryClient discovery.DiscoveryInterface) error
ValidateKubernetesInputSpecWithDiscovery validates a Kubernetes input specification using API discovery
Types ¶
type CelVariable ¶
type CelVariable struct {
// contains filtered or unexported fields
}
CelVariable implements CelVariable interface for conversion
func (*CelVariable) GroupVersionKind ¶
func (v *CelVariable) GroupVersionKind() schema.GroupVersionKind
func (*CelVariable) Name ¶
func (v *CelVariable) Name() string
func (*CelVariable) Namespace ¶
func (v *CelVariable) Namespace() string
func (*CelVariable) Value ¶
func (v *CelVariable) Value() string
type CompositeFetcher ¶
type CompositeFetcher struct {
// contains filtered or unexported fields
}
CompositeFetcher implements InputFetcher by delegating to specialized fetchers
func NewCompositeFetcher ¶
func NewCompositeFetcher() *CompositeFetcher
NewCompositeFetcher creates a new composite input fetcher with default implementations
func NewCompositeFetcherWithDefaults ¶
func NewCompositeFetcherWithDefaults( kubeClient runtimeclient.Client, kubeClientset kubernetes.Interface, apiResourcePath string, filesystemBasePath string, allowArbitraryCommands bool, ) *CompositeFetcher
NewCompositeFetcherWithDefaults creates a composite fetcher with default implementations
func (*CompositeFetcher) FetchInputs ¶
func (c *CompositeFetcher) FetchInputs(inputs []scanner.Input, variables []scanner.CelVariable) (map[string]interface{}, error)
FetchInputs retrieves inputs by delegating to appropriate specialized fetchers
func (*CompositeFetcher) FetchResources ¶
func (c *CompositeFetcher) FetchResources(ctx context.Context, rule scanner.Rule, variables []scanner.CelVariable) (map[string]interface{}, []string, error)
FetchResources implements the ResourceFetcher interface using the new unified API
func (*CompositeFetcher) GetSupportedInputTypes ¶
func (c *CompositeFetcher) GetSupportedInputTypes() []scanner.InputType
GetSupportedInputTypes returns all supported input types
func (*CompositeFetcher) RegisterCustomFetcher ¶
func (c *CompositeFetcher) RegisterCustomFetcher(inputType scanner.InputType, fetcher scanner.InputFetcher)
RegisterCustomFetcher registers a custom fetcher for a specific input type
func (*CompositeFetcher) SetFilesystemFetcher ¶
func (c *CompositeFetcher) SetFilesystemFetcher(fetcher *FilesystemFetcher)
SetFilesystemFetcher sets the filesystem fetcher
func (*CompositeFetcher) SetKubernetesFetcher ¶
func (c *CompositeFetcher) SetKubernetesFetcher(fetcher *KubernetesFetcher)
SetKubernetesFetcher sets the Kubernetes fetcher
func (*CompositeFetcher) SupportsInputType ¶
func (c *CompositeFetcher) SupportsInputType(inputType scanner.InputType) bool
SupportsInputType returns true if any registered fetcher supports the input type
func (*CompositeFetcher) ValidateInputs ¶
func (c *CompositeFetcher) ValidateInputs(inputs []scanner.Input) error
ValidateInputs validates all inputs are supported
type CompositeFetcherBuilder ¶
type CompositeFetcherBuilder struct {
// contains filtered or unexported fields
}
CompositeFetcherBuilder helps build composite fetchers
func NewCompositeFetcherBuilder ¶
func NewCompositeFetcherBuilder() *CompositeFetcherBuilder
NewCompositeFetcherBuilder creates a new builder
func (*CompositeFetcherBuilder) Build ¶
func (b *CompositeFetcherBuilder) Build() *CompositeFetcher
Build returns the configured composite fetcher
func (*CompositeFetcherBuilder) WithCustomFetcher ¶
func (b *CompositeFetcherBuilder) WithCustomFetcher(inputType scanner.InputType, fetcher scanner.InputFetcher) *CompositeFetcherBuilder
WithCustomFetcher adds a custom fetcher
func (*CompositeFetcherBuilder) WithFilesystem ¶
func (b *CompositeFetcherBuilder) WithFilesystem(basePath string) *CompositeFetcherBuilder
WithFilesystem configures filesystem support
func (*CompositeFetcherBuilder) WithKubernetes ¶
func (b *CompositeFetcherBuilder) WithKubernetes(client runtimeclient.Client, clientset kubernetes.Interface) *CompositeFetcherBuilder
WithKubernetes configures Kubernetes support
func (*CompositeFetcherBuilder) WithKubernetesFiles ¶
func (b *CompositeFetcherBuilder) WithKubernetesFiles(apiResourcePath string) *CompositeFetcherBuilder
WithKubernetesFiles configures Kubernetes support with file-based resources
type FilesystemFetcher ¶
type FilesystemFetcher struct {
// contains filtered or unexported fields
}
FilesystemFetcher implements InputFetcher for file system resources
func NewFilesystemFetcher ¶
func NewFilesystemFetcher(basePath string) *FilesystemFetcher
NewFilesystemFetcher creates a new filesystem input fetcher
func (*FilesystemFetcher) FetchInputs ¶
func (f *FilesystemFetcher) FetchInputs(inputs []scanner.Input, variables []scanner.CelVariable) (map[string]interface{}, error)
FetchInputs retrieves file system resources for the specified inputs
func (*FilesystemFetcher) SupportsInputType ¶
func (f *FilesystemFetcher) SupportsInputType(inputType scanner.InputType) bool
SupportsInputType returns true for file input types
type KubernetesFetcher ¶
type KubernetesFetcher struct {
// contains filtered or unexported fields
}
KubernetesFetcher implements InputFetcher for Kubernetes resources
func NewKubernetesFetcher ¶
func NewKubernetesFetcher(client runtimeclient.Client, clientset kubernetes.Interface) *KubernetesFetcher
NewKubernetesFetcher creates a new Kubernetes input fetcher
func NewKubernetesFileFetcher ¶
func NewKubernetesFileFetcher(apiResourcePath string) *KubernetesFetcher
NewKubernetesFileFetcher creates a fetcher that reads from pre-fetched files
func (*KubernetesFetcher) FetchInputs ¶
func (k *KubernetesFetcher) FetchInputs(inputs []scanner.Input, variables []scanner.CelVariable) (map[string]interface{}, error)
FetchInputs retrieves Kubernetes resources for the specified inputs
func (*KubernetesFetcher) GetResourceScope ¶
func (k *KubernetesFetcher) GetResourceScope(spec scanner.KubernetesInputSpec) bool
GetResourceScope returns the scope of a resource (namespaced or cluster-scoped) using API discovery
func (*KubernetesFetcher) SupportsInputType ¶
func (k *KubernetesFetcher) SupportsInputType(inputType scanner.InputType) bool
SupportsInputType returns true for Kubernetes input types
func (*KubernetesFetcher) ValidateInputSpec ¶
func (k *KubernetesFetcher) ValidateInputSpec(spec scanner.KubernetesInputSpec) error
ValidateInputSpec validates a Kubernetes input specification using the fetcher's discovery client
func (*KubernetesFetcher) WithConfig ¶
func (k *KubernetesFetcher) WithConfig(config *ResourceMappingConfig) *KubernetesFetcher
WithConfig allows customization of the fetcher configuration
type ResourceDiscoveryCache ¶
type ResourceDiscoveryCache struct {
// contains filtered or unexported fields
}
ResourceDiscoveryCache caches resource discovery information
type ResourceMappingConfig ¶
type ResourceMappingConfig struct {
// CustomKindMappings allows override of resource type to Kind mappings
CustomKindMappings map[string]string
// CustomScopeMappings allows override of resource scope (true=namespaced, false=cluster-scoped)
CustomScopeMappings map[schema.GroupVersionKind]bool
}
ResourceMappingConfig allows customization of resource mappings
func DefaultResourceMappingConfig ¶
func DefaultResourceMappingConfig() *ResourceMappingConfig
DefaultResourceMappingConfig returns a default configuration
func LoadResourceMappingsFromFile ¶
func LoadResourceMappingsFromFile(filePath string) (*ResourceMappingConfig, error)
LoadResourceMappingsFromFile loads custom resource mappings from a JSON file