db

package
v0.0.0-...-318a3d5 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEventAlreadyExists = errors.New("event already exists")
View Source
var ErrNoEventFound = errors.New("no matching event found")

ErrNoEventFound indicates that no event could be found

View Source
var ErrProjectNameMustNotBeEmpty = errors.New("project name must not be empty")
View Source
var ErrSequenceIDMustNotBeEmpty = errors.New("sequence ID must not be empty")
View Source
var ErrStateAlreadyExists = errors.New("sequence state already exists")
View Source
var ErrUniformRegistrationAlreadyExists = errors.New("uniform integration already exists")
View Source
var ErrUniformRegistrationNotFound = errors.New("uniform integration not found")

Functions

func DecodeProjectKeys

func DecodeProjectKeys(project *apimodels.ExpandedProject) *apimodels.ExpandedProject

func DecodeProjectsKeys

func DecodeProjectsKeys(projects []*apimodels.ExpandedProject) ([]*apimodels.ExpandedProject, error)

func EncodeProjectKeys

func EncodeProjectKeys(project *apimodels.ExpandedProject) (*apimodels.ExpandedProject, error)

func NewProjectCredentialsRepo

func NewProjectCredentialsRepo(dbConnection *MongoDBConnection) *projectCredentialsRepo

func NewSecretCredentialsRepo

func NewSecretCredentialsRepo(secretStore secretstore.SecretStore) *secretCredentialsRepo

func SetupTTLIndex

func SetupTTLIndex(ctx context.Context, propertyName string, duration time.Duration, collection *mongo.Collection) error

func TransformGitCredentials

func TransformGitCredentials(project *models.ExpandedProjectOld) *apimodels.ExpandedProject

Types

type DBDumpRepo

type DBDumpRepo interface {
	GetDump(collectionName string) ([]bson.M, error)
	ListAllCollections() ([]string, error)
}

type EventQueueRepo

type EventQueueRepo interface {
	QueueEvent(item models.QueueItem) error
	GetQueuedEvents(timestamp time.Time) ([]models.QueueItem, error)
	IsEventInQueue(eventID string) (bool, error)
	IsSequenceOfEventPaused(eventScope models.EventScope) bool
	DeleteQueuedEvent(eventID string) error
	DeleteQueuedEvents(scope models.EventScope) error
	CreateOrUpdateEventQueueState(state models.EventQueueSequenceState) error
	GetEventQueueSequenceStates(filter models.EventQueueSequenceState) ([]models.EventQueueSequenceState, error)
	DeleteEventQueueStates(state models.EventQueueSequenceState) error
}

EventQueueRepo defines the interface for storing, retrieving and deleting queued events

type EventRepo

type EventRepo interface {
	GetEvents(project string, filter common.EventFilter, status ...common.EventStatus) ([]apimodels.KeptnContextExtendedCE, error)
	GetEventByID(project string, filter common.EventFilter, status ...common.EventStatus) (apimodels.KeptnContextExtendedCE, error)
	GetRootEvents(params models.GetRootEventParams) (*models.GetEventsResult, error)
	InsertEvent(project string, event apimodels.KeptnContextExtendedCE, status common.EventStatus) error
	DeleteEvent(project string, eventID string, status common.EventStatus) error
	DeleteEventCollections(project string) error
	GetStartedEventsForTriggeredID(eventScope models.EventScope) ([]apimodels.KeptnContextExtendedCE, error)
	GetEventsWithRetry(project string, filter common.EventFilter, status common.EventStatus, nrRetries int) ([]apimodels.KeptnContextExtendedCE, error)
	GetTaskSequenceTriggeredEvent(eventScope models.EventScope, taskSequenceName string) (*apimodels.KeptnContextExtendedCE, error)
	DeleteAllFinishedEvents(eventScope models.EventScope) error
	GetFinishedEvents(eventScope models.EventScope) ([]apimodels.KeptnContextExtendedCE, error)
}

type EventsRetriever

