This repository has been archived by the owner on Mar 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add external aliasas for internal runtime event helper types
Make it easier for third party services to record events without importing internal packages by adding type aliases and wrapper functions in our external API package. Signed-off-by: Nick Hale <[email protected]>
- Loading branch information
Showing
6 changed files
with
70 additions
and
35 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,47 @@ | ||
package v1 | ||
|
||
import ( | ||
"time" | ||
|
||
internalv1 "github.com/acorn-io/runtime/pkg/apis/internal.acorn.io/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
type Event internalv1.EventInstance | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
type EventList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []Event `json:"items"` | ||
} | ||
|
||
// Alias helper types so that clients don't need to import the internal package when creating events. | ||
|
||
// +k8s:deepcopy-gen=false | ||
|
||
type EventResource = internalv1.EventResource | ||
|
||
// +k8s:deepcopy-gen=false | ||
|
||
type MicroTime = internalv1.MicroTime | ||
|
||
func NowMicro() MicroTime { | ||
return internalv1.NowMicro() | ||
} | ||
|
||
func NewMicroTime(t time.Time) MicroTime { | ||
return internalv1.NewMicroTime(t) | ||
} | ||
|
||
const ( | ||
EventSeverityInfo = internalv1.EventSeverityInfo | ||
EventSeverityError = internalv1.EventSeverityError | ||
) | ||
|
||
func Mapify(v any) (internalv1.GenericMap, error) { | ||
return internalv1.Mapify(v) | ||
} |
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
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
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