Skip to content

Commit 7449b9d

Browse files
authored
Use enum variants for HTTP matching types (#7)
Signed-off-by: Oliver Gould <[email protected]>
1 parent de0d905 commit 7449b9d

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "k8s-gateway-api"
3-
version = "0.2.1"
3+
version = "0.3.0"
44
edition = "2021"
55
license = "Apache-2.0"
66
repository = "https://github.com/linkerd/k8s-gateway-api"

src/v1alpha2/httproute.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,12 @@ pub struct HttpRouteRule {
181181
///
182182
/// - Must begin with the `/` character
183183
/// - Must not contain consecutive `/` characters (e.g. `/foo///`, `//`).
184-
pub type PathMatchType = String;
184+
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize, schemars::JsonSchema)]
185+
pub enum PathMatchType {
186+
Exact,
187+
PathPrefix,
188+
RegularExpression,
189+
}
185190

186191
/// HTTPPathMatch describes how to select a HTTP route by matching the HTTP request path.
187192
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize, schemars::JsonSchema)]
@@ -202,7 +207,11 @@ pub struct HttpPathMatch {
202207
///
203208
/// * "Exact"
204209
/// * "RegularExpression"
205-
pub type HeaderMatchType = String;
210+
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize, schemars::JsonSchema)]
211+
pub enum HeaderMatchType {
212+
Exact,
213+
RegularExpression,
214+
}
206215

207216
/// HTTPHeaderName is the name of an HTTP header.
208217
///
@@ -259,7 +268,11 @@ pub struct HttpHeaderMatch {
259268
///
260269
/// * "Exact"
261270
/// * "RegularExpression"
262-
pub type QueryParamMatchType = String;
271+
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize, schemars::JsonSchema)]
272+
pub enum QueryParamMatchType {
273+
Exact,
274+
RegularExpression,
275+
}
263276

264277
/// HTTPQueryParamMatch describes how to select a HTTP route by matching HTTP
265278
/// query parameters.

0 commit comments

Comments
 (0)