file

package
v0.0.117 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GobExt                   = ".g"
	JsonExt                  = ".j"
	MetadataExt              = ".m"
	DefaultStorageRoot       = "/data"
	StorageV1Beta1ApiVersion = "spdx.softwarecomposition.kubescape.io/v1beta1"
)

Variables

This section is empty.

Functions

func IsMetadataFile added in v0.0.47

func IsMetadataFile(path string) bool

isMetadataFile returns true if a given file at `path` is an object metadata file, else false

func NewConfigurationScanSummaryStorage added in v0.0.18

func NewConfigurationScanSummaryStorage(realStore StorageQuerier) storage.Interface

func NewGeneratedNetworkPolicyStorage added in v0.0.33

func NewGeneratedNetworkPolicyStorage(realStore StorageQuerier) storage.Interface

func NewVulnerabilitySummaryStorage added in v0.0.20

func NewVulnerabilitySummaryStorage(realStore StorageQuerier) storage.Interface

Types

type ApplicationProfileProcessor added in v0.0.66

type ApplicationProfileProcessor struct {
}

func (ApplicationProfileProcessor) PreSave added in v0.0.66

func (a ApplicationProfileProcessor) PreSave(object runtime.Object) error

type ConfigurationScanSummaryStorage added in v0.0.18

type ConfigurationScanSummaryStorage struct {
	// contains filtered or unexported fields
}

ConfigurationScanSummaryStorage offers a storage solution for ConfigurationScanSummary objects, implementing custom business logic for these objects and using the underlying default storage implementation.

func (ConfigurationScanSummaryStorage) Count added in v0.0.18

func (ConfigurationScanSummaryStorage) Count(key string) (int64, error)

Count is not supported for immutable objects. Objects are generated on the fly and not stored.

func (ConfigurationScanSummaryStorage) Create added in v0.0.18

func (ConfigurationScanSummaryStorage) Create(ctx context.Context, key string, obj, out runtime.Object, _ uint64) error

Create is not supported for immutable objects. Objects are generated on the fly and not stored.

func (ConfigurationScanSummaryStorage) Delete added in v0.0.18

func (ConfigurationScanSummaryStorage) Delete(ctx context.Context, key string, out runtime.Object, _ *storage.Preconditions, _ storage.ValidateObjectFunc, _ runtime.Object) error

Delete is not supported for immutable objects. Objects are generated on the fly and not stored.

func (*ConfigurationScanSummaryStorage) Get added in v0.0.18

Get generates and returns a single ConfigurationScanSummary object for a namespace

func (*ConfigurationScanSummaryStorage) GetList added in v0.0.18

GetList generates and returns a list of ConfigurationScanSummary objects for the cluster

func (ConfigurationScanSummaryStorage) GuaranteedUpdate added in v0.0.18

func (ConfigurationScanSummaryStorage) GuaranteedUpdate(_ context.Context, key string, _ runtime.Object, _ bool, _ *storage.Preconditions, _ storage.UpdateFunc, _ runtime.Object) error

GuaranteedUpdate is not supported for immutable objects. Objects are generated on the fly and not stored.

func (ConfigurationScanSummaryStorage) RequestWatchProgress added in v0.0.42

func (ConfigurationScanSummaryStorage) RequestWatchProgress(context.Context) error

RequestWatchProgress fulfills the storage.Interface

It’s function is only relevant to etcd.

func (ConfigurationScanSummaryStorage) Versioner added in v0.0.18

func (ConfigurationScanSummaryStorage) Versioner() storage.Versioner

Versioner Returns fixed versioner associated with this interface.

func (ConfigurationScanSummaryStorage) Watch added in v0.0.18

func (ConfigurationScanSummaryStorage) Watch(ctx context.Context, key string, _ storage.ListOptions) (watch.Interface, error)

Watch is not supported for immutable objects. Objects are generated on the fly and not stored.

type DefaultProcessor added in v0.0.66

type DefaultProcessor struct {
}

