resource

package
v0.0.0-...-81e7916 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EDPMeasurement

type EDPMeasurement struct {
	VMTypes            []VMType           `json:"vm_types"            validate:"required"`
	ProvisionedCPUs    int                `json:"provisioned_cpus"    validate:"numeric"`
	ProvisionedRAMGb   float64            `json:"provisioned_ram_gb"  validate:"numeric"`
	ProvisionedVolumes ProvisionedVolumes `json:"provisioned_volumes" validate:"required"`
}

type EDPMeasurementConverter

type EDPMeasurementConverter interface {
	// EDP updates the EDPRecord with the measure. All billing logic such as conversion to storage / cpu / memory units must be done here.
	// As the EDPRecord is not time dependent, the duration is not passed.
	EDP() (EDPMeasurement, error)
}

type ProvisionedVolumes

type ProvisionedVolumes struct {
	SizeGbTotal   int64 `json:"size_gb_total"   validate:"numeric"`
	Count         int   `json:"count"           validate:"numeric"`
	SizeGbRounded int64 `json:"size_gb_rounded" validate:"numeric"`
}

type ScanConverter

type ScanConverter interface {
	UMMeasurementConverter
	EDPMeasurementConverter
}

type Scanner

type Scanner interface {
	// ScanConverter returns the measure for the given clusterid. If an error occurs, the measure is nil.
	// The scan is time dependent and should be taken at the time of the call.
	// The scanner is responsible for exposing metrics about the values retrieved. All scanners should follow a similar pattern.
	// These metrics are just for informational purposes and must not be used for alerting or billing.
	Scan(ctx context.Context, runtime *runtime.Info) (ScanConverter, error)

	// ID returns the ID of the scanner. This name is used to identify the measure in the record.
	ID() ScannerID
}

Scanner is an interface for measuring a specific resource related to a single cluster.

type ScannerID

type ScannerID string

type UMMeasurement

type UMMeasurement struct{}

type UMMeasurementConverter

type UMMeasurementConverter interface {
	// UM returns the measurement data required for creating a unified metering record
	// The duration is the time passed since the last measure was taken.
	UM(duration time.Duration) (UMMeasurement, error)
}

type VMType

type VMType struct {
	Name  string `json:"name"  validate:"required"`
	Count int    `json:"count" validate:"numeric"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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