type EventsRetriever interface {
	GetEvents(filter *goutils.EventFilter) ([]*goutilsmodels.KeptnContextExtendedCE, *goutilsmodels.Error)
}

EventsRetriever defines the interface for fetching events from the data store

type LogRepo

type LogRepo interface {
	CreateLogEntries(entries []apimodels.LogEntry) error
	GetLogEntries(filter models.GetLogParams) (*models.GetLogsResponse, error)
	DeleteLogEntries(params models.DeleteLogParams) error
}

type MongoDBConnection

type MongoDBConnection struct {
	Client *mongo.Client
}

MongoDBConnection takes care of establishing a connection to the mongodb

func GetMongoDBConnectionInstance

func GetMongoDBConnectionInstance() *MongoDBConnection

func (*MongoDBConnection) EnsureDBConnection

func (m *MongoDBConnection) EnsureDBConnection() error

EnsureDBConnection makes sure a connection to the mongodb is established

type MongoDBDumpRepo

type MongoDBDumpRepo struct {
	DbConnection *MongoDBConnection
}

func NewMongoDBDumpRepo

func NewMongoDBDumpRepo(dbConnection *MongoDBConnection) *MongoDBDumpRepo

func (*MongoDBDumpRepo) GetDump

func (mdbrepo *MongoDBDumpRepo) GetDump(collectionName string) ([]bson.M, error)

func (*MongoDBDumpRepo) ListAllCollections

func (mdbrepo *MongoDBDumpRepo) ListAllCollections() ([]string, error)

type MongoDBEventQueueRepo

type MongoDBEventQueueRepo struct {
	DBConnection *MongoDBConnection
}

MongoDBEventQueueRepo retrieves and stores events in a mongodb collection

func NewMongoDBEventQueueRepo

func NewMongoDBEventQueueRepo(dbConnection *MongoDBConnection) *MongoDBEventQueueRepo

func (*MongoDBEventQueueRepo) CreateOrUpdateEventQueueState

func (m *MongoDBEventQueueRepo) CreateOrUpdateEventQueueState(state models.EventQueueSequenceState) error

func (*MongoDBEventQueueRepo) DeleteEventQueueStates

func (m *MongoDBEventQueueRepo) DeleteEventQueueStates(filter models.EventQueueSequenceState) error

func (*MongoDBEventQueueRepo) DeleteQueuedEvent

func (m *MongoDBEventQueueRepo) DeleteQueuedEvent(eventID string) error

DeleteQueuedEvent deletes a queue item from the collection

func (*MongoDBEventQueueRepo) DeleteQueuedEvents

func (m *MongoDBEventQueueRepo) DeleteQueuedEvents(scope models.EventScope) error

DeleteQueuedEvents deletes all matching queue items from the collection

func (*MongoDBEventQueueRepo) GetEventQueueSequenceStates

func (m *MongoDBEventQueueRepo) GetEventQueueSequenceStates(filter models.EventQueueSequenceState) ([]models.EventQueueSequenceState, error)

func (*MongoDBEventQueueRepo) GetQueuedEvents

func (m *MongoDBEventQueueRepo) GetQueuedEvents(timestamp time.Time) ([]models.QueueItem, error)

GetQueuedEvents gets all queued events that should be sent next

func (*MongoDBEventQueueRepo) IsEventInQueue

func (m *MongoDBEventQueueRepo) IsEventInQueue(eventID string) (bool, error)

func (*MongoDBEventQueueRepo) IsSequenceOfEventPaused

func (m *MongoDBEventQueueRepo) IsSequenceOfEventPaused(eventScope models.EventScope) bool

func (*MongoDBEventQueueRepo) QueueEvent

func (m *MongoDBEventQueueRepo) QueueEvent(item models.QueueItem) error

type MongoDBEventsRepo

type MongoDBEventsRepo struct {
	DBConnection *MongoDBConnection
}

MongoDBEventsRepo retrieves and stores events in a mongodb collection

func NewMongoDBEventsRepo

