Documentation
¶
Index ¶
- Constants
- type AgentService
- type AssessmentFilter
- func (f *AssessmentFilter) WithLimit(limit int) *AssessmentFilter
- func (f *AssessmentFilter) WithNameLike(pattern string) *AssessmentFilter
- func (f *AssessmentFilter) WithOffset(offset int) *AssessmentFilter
- func (f *AssessmentFilter) WithSource(source string) *AssessmentFilter
- func (f *AssessmentFilter) WithSourceID(sourceID string) *AssessmentFilter
- type AssessmentService
- func (as *AssessmentService) CreateAssessment(ctx context.Context, createForm mappers.AssessmentCreateForm) (*model.Assessment, error)
- func (as *AssessmentService) DeleteAssessment(ctx context.Context, id uuid.UUID) error
- func (as *AssessmentService) GetAssessment(ctx context.Context, id uuid.UUID) (*model.Assessment, error)
- func (as *AssessmentService) ListAssessments(ctx context.Context, filter *AssessmentFilter) ([]model.Assessment, error)
- func (as *AssessmentService) UpdateAssessment(ctx context.Context, id uuid.UUID, name *string) (*model.Assessment, error)
- type ErrAgentUpdateForbidden
- type ErrAssessmentCreationForbidden
- type ErrExcelFileNotValid
- type ErrInvalidVCenterID
- type ErrResourceNotFound
- type ErrSourceHasNoInventory
- type SourceFilter
- type SourceFilterFunc
- type SourceService
- func (s *SourceService) CreateSource(ctx context.Context, sourceForm mappers.SourceCreateForm) (model.Source, error)
- func (s *SourceService) DeleteSource(ctx context.Context, id uuid.UUID) error
- func (s *SourceService) DeleteSources(ctx context.Context) error
- func (s *SourceService) GetSource(ctx context.Context, id uuid.UUID) (*model.Source, error)
- func (s *SourceService) GetSourceDownloadURL(ctx context.Context, id uuid.UUID) (string, time.Time, error)
- func (s *SourceService) ListSources(ctx context.Context, filter *SourceFilter) ([]model.Source, error)
- func (s *SourceService) UpdateInventory(ctx context.Context, form mappers.InventoryUpdateForm) (model.Source, error)
- func (s *SourceService) UpdateSource(ctx context.Context, id uuid.UUID, form mappers.SourceUpdateForm) (*model.Source, error)
- func (s *SourceService) UploadRvtoolsFile(ctx context.Context, sourceID uuid.UUID, reader io.Reader) error
Constants ¶
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 (*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 ¶
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 (*SourceService) DeleteSources ¶
func (s *SourceService) DeleteSources(ctx context.Context) 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)