provider

package module
v0.0.0-...-cc58253 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetDiscoverer

type AssetDiscoverer interface {
	Chan() chan apitypes.AssetType
	Err() error
}

AssetDiscoverer is used to discover assets in a buffered manner.

type Discoverer

type Discoverer interface {
	// DiscoverAssets returns AssetDiscoverer.
	// It is the responsibility of DiscoverAssets to feed the AssetDiscoverer channel with assets, and to close the channel when done.
	// In addition, any error should be reported on the AssetDiscoverer error part.
	DiscoverAssets(ctx context.Context) AssetDiscoverer
}

type Estimator

type Estimator interface {
	// Estimate returns Estimation containing asset scan estimation data according to the AssetScanTemplate.
	// The cost estimation takes into account all the resources that are being used during a scan, and includes a detailed bill of the cost of each resource.
	// If AssetScanTemplate contains several input paths to scan, the cost will be calculated for each input and will be summed up to a total cost.
	// When exists, the scan size and scan time will be taken from the AssetScanStats. Otherwise, they will be estimated base on lab tests and Asset volume size.
	Estimate(context.Context, apitypes.AssetScanStats, *apitypes.Asset, *apitypes.AssetScanTemplate) (*apitypes.Estimation, error)
}

Estimator estimates asset scans cost, time and size without running any asset scan.

type FatalError

type FatalError struct {
	Err error
}

func FatalErrorf

func FatalErrorf(tmpl string, parts ...interface{}) FatalError

func (FatalError) Error

func (e FatalError) Error() string

func (FatalError) RetryAfter

func (e FatalError) RetryAfter() time.Duration

func (FatalError) Retryable

func (e FatalError) Retryable() bool

func (FatalError) Unwrap

func (e FatalError) Unwrap() error

type Provider

type Provider interface {
	// Kind returns apitypes.CloudProvider
	Kind() apitypes.CloudProvider

	Discoverer
	Estimator
	Scanner
}

type RetryableError

type RetryableError struct {
	Err   error
	After time.Duration
}

func RetryableErrorf

func RetryableErrorf(d time.Duration, tmpl string, parts ...interface{}) RetryableError

func (RetryableError) Error

func (e RetryableError) Error() string

func (RetryableError) RetryAfter

func (e RetryableError) RetryAfter() time.Duration

func (RetryableError) Retryable

func (e RetryableError) Retryable() bool

func (RetryableError) Unwrap

func (e RetryableError) Unwrap() error

type ScanJobConfig

type ScanJobConfig struct {
	ScannerImage     string // Scanner Container Image to use containing the vmclarity-cli and tools
	ScannerCLIConfig string // Scanner CLI config yaml (families config yaml)
	VMClarityAddress string // The backend address for the scanner CLI to export too

	ScanMetadata
	apitypes.ScannerInstanceCreationConfig
	apitypes.Asset
}

type ScanMetadata

type ScanMetadata struct {
	ScanID      string
	AssetScanID string
	AssetID     string
}

type Scanner

type Scanner interface {
	// RunAssetScan is a non-blocking call which takes a ScanJobConfig and creates resources for performing Scan.
	// It may return FatalError or RetryableError to indicate if the error is permanent or transient.
	// It is expected to return RetryableError in case the resources are not ready or are still being created.
	// It must return nil if all the resources are created and ready.
	// It also must be idempotent.
	RunAssetScan(context.Context, *ScanJobConfig) error
	// RemoveAssetScan is a non-blocking call which takes a ScanJobConfig and remove resources created for Scan.
	// It may return FatalError or RetryableError to indicate if the error is permanent or transient.
	// It is expected to return RetryableError in case the resources are still being deleted.
	// It must return nil if all the resources are deleted.
	// It also must be idempotent.
	RemoveAssetScan(context.Context, *ScanJobConfig) error
}

type SimpleAssetDiscoverer

type SimpleAssetDiscoverer struct {
	OutputChan chan apitypes.AssetType
	Error      error
}

func NewSimpleAssetDiscoverer

func NewSimpleAssetDiscoverer() *SimpleAssetDiscoverer

func (*SimpleAssetDiscoverer) Chan

func (ad *SimpleAssetDiscoverer) Chan() chan apitypes.AssetType

func (*SimpleAssetDiscoverer) Err

func (ad *SimpleAssetDiscoverer) Err() error

Jump to

Keyboard shortcuts

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