func NewMongoDBEventsRepo(dbConnection *MongoDBConnection) *MongoDBEventsRepo

func (*MongoDBEventsRepo) DeleteAllFinishedEvents

func (e *MongoDBEventsRepo) DeleteAllFinishedEvents(eventScope models.EventScope) error

func (*MongoDBEventsRepo) DeleteEvent

func (mdbrepo *MongoDBEventsRepo) DeleteEvent(project, eventID string, status common.EventStatus) error

DeleteEvent deletes an event from the collection

func (*MongoDBEventsRepo) DeleteEventCollections

func (mdbrepo *MongoDBEventsRepo) DeleteEventCollections(project string) error

DeleteEventCollections godoc

func (*MongoDBEventsRepo) GetEventByID

func (mdbrepo *MongoDBEventsRepo) GetEventByID(projectName string, filter common.EventFilter, status ...common.EventStatus) (apimodels.KeptnContextExtendedCE, error)

GetEventByID gets a single event of a project, based on the id

func (*MongoDBEventsRepo) GetEvents

func (mdbrepo *MongoDBEventsRepo) GetEvents(project string, filter common.EventFilter, status ...common.EventStatus) ([]apimodels.KeptnContextExtendedCE, error)

GetEvents gets all events of a project, based on the provided filter

func (*MongoDBEventsRepo) GetEventsWithRetry

func (e *MongoDBEventsRepo) GetEventsWithRetry(project string, filter common.EventFilter, status common.EventStatus, nrRetries int) ([]apimodels.KeptnContextExtendedCE, error)

func (*MongoDBEventsRepo) GetFinishedEvents

func (e *MongoDBEventsRepo) GetFinishedEvents(eventScope models.EventScope) ([]apimodels.KeptnContextExtendedCE, error)

func (*MongoDBEventsRepo) GetRootEvents

func (mdbrepo *MongoDBEventsRepo) GetRootEvents(getRootParams models.GetRootEventParams) (*models.GetEventsResult, error)

func (*MongoDBEventsRepo) GetStartedEventsForTriggeredID

func (e *MongoDBEventsRepo) GetStartedEventsForTriggeredID(eventScope models.EventScope) ([]apimodels.KeptnContextExtendedCE, error)

func (*MongoDBEventsRepo) GetTaskSequenceTriggeredEvent

func (e *MongoDBEventsRepo) GetTaskSequenceTriggeredEvent(eventScope models.EventScope, taskSequenceName string) (*apimodels.KeptnContextExtendedCE, error)

func (*MongoDBEventsRepo) InsertEvent

func (mdbrepo *MongoDBEventsRepo) InsertEvent(project string, event apimodels.KeptnContextExtendedCE, status common.EventStatus) error

InsertEvent inserts an event into the collection of the specified project

type MongoDBKeyEncodingProjectsRepo

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

MongoDBKeyEncodingProjectsRepo is a wrapper around a ProjectRepo which takes care of transforming the value of a project's LastEventTypes to not contain invalid characters like a dot (.)

func NewMongoDBKeyEncodingProjectsRepo

func NewMongoDBKeyEncodingProjectsRepo(dbConnection *MongoDBConnection) *MongoDBKeyEncodingProjectsRepo

func (*MongoDBKeyEncodingProjectsRepo) CreateProject

func (*MongoDBKeyEncodingProjectsRepo) DeleteProject

func (m *MongoDBKeyEncodingProjectsRepo) DeleteProject(projectName string) error

func (*MongoDBKeyEncodingProjectsRepo) GetProject

func (m *MongoDBKeyEncodingProjectsRepo) GetProject(projectName string) (*apimodels.ExpandedProject, error)

func (*MongoDBKeyEncodingProjectsRepo) GetProjects

func (*MongoDBKeyEncodingProjectsRepo) UpdateProject

func (*MongoDBKeyEncodingProjectsRepo) UpdateProjectService

func (m *MongoDBKeyEncodingProjectsRepo) UpdateProjectService(projectName, stageName, serviceName string, properties mvmodels.ServiceUpdate) error

