-
Notifications
You must be signed in to change notification settings - Fork 20
/
v2HelperService.go
40 lines (35 loc) · 929 Bytes
/
v2HelperService.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
package service
import (
"Envoy-Pilot/cmd/server/constant"
"fmt"
"github.com/envoyproxy/go-control-plane/pkg/cache"
)
type V2HelperService struct{}
func (v *V2HelperService) GetTypeUrlFor(topic string) string {
switch topic {
case constant.SUBSCRIBE_CDS:
return cache.ClusterType
case constant.SUBSCRIBE_LDS:
return cache.ListenerType
case constant.SUBSCRIBE_RDS:
return cache.RouteType
case constant.SUBSCRIBE_EDS:
return cache.EndpointType
default:
panic(fmt.Sprintf("No TypeUrl found for type %s\n", topic))
}
}
func (v *V2HelperService) GetTopicFor(typeUrl string) string {
switch typeUrl {
case cache.ClusterType:
return constant.SUBSCRIBE_CDS
case cache.ListenerType:
return constant.SUBSCRIBE_LDS
case cache.RouteType:
return constant.SUBSCRIBE_RDS
case cache.EndpointType:
return constant.SUBSCRIBE_EDS
default:
panic(fmt.Sprintf("No Topic found for typeUrl %s\n", typeUrl))
}
}