Skip to content

Commit

Permalink
add TODO to refactor string match types
Browse files Browse the repository at this point in the history
Signed-off-by: huabing zhao <[email protected]>
  • Loading branch information
zhaohuabing committed Oct 25, 2023
1 parent 8497f86 commit fc2b8ca
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions api/v1alpha1/envoyproxy_metric_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type ProxyPrometheusProvider struct {
}

// Match defines the stats match configuration.
type Match struct {
type Match struct { // TODO: zhaohuabing this type should be renamed to StatsMatch
// MatcherType defines the stats matcher type
//
// +kubebuilder:validation:Enum=RegularExpression;Prefix;Suffix
Expand All @@ -70,7 +70,7 @@ type Match struct {

type MatcherType string

const (
const ( // TODO: zhaohuabing the const types should be prefixed with StatsMatch
Prefix MatcherType = "Prefix"
RegularExpression MatcherType = "RegularExpression"
Suffix MatcherType = "Suffix"
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/ratelimitfilter_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ type SourceMatch struct {
}

// HeaderMatch defines the match attributes within the HTTP Headers of the request.
type HeaderMatch struct {
type HeaderMatch struct { // TODO: zhaohuabing this type could be replaced with a general purpose StringMatch type.
// Type specifies how to match against the value of the header.
//
// +optional
Expand Down
3 changes: 2 additions & 1 deletion api/v1alpha1/securitypolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ type CORS struct {
}

// StringMatch defines how to match any strings.
// TODO: zhaohuabing make this a shared type for all APIs
// This is a general purpose match condition that can be used by other EG APIs
// that need to match against a string.
type StringMatch struct {
// Type specifies how to match against a string.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ spec:
description: AllowOrigins defines the origins that are allowed
to make requests.
items:
description: 'StringMatch defines how to match any strings.
TODO: zhaohuabing make this a shared type for all APIs'
description: StringMatch defines how to match any strings. This
is a general purpose match condition that can be used by other
EG APIs that need to match against a string.
properties:
caseSensitive:
default: "False"
Expand Down
2 changes: 1 addition & 1 deletion site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,7 @@ _Appears in:_



StringMatch defines how to match any strings. TODO: zhaohuabing make this a shared type for all APIs
StringMatch defines how to match any strings. This is a general purpose match condition that can be used by other EG APIs that need to match against a string.

_Appears in:_
- [CORS](#cors)
Expand Down

0 comments on commit fc2b8ca

Please sign in to comment.