-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation for V2 incident patching (#26)
- Loading branch information
Showing
11 changed files
with
478 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package errors | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
) | ||
|
||
var ErrComponentDSNotExist = errors.New("component does not exist") | ||
|
||
func NewErrComponentDSNotExist(componentID int) error { | ||
return fmt.Errorf("%w, component_id: %d", ErrComponentDSNotExist, componentID) | ||
} | ||
|
||
var ErrComponentExist = errors.New("component already exists") | ||
var ErrComponentInvalidFormat = errors.New("component invalid format") | ||
var ErrComponentAttrInvalidFormat = errors.New("component attribute has invalid format") | ||
var ErrComponentRegionAttrMissing = errors.New("component attribute region is missing or invalid") | ||
var ErrComponentTypeAttrMissing = errors.New("component attribute type is missing or invalid") | ||
var ErrComponentCategoryAttrMissing = errors.New("component attribute category is missing or invalid") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package errors | ||
|
||
import "errors" | ||
|
||
var ErrIncidentDSNotExist = errors.New("incident does not exist") | ||
var ErrIncidentEndDateShouldBeEmpty = errors.New("incident end_date should be empty") | ||
var ErrIncidentUpdatesShouldBeEmpty = errors.New("incident updates should be empty") | ||
|
||
var ErrIncidentCreationMaintenanceExists = errors.New("incident creation failed, component in maintenance") | ||
var ErrIncidentCreationLowImpact = errors.New( | ||
"incident creation failed, exists the incident with higher impact for component", | ||
) | ||
|
||
// Errors for patching incident | ||
|
||
var ErrIncidentPatchMaintenanceImpactForbidden = errors.New("can not change impact for maintenance") | ||
var ErrIncidentPatchMaintenanceStatus = errors.New("wrong status for maintenance") | ||
var ErrIncidentPatchStatus = errors.New("wrong status for incident") | ||
var ErrIncidentPatchClosedStatus = errors.New("wrong status for closed incident") | ||
var ErrIncidentPatchOpenedStartDate = errors.New("can not change start date for open incident") | ||
var ErrIncidentPatchOpenedEndDateMissing = errors.New("wrong end date with resolved status") | ||
var ErrIncidentPatchImpactStatusWrong = errors.New("wrong status for changing impact") | ||
var ErrIncidentPatchImpactToMaintenanceForbidden = errors.New("can not change impact to maintenance") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package v2 | ||
|
||
const ( | ||
MaintenanceInProgress = "in progress" | ||
// MaintenanceModified is placed if the time window was changed. | ||
MaintenanceModified = "modified" | ||
MaintenanceCompleted = "completed" | ||
) | ||
|
||
//nolint:gochecknoglobals | ||
var maintenanceStatuses = map[string]struct{}{ | ||
MaintenanceInProgress: {}, | ||
MaintenanceModified: {}, | ||
MaintenanceCompleted: {}, | ||
} | ||
|
||
// Incident actions for opened incidents. | ||
const ( | ||
IncidentAnalysing = "analysing" | ||
IncidentFixing = "fixing" | ||
IncidentImpactChanged = "impact changed" | ||
IncidentObserving = "observing" | ||
IncidentResolved = "resolved" | ||
) | ||
|
||
//nolint:gochecknoglobals | ||
var incidentOpenStatuses = map[string]struct{}{ | ||
IncidentAnalysing: {}, | ||
IncidentFixing: {}, | ||
IncidentImpactChanged: {}, | ||
IncidentObserving: {}, | ||
IncidentResolved: {}, | ||
} | ||
|
||
// These statuses are using only for closed incidents. | ||
const ( | ||
IncidentReopened = "reopened" | ||
// IncidentChanged indicates if the end date was changed for closed incident. | ||
IncidentChanged = "changed" | ||
) | ||
|
||
//nolint:gochecknoglobals | ||
var incidentClosedStatuses = map[string]struct{}{ | ||
IncidentReopened: {}, | ||
IncidentChanged: {}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.