func (*MongoDBKeyEncodingProjectsRepo) UpdateProjectUpstream

func (m *MongoDBKeyEncodingProjectsRepo) UpdateProjectUpstream(projectName string, uri string, user string) error

type MongoDBLogRepo

type MongoDBLogRepo struct {
	DbConnection *MongoDBConnection
	TheClock     clock.Clock
}

func NewMongoDBLogRepo

func NewMongoDBLogRepo(dbConnection *MongoDBConnection) *MongoDBLogRepo

func (*MongoDBLogRepo) CreateLogEntries

func (mdbrepo *MongoDBLogRepo) CreateLogEntries(entries []apimodels.LogEntry) error

func (*MongoDBLogRepo) DeleteLogEntries

func (mdbrepo *MongoDBLogRepo) DeleteLogEntries(params models.DeleteLogParams) error

func (*MongoDBLogRepo) GetLogEntries

func (mdbrepo *MongoDBLogRepo) GetLogEntries(params models.GetLogParams) (*models.GetLogsResponse, error)

func (*MongoDBLogRepo) SetupTTLIndex

func (mdbrepo *MongoDBLogRepo) SetupTTLIndex(duration time.Duration) error

type MongoDBProjectMVRepo

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

func NewProjectMVRepo

func NewProjectMVRepo(projectRepo ProjectRepo, eventRepo EventRepo, sequenceExecutionRepo SequenceExecutionRepo) *MongoDBProjectMVRepo

func (*MongoDBProjectMVRepo) CloseOpenRemediations

func (mv *MongoDBProjectMVRepo) CloseOpenRemediations(project, stage, service, keptnContext string) error

CloseOpenRemediations closes a open remediation actions for a given keptnContext

func (*MongoDBProjectMVRepo) CreateProject

func (mv *MongoDBProjectMVRepo) CreateProject(prj *apimodels.ExpandedProject) error

CreateProject creates a project

func (*MongoDBProjectMVRepo) CreateRemediation

func (mv *MongoDBProjectMVRepo) CreateRemediation(project, stage, service string, remediation *apimodels.Remediation) error

CreateRemediation creates a remediation action

func (*MongoDBProjectMVRepo) CreateService

func (mv *MongoDBProjectMVRepo) CreateService(project string, stage string, service string) error

CreateService creates a service

func (*MongoDBProjectMVRepo) CreateStage

func (mv *MongoDBProjectMVRepo) CreateStage(project string, stage string) error

CreateStage creates a stage

func (*MongoDBProjectMVRepo) DeleteProject

func (mv *MongoDBProjectMVRepo) DeleteProject(projectName string) error

DeleteProject deletes a project

func (*MongoDBProjectMVRepo) DeleteService

func (mv *MongoDBProjectMVRepo) DeleteService(project string, stage string, service string) error

DeleteService deletes a service

func (*MongoDBProjectMVRepo) DeleteStage

func (mv *MongoDBProjectMVRepo) DeleteStage(project string, stage string) error

DeleteStage deletes a stage

func (*MongoDBProjectMVRepo) DeleteUpstreamInfo

func (mv *MongoDBProjectMVRepo) DeleteUpstreamInfo(projectName string) error

DeleteUpstreamInfo deletes the Upstream Repository URL and git user of a project

func (*MongoDBProjectMVRepo) GetProject

func (mv *MongoDBProjectMVRepo) GetProject(projectName string) (*apimodels.ExpandedProject, error)

GetProject returns a project by its name

func (*MongoDBProjectMVRepo) GetProjects

func (mv *MongoDBProjectMVRepo) GetProjects() ([]*apimodels.ExpandedProject, error)

GetProjects returns all projects

func (*MongoDBProjectMVRepo) GetService

func (mv *MongoDBProjectMVRepo) GetService(projectName, stageName, serviceName string) (*apimodels.ExpandedService, error)

func (*MongoDBProjectMVRepo) OnSequenceTaskEvent

