2023-03-28 22:48:58 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2023-01-30 21:35:26 +00:00
|
|
|
package extensioncommon
|
|
|
|
|
|
|
|
import (
|
2023-02-06 17:14:35 +00:00
|
|
|
"github.com/hashicorp/consul/envoyextensions/xdscommon"
|
2023-01-30 21:35:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// EnvoyExtender is the interface that all Envoy extensions must implement in order
|
|
|
|
// to be dynamically executed during runtime.
|
|
|
|
type EnvoyExtender interface {
|
|
|
|
|
2023-07-31 19:24:33 +00:00
|
|
|
// CanApply checks whether the extension configured for this extender is eligible
|
|
|
|
// for application based on the specified RuntimeConfig.
|
|
|
|
CanApply(*RuntimeConfig) bool
|
|
|
|
|
2023-01-30 21:35:26 +00:00
|
|
|
// Validate ensures the data in config can successfuly be used
|
|
|
|
// to apply the specified Envoy extension.
|
|
|
|
Validate(*RuntimeConfig) error
|
|
|
|
|
|
|
|
// Extend updates indexed xDS structures to include patches for
|
|
|
|
// built-in extensions. It is responsible for applying extensions to
|
2023-07-31 17:56:09 +00:00
|
|
|
// the appropriate xDS resources. If any portion of this function fails,
|
2023-01-30 21:35:26 +00:00
|
|
|
// it will attempt continue and return an error. The caller can then determine
|
|
|
|
// if it is better to use a partially applied extension or error out.
|
|
|
|
Extend(*xdscommon.IndexedResources, *RuntimeConfig) (*xdscommon.IndexedResources, error)
|
|
|
|
}
|