2023-03-28 18:39:22 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-03-28 18:39:22 +00:00
|
|
|
|
2022-03-27 10:59:30 +00:00
|
|
|
package dataplane
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-04-05 21:10:06 +00:00
|
|
|
"google.golang.org/grpc/codes"
|
|
|
|
"google.golang.org/grpc/status"
|
|
|
|
|
2022-07-13 15:33:48 +00:00
|
|
|
external "github.com/hashicorp/consul/agent/grpc-external"
|
2022-03-27 10:59:30 +00:00
|
|
|
"github.com/hashicorp/consul/proto-public/pbdataplane"
|
2023-05-31 15:53:37 +00:00
|
|
|
"github.com/hashicorp/consul/version"
|
2022-03-27 10:59:30 +00:00
|
|
|
)
|
|
|
|
|
2023-09-06 22:46:25 +00:00
|
|
|
func (s *Server) GetSupportedDataplaneFeatures(ctx context.Context, _ *pbdataplane.GetSupportedDataplaneFeaturesRequest) (*pbdataplane.GetSupportedDataplaneFeaturesResponse, error) {
|
2022-07-13 15:33:48 +00:00
|
|
|
logger := s.Logger.Named("get-supported-dataplane-features").With("request_id", external.TraceID())
|
2022-04-20 00:24:21 +00:00
|
|
|
|
|
|
|
logger.Trace("Started processing request")
|
|
|
|
defer logger.Trace("Finished processing request")
|
2022-03-27 10:59:30 +00:00
|
|
|
|
2022-09-28 16:56:59 +00:00
|
|
|
options, err := external.QueryOptionsFromContext(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, status.Error(codes.Internal, err.Error())
|
|
|
|
}
|
2023-01-04 12:40:34 +00:00
|
|
|
if err := external.RequireAnyValidACLToken(s.ACLResolver, options.Token); err != nil {
|
|
|
|
return nil, err
|
2022-03-27 10:59:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
supportedFeatures := []*pbdataplane.DataplaneFeatureSupport{
|
|
|
|
{
|
2022-05-23 14:37:52 +00:00
|
|
|
FeatureName: pbdataplane.DataplaneFeatures_DATAPLANE_FEATURES_WATCH_SERVERS,
|
2022-03-27 10:59:30 +00:00
|
|
|
Supported: true,
|
|
|
|
},
|
|
|
|
{
|
2022-05-23 14:37:52 +00:00
|
|
|
FeatureName: pbdataplane.DataplaneFeatures_DATAPLANE_FEATURES_EDGE_CERTIFICATE_MANAGEMENT,
|
2022-03-27 10:59:30 +00:00
|
|
|
Supported: true,
|
|
|
|
},
|
|
|
|
{
|
2022-05-23 14:37:52 +00:00
|
|
|
FeatureName: pbdataplane.DataplaneFeatures_DATAPLANE_FEATURES_ENVOY_BOOTSTRAP_CONFIGURATION,
|
2022-03-27 10:59:30 +00:00
|
|
|
Supported: true,
|
|
|
|
},
|
2023-05-31 15:53:37 +00:00
|
|
|
{
|
|
|
|
FeatureName: pbdataplane.DataplaneFeatures_DATAPLANE_FEATURES_FIPS,
|
|
|
|
Supported: version.IsFIPS(),
|
|
|
|
},
|
2022-03-27 10:59:30 +00:00
|
|
|
}
|
|
|
|
|
2022-04-20 00:24:21 +00:00
|
|
|
return &pbdataplane.GetSupportedDataplaneFeaturesResponse{SupportedDataplaneFeatures: supportedFeatures}, nil
|
2022-03-27 10:59:30 +00:00
|
|
|
}
|