...
1 package resource
2
3 import (
4 "github.com/golang/protobuf/ptypes"
5
6 core "github.com/datawire/ambassador/v2/pkg/api/envoy/config/core/v3"
7 listener "github.com/datawire/ambassador/v2/pkg/api/envoy/config/listener/v3"
8 hcm "github.com/datawire/ambassador/v2/pkg/api/envoy/extensions/filters/network/http_connection_manager/v3"
9 )
10
11
12 const (
13 apiTypePrefix = "type.googleapis.com/"
14 EndpointType = apiTypePrefix + "envoy.config.endpoint.v3.ClusterLoadAssignment"
15 ClusterType = apiTypePrefix + "envoy.config.cluster.v3.Cluster"
16 RouteType = apiTypePrefix + "envoy.config.route.v3.RouteConfiguration"
17 ListenerType = apiTypePrefix + "envoy.config.listener.v3.Listener"
18 SecretType = apiTypePrefix + "envoy.extensions.transport_sockets.tls.v3.Secret"
19 ExtensionConfigType = apiTypePrefix + "envoy.config.core.v3.TypedExtensionConfig"
20 RuntimeType = apiTypePrefix + "envoy.service.runtime.v3.Runtime"
21
22
23 AnyType = ""
24 )
25
26
27 const (
28 FetchEndpoints = "/v3/discovery:endpoints"
29 FetchClusters = "/v3/discovery:clusters"
30 FetchListeners = "/v3/discovery:listeners"
31 FetchRoutes = "/v3/discovery:routes"
32 FetchSecrets = "/v3/discovery:secrets"
33 FetchRuntimes = "/v3/discovery:runtime"
34 FetchExtensionConfigs = "/v3/discovery:extension_configs"
35 )
36
37
38 const DefaultAPIVersion = core.ApiVersion_V3
39
40
41 func GetHTTPConnectionManager(filter *listener.Filter) *hcm.HttpConnectionManager {
42 config := &hcm.HttpConnectionManager{}
43
44
45 if typedConfig := filter.GetTypedConfig(); typedConfig != nil {
46 ptypes.UnmarshalAny(typedConfig, config)
47 }
48 return config
49 }
50
View as plain text