func (DefaultProcessor) PreSave added in v0.0.66

func (d DefaultProcessor) PreSave(_ runtime.Object) error

type GeneratedNetworkPolicyStorage added in v0.0.33

type GeneratedNetworkPolicyStorage struct {
	// contains filtered or unexported fields
}

GeneratedNetworkPolicyStorage offers a storage solution for GeneratedNetworkPolicy objects, implementing custom business logic for these objects and using the underlying default storage implementation.

func (GeneratedNetworkPolicyStorage) Count added in v0.0.33

func (GeneratedNetworkPolicyStorage) Count(key string) (int64, error)

Count is not supported for immutable objects. Objects are generated on the fly and not stored.

func (GeneratedNetworkPolicyStorage) Create added in v0.0.33

func (GeneratedNetworkPolicyStorage) Create(ctx context.Context, key string, obj, out runtime.Object, _ uint64) error

Create is not supported for immutable objects. Objects are generated on the fly and not stored.

func (GeneratedNetworkPolicyStorage) Delete added in v0.0.33

func (GeneratedNetworkPolicyStorage) Delete(ctx context.Context, key string, out runtime.Object, _ *storage.Preconditions, _ storage.ValidateObjectFunc, _ runtime.Object) error

Delete is not supported for immutable objects. Objects are generated on the fly and not stored.

func (*GeneratedNetworkPolicyStorage) Get added in v0.0.33

Get generates and returns a single GeneratedNetworkPolicy object

func (*GeneratedNetworkPolicyStorage) GetList added in v0.0.33

GetList generates and returns a list of GeneratedNetworkPolicy objects for the given namespace

func (GeneratedNetworkPolicyStorage) GuaranteedUpdate added in v0.0.33

func (GeneratedNetworkPolicyStorage) GuaranteedUpdate(_ context.Context, key string, _ runtime.Object, _ bool, _ *storage.Preconditions, _ storage.UpdateFunc, _ runtime.Object) error

GuaranteedUpdate is not supported for immutable objects. Objects are generated on the fly and not stored.

func (GeneratedNetworkPolicyStorage) RequestWatchProgress added in v0.0.42

func (GeneratedNetworkPolicyStorage) RequestWatchProgress(context.Context) error

RequestWatchProgress fulfills the storage.Interface

It’s function is only relevant to etcd.

func (GeneratedNetworkPolicyStorage) Versioner added in v0.0.33

func (GeneratedNetworkPolicyStorage) Versioner() storage.Versioner

Versioner Returns fixed versioner associated with this interface.

func (GeneratedNetworkPolicyStorage) Watch added in v0.0.33

func (GeneratedNetworkPolicyStorage) Watch(ctx context.Context, key string, _ storage.ListOptions) (watch.Interface, error)

Watch is not supported for immutable objects. Objects are generated on the fly and not stored.

type NetworkNeighborhoodProcessor added in v0.0.81

type NetworkNeighborhoodProcessor struct {
}

func (NetworkNeighborhoodProcessor) PreSave added in v0.0.81

type Processor added in v0.0.66

type Processor interface {
	PreSave(object runtime.Object) error
}

type StorageImpl

type StorageImpl struct {
	// contains filtered or unexported fields
}

StorageImpl offers a common interface for object marshaling/unmarshaling operations and hides all the storage-related operations behind it.

func (*StorageImpl) Count

func (s *StorageImpl) Count(key string) (int64, error)

Count returns number of different entries under the key (generally being path prefix).

func (*StorageImpl) Create

func (s *StorageImpl) Create(ctx context.Context, key string, obj, metaOut runtime.Object, _ uint64) error

Create adds a new object at a key even when it already exists. 'ttl' is time-to-live in seconds (and is ignored). If no error is returned and out is not nil, out will be set to the read value from database.

func (*StorageImpl) Delete

