Documentation ¶
Overview ¶
Package filtergen provides individual Filter Generators to generate an xDS filter config.
Index ¶
- Constants
- func BackendAddressToJWTAud(address string) (string, error)
- func CORSSelectorToSelector(corsSelector string, corsOperationDelimiter string) (string, error)
- func ExtractAPIKeyLocations(parameters []*confpb.SystemParameter) []*scpb.ApiKeyLocation
- func FilterConfigToHTTPFilter(filter proto.Message, name string) (*hcmpb.HttpFilter, error)
- func FilterConfigToNetworkFilter(filter proto.Message, name string) (*listenerpb.Filter, error)
- func GenTranslationInfoFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) (map[string]TranslationInfo, error)
- func GetAPIKeySystemParametersBySelectorFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) map[string][]*servicepb.SystemParameter
- func GetAPINamesListFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) []string
- func GetAPINamesSetFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) map[string]bool
- func GetAuthRequiredSelectorsFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) (map[string]bool, error)
- func GetAutoGeneratedCORSRequirementsFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) []*scpb.Requirement
- func GetDescriptorBinFromOPConfig(serviceConfig *servicepb.Service) ([]byte, error)
- func GetHTTPBackendSelectorsFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) (map[string]bool, error)
- func GetHealthzRequirementFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) *scpb.Requirement
- func GetIgnoredQueryParamsFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) (map[string]bool, error)
- func GetJWTAudiencesBySelectorFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) (map[string]string, map[string]bool, error)
- func GetQuotaAndUsageRequirementsFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) ([]*scpb.Requirement, error)
- func GetQuotaMetricCostsFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) map[string][]*scpb.MetricCost
- func GetServiceControlURLFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) string
- func GetUsageRulesBySelectorFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) map[string]*servicepb.UsageRule
- func IsAutoGenCORSRequiredForOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) bool
- func IsGRPCSupportRequiredForOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) (bool, error)
- func IsSchemeHeaderOverrideRequiredForOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) (bool, error)
- func MakeMethodRequirementsFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) ([]*scpb.Requirement, error)
- func MakeSCCallingConfigFromOPConfig(opts options.ConfigGeneratorOptions) *scpb.ServiceControlCallingConfig
- func MethodToCORSSelector(api *apipb.Api, method *apipb.Method, corsOperationDelimiter string) string
- func MethodToSelector(api *apipb.Api, method *apipb.Method) string
- func ParseDepErrorBehavior(stringVal string) (commonpb.DependencyErrorBehavior, error)
- func ParseServiceControlURLFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) (url.URL, error)
- func PreserveDefaultHttpBinding(httpRule *ahpb.HttpRule, defaultPath string)
- func UpdateProtoDescriptorFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions, ...) ([]byte, error)
- type BackendAuthGenerator
- type CORSGenerator
- type CompressorGenerator
- type CompressorType
- type FilterGenerator
- func NewBackendAuthFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
- func NewCORSFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
- func NewCompressorFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
- func NewGRPCMetadataScrubberFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
- func NewGRPCTranscoderFilterGensFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
- func NewGRPCWebFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
- func NewHeaderSanitizerFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
- func NewHealthCheckFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
- func NewJwtAuthnFilterGensFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
- func NewPathRewriteFilterGensFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
- func NewRouterFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
- func NewServiceControlFilterGensFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions, ...) ([]FilterGenerator, error)
- type FilterGeneratorOPFactory
- type GRPCMetadataScrubberGenerator
- type GRPCTranscoderGenerator
- type GRPCWebGenerator
- type HTTPConnectionManagerGenerator
- type HeaderSanitizerGenerator
- type HealthCheckGenerator
- type JwtAuthnGenerator
- type NoopFilterGenerator
- type PathRewriteGenerator
- type RouterGenerator
- type ServiceControlGenerator
- type ServiceControlOPFactoryParams
- type TranslationInfo
Constants ¶
const ( // EnvoyCompressorFilterName is the Envoy filter name for debug logging. EnvoyCompressorFilterName = "envoy.filters.http.compressor" // EnvoyBrotliCompressorName is a compressor extension name. EnvoyBrotliCompressorName = "envoy.compression.brotli.compressor" // EnvoyGzipCompressorName is a compressor extension name. EnvoyGzipCompressorName = "envoy.compression.gzip.compressor" )
const (
// BackendAuthFilterName is the Envoy filter name for debug logging.
BackendAuthFilterName = "com.google.espv2.filters.http.backend_auth"
)
const (
// CORSFilterName is the Envoy filter name for debug logging.
CORSFilterName = "envoy.filters.http.cors"
)
const (
// GRPCTranscoderFilterName is the Envoy filter name for debug logging.
GRPCTranscoderFilterName = "envoy.filters.http.grpc_json_transcoder"
)
const (
// GRPCWebFilterName is the Envoy filter name for debug logging.
GRPCWebFilterName = "envoy.filters.http.grpc_web"
)
const (
// GrpcMetadataScrubberFilterName is the Envoy filter name for debug logging.
GrpcMetadataScrubberFilterName = "com.google.espv2.filters.http.grpc_metadata_scrubber"
)
const (
// HTTPConnectionManagerFilterName is the Envoy filter name for debug logging.
HTTPConnectionManagerFilterName = "envoy.filters.network.http_connection_manager"
)
const (
// HeaderSanitizerFilterName is the Envoy filter name for debug logging.
HeaderSanitizerFilterName = "com.google.espv2.filters.http.header_sanitizer"
)
const (
// HealthCheckFilterName is the Envoy filter name for debug logging.
HealthCheckFilterName = "envoy.filters.http.health_check"
)
const (
// JWTAuthnFilterName is the Envoy filter name for debug logging.
JWTAuthnFilterName = "envoy.filters.http.jwt_authn"
)
const (
// PathRewriteFilterName is the Envoy filter name for debug logging.
PathRewriteFilterName = "com.google.espv2.filters.http.path_rewrite"
)
const (
// RouterFilterName is the Envoy filter name for debug logging.
RouterFilterName = "envoy.filters.http.router"
)
const (
// ServiceControlFilterName is the Envoy filter name for debug logging.
ServiceControlFilterName = "com.google.espv2.filters.http.service_control"
)
Variables ¶
This section is empty.
Functions ¶
func BackendAddressToJWTAud ¶
BackendAddressToJWTAud transforms the backend address into the proper JWT audience.
If the backend address's scheme is grpc/grpcs, it is changed to http/https.
func CORSSelectorToSelector ¶
CORSSelectorToSelector reverses MethodToCORSSelector to extract the original selector name from a CORS selector.
func ExtractAPIKeyLocations ¶
func ExtractAPIKeyLocations(parameters []*confpb.SystemParameter) []*scpb.ApiKeyLocation
ExtractAPIKeyLocations extracts the locations of API Keys from the system parameters into the corresponding SC filter config proto.
System parameters passed in must only be ones for API Key, no other system parameters allowed.
Replaces ServiceInfo::extractApiKeyLocations.
func GenTranslationInfoFromOPConfig ¶
func GenTranslationInfoFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) (map[string]TranslationInfo, error)
GenTranslationInfoFromOPConfig returns per-route related translation information for each selector.
Replaces ServiceInfo::ruleToBackendInfo.
func GetAPIKeySystemParametersBySelectorFromOPConfig ¶
func GetAPIKeySystemParametersBySelectorFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) map[string][]*servicepb.SystemParameter
GetAPIKeySystemParametersBySelectorFromOPConfig returns a map of selector to system parameter. Only includes system parameters for API Key.
Replaces ServiceInfo::processApiKeyLocations.
func GetAPINamesListFromOPConfig ¶
func GetAPINamesListFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) []string
GetAPINamesListFromOPConfig is the same as GetAPINamesSetFromOPConfig, but returns a slice instead. Preserves original order of APIs in the service config.
Replaces ServiceInfo::processApis.
func GetAPINamesSetFromOPConfig ¶
func GetAPINamesSetFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) map[string]bool
GetAPINamesSetFromOPConfig returns a map of all API names (gRPC service names) to generate configs for.
func GetAuthRequiredSelectorsFromOPConfig ¶
func GetAuthRequiredSelectorsFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) (map[string]bool, error)
GetAuthRequiredSelectorsFromOPConfig returns a list of selectors that require per-method level authn config.
func GetAutoGeneratedCORSRequirementsFromOPConfig ¶
func GetAutoGeneratedCORSRequirementsFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) []*scpb.Requirement
GetAutoGeneratedCORSRequirementsFromOPConfig returns the Service Control requirements for all auto-generated CORS methods (if enabled).
Replaces ServiceInfo::processHttpRule.
func GetDescriptorBinFromOPConfig ¶
GetDescriptorBinFromOPConfig returns the descriptor bytes extracted from the OP service config.
func GetHTTPBackendSelectorsFromOPConfig ¶
func GetHTTPBackendSelectorsFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) (map[string]bool, error)
GetHTTPBackendSelectorsFromOPConfig returns a list of selectors that the transcoder should be completely disabled for. Useful for local (non-OpenAPI) HTTP backend usage. Not really used for ESPv2.
func GetHealthzRequirementFromOPConfig ¶
func GetHealthzRequirementFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) *scpb.Requirement
GetHealthzRequirementFromOPConfig returns the Service Control requirement for autogenerated healthz method (if enabled).
Replaces ServiceInfo::processHttpRule.
func GetIgnoredQueryParamsFromOPConfig ¶
func GetIgnoredQueryParamsFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) (map[string]bool, error)
GetIgnoredQueryParamsFromOPConfig returns a list of query params that should be ignored during transcoding. These params may be for JWT authn, API key, etc.
Replaces ServiceInfo::processTranscodingIgnoredQueryParams, ServiceInfo::processApiKeyLocations, and ServiceInfo::extractApiKeyLocations.
func GetJWTAudiencesBySelectorFromOPConfig ¶
func GetJWTAudiencesBySelectorFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) (map[string]string, map[string]bool, error)
GetJWTAudiencesBySelectorFromOPConfig returns: 1. A map of selector to JWT audience for the route. 2. A set of all unique JWT audiences (for optimization).
Replaces ServiceInfo::ruleToBackendInfo.
func GetQuotaAndUsageRequirementsFromOPConfig ¶
func GetQuotaAndUsageRequirementsFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) ([]*scpb.Requirement, error)
func GetQuotaMetricCostsFromOPConfig ¶
func GetQuotaMetricCostsFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) map[string][]*scpb.MetricCost
GetQuotaMetricCostsFromOPConfig pre-processes all quota rules into a map of metric costs by selector.
func GetServiceControlURLFromOPConfig ¶
func GetServiceControlURLFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) string
GetServiceControlURLFromOPConfig chooses the right data source to read the Service Control URL from.
func GetUsageRulesBySelectorFromOPConfig ¶
func GetUsageRulesBySelectorFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) map[string]*servicepb.UsageRule
GetUsageRulesBySelectorFromOPConfig returns a map of selector to usage rule. Usage rules may be modified from original service config.
Replaces ServiceInfo::processUsageRule.
func IsAutoGenCORSRequiredForOPConfig ¶
func IsAutoGenCORSRequiredForOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) bool
IsAutoGenCORSRequiredForOPConfig returns true if CORS methods should be autogenerated.
Replaces ServiceInfo::processEndpoints.
func IsGRPCSupportRequiredForOPConfig ¶
func IsGRPCSupportRequiredForOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) (bool, error)
IsGRPCSupportRequiredForOPConfig determines if any customer configuration requires gRPC features. If not, the generated configuration can be trimmed.
Replaces ServiceInfo::buildBackendFromAddress and ServiceInfo::addBackendRuleToMethod.
func IsSchemeHeaderOverrideRequiredForOPConfig ¶
func IsSchemeHeaderOverrideRequiredForOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) (bool, error)
IsSchemeHeaderOverrideRequiredForOPConfig fixes b/221072669: a hack to work around b/221308324 where Cloud Run always set :scheme header to http when using http2 protocol for grpc. Override scheme header to https when following conditions meet: * Deployed in serverless platform. * Backend uses grpc * Any remote backends is using TLS
func MakeMethodRequirementsFromOPConfig ¶
func MakeMethodRequirementsFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) ([]*scpb.Requirement, error)
MakeMethodRequirementsFromOPConfig creates the method requirements config.
func MakeSCCallingConfigFromOPConfig ¶
func MakeSCCallingConfigFromOPConfig(opts options.ConfigGeneratorOptions) *scpb.ServiceControlCallingConfig
func MethodToCORSSelector ¶
func MethodToCORSSelector(api *apipb.Api, method *apipb.Method, corsOperationDelimiter string) string
MethodToCORSSelector gets the corresponding autogenerated CORS selector for an OP API and Method.
func MethodToSelector ¶
MethodToSelector gets the operation name from OP API and Method.
func ParseDepErrorBehavior ¶
func ParseDepErrorBehavior(stringVal string) (commonpb.DependencyErrorBehavior, error)
func ParseServiceControlURLFromOPConfig ¶
func ParseServiceControlURLFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) (url.URL, error)
ParseServiceControlURLFromOPConfig will get and parse the Service Control URL.
func UpdateProtoDescriptorFromOPConfig ¶
func UpdateProtoDescriptorFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions, descriptorBytes []byte) ([]byte, error)
UpdateProtoDescriptorFromOPConfig mutates the proto descriptor based on OP service configuration.
To support specifying custom http rules in service config. Envoy grpc_json_transcoder only uses the http.rules in the proto descriptor generated from "google.api.http" annotation in the proto file. For some shared grpc services, each service may want to define its own http.rules mapping. This function will copy the http.rules from the service config into proto descriptor.
api-compiler has following behaviours:
- If a "google.api.http" annotation is specified in a method in the proto, and the service config yaml doesn't specify one, api-compiler will copy it out to the normalized service config.
- If a http.rule is specified in the service config, it will overwrite the one from the proto annotation.
So it should be ok to blindly copy the http.rules from the service config to proto descriptor.
Types ¶
type BackendAuthGenerator ¶
type BackendAuthGenerator struct { // UniqueAudiences is the list of unique JWT audiences in the config. UniqueAudiences map[string]bool // AudienceBySelector lists the JWT audience for each method. AudienceBySelector map[string]string IamURL string MetadataURL string HttpRequestTimeout time.Duration DependencyErrorBehavior string CORSOperationDelimiter string BackendAuthCredentials *options.IAMCredentialsOptions AccessToken *helpers.FilterAccessTokenConfiger NoopFilterGenerator }
func (*BackendAuthGenerator) FilterName ¶
func (g *BackendAuthGenerator) FilterName() string
func (*BackendAuthGenerator) GenFilterConfig ¶
func (g *BackendAuthGenerator) GenFilterConfig() (proto.Message, error)
func (*BackendAuthGenerator) GenPerRouteConfig ¶
func (g *BackendAuthGenerator) GenPerRouteConfig(selector string, httpRule *httppattern.Pattern) (proto.Message, error)
type CORSGenerator ¶
type CORSGenerator struct { Preset string // AllowOrigin should only be set if preset=basic AllowOrigin string // AllowOriginRegex should only be set if preset=cors_with_regex AllowOriginRegex string MaxAge time.Duration AllowMethods string AllowHeaders string ExposeHeaders string AllowCredentials bool NoopFilterGenerator }
CORSGenerator is a FilterGenerator to configure CORS config.
func (*CORSGenerator) FilterName ¶
func (g *CORSGenerator) FilterName() string
func (*CORSGenerator) GenFilterConfig ¶
func (g *CORSGenerator) GenFilterConfig() (proto.Message, error)
func (*CORSGenerator) GenPerHostConfig ¶
func (g *CORSGenerator) GenPerHostConfig(vHostName string) (proto.Message, error)
type CompressorGenerator ¶
type CompressorGenerator struct { NoopFilterGenerator // contains filtered or unexported fields }
func (*CompressorGenerator) FilterName ¶
func (g *CompressorGenerator) FilterName() string
func (*CompressorGenerator) GenFilterConfig ¶
func (g *CompressorGenerator) GenFilterConfig() (proto.Message, error)
type CompressorType ¶
type CompressorType int
const ( GzipCompressor CompressorType = iota BrotliCompressor )
type FilterGenerator ¶
type FilterGenerator interface { // FilterName returns the debug name of the filter. FilterName() string // GenFilterConfig generates the filter config. // // Return type is the filter's config proto. // // Return (nil, nil) if the filter has no listener-level config, but may // have per-route configurations. GenFilterConfig() (proto.Message, error) // GenPerRouteConfig generates the per-route config for the given selector and HTTP route (HTTP pattern). // // Return type is the filter's per-route config proto. // // This method is called on all routes. Return (nil, nil) to indicate the // filter does NOT require a per-route config for the given route. GenPerRouteConfig(string, *httppattern.Pattern) (proto.Message, error) // GenPerHostConfig generates the per-host config in RDS for the given virtual // host name. Useful in case a filter needs to apply config for the entire // virtual host. // // Return type is the filter's per-host config proto. // // This method is called on all virtual hosts. Return (nil, nil) to indicate the // filter does NOT require a per-host config for the given virtual host. GenPerHostConfig(string) (proto.Message, error) }
FilterGenerator is an interface for objects that generate Envoy filters.
func NewBackendAuthFilterGensFromOPConfig ¶
func NewBackendAuthFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
NewBackendAuthFilterGensFromOPConfig creates a BackendAuthGenerator from OP service config + descriptor + ESPv2 options. It is a FilterGeneratorOPFactory.
func NewCORSFilterGensFromOPConfig ¶
func NewCORSFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
NewCORSFilterGensFromOPConfig creates a CORSGenerator from OP service config + descriptor + ESPv2 options. It is a FilterGeneratorOPFactory.
func NewCompressorFilterGensFromOPConfig ¶
func NewCompressorFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
NewCompressorFilterGensFromOPConfig creates a CompressorGenerator from OP service config + descriptor + ESPv2 options. It is a FilterGeneratorOPFactory.
func NewGRPCMetadataScrubberFilterGensFromOPConfig ¶
func NewGRPCMetadataScrubberFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
NewGRPCMetadataScrubberFilterGensFromOPConfig creates a GRPCMetadataScrubberGenerator from OP service config + descriptor + ESPv2 options. It is a FilterGeneratorOPFactory.
func NewGRPCTranscoderFilterGensFromOPConfig ¶
func NewGRPCTranscoderFilterGensFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
NewGRPCTranscoderFilterGensFromOPConfig creates a GRPCTranscoderGenerator from OP service config + descriptor + ESPv2 options. It is a FilterGeneratorOPFactory.
func NewGRPCWebFilterGensFromOPConfig ¶
func NewGRPCWebFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
NewGRPCWebFilterGensFromOPConfig creates a GRPCWebGenerator from OP service config + descriptor + ESPv2 options. It is a FilterGeneratorOPFactory.
func NewHeaderSanitizerFilterGensFromOPConfig ¶
func NewHeaderSanitizerFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
NewHeaderSanitizerFilterGensFromOPConfig creates a HeaderSanitizerGenerator from OP service config + descriptor + ESPv2 options. It is a FilterGeneratorOPFactory.
func NewHealthCheckFilterGensFromOPConfig ¶
func NewHealthCheckFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
NewHealthCheckFilterGensFromOPConfig creates a HealthCheckGenerator from OP service config + descriptor + ESPv2 options. It is a FilterGeneratorOPFactory.
func NewJwtAuthnFilterGensFromOPConfig ¶
func NewJwtAuthnFilterGensFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
NewJwtAuthnFilterGensFromOPConfig creates a JwtAuthnGenerator from OP service config + descriptor + ESPv2 options. It is a FilterGeneratorOPFactory.
func NewPathRewriteFilterGensFromOPConfig ¶
func NewPathRewriteFilterGensFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
NewPathRewriteFilterGensFromOPConfig creates a PathRewriteGenerator from OP service config + descriptor + ESPv2 options. It is a FilterGeneratorOPFactory.
func NewRouterFilterGensFromOPConfig ¶
func NewRouterFilterGensFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
NewRouterFilterGensFromOPConfig creates a RouterGenerator from OP service config + descriptor + ESPv2 options. It is a FilterGeneratorOPFactory.
func NewServiceControlFilterGensFromOPConfig ¶
func NewServiceControlFilterGensFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions, params ServiceControlOPFactoryParams) ([]FilterGenerator, error)
NewServiceControlFilterGensFromOPConfig creates a ServiceControlGenerator from OP service config + descriptor + ESPv2 options.
type FilterGeneratorOPFactory ¶
type FilterGeneratorOPFactory func(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) ([]FilterGenerator, error)
FilterGeneratorOPFactory is the factory function to create an ordered slice of FilterGenerator from One Platform config.
The majority of factories will only return 1 FilterGenerator, but they should be encapsulated by a slice for generalization.
type GRPCMetadataScrubberGenerator ¶
type GRPCMetadataScrubberGenerator struct {
NoopFilterGenerator
}
func (*GRPCMetadataScrubberGenerator) FilterName ¶
func (g *GRPCMetadataScrubberGenerator) FilterName() string
func (*GRPCMetadataScrubberGenerator) GenFilterConfig ¶
func (g *GRPCMetadataScrubberGenerator) GenFilterConfig() (proto.Message, error)
type GRPCTranscoderGenerator ¶
type GRPCTranscoderGenerator struct { ProtoDescriptorBin []byte ServiceNames []string // IgnoredQueryParams is the list of query params the transcoder should ignore. // Query params not in this list will result in request rejection. IgnoredQueryParams map[string]bool // DisabledSelectors contains selectors that the transcoder should be disabled // for via per-route filter config. DisabledSelectors map[string]bool IgnoreUnknownQueryParameters bool QueryParametersDisableUnescapePlus bool MatchUnregisteredCustomVerb bool CaseInsensitiveEnumParsing bool StrictRequestValidation bool RejectCollision bool PrintOptions *transcoderpb.GrpcJsonTranscoder_PrintOptions NoopFilterGenerator }
func NewGRPCTranscoderFilterGenFromOPConfig ¶
func NewGRPCTranscoderFilterGenFromOPConfig(serviceConfig *confpb.Service, opts options.ConfigGeneratorOptions, maybeSkipFilter bool) (*GRPCTranscoderGenerator, error)
NewGRPCTranscoderFilterGenFromOPConfig creates a single GRPCTranscoderGenerator.
It also has the option to skip the filter. If enabled, all checks will occur and filter may not be created. Otherwise, filter is always created.
func (*GRPCTranscoderGenerator) FilterName ¶
func (g *GRPCTranscoderGenerator) FilterName() string
func (*GRPCTranscoderGenerator) GenFilterConfig ¶
func (g *GRPCTranscoderGenerator) GenFilterConfig() (proto.Message, error)
func (*GRPCTranscoderGenerator) GenPerRouteConfig ¶
func (g *GRPCTranscoderGenerator) GenPerRouteConfig(selector string, httpRule *httppattern.Pattern) (protov2.Message, error)
type GRPCWebGenerator ¶
type GRPCWebGenerator struct {
NoopFilterGenerator
}
func (*GRPCWebGenerator) FilterName ¶
func (g *GRPCWebGenerator) FilterName() string
func (*GRPCWebGenerator) GenFilterConfig ¶
func (g *GRPCWebGenerator) GenFilterConfig() (proto.Message, error)
type HTTPConnectionManagerGenerator ¶
type HTTPConnectionManagerGenerator struct { IsSchemeHeaderOverrideRequired bool // ESPv2 options EnvoyUseRemoteAddress bool EnvoyXffNumTrustedHops int NormalizePath bool MergeSlashesInPath bool DisallowEscapedSlashesInPath bool AccessLogPath string AccessLogFormat string UnderscoresInHeaders bool EnableGrpcForHttp1 bool TracingOptions *options.TracingOptions NoopFilterGenerator }
func NewHTTPConnectionManagerGenFromOPConfig ¶
func NewHTTPConnectionManagerGenFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) (*HTTPConnectionManagerGenerator, error)
NewHTTPConnectionManagerGenFromOPConfig creates a HTTPConnectionManagerGenerator from OP service config + descriptor + ESPv2 options.
This is a special case generator as it a network filter, not HTTP filter.
func (*HTTPConnectionManagerGenerator) FilterName ¶
func (g *HTTPConnectionManagerGenerator) FilterName() string
func (*HTTPConnectionManagerGenerator) GenFilterConfig ¶
func (g *HTTPConnectionManagerGenerator) GenFilterConfig() (proto.Message, error)
type HeaderSanitizerGenerator ¶
type HeaderSanitizerGenerator struct {
NoopFilterGenerator
}
func (*HeaderSanitizerGenerator) FilterName ¶
func (g *HeaderSanitizerGenerator) FilterName() string
func (*HeaderSanitizerGenerator) GenFilterConfig ¶
func (g *HeaderSanitizerGenerator) GenFilterConfig() (proto.Message, error)
type HealthCheckGenerator ¶
type HealthCheckGenerator struct { HealthzPath string ShouldHealthCheckGrpcBackend bool LocalBackendClusterName string NoopFilterGenerator }
func (*HealthCheckGenerator) FilterName ¶
func (g *HealthCheckGenerator) FilterName() string
func (*HealthCheckGenerator) GenFilterConfig ¶
func (g *HealthCheckGenerator) GenFilterConfig() (proto.Message, error)
type JwtAuthnGenerator ¶
type JwtAuthnGenerator struct { // ServiceName is the service config name. ServiceName string // AuthConfig is the full authentication config from the OP service config. // TODO(nareddyt): This should be generalized, but since we only use jwt_authn // filter in ESPv2, we can generalize it later. AuthConfig *confpb.Authentication // AuthRequiredBySelector maps which selectors require per-route level authn // config. AuthRequiredBySelector map[string]bool HttpRequestTimeout time.Duration GeneratedHeaderPrefix string JwksCacheDurationInS int DisableJwksAsyncFetch bool JwksAsyncFetchFastListener bool JwksFetchNumRetries int JwksFetchRetryBackOffBaseInterval time.Duration JwksFetchRetryBackOffMaxInterval time.Duration JwtPadForwardPayloadHeader bool DisableJwtAudienceServiceNameCheck bool JwtCacheSize uint NoopFilterGenerator }
func (*JwtAuthnGenerator) FilterName ¶
func (g *JwtAuthnGenerator) FilterName() string
func (*JwtAuthnGenerator) GenFilterConfig ¶
func (g *JwtAuthnGenerator) GenFilterConfig() (proto.Message, error)
func (*JwtAuthnGenerator) GenPerRouteConfig ¶
func (g *JwtAuthnGenerator) GenPerRouteConfig(selector string, httpRule *httppattern.Pattern) (proto.Message, error)
type NoopFilterGenerator ¶
type NoopFilterGenerator struct{}
NoopFilterGenerator is a FilterGenerator that provides empty implementation for all optional methods.
func (*NoopFilterGenerator) GenPerHostConfig ¶
func (g *NoopFilterGenerator) GenPerHostConfig(string) (proto.Message, error)
func (*NoopFilterGenerator) GenPerRouteConfig ¶
func (g *NoopFilterGenerator) GenPerRouteConfig(string, *httppattern.Pattern) (proto.Message, error)
type PathRewriteGenerator ¶
type PathRewriteGenerator struct { CORSOperationDelimiter string TranslationInfoBySelector map[string]TranslationInfo NoopFilterGenerator }
func (*PathRewriteGenerator) FilterName ¶
func (g *PathRewriteGenerator) FilterName() string
func (*PathRewriteGenerator) GenFilterConfig ¶
func (g *PathRewriteGenerator) GenFilterConfig() (proto.Message, error)
func (*PathRewriteGenerator) GenPerRouteConfig ¶
func (g *PathRewriteGenerator) GenPerRouteConfig(selector string, httpRule *httppattern.Pattern) (proto.Message, error)
type RouterGenerator ¶
type RouterGenerator struct { SuppressEnvoyHeaders bool StartChildSpan bool NoopFilterGenerator }
func (*RouterGenerator) FilterName ¶
func (g *RouterGenerator) FilterName() string
func (*RouterGenerator) GenFilterConfig ¶
func (g *RouterGenerator) GenFilterConfig() (proto.Message, error)
type ServiceControlGenerator ¶
type ServiceControlGenerator struct { ServiceName string ServiceConfigID string ProducerProjectID string // ServiceConfig is the full OP service config. ServiceConfig *confpb.Service // GRPCSupportRequired indicates if any backends use gRPC. GRPCSupportRequired bool ServiceControlURI url.URL CallCredentials *options.IAMCredentialsOptions AccessToken *helpers.FilterAccessTokenConfiger DisableTracing bool TracingProjectID string HttpRequestTimeout time.Duration GeneratedHeaderPrefix string IAMURL string DependencyErrorBehavior string ClientIPFromForwardedHeader bool LogRequestHeaders string LogResponseHeaders string LogJwtPayloads string MinStreamReportIntervalMs uint64 ComputePlatformOverride string // Service control configs. MethodRequirements []*scpb.Requirement CallingConfig *scpb.ServiceControlCallingConfig GCPAttributes *scpb.GcpAttributes NoopFilterGenerator }
func (*ServiceControlGenerator) FilterName ¶
func (g *ServiceControlGenerator) FilterName() string
func (*ServiceControlGenerator) GenFilterConfig ¶
func (g *ServiceControlGenerator) GenFilterConfig() (proto.Message, error)
func (*ServiceControlGenerator) GenPerRouteConfig ¶
func (g *ServiceControlGenerator) GenPerRouteConfig(selector string, httpRule *httppattern.Pattern) (proto.Message, error)
type ServiceControlOPFactoryParams ¶
type ServiceControlOPFactoryParams struct {
GCPAttributes *scpb.GcpAttributes
}
ServiceControlOPFactoryParams are extra params that don't fit within OP service config, but needed for construction.
type TranslationInfo ¶
type TranslationInfo struct { // TranslationType cannot be UNSPECIFIED. Do not add it to the config if so. TranslationType confpb.BackendRule_PathTranslation // Path cannot be empty. Do NOT add it to the config if so. Path string }
TranslationInfo captures https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#understanding_path_translation.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package filtergentest contains test helpers to test filter generators.
|
Package filtergentest contains test helpers to test filter generators. |