Correlations: Add UpdateCorrelation HTTP API (#52444)

* Correlations: add UpdateCorrelation HTTP API

* handle correlation not found

* add tests

* fix lint errors

* add bad request to API spec

* change casing

* fix casing in docs

* fix tests

* update spec
This commit is contained in:
Giordano Ricci
2022-08-03 14:18:51 +01:00
committed by GitHub
parent f61a97a0ab
commit 09c4dbdb9f
9 changed files with 738 additions and 1 deletions

View File

@@ -9,8 +9,8 @@ var (
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")
ErrCorrelationNotFound = errors.New("correlation not found")
ErrUpdateCorrelationEmptyParams = errors.New("not enough parameters to edit correlation")
)
// Correlation is the model for correlations definitions
@@ -72,6 +72,28 @@ type DeleteCorrelationCommand struct {
OrgId int64
}
// swagger:model
type UpdateCorrelationResponseBody struct {
Result Correlation `json:"result"`
// example: Correlation updated
Message string `json:"message"`
}
// UpdateCorrelationCommand is the command for updating a correlation
type UpdateCorrelationCommand struct {
// UID of the correlation to be deleted.
UID string `json:"-"`
SourceUID string `json:"-"`
OrgId int64 `json:"-"`
// 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"`
}
type DeleteCorrelationsBySourceUIDCommand struct {
SourceUID string
}