inventory

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	VPCStore
	VMStore
}

type Inventory

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

func InitInventory

func InitInventory() *Inventory

InitInventory creates an instance of Inventory struct and initializes inventory with cache indexers.

func (*Inventory) BuildVmCache

func (i *Inventory) BuildVmCache(discoveredVmMap map[string]*runtimev1alpha1.VirtualMachine, accountNamespacedName *types.NamespacedName,
	selectorNamespacedName *types.NamespacedName)

BuildVmCache builds vm cache for given account using vm list fetched from cloud.

func (*Inventory) BuildVpcCache

func (i *Inventory) BuildVpcCache(discoveredVpcMap map[string]*runtimev1alpha1.Vpc,
	namespacedName *types.NamespacedName) error

BuildVpcCache builds vpc cache for given account using vpc list fetched from cloud.

func (*Inventory) DeleteAllVmsFromCache added in v0.6.0

func (i *Inventory) DeleteAllVmsFromCache(accountNamespacedName *types.NamespacedName) error

DeleteAllVmsFromCache deletes all entries from vm cache for a given account.

func (*Inventory) DeleteVmsFromCache

func (i *Inventory) DeleteVmsFromCache(accountNamespacedName *types.NamespacedName,
	selectorNamespacedName *types.NamespacedName) error

DeleteVmsFromCache deletes all entries from vm cache for a given selector.

func (*Inventory) DeleteVpcsFromCache

func (i *Inventory) DeleteVpcsFromCache(namespacedName *types.NamespacedName) error

DeleteVpcsFromCache deletes all entries from vpc cache for a given account.

func (*Inventory) GetAllVms

func (i *Inventory) GetAllVms() []interface{}

GetAllVms returns all the vms from the vm cache.

func (*Inventory) GetAllVpcs

func (i *Inventory) GetAllVpcs() []interface{}

GetAllVpcs returns all the vpcs from the vpc cache.

func (*Inventory) GetVmByKey

func (i *Inventory) GetVmByKey(key string) (*runtimev1alpha1.VirtualMachine, bool)

GetVmByKey returns vm from vm cache for a given key (namespace/name).

func (*Inventory) GetVmFromIndexer

func (i *Inventory) GetVmFromIndexer(indexName string, indexedValue string) ([]interface{}, error)

GetVmFromIndexer returns vms matching the indexedValue for the requested indexName.

func (*Inventory) GetVpcsFromIndexer

func (i *Inventory) GetVpcsFromIndexer(indexName string, indexedValue string) ([]interface{}, error)

GetVpcsFromIndexer returns vpcs matching the indexedValue for the requested indexName.

func (*Inventory) UpdateVm added in v0.6.0

func (i *Inventory) UpdateVm(vm *runtimev1alpha1.VirtualMachine) error

UpdateVm updates virtual machine object in vm cache.

func (*Inventory) WatchVms

func (i *Inventory) WatchVms(ctx context.Context, key string, labelSelector labels.Selector,
	fieldSelector fields.Selector) (watch.Interface, error)

WatchVms returns a Watch interface of vm cache.

func (*Inventory) WatchVpcs

func (i *Inventory) WatchVpcs(ctx context.Context, key string, labelSelector labels.Selector,
	fieldSelector fields.Selector) (watch.Interface, error)

WatchVpcs returns a Watch interface of vpc.

type VMStore

type VMStore interface {
	// BuildVmCache builds the vm cache using discoveredVmMap.
	BuildVmCache(discoveredVmMap map[string]*runtimev1alpha1.VirtualMachine, accountNamespacedName *types.NamespacedName,
		selectorNamespacedName *types.NamespacedName)

	// DeleteAllVmsFromCache deletes all vms from the cache for a given account.
	DeleteAllVmsFromCache(accountNamespacedName *types.NamespacedName) error

	// DeleteVmsFromCache deletes all vms from the cache for a given selector.
	DeleteVmsFromCache(accountNamespacedName *types.NamespacedName, selectorNamespacedName *types.NamespacedName) error

	// GetVmFromIndexer gets all vms from the cache that have a matching index value.
	GetVmFromIndexer(indexName string, indexedValue string) ([]interface{}, error)

	// GetAllVms gets all vms from the cache.
	GetAllVms() []interface{}

	// GetVmByKey gets the vm that matches the given key.
	GetVmByKey(key string) (*runtimev1alpha1.VirtualMachine, bool)

	// WatchVms returns a watch interface on the vm cache for the given selectors.
	WatchVms(ctx context.Context, key string, labelSelector labels.Selector, fieldSelector fields.Selector) (watch.Interface, error)

	// UpdateVm updates virtual machine object in vm cache.
	UpdateVm(vm *runtimev1alpha1.VirtualMachine) error
}

type VPCStore

type VPCStore interface {
	// BuildVpcCache builds the vpc cache using discoveredVpcMap.
	BuildVpcCache(discoveredVpcMap map[string]*runtimev1alpha1.Vpc, namespacedName *types.NamespacedName) error

	// DeleteVpcsFromCache deletes all vpcs from the cache.
	DeleteVpcsFromCache(namespacedName *types.NamespacedName) error

	// GetVpcsFromIndexer gets all vpcs from the cache that have a matching index value.
	GetVpcsFromIndexer(indexName string, indexedValue string) ([]interface{}, error)

	// GetAllVpcs gets all vpcs from the cache.
	GetAllVpcs() []interface{}

	// WatchVpcs returns a watch interface on the vpc cache for the given selectors.
	WatchVpcs(ctx context.Context, key string, labelSelector labels.Selector, fieldSelector fields.Selector) (watch.Interface, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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