consul/agent/structs/config_entry_ce.go

65 lines
1.6 KiB
Go
Raw Normal View History

// Copyright (c) HashiCorp, Inc.
[COMPLIANCE] License changes (#18443) * Adding explicit MPL license for sub-package This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Adding explicit MPL license for sub-package This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Updating the license from MPL to Business Source License Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at <Blog URL>, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl. * add missing license headers * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-08-11 13:12:13 +00:00
// SPDX-License-Identifier: BUSL-1.1
//go:build !consulent
// +build !consulent
package structs
import (
"fmt"
"strings"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/consul/acl"
)
func (e *ProxyConfigEntry) validateEnterpriseMeta() error {
return nil
}
func validateUnusedKeys(unused []string) error {
var err error
for _, k := range unused {
switch {
case k == "CreateIndex" || k == "ModifyIndex":
case k == "kind" || k == "Kind":
// The kind field is used to determine the target, but doesn't need
// to exist on the target.
case strings.HasSuffix(strings.ToLower(k), "namespace"):
err = multierror.Append(err, fmt.Errorf("invalid config key %q, namespaces are a consul enterprise feature", k))
case strings.Contains(strings.ToLower(k), "jwt"):
err = multierror.Append(err, fmt.Errorf("invalid config key %q, api-gateway jwt validation is a consul enterprise feature", k))
default:
err = multierror.Append(err, fmt.Errorf("invalid config key %q", k))
}
}
return err
}
func validateInnerEnterpriseMeta(_, _ *acl.EnterpriseMeta) error {
return nil
}
func validateExportedServicesName(name string) error {
if name != "default" {
return fmt.Errorf(`exported-services Name must be "default"`)
}
return nil
}
func makeEnterpriseConfigEntry(kind, name string) ConfigEntry {
return nil
}
2023-08-25 16:47:20 +00:00
func validateRatelimit(rl *RateLimits) error {
if rl != nil {
return fmt.Errorf("invalid rate_limits config. Rate limiting is a consul enterprise feature")
}
return nil
}
func (rl RateLimits) ToEnvoyExtension() *EnvoyExtension { return nil }