forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils.go
50 lines (43 loc) · 2.41 KB
/
utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package applyconfiguration
import (
v0alpha1 "github.com/grafana/grafana/pkg/apis/alerting_notifications/v0alpha1"
servicev0alpha1 "github.com/grafana/grafana/pkg/apis/service/v0alpha1"
alertingnotificationsv0alpha1 "github.com/grafana/grafana/pkg/generated/applyconfiguration/alerting_notifications/v0alpha1"
internal "github.com/grafana/grafana/pkg/generated/applyconfiguration/internal"
applyconfigurationservicev0alpha1 "github.com/grafana/grafana/pkg/generated/applyconfiguration/service/v0alpha1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
testing "k8s.io/client-go/testing"
)
// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no
// apply configuration type exists for the given GroupVersionKind.
func ForKind(kind schema.GroupVersionKind) interface{} {
switch kind {
// Group=notifications.alerting.grafana.app, Version=v0alpha1
case v0alpha1.SchemeGroupVersion.WithKind("Integration"):
return &alertingnotificationsv0alpha1.IntegrationApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("Interval"):
return &alertingnotificationsv0alpha1.IntervalApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("Receiver"):
return &alertingnotificationsv0alpha1.ReceiverApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("ReceiverSpec"):
return &alertingnotificationsv0alpha1.ReceiverSpecApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("TimeInterval"):
return &alertingnotificationsv0alpha1.TimeIntervalApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("TimeIntervalSpec"):
return &alertingnotificationsv0alpha1.TimeIntervalSpecApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("TimeRange"):
return &alertingnotificationsv0alpha1.TimeRangeApplyConfiguration{}
// Group=service.grafana.app, Version=v0alpha1
case servicev0alpha1.SchemeGroupVersion.WithKind("ExternalName"):
return &applyconfigurationservicev0alpha1.ExternalNameApplyConfiguration{}
case servicev0alpha1.SchemeGroupVersion.WithKind("ExternalNameSpec"):
return &applyconfigurationservicev0alpha1.ExternalNameSpecApplyConfiguration{}
}
return nil
}
func NewTypeConverter(scheme *runtime.Scheme) *testing.TypeConverter {
return &testing.TypeConverter{Scheme: scheme, TypeResolver: internal.Parser()}
}