Skip to content

Commit 8374ff8

Browse files
authored
Export the unwrapResource method, to allow callers outside of the package (#6181)
1 parent efb2f45 commit 8374ff8

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

xds/internal/xdsclient/xdsresource/type.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ func IsEndpointsResource(url string) bool {
7878
return url == version.V3EndpointsURL
7979
}
8080

81-
// unwrapResource unwraps and returns the inner resource if it's in a resource
81+
// UnwrapResource unwraps and returns the inner resource if it's in a resource
8282
// wrapper. The original resource is returned if it's not wrapped.
83-
func unwrapResource(r *anypb.Any) (*anypb.Any, error) {
83+
func UnwrapResource(r *anypb.Any) (*anypb.Any, error) {
8484
url := r.GetTypeUrl()
8585
if url != version.V3ResourceWrapperURL {
8686
// Not wrapped.

xds/internal/xdsclient/xdsresource/unmarshal_cds.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import (
4040
const transportSocketName = "envoy.transport_sockets.tls"
4141

4242
func unmarshalClusterResource(r *anypb.Any) (string, ClusterUpdate, error) {
43-
r, err := unwrapResource(r)
43+
r, err := UnwrapResource(r)
4444
if err != nil {
4545
return "", ClusterUpdate{}, fmt.Errorf("failed to unwrap resource: %v", err)
4646
}

xds/internal/xdsclient/xdsresource/unmarshal_eds.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
)
3434

3535
func unmarshalEndpointsResource(r *anypb.Any) (string, EndpointsUpdate, error) {
36-
r, err := unwrapResource(r)
36+
r, err := UnwrapResource(r)
3737
if err != nil {
3838
return "", EndpointsUpdate{}, fmt.Errorf("failed to unwrap resource: %v", err)
3939
}

xds/internal/xdsclient/xdsresource/unmarshal_lds.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
)
3535

3636
func unmarshalListenerResource(r *anypb.Any) (string, ListenerUpdate, error) {
37-
r, err := unwrapResource(r)
37+
r, err := UnwrapResource(r)
3838
if err != nil {
3939
return "", ListenerUpdate{}, fmt.Errorf("failed to unwrap resource: %v", err)
4040
}

xds/internal/xdsclient/xdsresource/unmarshal_rds.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
)
3535

3636
func unmarshalRouteConfigResource(r *anypb.Any) (string, RouteConfigUpdate, error) {
37-
r, err := unwrapResource(r)
37+
r, err := UnwrapResource(r)
3838
if err != nil {
3939
return "", RouteConfigUpdate{}, fmt.Errorf("failed to unwrap resource: %v", err)
4040
}

0 commit comments

Comments
 (0)