Delete removes the specified key and returns the value that existed at that spot. If key didn't exist, it will return NotFound storage error. If 'cachedExistingObject' is non-nil, it can be used as a suggestion about the current version of the object to avoid read operation from storage to get it. However, the implementations have to retry in case suggestion is stale.

func (*StorageImpl) Get

func (s *StorageImpl) Get(ctx context.Context, key string, opts storage.GetOptions, objPtr runtime.Object) error

Get unmarshals object found at key into objPtr. On a not found error, will either return a zero object of the requested type, or an error, depending on 'opts.ignoreNotFound'. Treats empty responses and nil response nodes exactly like a not found error. The returned contents may be delayed, but it is guaranteed that they will match 'opts.ResourceVersion' according 'opts.ResourceVersionMatch'.

func (*StorageImpl) GetByCluster added in v0.0.18

func (s *StorageImpl) GetByCluster(ctx context.Context, apiVersion, kind string, listObj runtime.Object) error

GetByCluster returns all objects in a given cluster, given their api version and kind.

func (*StorageImpl) GetByNamespace added in v0.0.18

func (s *StorageImpl) GetByNamespace(ctx context.Context, apiVersion, kind, namespace string, listObj runtime.Object) error

GetByNamespace returns all objects in a given namespace, given their api version and kind.

func (*StorageImpl) GetClusterScopedResource added in v0.0.44

func (s *StorageImpl) GetClusterScopedResource(ctx context.Context, apiVersion, kind string, listObj runtime.Object) error

GetClusterScopedResource returns all objects in a given cluster, given their api version and kind.

func (*StorageImpl) GetList

func (s *StorageImpl) GetList(ctx context.Context, key string, _ storage.ListOptions, listObj runtime.Object) error

