2024-01-29 22:33:45 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
|
|
|
|
//go:build !consulent
|
|
|
|
|
|
|
|
package discovery
|
|
|
|
|
|
|
|
import (
|
2024-02-02 23:29:38 +00:00
|
|
|
"github.com/hashicorp/consul/acl"
|
2024-01-29 22:33:45 +00:00
|
|
|
)
|
|
|
|
|
2024-02-02 23:29:38 +00:00
|
|
|
func (f *V1DataFetcher) NormalizeRequest(req *QueryPayload) {
|
|
|
|
// Nothing to do for CE
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-05-28 22:20:59 +00:00
|
|
|
// validateEnterpriseTenancy validates the tenancy fields for an enterprise request to
|
|
|
|
// make sure that they are either set to an empty string or "default" to align with the behavior
|
|
|
|
// in CE.
|
2024-02-02 23:29:38 +00:00
|
|
|
func validateEnterpriseTenancy(req QueryTenancy) error {
|
2024-05-28 22:20:59 +00:00
|
|
|
if !(req.Namespace == acl.EmptyNamespaceName || req.Namespace == acl.DefaultNamespaceName) ||
|
|
|
|
!(req.Partition == acl.DefaultPartitionName || req.Partition == acl.NonEmptyDefaultPartitionName) {
|
2024-02-02 23:29:38 +00:00
|
|
|
return ErrNotSupported
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func queryTenancyToEntMeta(_ QueryTenancy) acl.EnterpriseMeta {
|
|
|
|
return acl.EnterpriseMeta{}
|
|
|
|
}
|