Export the unwrapResource method, to allow callers outside of the package (#6181)

This commit is contained in:
Anirudh Ramachandra 2023-04-11 09:51:09 -07:00 committed by GitHub
parent efb2f45956
commit 8374ff8fbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 6 deletions

View File

@ -78,9 +78,9 @@ func IsEndpointsResource(url string) bool {
return url == version.V3EndpointsURL
}
// unwrapResource unwraps and returns the inner resource if it's in a resource
// UnwrapResource unwraps and returns the inner resource if it's in a resource
// wrapper. The original resource is returned if it's not wrapped.
func unwrapResource(r *anypb.Any) (*anypb.Any, error) {
func UnwrapResource(r *anypb.Any) (*anypb.Any, error) {
url := r.GetTypeUrl()
if url != version.V3ResourceWrapperURL {
// Not wrapped.

View File

@ -40,7 +40,7 @@ import (
const transportSocketName = "envoy.transport_sockets.tls"
func unmarshalClusterResource(r *anypb.Any) (string, ClusterUpdate, error) {
r, err := unwrapResource(r)
r, err := UnwrapResource(r)
if err != nil {
return "", ClusterUpdate{}, fmt.Errorf("failed to unwrap resource: %v", err)
}

View File

@ -33,7 +33,7 @@ import (
)
func unmarshalEndpointsResource(r *anypb.Any) (string, EndpointsUpdate, error) {
r, err := unwrapResource(r)
r, err := UnwrapResource(r)
if err != nil {
return "", EndpointsUpdate{}, fmt.Errorf("failed to unwrap resource: %v", err)
}

View File

@ -34,7 +34,7 @@ import (
)
func unmarshalListenerResource(r *anypb.Any) (string, ListenerUpdate, error) {
r, err := unwrapResource(r)
r, err := UnwrapResource(r)
if err != nil {
return "", ListenerUpdate{}, fmt.Errorf("failed to unwrap resource: %v", err)
}

View File

@ -34,7 +34,7 @@ import (
)
func unmarshalRouteConfigResource(r *anypb.Any) (string, RouteConfigUpdate, error) {
r, err := unwrapResource(r)
r, err := UnwrapResource(r)
if err != nil {
return "", RouteConfigUpdate{}, fmt.Errorf("failed to unwrap resource: %v", err)
}