2021-11-16 18:04:01 +00:00
|
|
|
//go:build !consulent
|
2020-01-24 15:04:58 +00:00
|
|
|
// +build !consulent
|
|
|
|
|
|
|
|
package structs
|
|
|
|
|
2020-06-25 19:58:29 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/hashicorp/go-multierror"
|
2022-03-13 03:55:53 +00:00
|
|
|
|
|
|
|
"github.com/hashicorp/consul/acl"
|
2020-06-25 19:58:29 +00:00
|
|
|
)
|
|
|
|
|
2020-01-24 15:04:58 +00:00
|
|
|
func (e *ProxyConfigEntry) validateEnterpriseMeta() error {
|
|
|
|
return nil
|
|
|
|
}
|
2020-06-25 19:58:29 +00:00
|
|
|
|
|
|
|
func validateUnusedKeys(unused []string) error {
|
|
|
|
var err error
|
|
|
|
|
|
|
|
for _, k := range unused {
|
|
|
|
switch {
|
|
|
|
case k == "CreateIndex" || k == "ModifyIndex":
|
2021-04-29 19:54:27 +00:00
|
|
|
case k == "kind" || k == "Kind":
|
|
|
|
// The kind field is used to determine the target, but doesn't need
|
|
|
|
// to exist on the target.
|
2020-06-25 19:58:29 +00:00
|
|
|
case strings.HasSuffix(strings.ToLower(k), "namespace"):
|
|
|
|
err = multierror.Append(err, fmt.Errorf("invalid config key %q, namespaces are a consul enterprise feature", k))
|
|
|
|
default:
|
|
|
|
err = multierror.Append(err, fmt.Errorf("invalid config key %q", k))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return err
|
|
|
|
}
|
2021-06-23 21:44:10 +00:00
|
|
|
|
2022-03-13 03:55:53 +00:00
|
|
|
func validateInnerEnterpriseMeta(_, _ *acl.EnterpriseMeta) error {
|
2021-06-23 21:44:10 +00:00
|
|
|
return nil
|
|
|
|
}
|
2021-11-29 18:21:33 +00:00
|
|
|
|
|
|
|
func requireEnterprise(kind string) error {
|
|
|
|
return fmt.Errorf("Config entry kind %q requires Consul Enterprise", kind)
|
|
|
|
}
|