scanestimation

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecondsInAMonth = 86400 * 30
	SecondsInAnHour = 60 * 60
	MBInGB          = 1000
)
View Source
const (
	Snapshot           recipeResource = "Snapshot"
	ScannerInstance    recipeResource = "ScannerInstance"
	VolumeFromSnapshot recipeResource = "VolumeFromSnapshot"
	ScannerRootVolume  recipeResource = "ScannerRootVolume"
	DataTransfer       recipeResource = "DataTransfer"
)

Variables

View Source
var FamilyScanDurationsMap = map[familiestypes.FamilyType]*common.LogarithmicFormula{
	familiestypes.SBOM:             common.MustLogarithmicFit(scanSizesGB, []float64{0.01, 11, 37}),
	familiestypes.Vulnerabilities:  common.MustLogarithmicFit(scanSizesGB, []float64{0.01, 1, 11}),
	familiestypes.Secrets:          common.MustLogarithmicFit(scanSizesGB, []float64{0.01, 720, 1320}),
	familiestypes.Exploits:         common.MustLogarithmicFit(scanSizesGB, []float64{0, 0, 0}),
	familiestypes.Rootkits:         common.MustLogarithmicFit(scanSizesGB, []float64{0, 0, 0}),
	familiestypes.Misconfiguration: common.MustLogarithmicFit(scanSizesGB, []float64{0.01, 4, 5}),
	familiestypes.Malware:          common.MustLogarithmicFit(scanSizesGB, []float64{0.01, 840, 2460}),
}

FamilyScanDurationsMap Calculate the logarithmic fit of each family base on static measurements of family scan duration in seconds per scanSizesGB value. The tests were made on a t2.large instance with a gp2 volume. The times correspond to the scan size values in scanSizesGB. TODO add infoFinder family stats. nolint:mnd

Functions

This section is empty.

Types

type EstimateAssetScanParams

type EstimateAssetScanParams struct {
	SourceRegion            string
	DestRegion              string
	ScannerVolumeType       ec2types.VolumeType
	FromSnapshotVolumeType  ec2types.VolumeType
	ScannerInstanceType     ec2types.InstanceType
	JobCreationTimeSec      int64
	ScannerRootVolumeSizeGB int64
	Stats                   apitypes.AssetScanStats
	Asset                   *apitypes.Asset
	AssetScanTemplate       *apitypes.AssetScanTemplate
}

type MarketOption

type MarketOption string
const (
	MarketOptionSpot     MarketOption = "Spot"
	MarketOptionOnDemand MarketOption = "OnDemand"
)

type PriceFetcher

type PriceFetcher interface {
	GetSnapshotMonthlyCostPerGB(ctx context.Context, regionCode string) (float64, error)
	GetVolumeMonthlyCostPerGB(ctx context.Context, regionCode string, volumeType ec2types.VolumeType) (float64, error)
	GetDataTransferCostPerGB(sourceRegion, destRegion string) (float64, error)
	GetInstancePerHourCost(ctx context.Context, regionCode string, instanceType ec2types.InstanceType, marketOption MarketOption) (float64, error)
}

type PriceFetcherImpl

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

func (*PriceFetcherImpl) GetDataTransferCostPerGB

func (o *PriceFetcherImpl) GetDataTransferCostPerGB(sourceRegion, destRegion string) (float64, error)

func (*PriceFetcherImpl) GetInstancePerHourCost

func (o *PriceFetcherImpl) GetInstancePerHourCost(ctx context.Context, regionCode string, instanceType ec2types.InstanceType, marketOption MarketOption) (float64, error)

func (*PriceFetcherImpl) GetSnapshotMonthlyCostPerGB

func (o *PriceFetcherImpl) GetSnapshotMonthlyCostPerGB(ctx context.Context, regionCode string) (float64, error)

func (*PriceFetcherImpl) GetVolumeMonthlyCostPerGB

func (o *PriceFetcherImpl) GetVolumeMonthlyCostPerGB(ctx context.Context, regionCode string, volumeType ec2types.VolumeType) (float64, error)

type ScanEstimator

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

func New

func New(pricingClient *pricing.Client, ec2Client *ec2.Client) *ScanEstimator

func (*ScanEstimator) EstimateAssetScan

func (s *ScanEstimator) EstimateAssetScan(ctx context.Context, params EstimateAssetScanParams) (*apitypes.Estimation, error)

nolint:cyclop

Jump to

Keyboard shortcuts

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