func (mv *MongoDBProjectMVRepo) OnSequenceTaskEvent(event apimodels.KeptnContextExtendedCE)

func (*MongoDBProjectMVRepo) UpdateEventOfService

func (mv *MongoDBProjectMVRepo) UpdateEventOfService(e apimodels.KeptnContextExtendedCE) error

UpdateEventOfService updates a service event

func (*MongoDBProjectMVRepo) UpdateProject

func (mv *MongoDBProjectMVRepo) UpdateProject(prj *apimodels.ExpandedProject) error

UpdateProject updates a project

func (*MongoDBProjectMVRepo) UpdateShipyard

func (mv *MongoDBProjectMVRepo) UpdateShipyard(projectName string, shipyardContent string) error

UpdateShipyard updates the shipyard of a project

func (*MongoDBProjectMVRepo) UpdateUpstreamInfo

func (mv *MongoDBProjectMVRepo) UpdateUpstreamInfo(projectName string, uri, user string) error

UpdateUpstreamInfo updates the Upstream Repository URL and git user of a project

func (*MongoDBProjectMVRepo) UpdatedShipyard

func (mv *MongoDBProjectMVRepo) UpdatedShipyard(projectName string, shipyard string) error

type MongoDBProjectsRepo

type MongoDBProjectsRepo struct {
	DBConnection *MongoDBConnection
}

func NewMongoDBProjectsRepo

func NewMongoDBProjectsRepo(dbConnection *MongoDBConnection) *MongoDBProjectsRepo

func (*MongoDBProjectsRepo) CreateProject

func (m *MongoDBProjectsRepo) CreateProject(project *apimodels.ExpandedProject) error

func (*MongoDBProjectsRepo) DeleteProject

func (m *MongoDBProjectsRepo) DeleteProject(projectName string) error

func (*MongoDBProjectsRepo) GetProject

func (m *MongoDBProjectsRepo) GetProject(projectName string) (*apimodels.ExpandedProject, error)

func (*MongoDBProjectsRepo) GetProjects

func (m *MongoDBProjectsRepo) GetProjects() ([]*apimodels.ExpandedProject, error)

func (*MongoDBProjectsRepo) UpdateProject

func (m *MongoDBProjectsRepo) UpdateProject(project *apimodels.ExpandedProject) error

func (*MongoDBProjectsRepo) UpdateProjectService

func (m *MongoDBProjectsRepo) UpdateProjectService(projectName, stageName, serviceName string, properties mvmodels.ServiceUpdate) error

func (*MongoDBProjectsRepo) UpdateProjectUpstream

func (m *MongoDBProjectsRepo) UpdateProjectUpstream(projectName string, uri string, user string) error

type MongoDBSequenceExecutionRepo

type MongoDBSequenceExecutionRepo struct {
	DbConnection *MongoDBConnection
	// ModelTransformer allows transforming sequence execution objects before storing and after retrieving to and from the database.
	// This is needed if the items for that collection should be stored in a different format while retaining its structure used outside the package
	ModelTransformer sequence_execution.ModelTransformer
}

func NewMongoDBSequenceExecutionRepo

func NewMongoDBSequenceExecutionRepo(dbConnection *MongoDBConnection, opts ...SequenceExecutionRepoOpt) *MongoDBSequenceExecutionRepo

func (*MongoDBSequenceExecutionRepo) AppendTaskEvent

func (mdbrepo *MongoDBSequenceExecutionRepo) AppendTaskEvent(taskSequence models.SequenceExecution, event models.TaskEvent) (*models.SequenceExecution, error)

AppendTaskEvent adds an event that is relevant to the execution of the current task. This function needs to be thread safe since it can potentially be invoked by multiple threads at the same time.

func (*MongoDBSequenceExecutionRepo) Clear

func (mdbrepo *MongoDBSequenceExecutionRepo) Clear(projectName string) error

Clear deletes the sequence execution collection of the given project

func (*MongoDBSequenceExecutionRepo) Get

Get returns all matching sequence executions, based on the given filter

