-
Notifications
You must be signed in to change notification settings - Fork 688
/
ingress.go
42 lines (36 loc) · 889 Bytes
/
ingress.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
package snapshot
import (
"encoding/json"
"github.com/emissary-ingress/emissary/v3/pkg/kates"
"github.com/emissary-ingress/emissary/v3/pkg/kates/k8s_resource_types"
)
type Ingress struct {
k8s_resource_types.Ingress
}
func (ingress *Ingress) UnmarshalJSON(bs []byte) error {
var untyped kates.Unstructured
if err := json.Unmarshal(bs, &untyped); err != nil {
return err
}
typed, err := k8s_resource_types.NewIngress(&untyped)
if err != nil {
return err
}
ingress.Ingress = *typed
return nil
}
type IngressClass struct {
k8s_resource_types.IngressClass
}
func (ingressclass *IngressClass) UnmarshalJSON(bs []byte) error {
var untyped kates.Unstructured
if err := json.Unmarshal(bs, &untyped); err != nil {
return err
}
typed, err := k8s_resource_types.NewIngressClass(&untyped)
if err != nil {
return err
}
ingressclass.IngressClass = *typed
return nil
}