Skip to content

Commit ed81e90

Browse files
committed
Add warnings to the customer facing Boundary API.
Warnings are helpful for deprecation notices or when a request configures Boundary in a way that is valid but might not work as intended. A recent example of where warnings might be helpful is when a user updates a target's "filter" field which is deprecated in favor of "ingress_worker_filter" or "egress_worker_filter".
1 parent 578d870 commit ed81e90

File tree

5 files changed

+826
-0
lines changed

5 files changed

+826
-0
lines changed

internal/daemon/controller/gateway.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/hashicorp/boundary/internal/event"
2020
"github.com/hashicorp/boundary/internal/kms"
2121
"github.com/hashicorp/boundary/internal/types/subtypes"
22+
"github.com/hashicorp/boundary/internal/warning"
2223
"google.golang.org/grpc"
2324
"google.golang.org/grpc/test/bufconn"
2425
)
@@ -58,6 +59,7 @@ func newGrpcGatewayMux() *runtime.ServeMux {
5859
}),
5960
runtime.WithErrorHandler(handlers.ErrorHandler()),
6061
runtime.WithForwardResponseOption(handlers.OutgoingResponseFilter),
62+
runtime.WithOutgoingHeaderMatcher(warning.OutgoingHeaderMatcher()),
6163
)
6264
}
6365

@@ -114,6 +116,7 @@ func newGrpcServer(
114116
grpc.UnaryInterceptor(
115117
grpc_middleware.ChainUnaryServer(
116118
unaryCtxInterceptor, // populated requestInfo from headers into the request ctx
119+
warning.GrpcInterceptor(ctx), // add warning handling to the ctx and convert them to an http header
117120
errorInterceptor(ctx), // convert domain and api errors into headers for the http proxy
118121
subtypes.AttributeTransformerInterceptor(ctx), // convert to/from generic attributes from/to subtype specific attributes
119122
eventsRequestInterceptor(ctx), // before we get started, send the required events with the request

0 commit comments

Comments
 (0)