func (*MongoDBSequenceExecutionRepo) GetByTriggeredID

func (mdbrepo *MongoDBSequenceExecutionRepo) GetByTriggeredID(project, triggeredID string) (*models.SequenceExecution, error)

GetByTriggeredID searches for a sequence execution with the given triggeredID.

func (*MongoDBSequenceExecutionRepo) GetPaginated

GetPaginated returns all matching sequence executions within the specified range, based on the given filter

func (*MongoDBSequenceExecutionRepo) IsContextPaused

func (mdbrepo *MongoDBSequenceExecutionRepo) IsContextPaused(eventScope models.EventScope) bool

IsContextPaused checks whether a sequence that belongs to the given Keptn Context is currently paused

func (*MongoDBSequenceExecutionRepo) PauseContext

func (mdbrepo *MongoDBSequenceExecutionRepo) PauseContext(eventScope models.EventScope) error

PauseContext pauses all sequence executions for the given Keptn Context

func (*MongoDBSequenceExecutionRepo) ResumeContext

func (mdbrepo *MongoDBSequenceExecutionRepo) ResumeContext(eventScope models.EventScope) error

ResumeContext resumes all sequence executions for the given Keptn Context

func (*MongoDBSequenceExecutionRepo) UpdateStatus

func (mdbrepo *MongoDBSequenceExecutionRepo) UpdateStatus(taskSequence models.SequenceExecution) (*models.SequenceExecution, error)

UpdateStatus is used to update the overall state of the sequence, e.g. when it was paused via the API. This will not update a complete sequence execution, but just the attributes representing the overall state of the sequence

func (*MongoDBSequenceExecutionRepo) Upsert

Upsert inserts or updates a sequence execution into the sequence execution collection. By setting the CheckUniqueTriggeredID of the upsertOptions to true, this function will return a ErrSequenceWithTriggeredIDAlreadyExists, if a sequence with the same triggeredID already exists (can be useful to avoid storing duplicate sequences).

type MongoDBSequenceQueueRepo

type MongoDBSequenceQueueRepo struct {
	DBConnection *MongoDBConnection
}

func NewMongoDBSequenceQueueRepo

func NewMongoDBSequenceQueueRepo(dbConnection *MongoDBConnection) *MongoDBSequenceQueueRepo

func (*MongoDBSequenceQueueRepo) DeleteQueuedSequences

func (sq *MongoDBSequenceQueueRepo) DeleteQueuedSequences(itemFilter models.QueueItem) error

func (*MongoDBSequenceQueueRepo) GetQueuedSequences

func (sq *MongoDBSequenceQueueRepo) GetQueuedSequences() ([]models.QueueItem, error)

func (*MongoDBSequenceQueueRepo) QueueSequence

func (sq *MongoDBSequenceQueueRepo) QueueSequence(item models.QueueItem) error

type MongoDBStateRepo

type MongoDBStateRepo struct {
	DBConnection *MongoDBConnection
}

func NewMongoDBStateRepo

func NewMongoDBStateRepo(dbConnection *MongoDBConnection) *MongoDBStateRepo

func (*MongoDBStateRepo) CreateSequenceState

func (mdbrepo *MongoDBStateRepo) CreateSequenceState(state models.SequenceState) error

func (*MongoDBStateRepo) DeleteSequenceStates

func (mdbrepo *MongoDBStateRepo) DeleteSequenceStates(filter models.StateFilter) error

func (*MongoDBStateRepo) FindSequenceStates

func (mdbrepo *MongoDBStateRepo) FindSequenceStates(filter models.StateFilter) (*models.SequenceStates, error)

func (*MongoDBStateRepo) GetSequenceStateByID

func (mdbrepo *MongoDBStateRepo) GetSequenceStateByID(filter models.StateFilter) (*models.SequenceState, error)

func (*MongoDBStateRepo) UpdateSequenceState

func (mdbrepo *MongoDBStateRepo) UpdateSequenceState(state models.SequenceState) error

type MongoDBUniformRepo

