2022-07-25 09:19:07 -05:00
|
|
|
package correlations
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
ErrSourceDataSourceReadOnly = errors.New("source data source is read only")
|
|
|
|
ErrSourceDataSourceDoesNotExists = errors.New("source data source does not exist")
|
|
|
|
ErrTargetDataSourceDoesNotExists = errors.New("target data source does not exist")
|
|
|
|
ErrCorrelationFailedGenerateUniqueUid = errors.New("failed to generate unique correlation UID")
|
|
|
|
ErrCorrelationIdentifierNotSet = errors.New("source identifier and org id are needed to be able to edit correlations")
|
2022-07-27 03:07:58 -05:00
|
|
|
ErrCorrelationNotFound = errors.New("correlation not found")
|
2022-07-25 09:19:07 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// Correlation is the model for correlations definitions
|
|
|
|
type Correlation struct {
|
|
|
|
// Unique identifier of the correlation
|
|
|
|
// example: 50xhMlg9k
|
|
|
|
UID string `json:"uid" xorm:"pk 'uid'"`
|
|
|
|
// UID of the data source the correlation originates from
|
|
|
|
// example:d0oxYRg4z
|
2022-07-27 01:01:46 -05:00
|
|
|
SourceUID string `json:"sourceUID" xorm:"pk 'source_uid'"`
|
2022-07-25 09:19:07 -05:00
|
|
|
// UID of the data source the correlation points to
|
|
|
|
// example:PE1C5CBDA0504A6A3
|
2022-07-27 01:01:46 -05:00
|
|
|
TargetUID string `json:"targetUID" xorm:"target_uid"`
|
2022-07-25 09:19:07 -05:00
|
|
|
// Label identifying the correlation
|
|
|
|
// example: My Label
|
|
|
|
Label string `json:"label" xorm:"label"`
|
|
|
|
// Description of the correlation
|
|
|
|
// example: Logs to Traces
|
|
|
|
Description string `json:"description" xorm:"description"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// CreateCorrelationResponse is the response struct for CreateCorrelationCommand
|
|
|
|
// swagger:model
|
|
|
|
type CreateCorrelationResponse struct {
|
|
|
|
Result Correlation `json:"result"`
|
|
|
|
// example: Correlation created
|
|
|
|
Message string `json:"message"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// CreateCorrelationCommand is the command for creating a correlation
|
|
|
|
// swagger:model
|
|
|
|
type CreateCorrelationCommand struct {
|
|
|
|
// UID of the data source for which correlation is created.
|
|
|
|
SourceUID string `json:"-"`
|
|
|
|
OrgId int64 `json:"-"`
|
|
|
|
SkipReadOnlyCheck bool `json:"-"`
|
|
|
|
// Target data source UID to which the correlation is created
|
|
|
|
// example:PE1C5CBDA0504A6A3
|
2022-07-27 01:01:46 -05:00
|
|
|
TargetUID string `json:"targetUID" binding:"Required"`
|
2022-07-25 09:19:07 -05:00
|
|
|
// Optional label identifying the correlation
|
|
|
|
// example: My label
|
|
|
|
Label string `json:"label"`
|
|
|
|
// Optional description of the correlation
|
|
|
|
// example: Logs to Traces
|
|
|
|
Description string `json:"description"`
|
|
|
|
}
|
|
|
|
|
2022-07-27 03:07:58 -05:00
|
|
|
// swagger:model
|
|
|
|
type DeleteCorrelationResponse struct {
|
|
|
|
// example: Correlation deleted
|
|
|
|
Message string `json:"message"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// DeleteCorrelationCommand is the command for deleting a correlation
|
|
|
|
type DeleteCorrelationCommand struct {
|
|
|
|
// UID of the correlation to be deleted.
|
|
|
|
UID string
|
|
|
|
SourceUID string
|
|
|
|
OrgId int64
|
|
|
|
}
|
|
|
|
|
2022-07-25 09:19:07 -05:00
|
|
|
type DeleteCorrelationsBySourceUIDCommand struct {
|
|
|
|
SourceUID string
|
|
|
|
}
|
|
|
|
|
|
|
|
type DeleteCorrelationsByTargetUIDCommand struct {
|
|
|
|
TargetUID string
|
|
|
|
}
|