gateway_api/apis/standard/
httproutes.rs

1// WARNING: generated file - manual changes will be overriden
2
3use super::common::*;
4#[allow(unused_imports)]
5mod prelude {
6    pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
7    pub use kube_derive::CustomResource;
8    pub use schemars::JsonSchema;
9    pub use serde::{Deserialize, Serialize};
10}
11use self::prelude::*;
12/// Spec defines the desired state of HTTPRoute.
13#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
14#[kube(
15    group = "gateway.networking.k8s.io",
16    version = "v1",
17    kind = "HTTPRoute",
18    plural = "httproutes"
19)]
20#[kube(namespaced)]
21#[kube(status = "RouteStatus")]
22#[kube(derive = "Default")]
23#[kube(derive = "PartialEq")]
24pub struct HTTPRouteSpec {
25    /// Hostnames defines a set of hostnames that should match against the HTTP Host
26    /// header to select a HTTPRoute used to process the request. Implementations
27    /// MUST ignore any port value specified in the HTTP Host header while
28    /// performing a match and (absent of any applicable header modification
29    /// configuration) MUST forward this header unmodified to the backend.
30    ///
31    /// Valid values for Hostnames are determined by RFC 1123 definition of a
32    /// hostname with 2 notable exceptions:
33    ///
34    /// 1. IPs are not allowed.
35    /// 2. A hostname may be prefixed with a wildcard label (`*.`). The wildcard
36    ///    label must appear by itself as the first label.
37    ///
38    /// If a hostname is specified by both the Listener and HTTPRoute, there
39    /// must be at least one intersecting hostname for the HTTPRoute to be
40    /// attached to the Listener. For example:
41    ///
42    /// * A Listener with `test.example.com` as the hostname matches HTTPRoutes
43    ///   that have either not specified any hostnames, or have specified at
44    ///   least one of `test.example.com` or `*.example.com`.
45    /// * A Listener with `*.example.com` as the hostname matches HTTPRoutes
46    ///   that have either not specified any hostnames or have specified at least
47    ///   one hostname that matches the Listener hostname. For example,
48    ///   `*.example.com`, `test.example.com`, and `foo.test.example.com` would
49    ///   all match. On the other hand, `example.com` and `test.example.net` would
50    ///   not match.
51    ///
52    /// Hostnames that are prefixed with a wildcard label (`*.`) are interpreted
53    /// as a suffix match. That means that a match for `*.example.com` would match
54    /// both `test.example.com`, and `foo.test.example.com`, but not `example.com`.
55    ///
56    /// If both the Listener and HTTPRoute have specified hostnames, any
57    /// HTTPRoute hostnames that do not match the Listener hostname MUST be
58    /// ignored. For example, if a Listener specified `*.example.com`, and the
59    /// HTTPRoute specified `test.example.com` and `test.example.net`,
60    /// `test.example.net` must not be considered for a match.
61    ///
62    /// If both the Listener and HTTPRoute have specified hostnames, and none
63    /// match with the criteria above, then the HTTPRoute is not accepted. The
64    /// implementation must raise an 'Accepted' Condition with a status of
65    /// `False` in the corresponding RouteParentStatus.
66    ///
67    /// In the event that multiple HTTPRoutes specify intersecting hostnames (e.g.
68    /// overlapping wildcard matching and exact matching hostnames), precedence must
69    /// be given to rules from the HTTPRoute with the largest number of:
70    ///
71    /// * Characters in a matching non-wildcard hostname.
72    /// * Characters in a matching hostname.
73    ///
74    /// If ties exist across multiple Routes, the matching precedence rules for
75    /// HTTPRouteMatches takes over.
76    ///
77    /// Support: Core
78    #[serde(default, skip_serializing_if = "Option::is_none")]
79    pub hostnames: Option<Vec<String>>,
80    /// ParentRefs references the resources (usually Gateways) that a Route wants
81    /// to be attached to. Note that the referenced parent resource needs to
82    /// allow this for the attachment to be complete. For Gateways, that means
83    /// the Gateway needs to allow attachment from Routes of this kind and
84    /// namespace. For Services, that means the Service must either be in the same
85    /// namespace for a "producer" route, or the mesh implementation must support
86    /// and allow "consumer" routes for the referenced Service. ReferenceGrant is
87    /// not applicable for governing ParentRefs to Services - it is not possible to
88    /// create a "producer" route for a Service in a different namespace from the
89    /// Route.
90    ///
91    /// There are two kinds of parent resources with "Core" support:
92    ///
93    /// * Gateway (Gateway conformance profile)
94    /// * Service (Mesh conformance profile, ClusterIP Services only)
95    ///
96    /// This API may be extended in the future to support additional kinds of parent
97    /// resources.
98    ///
99    /// ParentRefs must be _distinct_. This means either that:
100    ///
101    /// * They select different objects.  If this is the case, then parentRef
102    ///   entries are distinct. In terms of fields, this means that the
103    ///   multi-part key defined by `group`, `kind`, `namespace`, and `name` must
104    ///   be unique across all parentRef entries in the Route.
105    /// * They do not select different objects, but for each optional field used,
106    ///   each ParentRef that selects the same object must set the same set of
107    ///   optional fields to different values. If one ParentRef sets a
108    ///   combination of optional fields, all must set the same combination.
109    ///
110    /// Some examples:
111    ///
112    /// * If one ParentRef sets `sectionName`, all ParentRefs referencing the
113    ///   same object must also set `sectionName`.
114    /// * If one ParentRef sets `port`, all ParentRefs referencing the same
115    ///   object must also set `port`.
116    /// * If one ParentRef sets `sectionName` and `port`, all ParentRefs
117    ///   referencing the same object must also set `sectionName` and `port`.
118    ///
119    /// It is possible to separately reference multiple distinct objects that may
120    /// be collapsed by an implementation. For example, some implementations may
121    /// choose to merge compatible Gateway Listeners together. If that is the
122    /// case, the list of routes attached to those resources should also be
123    /// merged.
124    ///
125    /// Note that for ParentRefs that cross namespace boundaries, there are specific
126    /// rules. Cross-namespace references are only valid if they are explicitly
127    /// allowed by something in the namespace they are referring to. For example,
128    /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
129    /// generic way to enable other kinds of cross-namespace reference.
130    ///
131    ///
132    ///
133    ///
134    ///
135    ///
136    ///
137    #[serde(
138        default,
139        skip_serializing_if = "Option::is_none",
140        rename = "parentRefs"
141    )]
142    pub parent_refs: Option<Vec<ParentReference>>,
143    /// Rules are a list of HTTP matchers, filters and actions.
144    ///
145    ///
146    #[serde(default, skip_serializing_if = "Option::is_none")]
147    pub rules: Option<Vec<HTTPRouteRule>>,
148}
149/// HTTPRouteRule defines semantics for matching an HTTP request based on
150/// conditions (matches), processing it (filters), and forwarding the request to
151/// an API object (backendRefs).
152#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
153pub struct HTTPRouteRule {
154    /// BackendRefs defines the backend(s) where matching requests should be
155    /// sent.
156    ///
157    /// Failure behavior here depends on how many BackendRefs are specified and
158    /// how many are invalid.
159    ///
160    /// If *all* entries in BackendRefs are invalid, and there are also no filters
161    /// specified in this route rule, *all* traffic which matches this rule MUST
162    /// receive a 500 status code.
163    ///
164    /// See the HTTPBackendRef definition for the rules about what makes a single
165    /// HTTPBackendRef invalid.
166    ///
167    /// When a HTTPBackendRef is invalid, 500 status codes MUST be returned for
168    /// requests that would have otherwise been routed to an invalid backend. If
169    /// multiple backends are specified, and some are invalid, the proportion of
170    /// requests that would otherwise have been routed to an invalid backend
171    /// MUST receive a 500 status code.
172    ///
173    /// For example, if two backends are specified with equal weights, and one is
174    /// invalid, 50 percent of traffic must receive a 500. Implementations may
175    /// choose how that 50 percent is determined.
176    ///
177    /// When a HTTPBackendRef refers to a Service that has no ready endpoints,
178    /// implementations SHOULD return a 503 for requests to that backend instead.
179    /// If an implementation chooses to do this, all of the above rules for 500 responses
180    /// MUST also apply for responses that return a 503.
181    ///
182    /// Support: Core for Kubernetes Service
183    ///
184    /// Support: Extended for Kubernetes ServiceImport
185    ///
186    /// Support: Implementation-specific for any other resource
187    ///
188    /// Support for weight: Core
189    #[serde(
190        default,
191        skip_serializing_if = "Option::is_none",
192        rename = "backendRefs"
193    )]
194    pub backend_refs: Option<Vec<HTTPBackendReference>>,
195    /// Filters define the filters that are applied to requests that match
196    /// this rule.
197    ///
198    /// Wherever possible, implementations SHOULD implement filters in the order
199    /// they are specified.
200    ///
201    /// Implementations MAY choose to implement this ordering strictly, rejecting
202    /// any combination or order of filters that can not be supported. If implementations
203    /// choose a strict interpretation of filter ordering, they MUST clearly document
204    /// that behavior.
205    ///
206    /// To reject an invalid combination or order of filters, implementations SHOULD
207    /// consider the Route Rules with this configuration invalid. If all Route Rules
208    /// in a Route are invalid, the entire Route would be considered invalid. If only
209    /// a portion of Route Rules are invalid, implementations MUST set the
210    /// "PartiallyInvalid" condition for the Route.
211    ///
212    /// Conformance-levels at this level are defined based on the type of filter:
213    ///
214    /// - ALL core filters MUST be supported by all implementations.
215    /// - Implementers are encouraged to support extended filters.
216    /// - Implementation-specific custom filters have no API guarantees across
217    ///   implementations.
218    ///
219    /// Specifying the same filter multiple times is not supported unless explicitly
220    /// indicated in the filter.
221    ///
222    /// All filters are expected to be compatible with each other except for the
223    /// URLRewrite and RequestRedirect filters, which may not be combined. If an
224    /// implementation can not support other combinations of filters, they must clearly
225    /// document that limitation. In cases where incompatible or unsupported
226    /// filters are specified and cause the `Accepted` condition to be set to status
227    /// `False`, implementations may use the `IncompatibleFilters` reason to specify
228    /// this configuration error.
229    ///
230    /// Support: Core
231    #[serde(default, skip_serializing_if = "Option::is_none")]
232    pub filters: Option<Vec<HTTPRouteFilter>>,
233    /// Matches define conditions used for matching the rule against incoming
234    /// HTTP requests. Each match is independent, i.e. this rule will be matched
235    /// if **any** one of the matches is satisfied.
236    ///
237    /// For example, take the following matches configuration:
238    ///
239    /// ```text
240    /// matches:
241    /// - path:
242    ///     value: "/foo"
243    ///   headers:
244    ///   - name: "version"
245    ///     value: "v2"
246    /// - path:
247    ///     value: "/v2/foo"
248    /// ```
249    ///
250    /// For a request to match against this rule, a request must satisfy
251    /// EITHER of the two conditions:
252    ///
253    /// - path prefixed with `/foo` AND contains the header `version: v2`
254    /// - path prefix of `/v2/foo`
255    ///
256    /// See the documentation for HTTPRouteMatch on how to specify multiple
257    /// match conditions that should be ANDed together.
258    ///
259    /// If no matches are specified, the default is a prefix
260    /// path match on "/", which has the effect of matching every
261    /// HTTP request.
262    ///
263    /// Proxy or Load Balancer routing configuration generated from HTTPRoutes
264    /// MUST prioritize matches based on the following criteria, continuing on
265    /// ties. Across all rules specified on applicable Routes, precedence must be
266    /// given to the match having:
267    ///
268    /// * "Exact" path match.
269    /// * "Prefix" path match with largest number of characters.
270    /// * Method match.
271    /// * Largest number of header matches.
272    /// * Largest number of query param matches.
273    ///
274    /// Note: The precedence of RegularExpression path matches are implementation-specific.
275    ///
276    /// If ties still exist across multiple Routes, matching precedence MUST be
277    /// determined in order of the following criteria, continuing on ties:
278    ///
279    /// * The oldest Route based on creation timestamp.
280    /// * The Route appearing first in alphabetical order by
281    ///   "{namespace}/{name}".
282    ///
283    /// If ties still exist within an HTTPRoute, matching precedence MUST be granted
284    /// to the FIRST matching rule (in list order) with a match meeting the above
285    /// criteria.
286    ///
287    /// When no rules matching a request have been successfully attached to the
288    /// parent a request is coming from, a HTTP 404 status code MUST be returned.
289    #[serde(default, skip_serializing_if = "Option::is_none")]
290    pub matches: Option<Vec<RouteMatch>>,
291    /// Timeouts defines the timeouts that can be configured for an HTTP request.
292    ///
293    /// Support: Extended
294    #[serde(default, skip_serializing_if = "Option::is_none")]
295    pub timeouts: Option<HTTPRouteTimeout>,
296}
297/// HTTPBackendRef defines how a HTTPRoute forwards a HTTP request.
298///
299/// Note that when a namespace different than the local namespace is specified, a
300/// ReferenceGrant object is required in the referent namespace to allow that
301/// namespace's owner to accept the reference. See the ReferenceGrant
302/// documentation for details.
303///
304/// <gateway:experimental:description>
305///
306/// When the BackendRef points to a Kubernetes Service, implementations SHOULD
307/// honor the appProtocol field if it is set for the target Service Port.
308///
309/// Implementations supporting appProtocol SHOULD recognize the Kubernetes
310/// Standard Application Protocols defined in KEP-3726.
311///
312/// If a Service appProtocol isn't specified, an implementation MAY infer the
313/// backend protocol through its own means. Implementations MAY infer the
314/// protocol from the Route type referring to the backend Service.
315///
316/// If a Route is not able to send traffic to the backend using the specified
317/// protocol then the backend is considered invalid. Implementations MUST set the
318/// "ResolvedRefs" condition to "False" with the "UnsupportedProtocol" reason.
319///
320/// </gateway:experimental:description>
321#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
322pub struct HTTPBackendReference {
323    /// Filters defined at this level should be executed if and only if the
324    /// request is being forwarded to the backend defined here.
325    ///
326    /// Support: Implementation-specific (For broader support of filters, use the
327    /// Filters field in HTTPRouteRule.)
328    #[serde(default, skip_serializing_if = "Option::is_none")]
329    pub filters: Option<Vec<HTTPRouteBackendFilter>>,
330    /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
331    /// When unspecified or empty string, core API group is inferred.
332    #[serde(default, skip_serializing_if = "Option::is_none")]
333    pub group: Option<String>,
334    /// Kind is the Kubernetes resource kind of the referent. For example
335    /// "Service".
336    ///
337    /// Defaults to "Service" when not specified.
338    ///
339    /// ExternalName services can refer to CNAME DNS records that may live
340    /// outside of the cluster and as such are difficult to reason about in
341    /// terms of conformance. They also may not be safe to forward to (see
342    /// CVE-2021-25740 for more information). Implementations SHOULD NOT
343    /// support ExternalName Services.
344    ///
345    /// Support: Core (Services with a type other than ExternalName)
346    ///
347    /// Support: Implementation-specific (Services with type ExternalName)
348    #[serde(default, skip_serializing_if = "Option::is_none")]
349    pub kind: Option<String>,
350    /// Name is the name of the referent.
351    pub name: String,
352    /// Namespace is the namespace of the backend. When unspecified, the local
353    /// namespace is inferred.
354    ///
355    /// Note that when a namespace different than the local namespace is specified,
356    /// a ReferenceGrant object is required in the referent namespace to allow that
357    /// namespace's owner to accept the reference. See the ReferenceGrant
358    /// documentation for details.
359    ///
360    /// Support: Core
361    #[serde(default, skip_serializing_if = "Option::is_none")]
362    pub namespace: Option<String>,
363    /// Port specifies the destination port number to use for this resource.
364    /// Port is required when the referent is a Kubernetes Service. In this
365    /// case, the port number is the service port number, not the target port.
366    /// For other resources, destination port might be derived from the referent
367    /// resource or this field.
368    #[serde(default, skip_serializing_if = "Option::is_none")]
369    pub port: Option<i32>,
370    /// Weight specifies the proportion of requests forwarded to the referenced
371    /// backend. This is computed as weight/(sum of all weights in this
372    /// BackendRefs list). For non-zero values, there may be some epsilon from
373    /// the exact proportion defined here depending on the precision an
374    /// implementation supports. Weight is not a percentage and the sum of
375    /// weights does not need to equal 100.
376    ///
377    /// If only one backend is specified and it has a weight greater than 0, 100%
378    /// of the traffic is forwarded to that backend. If weight is set to 0, no
379    /// traffic should be forwarded for this entry. If unspecified, weight
380    /// defaults to 1.
381    ///
382    /// Support for this field varies based on the context where used.
383    #[serde(default, skip_serializing_if = "Option::is_none")]
384    pub weight: Option<i32>,
385}
386/// HTTPRouteFilter defines processing steps that must be completed during the
387/// request or response lifecycle. HTTPRouteFilters are meant as an extension
388/// point to express processing that may be done in Gateway implementations. Some
389/// examples include request or response modification, implementing
390/// authentication strategies, rate-limiting, and traffic shaping. API
391/// guarantee/conformance is defined based on the type of the filter.
392#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
393pub struct HTTPRouteBackendFilter {
394    /// ExtensionRef is an optional, implementation-specific extension to the
395    /// "filter" behavior.  For example, resource "myroutefilter" in group
396    /// "networking.example.net"). ExtensionRef MUST NOT be used for core and
397    /// extended filters.
398    ///
399    /// This filter can be used multiple times within the same rule.
400    ///
401    /// Support: Implementation-specific
402    #[serde(
403        default,
404        skip_serializing_if = "Option::is_none",
405        rename = "extensionRef"
406    )]
407    pub extension_ref: Option<GatewayInfrastructureParametersReference>,
408    /// RequestHeaderModifier defines a schema for a filter that modifies request
409    /// headers.
410    ///
411    /// Support: Core
412    #[serde(
413        default,
414        skip_serializing_if = "Option::is_none",
415        rename = "requestHeaderModifier"
416    )]
417    pub request_header_modifier: Option<HeaderModifier>,
418    /// RequestMirror defines a schema for a filter that mirrors requests.
419    /// Requests are sent to the specified destination, but responses from
420    /// that destination are ignored.
421    ///
422    /// This filter can be used multiple times within the same rule. Note that
423    /// not all implementations will be able to support mirroring to multiple
424    /// backends.
425    ///
426    /// Support: Extended
427    ///
428    ///
429    #[serde(
430        default,
431        skip_serializing_if = "Option::is_none",
432        rename = "requestMirror"
433    )]
434    pub request_mirror: Option<RequestMirror>,
435    /// RequestRedirect defines a schema for a filter that responds to the
436    /// request with an HTTP redirection.
437    ///
438    /// Support: Core
439    #[serde(
440        default,
441        skip_serializing_if = "Option::is_none",
442        rename = "requestRedirect"
443    )]
444    pub request_redirect: Option<RequestRedirect>,
445    /// ResponseHeaderModifier defines a schema for a filter that modifies response
446    /// headers.
447    ///
448    /// Support: Extended
449    #[serde(
450        default,
451        skip_serializing_if = "Option::is_none",
452        rename = "responseHeaderModifier"
453    )]
454    pub response_header_modifier: Option<HeaderModifier>,
455    /// Type identifies the type of filter to apply. As with other API fields,
456    /// types are classified into three conformance levels:
457    ///
458    /// - Core: Filter types and their corresponding configuration defined by
459    ///   "Support: Core" in this package, e.g. "RequestHeaderModifier". All
460    ///   implementations must support core filters.
461    ///
462    /// - Extended: Filter types and their corresponding configuration defined by
463    ///   "Support: Extended" in this package, e.g. "RequestMirror". Implementers
464    ///   are encouraged to support extended filters.
465    ///
466    /// - Implementation-specific: Filters that are defined and supported by
467    ///   specific vendors.
468    ///   In the future, filters showing convergence in behavior across multiple
469    ///   implementations will be considered for inclusion in extended or core
470    ///   conformance levels. Filter-specific configuration for such filters
471    ///   is specified using the ExtensionRef field. `Type` should be set to
472    ///   "ExtensionRef" for custom filters.
473    ///
474    /// Implementers are encouraged to define custom implementation types to
475    /// extend the core API with implementation-specific behavior.
476    ///
477    /// If a reference to a custom filter type cannot be resolved, the filter
478    /// MUST NOT be skipped. Instead, requests that would have been processed by
479    /// that filter MUST receive a HTTP error response.
480    ///
481    /// Note that values may be added to this enum, implementations
482    /// must ensure that unknown values will not cause a crash.
483    ///
484    /// Unknown values here must result in the implementation setting the
485    /// Accepted Condition for the Route to `status: False`, with a
486    /// Reason of `UnsupportedValue`.
487    #[serde(rename = "type")]
488    pub r#type: HTTPFilterType,
489    /// URLRewrite defines a schema for a filter that modifies a request during forwarding.
490    ///
491    /// Support: Extended
492    #[serde(
493        default,
494        skip_serializing_if = "Option::is_none",
495        rename = "urlRewrite"
496    )]
497    pub url_rewrite: Option<HTTPRouteUrlRewrite>,
498}
499/// HTTPRouteFilter defines processing steps that must be completed during the
500/// request or response lifecycle. HTTPRouteFilters are meant as an extension
501/// point to express processing that may be done in Gateway implementations. Some
502/// examples include request or response modification, implementing
503/// authentication strategies, rate-limiting, and traffic shaping. API
504/// guarantee/conformance is defined based on the type of the filter.
505#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
506pub struct HTTPRouteFilter {
507    /// ExtensionRef is an optional, implementation-specific extension to the
508    /// "filter" behavior.  For example, resource "myroutefilter" in group
509    /// "networking.example.net"). ExtensionRef MUST NOT be used for core and
510    /// extended filters.
511    ///
512    /// This filter can be used multiple times within the same rule.
513    ///
514    /// Support: Implementation-specific
515    #[serde(
516        default,
517        skip_serializing_if = "Option::is_none",
518        rename = "extensionRef"
519    )]
520    pub extension_ref: Option<GatewayInfrastructureParametersReference>,
521    /// RequestHeaderModifier defines a schema for a filter that modifies request
522    /// headers.
523    ///
524    /// Support: Core
525    #[serde(
526        default,
527        skip_serializing_if = "Option::is_none",
528        rename = "requestHeaderModifier"
529    )]
530    pub request_header_modifier: Option<HeaderModifier>,
531    /// RequestMirror defines a schema for a filter that mirrors requests.
532    /// Requests are sent to the specified destination, but responses from
533    /// that destination are ignored.
534    ///
535    /// This filter can be used multiple times within the same rule. Note that
536    /// not all implementations will be able to support mirroring to multiple
537    /// backends.
538    ///
539    /// Support: Extended
540    ///
541    ///
542    #[serde(
543        default,
544        skip_serializing_if = "Option::is_none",
545        rename = "requestMirror"
546    )]
547    pub request_mirror: Option<RequestMirror>,
548    /// RequestRedirect defines a schema for a filter that responds to the
549    /// request with an HTTP redirection.
550    ///
551    /// Support: Core
552    #[serde(
553        default,
554        skip_serializing_if = "Option::is_none",
555        rename = "requestRedirect"
556    )]
557    pub request_redirect: Option<RequestRedirect>,
558    /// ResponseHeaderModifier defines a schema for a filter that modifies response
559    /// headers.
560    ///
561    /// Support: Extended
562    #[serde(
563        default,
564        skip_serializing_if = "Option::is_none",
565        rename = "responseHeaderModifier"
566    )]
567    pub response_header_modifier: Option<HeaderModifier>,
568    /// Type identifies the type of filter to apply. As with other API fields,
569    /// types are classified into three conformance levels:
570    ///
571    /// - Core: Filter types and their corresponding configuration defined by
572    ///   "Support: Core" in this package, e.g. "RequestHeaderModifier". All
573    ///   implementations must support core filters.
574    ///
575    /// - Extended: Filter types and their corresponding configuration defined by
576    ///   "Support: Extended" in this package, e.g. "RequestMirror". Implementers
577    ///   are encouraged to support extended filters.
578    ///
579    /// - Implementation-specific: Filters that are defined and supported by
580    ///   specific vendors.
581    ///   In the future, filters showing convergence in behavior across multiple
582    ///   implementations will be considered for inclusion in extended or core
583    ///   conformance levels. Filter-specific configuration for such filters
584    ///   is specified using the ExtensionRef field. `Type` should be set to
585    ///   "ExtensionRef" for custom filters.
586    ///
587    /// Implementers are encouraged to define custom implementation types to
588    /// extend the core API with implementation-specific behavior.
589    ///
590    /// If a reference to a custom filter type cannot be resolved, the filter
591    /// MUST NOT be skipped. Instead, requests that would have been processed by
592    /// that filter MUST receive a HTTP error response.
593    ///
594    /// Note that values may be added to this enum, implementations
595    /// must ensure that unknown values will not cause a crash.
596    ///
597    /// Unknown values here must result in the implementation setting the
598    /// Accepted Condition for the Route to `status: False`, with a
599    /// Reason of `UnsupportedValue`.
600    #[serde(rename = "type")]
601    pub r#type: HTTPFilterType,
602    /// URLRewrite defines a schema for a filter that modifies a request during forwarding.
603    ///
604    /// Support: Extended
605    #[serde(
606        default,
607        skip_serializing_if = "Option::is_none",
608        rename = "urlRewrite"
609    )]
610    pub url_rewrite: Option<HTTPRouteUrlRewrite>,
611}
612/// HTTPRouteMatch defines the predicate used to match requests to a given
613/// action. Multiple match types are ANDed together, i.e. the match will
614/// evaluate to true only if all conditions are satisfied.
615///
616/// For example, the match below will match a HTTP request only if its path
617/// starts with `/foo` AND it contains the `version: v1` header:
618///
619/// ```text
620/// match:
621///
622/// 	path:
623/// 	  value: "/foo"
624/// 	headers:
625/// 	- name: "version"
626/// 	  value "v1"
627///
628/// ```
629#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
630pub struct RouteMatch {
631    /// Headers specifies HTTP request header matchers. Multiple match values are
632    /// ANDed together, meaning, a request must match all the specified headers
633    /// to select the route.
634    #[serde(default, skip_serializing_if = "Option::is_none")]
635    pub headers: Option<Vec<HeaderMatch>>,
636    /// Method specifies HTTP method matcher.
637    /// When specified, this route will be matched only if the request has the
638    /// specified method.
639    ///
640    /// Support: Extended
641    #[serde(default, skip_serializing_if = "Option::is_none")]
642    pub method: Option<HTTPMethodMatch>,
643    /// Path specifies a HTTP request path matcher. If this field is not
644    /// specified, a default prefix match on the "/" path is provided.
645    #[serde(default, skip_serializing_if = "Option::is_none")]
646    pub path: Option<PathMatch>,
647    /// QueryParams specifies HTTP query parameter matchers. Multiple match
648    /// values are ANDed together, meaning, a request must match all the
649    /// specified query parameters to select the route.
650    ///
651    /// Support: Extended
652    #[serde(
653        default,
654        skip_serializing_if = "Option::is_none",
655        rename = "queryParams"
656    )]
657    pub query_params: Option<Vec<HeaderMatch>>,
658}
659/// HTTPRouteMatch defines the predicate used to match requests to a given
660/// action. Multiple match types are ANDed together, i.e. the match will
661/// evaluate to true only if all conditions are satisfied.
662///
663/// For example, the match below will match a HTTP request only if its path
664/// starts with `/foo` AND it contains the `version: v1` header:
665///
666/// ```text
667/// match:
668///
669/// 	path:
670/// 	  value: "/foo"
671/// 	headers:
672/// 	- name: "version"
673/// 	  value "v1"
674///
675/// ```
676#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
677pub enum HTTPMethodMatch {
678    #[serde(rename = "GET")]
679    Get,
680    #[serde(rename = "HEAD")]
681    Head,
682    #[serde(rename = "POST")]
683    Post,
684    #[serde(rename = "PUT")]
685    Put,
686    #[serde(rename = "DELETE")]
687    Delete,
688    #[serde(rename = "CONNECT")]
689    Connect,
690    #[serde(rename = "OPTIONS")]
691    Options,
692    #[serde(rename = "TRACE")]
693    Trace,
694    #[serde(rename = "PATCH")]
695    Patch,
696}
697/// Path specifies a HTTP request path matcher. If this field is not
698/// specified, a default prefix match on the "/" path is provided.
699#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
700pub struct PathMatch {
701    /// Type specifies how to match against the path Value.
702    ///
703    /// Support: Core (Exact, PathPrefix)
704    ///
705    /// Support: Implementation-specific (RegularExpression)
706    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
707    pub r#type: Option<HTTPRouteRulesMatchesPathType>,
708    /// Value of the HTTP path to match against.
709    #[serde(default, skip_serializing_if = "Option::is_none")]
710    pub value: Option<String>,
711}
712/// Path specifies a HTTP request path matcher. If this field is not
713/// specified, a default prefix match on the "/" path is provided.
714#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
715pub enum HTTPRouteRulesMatchesPathType {
716    Exact,
717    PathPrefix,
718    RegularExpression,
719}
720/// Timeouts defines the timeouts that can be configured for an HTTP request.
721///
722/// Support: Extended
723#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
724pub struct HTTPRouteTimeout {
725    /// BackendRequest specifies a timeout for an individual request from the gateway
726    /// to a backend. This covers the time from when the request first starts being
727    /// sent from the gateway to when the full response has been received from the backend.
728    ///
729    /// Setting a timeout to the zero duration (e.g. "0s") SHOULD disable the timeout
730    /// completely. Implementations that cannot completely disable the timeout MUST
731    /// instead interpret the zero duration as the longest possible value to which
732    /// the timeout can be set.
733    ///
734    /// An entire client HTTP transaction with a gateway, covered by the Request timeout,
735    /// may result in more than one call from the gateway to the destination backend,
736    /// for example, if automatic retries are supported.
737    ///
738    /// The value of BackendRequest must be a Gateway API Duration string as defined by
739    /// GEP-2257.  When this field is unspecified, its behavior is implementation-specific;
740    /// when specified, the value of BackendRequest must be no more than the value of the
741    /// Request timeout (since the Request timeout encompasses the BackendRequest timeout).
742    ///
743    /// Support: Extended
744    #[serde(
745        default,
746        skip_serializing_if = "Option::is_none",
747        rename = "backendRequest"
748    )]
749    pub backend_request: Option<String>,
750    /// Request specifies the maximum duration for a gateway to respond to an HTTP request.
751    /// If the gateway has not been able to respond before this deadline is met, the gateway
752    /// MUST return a timeout error.
753    ///
754    /// For example, setting the `rules.timeouts.request` field to the value `10s` in an
755    /// `HTTPRoute` will cause a timeout if a client request is taking longer than 10 seconds
756    /// to complete.
757    ///
758    /// Setting a timeout to the zero duration (e.g. "0s") SHOULD disable the timeout
759    /// completely. Implementations that cannot completely disable the timeout MUST
760    /// instead interpret the zero duration as the longest possible value to which
761    /// the timeout can be set.
762    ///
763    /// This timeout is intended to cover as close to the whole request-response transaction
764    /// as possible although an implementation MAY choose to start the timeout after the entire
765    /// request stream has been received instead of immediately after the transaction is
766    /// initiated by the client.
767    ///
768    /// The value of Request is a Gateway API Duration string as defined by GEP-2257. When this
769    /// field is unspecified, request timeout behavior is implementation-specific.
770    ///
771    /// Support: Extended
772    #[serde(default, skip_serializing_if = "Option::is_none")]
773    pub request: Option<String>,
774}