type MongoDBUniformRepo struct {
	DbConnection *MongoDBConnection
}

func NewMongoDBUniformRepo

func NewMongoDBUniformRepo(dbConnection *MongoDBConnection) *MongoDBUniformRepo

func (*MongoDBUniformRepo) CreateOrUpdateSubscription

func (mdbrepo *MongoDBUniformRepo) CreateOrUpdateSubscription(integrationID string, subscription apimodels.EventSubscription) error

func (*MongoDBUniformRepo) CreateOrUpdateUniformIntegration

func (mdbrepo *MongoDBUniformRepo) CreateOrUpdateUniformIntegration(integration apimodels.Integration) error

func (*MongoDBUniformRepo) CreateUniformIntegration

func (mdbrepo *MongoDBUniformRepo) CreateUniformIntegration(integration apimodels.Integration) error

func (*MongoDBUniformRepo) DeleteSubscription

func (mdbrepo *MongoDBUniformRepo) DeleteSubscription(integrationID, subscriptionID string) error

func (*MongoDBUniformRepo) DeleteUniformIntegration

func (mdbrepo *MongoDBUniformRepo) DeleteUniformIntegration(id string) error

func (*MongoDBUniformRepo) GetSubscription

func (mdbrepo *MongoDBUniformRepo) GetSubscription(integrationID, subscriptionID string) (*apimodels.EventSubscription, error)

func (*MongoDBUniformRepo) GetSubscriptions

func (mdbrepo *MongoDBUniformRepo) GetSubscriptions(integrationID string) ([]apimodels.EventSubscription, error)

func (*MongoDBUniformRepo) GetUniformIntegrations

func (mdbrepo *MongoDBUniformRepo) GetUniformIntegrations(params models.GetUniformIntegrationsParams) ([]apimodels.Integration, error)

func (*MongoDBUniformRepo) SetupTTLIndex

func (mdbrepo *MongoDBUniformRepo) SetupTTLIndex(duration time.Duration) error

func (*MongoDBUniformRepo) UpdateLastSeen

func (mdbrepo *MongoDBUniformRepo) UpdateLastSeen(integrationID string) (*apimodels.Integration, error)

func (*MongoDBUniformRepo) UpdateVersionInfo

func (mdbrepo *MongoDBUniformRepo) UpdateVersionInfo(integrationID, integrationVersion, distributorVersion string) (*apimodels.Integration, error)

type ProjectCredentialsRepo

type ProjectCredentialsRepo interface {
	UpdateProject(project *models.ExpandedProjectOld) error
	GetOldCredentialsProjects() ([]*models.ExpandedProjectOld, error)
	CreateOldCredentialsProject(project *models.ExpandedProjectOld) error
}

ProjectCredentialsRepo is a helper repository to migrate the old git credentials model to a new one (including the projects in DB) When the migration is not needed anymore, this struct/file can be removed

type ProjectMVRepo

type ProjectMVRepo interface {
	CreateProject(prj *apimodels.ExpandedProject) error
	UpdateShipyard(projectName string, shipyardContent string) error
	UpdateProject(prj *apimodels.ExpandedProject) error
	UpdateUpstreamInfo(projectName string, uri, user string) error
	UpdatedShipyard(projectName string, shipyard string) error
	DeleteUpstreamInfo(projectName string) error
	GetProjects() ([]*apimodels.ExpandedProject, error)
	GetProject(projectName string) (*apimodels.ExpandedProject, error)
	DeleteProject(projectName string) error
	CreateStage(project string, stage string) error
	DeleteStage(project string, stage string) error
	CreateService(project string, stage string, service string) error
	GetService(projectName, stageName, serviceName string) (*apimodels.ExpandedService, error)
	DeleteService(project string, stage string, service string) error
	UpdateEventOfService(e apimodels.KeptnContextExtendedCE) error
	CreateRemediation(project, stage, service string, remediation *apimodels.Remediation) error
	CloseOpenRemediations(project, stage, service, keptnContext string) error
	OnSequenceTaskEvent(event apimodels.KeptnContextExtendedCE)
}

