collector

package
v0.0.0-...-63956fc Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ResourcePoolUUIDNamespace = "1993e743-ad11-447a-ae00-816e22a37f63"
	ResourceUUIDNamespace     = "e6501bad-6f4e-46b1-b4eb-f6952bf532e1"
	ResourceTypeUUIDNamespace = "2e300cf4-3c4c-4c9a-a34c-1985bf4b7c41"
)

Defines the UUID namespace values used to generated name based UUID values for inventory objects. These values are selected arbitrarily. TODO: move to somewhere more generic

Variables

This section is empty.

Functions

This section is empty.

Types

type ACMDataSource

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

ACMDataSource defines an instance of a data source collector that interacts with the ACM search-api

func (*ACMDataSource) GetDeploymentManagers

func (d *ACMDataSource) GetDeploymentManagers(ctx context.Context) ([]models.DeploymentManager, error)

GetDeploymentManagers returns the list of deployment managers for this data source

func (*ACMDataSource) GetGenerationID

func (d *ACMDataSource) GetGenerationID() int

GetGenerationID retrieves the current generation id for this data source.

func (*ACMDataSource) GetResourcePools

func (d *ACMDataSource) GetResourcePools(ctx context.Context) ([]models.ResourcePool, error)

GetResourcePools returns the list of resource pools available for this data source.

func (*ACMDataSource) GetResources

func (d *ACMDataSource) GetResources(ctx context.Context, _ []models.ResourcePool) ([]models.Resource, error)

GetResources returns the list of resources available for this data source. The resources to be retrieved can be scoped to a set of pools (currently not used by this data source)

func (*ACMDataSource) IncrGenerationID

func (d *ACMDataSource) IncrGenerationID() int

IncrGenerationID increments the current generation id for this data source.

func (*ACMDataSource) MakeResourceType

func (d *ACMDataSource) MakeResourceType(resource *models.Resource) (*models.ResourceType, error)

MakeResourceType creates an instance of a ResourceType from a Resource object.

func (*ACMDataSource) Name

func (d *ACMDataSource) Name() string

Name returns the name of this data source

func (*ACMDataSource) SetGenerationID

func (d *ACMDataSource) SetGenerationID(value int)

SetGenerationID sets the current generation id for this data source. This value is expected to be restored from persistent storage at initialization time.

func (*ACMDataSource) SetID

func (d *ACMDataSource) SetID(uuid uuid.UUID)

SetID sets the unique identifier for this data source

type Collector

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

Collector defines the attributes required by the collector implementation.

func NewCollector

func NewCollector(repo *repo.ResourcesRepository, dataSources []DataSource) *Collector

NewCollector creates a new collector instance

func (*Collector) Run

func (c *Collector) Run(ctx context.Context) error

Run executes the collector main loop to gather data from external sources and writing to the database

type DataSource

type DataSource interface {
	Name() string
	SetID(uuid.UUID)
	SetGenerationID(value int)
	GetGenerationID() int
	IncrGenerationID() int
	GetResourcePools(ctx context.Context) ([]models.ResourcePool, error)
	GetResources(ctx context.Context, pools []models.ResourcePool) ([]models.Resource, error)
	GetDeploymentManagers(ctx context.Context) ([]models.DeploymentManager, error)
	MakeResourceType(resource *models.Resource) (*models.ResourceType, error)
}

DataSource represents the operations required to be supported by any objects implementing a data collection backend.

func NewACMDataSource

func NewACMDataSource(cloudID, globalCloudID uuid.UUID, backendURL string, extensions []string) (DataSource, error)

NewACMDataSource creates a new instance of an ACM data source collector whose purpose is to collect data from the ACM search API to be included in the resource, resource pool, resource type, and deployment manager tables.

type GenericModelConverter

type GenericModelConverter func(object interface{}) any

GenericModelConverter converts a db model object into an API object and returns it as an `any` so that it can be used generically since the API model doesn't implement a base interface.

Jump to

Keyboard shortcuts

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