Skip to content

Commit

Permalink
Naminh.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 committed Oct 9, 2023
1 parent 8f88066 commit 6098a9b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions cmd/metal-api/internal/issues/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type (
Config struct {
Machines metal.Machines
EventContainers metal.ProvisioningEventContainers
Severity IssueSeverity
Severity Severity
Only []Type
Omit []Type
LastErrorThreshold time.Duration
Expand All @@ -21,7 +21,7 @@ type (
// Issue formulates an issue of a machine
Issue struct {
Type Type
Severity IssueSeverity
Severity Severity
Description string
RefURL string
Details string
Expand Down Expand Up @@ -53,7 +53,7 @@ type (
// spec defines the specification of an issue.
spec struct {
Type Type
Severity IssueSeverity
Severity Severity
Description string
RefURL string
}
Expand Down
20 changes: 10 additions & 10 deletions cmd/metal-api/internal/issues/severeties.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ import "fmt"

const (
// SeverityMinor is an issue that should be checked from time to time but has no bad effects for the user.
SeverityMinor IssueSeverity = "minor"
SeverityMinor Severity = "minor"
// SeverityMajor is an issue where user experience is affected or provider resources are wasted.
// overall functionality is still maintained though. major issues should be resolved as soon as possible.
SeverityMajor IssueSeverity = "major"
SeverityMajor Severity = "major"
// SeverityCritical is an issue that can lead to disfunction of the system and need to be handled as quickly as possible.
SeverityCritical IssueSeverity = "critical"
SeverityCritical Severity = "critical"
)

type (
IssueSeverity string
Severity string
)

func AllSevereties() []IssueSeverity {
return []IssueSeverity{
func AllSevereties() []Severity {
return []Severity{
SeverityMinor,
SeverityMajor,
SeverityCritical,
}
}

func SeverityFromString(input string) (IssueSeverity, error) {
switch IssueSeverity(input) {
func SeverityFromString(input string) (Severity, error) {
switch Severity(input) {
case SeverityCritical:
return SeverityCritical, nil
case SeverityMajor:
Expand All @@ -37,8 +37,8 @@ func SeverityFromString(input string) (IssueSeverity, error) {
}
}

func (s IssueSeverity) LowerThan(o IssueSeverity) bool {
smap := map[IssueSeverity]int{
func (s Severity) LowerThan(o Severity) bool {
smap := map[Severity]int{
SeverityCritical: 10,
SeverityMajor: 5,
SeverityMinor: 0,
Expand Down

0 comments on commit 6098a9b

Please sign in to comment.