GetList unmarshalls objects found at key into a *List api object (an object that satisfies runtime.IsList definition). If 'opts.Recursive' is false, 'key' is used as an exact match. If `opts.Recursive' is true, 'key' is used as a prefix. The returned contents may be delayed, but it is guaranteed that they will match 'opts.ResourceVersion' according 'opts.ResourceVersionMatch'.

func (*StorageImpl) GuaranteedUpdate

func (s *StorageImpl) GuaranteedUpdate(
	ctx context.Context, key string, metaOut runtime.Object, ignoreNotFound bool,
	preconditions *storage.Preconditions, tryUpdate storage.UpdateFunc, cachedExistingObject runtime.Object) error

GuaranteedUpdate keeps calling 'tryUpdate()' to update key 'key' (of type 'destination') retrying the update until success if there is index conflict. Note that object passed to tryUpdate may change across invocations of tryUpdate() if other writers are simultaneously updating it, so tryUpdate() needs to take into account the current contents of the object when deciding how the update object should look. If the key doesn't exist, it will return NotFound storage error if ignoreNotFound=false else `destination` will be set to the zero value of it's type. If the eventual successful invocation of `tryUpdate` returns an output with the same serialized contents as the input, it won't perform any update, but instead set `destination` to an object with those contents. If 'cachedExistingObject' is non-nil, it can be used as a suggestion about the current version of the object to avoid read operation from storage to get it. However, the implementations have to retry in case suggestion is stale.

Example:

s := /* implementation of Interface */ err := s.GuaranteedUpdate(

 "myKey", &MyType{}, true, preconditions,
 func(input runtime.Object, res ResponseMeta) (runtime.Object, *uint64, error) {
   // Before each invocation of the user defined function, "input" is reset to
   // current contents for "myKey" in database.
   curr := input.(*MyType)  // Guaranteed to succeed.

   // Make the modification
   curr.Counter++

   // Return the modified object - return an error to stop iterating. Return
   // a uint64 to alter the TTL on the object, or nil to keep it the same value.
   return cur, nil, nil
}, cachedExistingObject

)

func (*StorageImpl) RequestWatchProgress added in v0.0.42

func (s *StorageImpl) RequestWatchProgress(context.Context) error

RequestWatchProgress fulfills the storage.Interface

Its function is only relevant to etcd.

func (*StorageImpl) Versioner

func (s *StorageImpl) Versioner() storage.Versioner

Versioner Returns Versioner associated with this interface.

func (*StorageImpl) Watch

Watch begins watching the specified key. Events are decoded into API objects, and any items selected by 'p' are sent down to returned watch.Interface. resourceVersion may be used to specify what version to begin watching, which should be the current resourceVersion, and no longer rv+1 (e.g. reconnecting without missing any updates). If resource version is "0", this interface will get current object at given key and send it in an "ADDED" event, before watch starts.

type StorageQuerier added in v0.0.18

type StorageQuerier interface {
	storage.Interface
	GetByNamespace(ctx context.Context, apiVersion, kind, namespace string, listObj runtime.Object) error
	GetByCluster(ctx context.Context, apiVersion, kind string, listObj runtime.Object) error
	GetClusterScopedResource(ctx context.Context, apiVersion, kind string, listObj runtime.Object) error
}

StorageQuerier wraps the storage.Interface and adds some extra methods which are used by the storage implementation.

func NewStorageImpl

func NewStorageImpl(appFs afero.Fs, root string) StorageQuerier

func NewStorageImplWithCollector added in v0.0.66

func NewStorageImplWithCollector(appFs afero.Fs, root string, processor Processor) StorageQuerier

type Stringer added in v0.0.66

type Stringer interface {
	String() string
}

type VulnerabilitySummaryStorage added in v0.0.20

type VulnerabilitySummaryStorage struct {
	// contains filtered or unexported fields
}

VulnerabilitySummaryStorage implements a storage for vulnerability summaries.

It provides vulnerability summaries for scopes like namespace and cluster. To get these summaries, the storage fetches existing stored VulnerabilitySummary objects and aggregates them on the fly.

func (VulnerabilitySummaryStorage) Count added in v0.0.20

func (VulnerabilitySummaryStorage) Count(key string) (int64, error)

Count is not supported for immutable objects. Objects are generated on the fly and not stored.

func (VulnerabilitySummaryStorage) Create added in v0.0.20

func (VulnerabilitySummaryStorage) Create(ctx context.Context, key string, obj, out runtime.Object, _ uint64) error

Create is not supported for immutable objects. Objects are generated on the fly and not stored.

func (VulnerabilitySummaryStorage) Delete added in v0.0.20

func (VulnerabilitySummaryStorage) Delete(ctx context.Context, key string, out runtime.Object, _ *storage.Preconditions, _ storage.ValidateObjectFunc, _ runtime.Object) error

Delete is not supported for immutable objects. Objects are generated on the fly and not stored.

func (*VulnerabilitySummaryStorage) Get added in v0.0.20

func (*VulnerabilitySummaryStorage) GetList added in v0.0.20

func (VulnerabilitySummaryStorage) GuaranteedUpdate added in v0.0.20

func (VulnerabilitySummaryStorage) GuaranteedUpdate(_ context.Context, key string, _ runtime.Object, _ bool, _ *storage.Preconditions, _ storage.UpdateFunc, _ runtime.Object) error

GuaranteedUpdate is not supported for immutable objects. Objects are generated on the fly and not stored.

func (VulnerabilitySummaryStorage) RequestWatchProgress added in v0.0.42

func (VulnerabilitySummaryStorage) RequestWatchProgress(context.Context) error

RequestWatchProgress fulfills the storage.Interface

It’s function is only relevant to etcd.

func (VulnerabilitySummaryStorage) Versioner added in v0.0.20

func (VulnerabilitySummaryStorage) Versioner() storage.Versioner

Versioner Returns fixed versioner associated with this interface.

func (VulnerabilitySummaryStorage) Watch added in v0.0.20

func (VulnerabilitySummaryStorage) Watch(ctx context.Context, key string, _ storage.ListOptions) (watch.Interface, error)

Watch is not supported for immutable objects. Objects are generated on the fly and not stored.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL