Skip to content

Commit

Permalink
Merge pull request #137 from Kuadrant/remove-unused-code
Browse files Browse the repository at this point in the history
remove unused conditions
  • Loading branch information
eguzki authored Nov 8, 2024
2 parents 8a8ee56 + 21b2fd7 commit 0dd4968
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 1,099 deletions.
96 changes: 0 additions & 96 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,102 +50,6 @@ evaluating to a `bool` value, while `Expression`, used for passing data to a ser

These expression can operate on the data made available to them through the Well Known Attributes, see below

#### Conditions, Selectors and Operators (deprecated!)

<details>

While still supported, these will eventually disappear. For now though, you still can express them as such:

```yaml
services:
auth-service:
type: auth
endpoint: auth-cluster
failureMode: deny
timeout: 10ms
ratelimit-service:
type: ratelimit
endpoint: ratelimit-cluster
failureMode: deny
actionSets:
- name: rlp-ns-A/rlp-name-A
routeRuleConditions:
hostnames: [ "*.toystore.com" ]
matches:
- selector: request.url_path
operator: startswith
value: /get
- selector: request.host
operator: eq
value: test.toystore.com
- selector: request.method
operator: eq
value: GET
actions:
- service: ratelimit-service
scope: rlp-ns-A/rlp-name-A
conditions: []
data:
- selector:
selector: request.headers.My-Custom-Header
- static:
key: admin
value: "1"
```

```Rust
#[derive(Deserialize, PartialEq, Debug, Clone)]
pub enum WhenConditionOperator {
#[serde(rename = "eq")]
EqualOperator,
#[serde(rename = "neq")]
NotEqualOperator,
#[serde(rename = "startswith")]
StartsWithOperator,
#[serde(rename = "endswith")]
EndsWithOperator,
#[serde(rename = "matches")]
MatchesOperator,
}
```

Selector of an attribute from the contextual properties provided by kuadrant.
See [Well Known Attributes](#Well-Known-Attributes) for more info about available attributes.

The struct is

```Rust
#[derive(Deserialize, Debug, Clone)]
pub struct SelectorItem {
// Selector of an attribute from the contextual properties provided by kuadrant
// during request and connection processing
pub selector: String,
// If not set it defaults to `selector` field value as the descriptor key.
#[serde(default)]
pub key: Option<String>,

// An optional value to use if the selector is not found in the context.
// If not set and the selector is not found in the context, then no data is generated.
#[serde(default)]
pub default: Option<String>,
}
```

Selectors are tokenized at each non-escaped occurrence of a separator character `.`.
Example:

```
Input: this.is.a.exam\.ple -> Retuns: ["this", "is", "a", "exam.ple"].
```

Some path segments include dot `.` char in them. For instance envoy filter
names: `envoy.filters.http.header_to_metadata`.
In that particular cases, the dot chat (separator), needs to be escaped.

</details>


### Well Known Attributes

| Attribute | Description |
Expand Down
Loading

0 comments on commit 0dd4968

Please sign in to comment.