...
1
2 package workload
3
4 import (
5 "fmt"
6
7 "edge-infra.dev/pkg/edge/constants"
8 )
9
10
11
12 const Label = "workload." + constants.Domain
13 const SIEMLabel = "siem.edge.ncr.com"
14
15
16 const (
17 HelmEdgeIDLabel = SIEMLabel + "/helm-edge-id"
18 HelmChartVersionLabel = SIEMLabel + "/helm-chart-version"
19 HelmChartNameLabel = SIEMLabel + "/helm-chart-name"
20 )
21
22
23 type Type string
24
25
26 const (
27 Platform = Type("platform")
28 NCR = Type("ncr")
29 Tenant = Type("tenant")
30 Helm = Type("helm")
31 )
32
33 var types = []Type{Platform, NCR, Tenant, Helm}
34
35 var ErrInvalidType = fmt.Errorf("invalid workload type, expected %v", types)
36
37
38 func (wt Type) IsValid() error {
39 found := false
40 for _, wlType := range types {
41 if wt == wlType {
42 found = true
43 }
44 }
45 if found {
46 return nil
47 }
48 return fmt.Errorf("%v: %w", wt, ErrInvalidType)
49 }
50
View as plain text