service

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SourceTypeAgent     string = "agent"
	SourceTypeInventory string = "inventory"
	SourceTypeRvtools   string = "rvtools"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentService

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

func NewAgentService

func NewAgentService(store store.Store) *AgentService

func (*AgentService) UpdateAgentStatus

func (as *AgentService) UpdateAgentStatus(ctx context.Context, updateForm mappers.AgentUpdateForm) (*model.Agent, bool, error)

UpdateAgentStatus updates or creates a new agent resource If the source has not agent than the agent is created.

func (*AgentService) UpdateSourceInventory

func (as *AgentService) UpdateSourceInventory(ctx context.Context, updateForm mappers.InventoryUpdateForm) (*model.Source, error)

UpdateSourceInventory updates source inventory

This implements the SingleModel logic: - Only updates for a single vCenterID are allowed - allow two agents trying to update the source with same vCenterID - don't allow updates from agents not belonging to the source - don't allow updates if source is missing. (i.g the source is created as per MultiSource logic). It fails anyway because an agent always has a source. - if the source has no inventory yet, set the vCenterID and AssociatedAgentID to this source.

type AssessmentFilter

type AssessmentFilter struct {
	OrgID    string
	Source   string
	SourceID string
	NameLike string
	Limit    int
	Offset   int
}

AssessmentFilter represents filtering options for listing assessments

func NewAssessmentFilter

func NewAssessmentFilter(orgID string) *AssessmentFilter

func (*AssessmentFilter) WithLimit

func (f *AssessmentFilter) WithLimit(limit int) *AssessmentFilter

func (*AssessmentFilter) WithNameLike

func (f *AssessmentFilter) WithNameLike(pattern string) *AssessmentFilter

func (*AssessmentFilter) WithOffset

func (f *AssessmentFilter) WithOffset(offset int) *AssessmentFilter

func (*AssessmentFilter) WithSource

func (f *AssessmentFilter) WithSource(source string) *AssessmentFilter

func (*AssessmentFilter) WithSourceID

func (f *AssessmentFilter) WithSourceID(sourceID string) *AssessmentFilter

type AssessmentService

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

func NewAssessmentService

func NewAssessmentService(store store.Store, opaValidator *opa.Validator) *AssessmentService

func (*AssessmentService) CreateAssessment

func (as *AssessmentService) CreateAssessment(ctx context.Context, createForm mappers.AssessmentCreateForm) (*model.Assessment, error)

func (*AssessmentService) DeleteAssessment

func (as *AssessmentService) DeleteAssessment(ctx context.Context, id uuid.UUID) error

func (*AssessmentService) GetAssessment

func (as *AssessmentService) GetAssessment(ctx context.Context, id uuid.UUID) (*model.Assessment, error)

func (*AssessmentService) ListAssessments

func (as *AssessmentService) ListAssessments(ctx context.Context, filter *AssessmentFilter) ([]model.Assessment, error)

func (*AssessmentService) UpdateAssessment

func (as *AssessmentService) UpdateAssessment(ctx context.Context, id uuid.UUID, name *string) (*model.Assessment, error)

type ErrAgentUpdateForbidden

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

func NewErrAgentUpdateForbidden

func NewErrAgentUpdateForbidden(sourceID, agentID uuid.UUID) *ErrAgentUpdateForbidden

type ErrAssessmentCreationForbidden

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

func NewErrAssessmentCreationForbidden

func NewErrAssessmentCreationForbidden(sourceID uuid.UUID) *ErrAssessmentCreationForbidden

type ErrExcelFileNotValid

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

func NewErrExcelFileNotValid

func NewErrExcelFileNotValid() *ErrExcelFileNotValid

type ErrInvalidVCenterID

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

func NewErrInvalidVCenterID

func NewErrInvalidVCenterID(sourceID uuid.UUID, vCenterID string) *ErrInvalidVCenterID

type ErrResourceNotFound

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

func NewErrAgentNotFound

func NewErrAgentNotFound(id uuid.UUID) *ErrResourceNotFound

func NewErrAssessmentNotFound

func NewErrAssessmentNotFound(id uuid.UUID) *ErrResourceNotFound

func NewErrResourceNotFound

func NewErrResourceNotFound(id uuid.UUID, resourceType string) *ErrResourceNotFound

func NewErrSourceNotFound

func NewErrSourceNotFound(id uuid.UUID) *ErrResourceNotFound

type ErrSourceHasNoInventory

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

func NewErrSourceHasNoInventory

func NewErrSourceHasNoInventory(sourceID uuid.UUID) *ErrSourceHasNoInventory

type SourceFilter

type SourceFilter struct {
	OrgID string
	ID    uuid.UUID
}

func NewSourceFilter

func NewSourceFilter(filters ...SourceFilterFunc) *SourceFilter

func (*SourceFilter) WithOption

func (s *SourceFilter) WithOption(o SourceFilterFunc) *SourceFilter

type SourceFilterFunc

type SourceFilterFunc func(s *SourceFilter)

func WithOrgID

func WithOrgID(orgID string) SourceFilterFunc

func WithSourceID

func WithSourceID(id uuid.UUID) SourceFilterFunc

type SourceService

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

func NewSourceService

func NewSourceService(store store.Store, opaValidator *opa.Validator) *SourceService

func (*SourceService) CreateSource

func (s *SourceService) CreateSource(ctx context.Context, sourceForm mappers.SourceCreateForm) (model.Source, error)

func (*SourceService) DeleteSource

func (s *SourceService) DeleteSource(ctx context.Context, id uuid.UUID) error

func (*SourceService) DeleteSources

func (s *SourceService) DeleteSources(ctx context.Context) error

func (*SourceService) GetSource

func (s *SourceService) GetSource(ctx context.Context, id uuid.UUID) (*model.Source, error)

func (*SourceService) GetSourceDownloadURL

func (s *SourceService) GetSourceDownloadURL(ctx context.Context, id uuid.UUID) (string, time.Time, error)

TODO should be moved to ImageService (to be created)

func (*SourceService) ListSources

func (s *SourceService) ListSources(ctx context.Context, filter *SourceFilter) ([]model.Source, error)

func (*SourceService) UpdateInventory

func (s *SourceService) UpdateInventory(ctx context.Context, form mappers.InventoryUpdateForm) (model.Source, error)

func (*SourceService) UpdateSource

func (s *SourceService) UpdateSource(ctx context.Context, id uuid.UUID, form mappers.SourceUpdateForm) (*model.Source, error)

func (*SourceService) UploadRvtoolsFile

func (s *SourceService) UploadRvtoolsFile(ctx context.Context, sourceID uuid.UUID, reader io.Reader) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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