type ProjectRepo

type ProjectRepo interface {
	GetProjects() ([]*apimodels.ExpandedProject, error)
	GetProject(projectName string) (*apimodels.ExpandedProject, error)
	CreateProject(project *apimodels.ExpandedProject) error
	UpdateProject(project *apimodels.ExpandedProject) error
	UpdateProjectService(projectName, stageName, serviceName string, properties mvmodels.ServiceUpdate) error
	UpdateProjectUpstream(projectName string, uri string, user string) error
	DeleteProject(projectName string) error
}

ProjectRepo is an interface to access projects

type SecretCredentialsRepo

type SecretCredentialsRepo interface {
	UpdateSecret(project *models.ExpandedProjectOld) error
}

SecretCredentialsRepo is a helper repository to migrate the old git credentials model to a new one (including the K8s secrets) When the migration is not needed anymore, this struct/file can be removed

type SequenceExecutionRepo

type SequenceExecutionRepo interface {
	Get(filter models.SequenceExecutionFilter) ([]models.SequenceExecution, error)
	GetPaginated(filter models.SequenceExecutionFilter, paginationParams models.PaginationParams) ([]models.SequenceExecution, *models.PaginationResult, error)
	GetByTriggeredID(project, triggeredID string) (*models.SequenceExecution, error)
	Upsert(item models.SequenceExecution, options *models.SequenceExecutionUpsertOptions) error
	AppendTaskEvent(taskSequence models.SequenceExecution, event models.TaskEvent) (*models.SequenceExecution, error)
	UpdateStatus(taskSequence models.SequenceExecution) (*models.SequenceExecution, error)
	PauseContext(eventScope models.EventScope) error
	ResumeContext(eventScope models.EventScope) error
	IsContextPaused(eventScope models.EventScope) bool
	Clear(projectName string) error
}

type SequenceExecutionRepoOpt

type SequenceExecutionRepoOpt func(repo *MongoDBSequenceExecutionRepo)

func WithSequenceExecutionModelTransformer

func WithSequenceExecutionModelTransformer(transformer sequence_execution.ModelTransformer) SequenceExecutionRepoOpt

type SequenceQueueRepo

type SequenceQueueRepo interface {
	QueueSequence(item models.QueueItem) error
	GetQueuedSequences() ([]models.QueueItem, error)
	DeleteQueuedSequences(itemFilter models.QueueItem) error
}

SequenceQueueRepo defines the interface for storing, retrieving and deleting queued events

type SequenceStateRepo

type SequenceStateRepo interface {
	CreateSequenceState(state apimodels.SequenceState) error
	FindSequenceStates(filter apimodels.StateFilter) (*apimodels.SequenceStates, error)
	GetSequenceStateByID(filter apimodels.StateFilter) (*apimodels.SequenceState, error)
	UpdateSequenceState(state apimodels.SequenceState) error
	DeleteSequenceStates(filter apimodels.StateFilter) error
}

type UniformRepo

type UniformRepo interface {
	GetUniformIntegrations(filter models.GetUniformIntegrationsParams) ([]apimodels.Integration, error)
	DeleteUniformIntegration(id string) error
	CreateUniformIntegration(integration apimodels.Integration) error
	CreateOrUpdateUniformIntegration(integration apimodels.Integration) error
	CreateOrUpdateSubscription(integrationID string, subscription apimodels.EventSubscription) error
	DeleteSubscription(integrationID, subscriptionID string) error
	GetSubscription(integrationID, subscriptionID string) (*apimodels.EventSubscription, error)
	GetSubscriptions(integrationID string) ([]apimodels.EventSubscription, error)
	UpdateLastSeen(integrationID string) (*apimodels.Integration, error)
	UpdateVersionInfo(integrationID, integrationVersion, distributorVersion string) (*apimodels.Integration, error)
}

Directories

Path Synopsis
models

Jump to

Keyboard shortcuts

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