2019-05-10 00:05:21 -07:00
|
|
|
package event
|
|
|
|
|
2023-12-22 11:47:22 +01:00
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
corev1 "k8s.io/api/core/v1"
|
|
|
|
)
|
2023-03-31 18:27:25 +08:00
|
|
|
|
2022-05-17 08:19:03 +02:00
|
|
|
// Info defines the event details
|
2019-05-10 12:36:55 -07:00
|
|
|
type Info struct {
|
2023-12-22 11:47:22 +01:00
|
|
|
Regarding corev1.ObjectReference
|
|
|
|
Related *corev1.ObjectReference
|
|
|
|
Reason Reason
|
|
|
|
Message string
|
|
|
|
Action Action
|
|
|
|
Source Source
|
2019-05-10 10:38:38 -07:00
|
|
|
}
|
2023-03-31 18:27:25 +08:00
|
|
|
|
|
|
|
func (i *Info) Resource() string {
|
2023-12-22 11:47:22 +01:00
|
|
|
if i.Regarding.Namespace == "" {
|
|
|
|
return strings.Join([]string{i.Regarding.Kind, i.Regarding.Name}, "/")
|
2023-03-31 18:27:25 +08:00
|
|
|
}
|
2023-12-22 11:47:22 +01:00
|
|
|
return strings.Join([]string{i.Regarding.Kind, i.Regarding.Namespace, i.Regarding.Name}, "/")
|
2023-03-31 18:27:25 +08:00
|
|
|
}
|