Skip to main content

gateway_api/apis/experimental/
httproutes.rs

1// WARNING: generated by kopium - manual changes will be overwritten
2// kopium command: kopium --schema=derived --derive=JsonSchema --derive=Default --derive=PartialEq --docs -f -
3// kopium version: 0.22.5
4
5#[allow(unused_imports)]
6mod prelude {
7    pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
8    pub use kube::CustomResource;
9    pub use schemars::JsonSchema;
10    pub use serde::{Deserialize, Serialize};
11}
12use self::prelude::*;
13
14/// Spec defines the desired state of HTTPRoute.
15#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
16#[kube(
17    group = "gateway.networking.k8s.io",
18    version = "v1",
19    kind = "HTTPRoute",
20    plural = "httproutes"
21)]
22#[kube(namespaced)]
23#[kube(status = "HttpRouteStatus")]
24#[kube(derive = "Default")]
25#[kube(derive = "PartialEq")]
26pub struct HttpRouteSpec {
27    /// Hostnames defines a set of hostnames that should match against the HTTP Host
28    /// header to select a HTTPRoute used to process the request. Implementations
29    /// MUST ignore any port value specified in the HTTP Host header while
30    /// performing a match and (absent of any applicable header modification
31    /// configuration) MUST forward this header unmodified to the backend.
32    ///
33    /// Valid values for Hostnames are determined by RFC 1123 definition of a
34    /// hostname with 2 notable exceptions:
35    ///
36    /// 1. IPs are not allowed.
37    /// 2. A hostname may be prefixed with a wildcard label (`*.`). The wildcard
38    ///    label must appear by itself as the first label.
39    ///
40    /// If a hostname is specified by both the Listener and HTTPRoute, there
41    /// must be at least one intersecting hostname for the HTTPRoute to be
42    /// attached to the Listener. For example:
43    ///
44    /// * A Listener with `test.example.com` as the hostname matches HTTPRoutes
45    ///   that have either not specified any hostnames, or have specified at
46    ///   least one of `test.example.com` or `*.example.com`.
47    /// * A Listener with `*.example.com` as the hostname matches HTTPRoutes
48    ///   that have either not specified any hostnames or have specified at least
49    ///   one hostname that matches the Listener hostname. For example,
50    ///   `*.example.com`, `test.example.com`, and `foo.test.example.com` would
51    ///   all match. On the other hand, `example.com` and `test.example.net` would
52    ///   not match.
53    ///
54    /// Hostnames that are prefixed with a wildcard label (`*.`) are interpreted
55    /// as a suffix match. That means that a match for `*.example.com` would match
56    /// both `test.example.com`, and `foo.test.example.com`, but not `example.com`.
57    ///
58    /// If both the Listener and HTTPRoute have specified hostnames, any
59    /// HTTPRoute hostnames that do not match the Listener hostname MUST be
60    /// ignored. For example, if a Listener specified `*.example.com`, and the
61    /// HTTPRoute specified `test.example.com` and `test.example.net`,
62    /// `test.example.net` must not be considered for a match.
63    ///
64    /// If both the Listener and HTTPRoute have specified hostnames, and none
65    /// match with the criteria above, then the HTTPRoute is not accepted. The
66    /// implementation must raise an 'Accepted' Condition with a status of
67    /// `False` in the corresponding RouteParentStatus.
68    ///
69    /// In the event that multiple HTTPRoutes specify intersecting hostnames (e.g.
70    /// overlapping wildcard matching and exact matching hostnames), precedence must
71    /// be given to rules from the HTTPRoute with the largest number of:
72    ///
73    /// * Characters in a matching non-wildcard hostname.
74    /// * Characters in a matching hostname.
75    ///
76    /// If ties exist across multiple Routes, the matching precedence rules for
77    /// HTTPRouteMatches takes over.
78    ///
79    /// Support: Core
80    #[serde(default, skip_serializing_if = "Option::is_none")]
81    pub hostnames: Option<Vec<String>>,
82    /// ParentRefs references the resources (usually Gateways) that a Route wants
83    /// to be attached to. Note that the referenced parent resource needs to
84    /// allow this for the attachment to be complete. For Gateways, that means
85    /// the Gateway needs to allow attachment from Routes of this kind and
86    /// namespace. For Services, that means the Service must either be in the same
87    /// namespace for a "producer" route, or the mesh implementation must support
88    /// and allow "consumer" routes for the referenced Service. ReferenceGrant is
89    /// not applicable for governing ParentRefs to Services - it is not possible to
90    /// create a "producer" route for a Service in a different namespace from the
91    /// Route.
92    ///
93    /// There are two kinds of parent resources with "Core" support:
94    ///
95    /// * Gateway (Gateway conformance profile)
96    /// * Service (Mesh conformance profile, ClusterIP Services only)
97    ///
98    /// This API may be extended in the future to support additional kinds of parent
99    /// resources.
100    ///
101    /// ParentRefs must be _distinct_. This means either that:
102    ///
103    /// * They select different objects.  If this is the case, then parentRef
104    ///   entries are distinct. In terms of fields, this means that the
105    ///   multi-part key defined by `group`, `kind`, `namespace`, and `name` must
106    ///   be unique across all parentRef entries in the Route.
107    /// * They do not select different objects, but for each optional field used,
108    ///   each ParentRef that selects the same object must set the same set of
109    ///   optional fields to different values. If one ParentRef sets a
110    ///   combination of optional fields, all must set the same combination.
111    ///
112    /// Some examples:
113    ///
114    /// * If one ParentRef sets `sectionName`, all ParentRefs referencing the
115    ///   same object must also set `sectionName`.
116    /// * If one ParentRef sets `port`, all ParentRefs referencing the same
117    ///   object must also set `port`.
118    /// * If one ParentRef sets `sectionName` and `port`, all ParentRefs
119    ///   referencing the same object must also set `sectionName` and `port`.
120    ///
121    /// It is possible to separately reference multiple distinct objects that may
122    /// be collapsed by an implementation. For example, some implementations may
123    /// choose to merge compatible Gateway Listeners together. If that is the
124    /// case, the list of routes attached to those resources should also be
125    /// merged.
126    ///
127    /// Note that for ParentRefs that cross namespace boundaries, there are specific
128    /// rules. Cross-namespace references are only valid if they are explicitly
129    /// allowed by something in the namespace they are referring to. For example,
130    /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
131    /// generic way to enable other kinds of cross-namespace reference.
132    ///
133    ///
134    /// ParentRefs from a Route to a Service in the same namespace are "producer"
135    /// routes, which apply default routing rules to inbound connections from
136    /// any namespace to the Service.
137    ///
138    /// ParentRefs from a Route to a Service in a different namespace are
139    /// "consumer" routes, and these routing rules are only applied to outbound
140    /// connections originating from the same namespace as the Route, for which
141    /// the intended destination of the connections are a Service targeted as a
142    /// ParentRef of the Route.
143    #[serde(default, skip_serializing_if = "Option::is_none", rename = "parentRefs")]
144    pub parent_refs: Option<Vec<HttpRouteParentRefs>>,
145    /// Rules are a list of HTTP matchers, filters and actions.
146    #[serde(default, skip_serializing_if = "Option::is_none")]
147    pub rules: Option<Vec<HttpRouteRules>>,
148    /// UseDefaultGateways indicates the default Gateway scope to use for this
149    /// Route. If unset (the default) or set to None, the Route will not be
150    /// attached to any default Gateway; if set, it will be attached to any
151    /// default Gateway supporting the named scope, subject to the usual rules
152    /// about which Routes a Gateway is allowed to claim.
153    ///
154    /// Think carefully before using this functionality! The set of default
155    /// Gateways supporting the requested scope can change over time without
156    /// any notice to the Route author, and in many situations it will not be
157    /// appropriate to request a default Gateway for a given Route -- for
158    /// example, a Route with specific security requirements should almost
159    /// certainly not use a default Gateway.
160    #[serde(default, skip_serializing_if = "Option::is_none", rename = "useDefaultGateways")]
161    pub use_default_gateways: Option<HttpRouteUseDefaultGateways>,
162}
163
164/// ParentReference identifies an API object (usually a Gateway) that can be considered
165/// a parent of this resource (usually a route). There are two kinds of parent resources
166/// with "Core" support:
167///
168/// * Gateway (Gateway conformance profile)
169/// * Service (Mesh conformance profile, ClusterIP Services only)
170///
171/// This API may be extended in the future to support additional kinds of parent
172/// resources.
173///
174/// The API object must be valid in the cluster; the Group and Kind must
175/// be registered in the cluster for this reference to be valid.
176#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
177pub struct HttpRouteParentRefs {
178    /// Group is the group of the referent.
179    /// When unspecified, "gateway.networking.k8s.io" is inferred.
180    /// To set the core API group (such as for a "Service" kind referent),
181    /// Group must be explicitly set to "" (empty string).
182    ///
183    /// Support: Core
184    #[serde(default, skip_serializing_if = "Option::is_none")]
185    pub group: Option<String>,
186    /// Kind is kind of the referent.
187    ///
188    /// There are two kinds of parent resources with "Core" support:
189    ///
190    /// * Gateway (Gateway conformance profile)
191    /// * Service (Mesh conformance profile, ClusterIP Services only)
192    ///
193    /// Support for other resources is Implementation-Specific.
194    #[serde(default, skip_serializing_if = "Option::is_none")]
195    pub kind: Option<String>,
196    /// Name is the name of the referent.
197    ///
198    /// Support: Core
199    pub name: String,
200    /// Namespace is the namespace of the referent. When unspecified, this refers
201    /// to the local namespace of the Route.
202    ///
203    /// Note that there are specific rules for ParentRefs which cross namespace
204    /// boundaries. Cross-namespace references are only valid if they are explicitly
205    /// allowed by something in the namespace they are referring to. For example:
206    /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
207    /// generic way to enable any other kind of cross-namespace reference.
208    ///
209    ///
210    /// ParentRefs from a Route to a Service in the same namespace are "producer"
211    /// routes, which apply default routing rules to inbound connections from
212    /// any namespace to the Service.
213    ///
214    /// ParentRefs from a Route to a Service in a different namespace are
215    /// "consumer" routes, and these routing rules are only applied to outbound
216    /// connections originating from the same namespace as the Route, for which
217    /// the intended destination of the connections are a Service targeted as a
218    /// ParentRef of the Route.
219    ///
220    ///
221    /// Support: Core
222    #[serde(default, skip_serializing_if = "Option::is_none")]
223    pub namespace: Option<String>,
224    /// Port is the network port this Route targets. It can be interpreted
225    /// differently based on the type of parent resource.
226    ///
227    /// When the parent resource is a Gateway, this targets all listeners
228    /// listening on the specified port that also support this kind of Route(and
229    /// select this Route). It's not recommended to set `Port` unless the
230    /// networking behaviors specified in a Route must apply to a specific port
231    /// as opposed to a listener(s) whose port(s) may be changed. When both Port
232    /// and SectionName are specified, the name and port of the selected listener
233    /// must match both specified values.
234    ///
235    ///
236    /// When the parent resource is a Service, this targets a specific port in the
237    /// Service spec. When both Port (experimental) and SectionName are specified,
238    /// the name and port of the selected port must match both specified values.
239    ///
240    ///
241    /// Implementations MAY choose to support other parent resources.
242    /// Implementations supporting other types of parent resources MUST clearly
243    /// document how/if Port is interpreted.
244    ///
245    /// For the purpose of status, an attachment is considered successful as
246    /// long as the parent resource accepts it partially. For example, Gateway
247    /// listeners can restrict which Routes can attach to them by Route kind,
248    /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
249    /// from the referencing Route, the Route MUST be considered successfully
250    /// attached. If no Gateway listeners accept attachment from this Route,
251    /// the Route MUST be considered detached from the Gateway.
252    ///
253    /// Support: Extended
254    #[serde(default, skip_serializing_if = "Option::is_none")]
255    pub port: Option<i32>,
256    /// SectionName is the name of a section within the target resource. In the
257    /// following resources, SectionName is interpreted as the following:
258    ///
259    /// * Gateway: Listener name. When both Port (experimental) and SectionName
260    /// are specified, the name and port of the selected listener must match
261    /// both specified values.
262    /// * Service: Port name. When both Port (experimental) and SectionName
263    /// are specified, the name and port of the selected listener must match
264    /// both specified values.
265    ///
266    /// Implementations MAY choose to support attaching Routes to other resources.
267    /// If that is the case, they MUST clearly document how SectionName is
268    /// interpreted.
269    ///
270    /// When unspecified (empty string), this will reference the entire resource.
271    /// For the purpose of status, an attachment is considered successful if at
272    /// least one section in the parent resource accepts it. For example, Gateway
273    /// listeners can restrict which Routes can attach to them by Route kind,
274    /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
275    /// the referencing Route, the Route MUST be considered successfully
276    /// attached. If no Gateway listeners accept attachment from this Route, the
277    /// Route MUST be considered detached from the Gateway.
278    ///
279    /// Support: Core
280    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sectionName")]
281    pub section_name: Option<String>,
282}
283
284/// HTTPRouteRule defines semantics for matching an HTTP request based on
285/// conditions (matches), processing it (filters), and forwarding the request to
286/// an API object (backendRefs).
287#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
288pub struct HttpRouteRules {
289    /// BackendRefs defines the backend(s) where matching requests should be
290    /// sent.
291    ///
292    /// Failure behavior here depends on how many BackendRefs are specified and
293    /// how many are invalid.
294    ///
295    /// If *all* entries in BackendRefs are invalid, and there are also no filters
296    /// specified in this route rule, *all* traffic which matches this rule MUST
297    /// receive a 500 status code.
298    ///
299    /// See the HTTPBackendRef definition for the rules about what makes a single
300    /// HTTPBackendRef invalid.
301    ///
302    /// When a HTTPBackendRef is invalid, 500 status codes MUST be returned for
303    /// requests that would have otherwise been routed to an invalid backend. If
304    /// multiple backends are specified, and some are invalid, the proportion of
305    /// requests that would otherwise have been routed to an invalid backend
306    /// MUST receive a 500 status code.
307    ///
308    /// For example, if two backends are specified with equal weights, and one is
309    /// invalid, 50 percent of traffic must receive a 500. Implementations may
310    /// choose how that 50 percent is determined.
311    ///
312    /// When a HTTPBackendRef refers to a Service that has no ready endpoints,
313    /// implementations SHOULD return a 503 for requests to that backend instead.
314    /// If an implementation chooses to do this, all of the above rules for 500 responses
315    /// MUST also apply for responses that return a 503.
316    ///
317    /// Support: Core for Kubernetes Service
318    ///
319    /// Support: Extended for Kubernetes ServiceImport
320    ///
321    /// Support: Implementation-specific for any other resource
322    ///
323    /// Support for weight: Core
324    #[serde(default, skip_serializing_if = "Option::is_none", rename = "backendRefs")]
325    pub backend_refs: Option<Vec<HttpRouteRulesBackendRefs>>,
326    /// Filters define the filters that are applied to requests that match
327    /// this rule.
328    ///
329    /// Wherever possible, implementations SHOULD implement filters in the order
330    /// they are specified.
331    ///
332    /// Implementations MAY choose to implement this ordering strictly, rejecting
333    /// any combination or order of filters that cannot be supported. If implementations
334    /// choose a strict interpretation of filter ordering, they MUST clearly document
335    /// that behavior.
336    ///
337    /// To reject an invalid combination or order of filters, implementations SHOULD
338    /// consider the Route Rules with this configuration invalid. If all Route Rules
339    /// in a Route are invalid, the entire Route would be considered invalid. If only
340    /// a portion of Route Rules are invalid, implementations MUST set the
341    /// "PartiallyInvalid" condition for the Route.
342    ///
343    /// Conformance-levels at this level are defined based on the type of filter:
344    ///
345    /// - ALL core filters MUST be supported by all implementations.
346    /// - Implementers are encouraged to support extended filters.
347    /// - Implementation-specific custom filters have no API guarantees across
348    ///   implementations.
349    ///
350    /// Specifying the same filter multiple times is not supported unless explicitly
351    /// indicated in the filter.
352    ///
353    /// All filters are expected to be compatible with each other except for the
354    /// URLRewrite and RequestRedirect filters, which may not be combined. If an
355    /// implementation cannot support other combinations of filters, they must clearly
356    /// document that limitation. In cases where incompatible or unsupported
357    /// filters are specified and cause the `Accepted` condition to be set to status
358    /// `False`, implementations may use the `IncompatibleFilters` reason to specify
359    /// this configuration error.
360    ///
361    /// Support: Core
362    #[serde(default, skip_serializing_if = "Option::is_none")]
363    pub filters: Option<Vec<HttpRouteRulesFilters>>,
364    /// Matches define conditions used for matching the rule against incoming
365    /// HTTP requests. Each match is independent, i.e. this rule will be matched
366    /// if **any** one of the matches is satisfied.
367    ///
368    /// For example, take the following matches configuration:
369    ///
370    /// ```text
371    /// matches:
372    /// - path:
373    ///     value: "/foo"
374    ///   headers:
375    ///   - name: "version"
376    ///     value: "v2"
377    /// - path:
378    ///     value: "/v2/foo"
379    /// ```
380    ///
381    /// For a request to match against this rule, a request must satisfy
382    /// EITHER of the two conditions:
383    ///
384    /// - path prefixed with `/foo` AND contains the header `version: v2`
385    /// - path prefix of `/v2/foo`
386    ///
387    /// See the documentation for HTTPRouteMatch on how to specify multiple
388    /// match conditions that should be ANDed together.
389    ///
390    /// If no matches are specified, the default is a prefix
391    /// path match on "/", which has the effect of matching every
392    /// HTTP request.
393    ///
394    /// Proxy or Load Balancer routing configuration generated from HTTPRoutes
395    /// MUST prioritize matches based on the following criteria, continuing on
396    /// ties. Across all rules specified on applicable Routes, precedence must be
397    /// given to the match having:
398    ///
399    /// * "Exact" path match.
400    /// * "Prefix" path match with largest number of characters.
401    /// * Method match.
402    /// * Largest number of header matches.
403    /// * Largest number of query param matches.
404    ///
405    /// Note: The precedence of RegularExpression path matches are implementation-specific.
406    ///
407    /// If ties still exist across multiple Routes, matching precedence MUST be
408    /// determined in order of the following criteria, continuing on ties:
409    ///
410    /// * The oldest Route based on creation timestamp.
411    /// * The Route appearing first in alphabetical order by
412    ///   "{namespace}/{name}".
413    ///
414    /// If ties still exist within an HTTPRoute, matching precedence MUST be granted
415    /// to the FIRST matching rule (in list order) with a match meeting the above
416    /// criteria.
417    ///
418    /// When no rules matching a request have been successfully attached to the
419    /// parent a request is coming from, a HTTP 404 status code MUST be returned.
420    #[serde(default, skip_serializing_if = "Option::is_none")]
421    pub matches: Option<Vec<HttpRouteRulesMatches>>,
422    /// Name is the name of the route rule. This name MUST be unique within a Route if it is set.
423    ///
424    /// Support: Extended
425    #[serde(default, skip_serializing_if = "Option::is_none")]
426    pub name: Option<String>,
427    /// Retry defines the configuration for when to retry an HTTP request.
428    ///
429    /// Support: Extended
430    #[serde(default, skip_serializing_if = "Option::is_none")]
431    pub retry: Option<HttpRouteRulesRetry>,
432    /// SessionPersistence defines and configures session persistence
433    /// for the route rule.
434    ///
435    /// Support: Extended
436    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sessionPersistence")]
437    pub session_persistence: Option<HttpRouteRulesSessionPersistence>,
438    /// Timeouts defines the timeouts that can be configured for an HTTP request.
439    ///
440    /// Support: Extended
441    #[serde(default, skip_serializing_if = "Option::is_none")]
442    pub timeouts: Option<HttpRouteRulesTimeouts>,
443}
444
445/// HTTPBackendRef defines how a HTTPRoute forwards a HTTP request.
446///
447/// Note that when a namespace different than the local namespace is specified, a
448/// ReferenceGrant object is required in the referent namespace to allow that
449/// namespace's owner to accept the reference. See the ReferenceGrant
450/// documentation for details.
451///
452///
453/// When the BackendRef points to a Kubernetes Service, implementations SHOULD
454/// honor the appProtocol field if it is set for the target Service Port.
455///
456/// Implementations supporting appProtocol SHOULD recognize the Kubernetes
457/// Standard Application Protocols defined in KEP-3726.
458///
459/// If a Service appProtocol isn't specified, an implementation MAY infer the
460/// backend protocol through its own means. Implementations MAY infer the
461/// protocol from the Route type referring to the backend Service.
462///
463/// If a Route is not able to send traffic to the backend using the specified
464/// protocol then the backend is considered invalid. Implementations MUST set the
465/// "ResolvedRefs" condition to "False" with the "UnsupportedProtocol" reason.
466#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
467pub struct HttpRouteRulesBackendRefs {
468    /// Filters defined at this level should be executed if and only if the
469    /// request is being forwarded to the backend defined here.
470    ///
471    /// Support: Implementation-specific (For broader support of filters, use the
472    /// Filters field in HTTPRouteRule.)
473    #[serde(default, skip_serializing_if = "Option::is_none")]
474    pub filters: Option<Vec<HttpRouteRulesBackendRefsFilters>>,
475    /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
476    /// When unspecified or empty string, core API group is inferred.
477    #[serde(default, skip_serializing_if = "Option::is_none")]
478    pub group: Option<String>,
479    /// Kind is the Kubernetes resource kind of the referent. For example
480    /// "Service".
481    ///
482    /// Defaults to "Service" when not specified.
483    ///
484    /// ExternalName services can refer to CNAME DNS records that may live
485    /// outside of the cluster and as such are difficult to reason about in
486    /// terms of conformance. They also may not be safe to forward to (see
487    /// CVE-2021-25740 for more information). Implementations SHOULD NOT
488    /// support ExternalName Services.
489    ///
490    /// Support: Core (Services with a type other than ExternalName)
491    ///
492    /// Support: Implementation-specific (Services with type ExternalName)
493    #[serde(default, skip_serializing_if = "Option::is_none")]
494    pub kind: Option<String>,
495    /// Name is the name of the referent.
496    pub name: String,
497    /// Namespace is the namespace of the backend. When unspecified, the local
498    /// namespace is inferred.
499    ///
500    /// Note that when a namespace different than the local namespace is specified,
501    /// a ReferenceGrant object is required in the referent namespace to allow that
502    /// namespace's owner to accept the reference. See the ReferenceGrant
503    /// documentation for details.
504    ///
505    /// Support: Core
506    #[serde(default, skip_serializing_if = "Option::is_none")]
507    pub namespace: Option<String>,
508    /// Port specifies the destination port number to use for this resource.
509    /// Port is required when the referent is a Kubernetes Service. In this
510    /// case, the port number is the service port number, not the target port.
511    /// For other resources, destination port might be derived from the referent
512    /// resource or this field.
513    #[serde(default, skip_serializing_if = "Option::is_none")]
514    pub port: Option<i32>,
515    /// Weight specifies the proportion of requests forwarded to the referenced
516    /// backend. This is computed as weight/(sum of all weights in this
517    /// BackendRefs list). For non-zero values, there may be some epsilon from
518    /// the exact proportion defined here depending on the precision an
519    /// implementation supports. Weight is not a percentage and the sum of
520    /// weights does not need to equal 100.
521    ///
522    /// If only one backend is specified and it has a weight greater than 0, 100%
523    /// of the traffic is forwarded to that backend. If weight is set to 0, no
524    /// traffic should be forwarded for this entry. If unspecified, weight
525    /// defaults to 1.
526    ///
527    /// Support for this field varies based on the context where used.
528    #[serde(default, skip_serializing_if = "Option::is_none")]
529    pub weight: Option<i32>,
530}
531
532/// HTTPRouteFilter defines processing steps that must be completed during the
533/// request or response lifecycle. HTTPRouteFilters are meant as an extension
534/// point to express processing that may be done in Gateway implementations. Some
535/// examples include request or response modification, implementing
536/// authentication strategies, rate-limiting, and traffic shaping. API
537/// guarantee/conformance is defined based on the type of the filter.
538#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
539pub struct HttpRouteRulesBackendRefsFilters {
540    /// CORS defines a schema for a filter that responds to the
541    /// cross-origin request based on HTTP response header.
542    ///
543    /// Support: Extended
544    #[serde(default, skip_serializing_if = "Option::is_none")]
545    pub cors: Option<HttpRouteRulesBackendRefsFiltersCors>,
546    /// ExtensionRef is an optional, implementation-specific extension to the
547    /// "filter" behavior.  For example, resource "myroutefilter" in group
548    /// "networking.example.net"). ExtensionRef MUST NOT be used for core and
549    /// extended filters.
550    ///
551    /// This filter can be used multiple times within the same rule.
552    ///
553    /// Support: Implementation-specific
554    #[serde(default, skip_serializing_if = "Option::is_none", rename = "extensionRef")]
555    pub extension_ref: Option<HttpRouteRulesBackendRefsFiltersExtensionRef>,
556    /// ExternalAuth configures settings related to sending request details
557    /// to an external auth service. The external service MUST authenticate
558    /// the request, and MAY authorize the request as well.
559    ///
560    /// If there is any problem communicating with the external service,
561    /// this filter MUST fail closed.
562    ///
563    /// Support: Extended
564    #[serde(default, skip_serializing_if = "Option::is_none", rename = "externalAuth")]
565    pub external_auth: Option<HttpRouteRulesBackendRefsFiltersExternalAuth>,
566    /// RequestHeaderModifier defines a schema for a filter that modifies request
567    /// headers.
568    ///
569    /// Support: Core
570    #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestHeaderModifier")]
571    pub request_header_modifier: Option<HttpRouteRulesBackendRefsFiltersRequestHeaderModifier>,
572    /// RequestMirror defines a schema for a filter that mirrors requests.
573    /// Requests are sent to the specified destination, but responses from
574    /// that destination are ignored.
575    ///
576    /// This filter can be used multiple times within the same rule. Note that
577    /// not all implementations will be able to support mirroring to multiple
578    /// backends.
579    ///
580    /// Support: Extended
581    #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestMirror")]
582    pub request_mirror: Option<HttpRouteRulesBackendRefsFiltersRequestMirror>,
583    /// RequestRedirect defines a schema for a filter that responds to the
584    /// request with an HTTP redirection.
585    ///
586    /// Support: Core
587    #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestRedirect")]
588    pub request_redirect: Option<HttpRouteRulesBackendRefsFiltersRequestRedirect>,
589    /// ResponseHeaderModifier defines a schema for a filter that modifies response
590    /// headers.
591    ///
592    /// Support: Extended
593    #[serde(default, skip_serializing_if = "Option::is_none", rename = "responseHeaderModifier")]
594    pub response_header_modifier: Option<HttpRouteRulesBackendRefsFiltersResponseHeaderModifier>,
595    /// Type identifies the type of filter to apply. As with other API fields,
596    /// types are classified into three conformance levels:
597    ///
598    /// - Core: Filter types and their corresponding configuration defined by
599    ///   "Support: Core" in this package, e.g. "RequestHeaderModifier". All
600    ///   implementations must support core filters.
601    ///
602    /// - Extended: Filter types and their corresponding configuration defined by
603    ///   "Support: Extended" in this package, e.g. "RequestMirror". Implementers
604    ///   are encouraged to support extended filters.
605    ///
606    /// - Implementation-specific: Filters that are defined and supported by
607    ///   specific vendors.
608    ///   In the future, filters showing convergence in behavior across multiple
609    ///   implementations will be considered for inclusion in extended or core
610    ///   conformance levels. Filter-specific configuration for such filters
611    ///   is specified using the ExtensionRef field. `Type` should be set to
612    ///   "ExtensionRef" for custom filters.
613    ///
614    /// Implementers are encouraged to define custom implementation types to
615    /// extend the core API with implementation-specific behavior.
616    ///
617    /// If a reference to a custom filter type cannot be resolved, the filter
618    /// MUST NOT be skipped. Instead, requests that would have been processed by
619    /// that filter MUST receive a HTTP error response.
620    ///
621    /// Note that values may be added to this enum, implementations
622    /// must ensure that unknown values will not cause a crash.
623    ///
624    /// Unknown values here must result in the implementation setting the
625    /// Accepted Condition for the Route to `status: False`, with a
626    /// Reason of `UnsupportedValue`.
627    #[serde(rename = "type")]
628    pub r#type: HttpRouteRulesBackendRefsFiltersType,
629    /// URLRewrite defines a schema for a filter that modifies a request during forwarding.
630    ///
631    /// Support: Extended
632    #[serde(default, skip_serializing_if = "Option::is_none", rename = "urlRewrite")]
633    pub url_rewrite: Option<HttpRouteRulesBackendRefsFiltersUrlRewrite>,
634}
635
636/// CORS defines a schema for a filter that responds to the
637/// cross-origin request based on HTTP response header.
638///
639/// Support: Extended
640#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
641pub struct HttpRouteRulesBackendRefsFiltersCors {
642    /// AllowCredentials indicates whether the actual cross-origin request allows
643    /// to include credentials.
644    ///
645    /// When set to true, the gateway will include the `Access-Control-Allow-Credentials`
646    /// response header with value true (case-sensitive).
647    ///
648    /// When set to false or omitted the gateway will omit the header
649    /// `Access-Control-Allow-Credentials` entirely (this is the standard CORS
650    /// behavior).
651    ///
652    /// Support: Extended
653    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowCredentials")]
654    pub allow_credentials: Option<bool>,
655    /// AllowHeaders indicates which HTTP request headers are supported for
656    /// accessing the requested resource.
657    ///
658    /// Header names are not case-sensitive.
659    ///
660    /// Multiple header names in the value of the `Access-Control-Allow-Headers`
661    /// response header are separated by a comma (",").
662    ///
663    /// When the `AllowHeaders` field is configured with one or more headers, the
664    /// gateway must return the `Access-Control-Allow-Headers` response header
665    /// which value is present in the `AllowHeaders` field.
666    ///
667    /// If any header name in the `Access-Control-Request-Headers` request header
668    /// is not included in the list of header names specified by the response
669    /// header `Access-Control-Allow-Headers`, it will present an error on the
670    /// client side.
671    ///
672    /// If any header name in the `Access-Control-Allow-Headers` response header
673    /// does not recognize by the client, it will also occur an error on the
674    /// client side.
675    ///
676    /// A wildcard indicates that the requests with all HTTP headers are allowed.
677    /// If config contains the wildcard "*" in allowHeaders and the request is
678    /// not credentialed, the `Access-Control-Allow-Headers` response header
679    /// can either use the `*` wildcard or the value of
680    /// Access-Control-Request-Headers from the request.
681    ///
682    /// When the request is credentialed, the gateway must not specify the `*`
683    /// wildcard in the `Access-Control-Allow-Headers` response header. When
684    /// also the `AllowCredentials` field is true and `AllowHeaders` field
685    /// is specified with the `*` wildcard, the gateway must specify one or more
686    /// HTTP headers in the value of the `Access-Control-Allow-Headers` response
687    /// header. The value of the header `Access-Control-Allow-Headers` is same as
688    /// the `Access-Control-Request-Headers` header provided by the client. If
689    /// the header `Access-Control-Request-Headers` is not included in the
690    /// request, the gateway will omit the `Access-Control-Allow-Headers`
691    /// response header, instead of specifying the `*` wildcard.
692    ///
693    /// Support: Extended
694    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowHeaders")]
695    pub allow_headers: Option<Vec<String>>,
696    /// AllowMethods indicates which HTTP methods are supported for accessing the
697    /// requested resource.
698    ///
699    /// Valid values are any method defined by RFC9110, along with the special
700    /// value `*`, which represents all HTTP methods are allowed.
701    ///
702    /// Method names are case-sensitive, so these values are also case-sensitive.
703    /// (See <https://www.rfc-editor.org/rfc/rfc2616#section-5.1.1)>
704    ///
705    /// Multiple method names in the value of the `Access-Control-Allow-Methods`
706    /// response header are separated by a comma (",").
707    ///
708    /// A CORS-safelisted method is a method that is `GET`, `HEAD`, or `POST`.
709    /// (See <https://fetch.spec.whatwg.org/#cors-safelisted-method)> The
710    /// CORS-safelisted methods are always allowed, regardless of whether they
711    /// are specified in the `AllowMethods` field.
712    ///
713    /// When the `AllowMethods` field is configured with one or more methods, the
714    /// gateway must return the `Access-Control-Allow-Methods` response header
715    /// which value is present in the `AllowMethods` field.
716    ///
717    /// If the HTTP method of the `Access-Control-Request-Method` request header
718    /// is not included in the list of methods specified by the response header
719    /// `Access-Control-Allow-Methods`, it will present an error on the client
720    /// side.
721    ///
722    /// If config contains the wildcard "*" in allowMethods and the request is
723    /// not credentialed, the `Access-Control-Allow-Methods` response header
724    /// can either use the `*` wildcard or the value of
725    /// Access-Control-Request-Method from the request.
726    ///
727    /// When the request is credentialed, the gateway must not specify the `*`
728    /// wildcard in the `Access-Control-Allow-Methods` response header. When
729    /// also the `AllowCredentials` field is true and `AllowMethods` field
730    /// specified with the `*` wildcard, the gateway must specify one HTTP method
731    /// in the value of the Access-Control-Allow-Methods response header. The
732    /// value of the header `Access-Control-Allow-Methods` is same as the
733    /// `Access-Control-Request-Method` header provided by the client. If the
734    /// header `Access-Control-Request-Method` is not included in the request,
735    /// the gateway will omit the `Access-Control-Allow-Methods` response header,
736    /// instead of specifying the `*` wildcard.
737    ///
738    /// Support: Extended
739    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowMethods")]
740    pub allow_methods: Option<Vec<String>>,
741    /// AllowOrigins indicates whether the response can be shared with requested
742    /// resource from the given `Origin`.
743    ///
744    /// The `Origin` consists of a scheme and a host, with an optional port, and
745    /// takes the form `<scheme>://<host>(:<port>)`.
746    ///
747    /// Valid values for scheme are: `http` and `https`.
748    ///
749    /// Valid values for port are any integer between 1 and 65535 (the list of
750    /// available TCP/UDP ports). Note that, if not included, port `80` is
751    /// assumed for `http` scheme origins, and port `443` is assumed for `https`
752    /// origins. This may affect origin matching.
753    ///
754    /// The host part of the origin may contain the wildcard character `*`. These
755    /// wildcard characters behave as follows:
756    ///
757    /// * `*` is a greedy match to the _left_, including any number of
758    ///   DNS labels to the left of its position. This also means that
759    ///   `*` will include any number of period `.` characters to the
760    ///   left of its position.
761    /// * A wildcard by itself matches all hosts.
762    ///
763    /// An origin value that includes _only_ the `*` character indicates requests
764    /// from all `Origin`s are allowed.
765    ///
766    /// When the `AllowOrigins` field is configured with multiple origins, it
767    /// means the server supports clients from multiple origins. If the request
768    /// `Origin` matches the configured allowed origins, the gateway must return
769    /// the given `Origin` and sets value of the header
770    /// `Access-Control-Allow-Origin` same as the `Origin` header provided by the
771    /// client.
772    ///
773    /// The status code of a successful response to a "preflight" request is
774    /// always an OK status (i.e., 204 or 200).
775    ///
776    /// If the request `Origin` does not match the configured allowed origins,
777    /// the gateway returns 204/200 response but doesn't set the relevant
778    /// cross-origin response headers. Alternatively, the gateway responds with
779    /// 403 status to the "preflight" request is denied, coupled with omitting
780    /// the CORS headers. The cross-origin request fails on the client side.
781    /// Therefore, the client doesn't attempt the actual cross-origin request.
782    ///
783    /// Conversely, if the request `Origin` matches one of the configured
784    /// allowed origins, the gateway sets the response header
785    /// `Access-Control-Allow-Origin` to the same value as the `Origin`
786    /// header provided by the client.
787    ///
788    /// When config has the wildcard ("*") in allowOrigins, and the request
789    /// is not credentialed (e.g., it is a preflight request), the
790    /// `Access-Control-Allow-Origin` response header either contains the
791    /// wildcard as well or the Origin from the request.
792    ///
793    /// When the request is credentialed, the gateway must not specify the `*`
794    /// wildcard in the `Access-Control-Allow-Origin` response header. When
795    /// also the `AllowCredentials` field is true and `AllowOrigins` field
796    /// specified with the `*` wildcard, the gateway must return a single origin
797    /// in the value of the `Access-Control-Allow-Origin` response header,
798    /// instead of specifying the `*` wildcard. The value of the header
799    /// `Access-Control-Allow-Origin` is same as the `Origin` header provided by
800    /// the client.
801    ///
802    /// Support: Extended
803    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowOrigins")]
804    pub allow_origins: Option<Vec<String>>,
805    /// ExposeHeaders indicates which HTTP response headers can be exposed
806    /// to client-side scripts in response to a cross-origin request.
807    ///
808    /// A CORS-safelisted response header is an HTTP header in a CORS response
809    /// that it is considered safe to expose to the client scripts.
810    /// The CORS-safelisted response headers include the following headers:
811    /// `Cache-Control`
812    /// `Content-Language`
813    /// `Content-Length`
814    /// `Content-Type`
815    /// `Expires`
816    /// `Last-Modified`
817    /// `Pragma`
818    /// (See <https://fetch.spec.whatwg.org/#cors-safelisted-response-header-name)>
819    /// The CORS-safelisted response headers are exposed to client by default.
820    ///
821    /// When an HTTP header name is specified using the `ExposeHeaders` field,
822    /// this additional header will be exposed as part of the response to the
823    /// client.
824    ///
825    /// Header names are not case-sensitive.
826    ///
827    /// Multiple header names in the value of the `Access-Control-Expose-Headers`
828    /// response header are separated by a comma (",").
829    ///
830    /// A wildcard indicates that the responses with all HTTP headers are exposed
831    /// to clients. The `Access-Control-Expose-Headers` response header can only
832    /// use `*` wildcard as value when the request is not credentialed.
833    ///
834    /// When the `exposeHeaders` config field contains the "*" wildcard and
835    /// the request is credentialed, the gateway cannot use the `*` wildcard in
836    /// the `Access-Control-Expose-Headers` response header.
837    ///
838    /// Support: Extended
839    #[serde(default, skip_serializing_if = "Option::is_none", rename = "exposeHeaders")]
840    pub expose_headers: Option<Vec<String>>,
841    /// MaxAge indicates the duration (in seconds) for the client to cache the
842    /// results of a "preflight" request.
843    ///
844    /// The information provided by the `Access-Control-Allow-Methods` and
845    /// `Access-Control-Allow-Headers` response headers can be cached by the
846    /// client until the time specified by `Access-Control-Max-Age` elapses.
847    ///
848    /// The default value of `Access-Control-Max-Age` response header is 5
849    /// (seconds).
850    ///
851    /// When the `MaxAge` field is unspecified, the gateway sets the response
852    /// header "Access-Control-Max-Age: 5" by default.
853    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxAge")]
854    pub max_age: Option<i32>,
855}
856
857/// ExtensionRef is an optional, implementation-specific extension to the
858/// "filter" behavior.  For example, resource "myroutefilter" in group
859/// "networking.example.net"). ExtensionRef MUST NOT be used for core and
860/// extended filters.
861///
862/// This filter can be used multiple times within the same rule.
863///
864/// Support: Implementation-specific
865#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
866pub struct HttpRouteRulesBackendRefsFiltersExtensionRef {
867    /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
868    /// When unspecified or empty string, core API group is inferred.
869    pub group: String,
870    /// Kind is kind of the referent. For example "HTTPRoute" or "Service".
871    pub kind: String,
872    /// Name is the name of the referent.
873    pub name: String,
874}
875
876/// ExternalAuth configures settings related to sending request details
877/// to an external auth service. The external service MUST authenticate
878/// the request, and MAY authorize the request as well.
879///
880/// If there is any problem communicating with the external service,
881/// this filter MUST fail closed.
882///
883/// Support: Extended
884#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
885pub struct HttpRouteRulesBackendRefsFiltersExternalAuth {
886    /// BackendRef is a reference to a backend to send authorization
887    /// requests to.
888    ///
889    /// The backend must speak the selected protocol (GRPC or HTTP) on the
890    /// referenced port.
891    ///
892    /// If the backend service requires TLS, use BackendTLSPolicy to tell the
893    /// implementation to supply the TLS details to be used to connect to that
894    /// backend.
895    #[serde(rename = "backendRef")]
896    pub backend_ref: HttpRouteRulesBackendRefsFiltersExternalAuthBackendRef,
897    /// ForwardBody controls if requests to the authorization server should include
898    /// the body of the client request; and if so, how big that body is allowed
899    /// to be.
900    ///
901    /// It is expected that implementations will buffer the request body up to
902    /// `forwardBody.maxSize` bytes. Bodies over that size must be rejected with a
903    /// 4xx series error (413 or 403 are common examples), and fail processing
904    /// of the filter.
905    ///
906    /// If unset, or `forwardBody.maxSize` is set to `0`, then the body will not
907    /// be forwarded.
908    ///
909    /// Feature Name: HTTPRouteExternalAuthForwardBody
910    #[serde(default, skip_serializing_if = "Option::is_none", rename = "forwardBody")]
911    pub forward_body: Option<HttpRouteRulesBackendRefsFiltersExternalAuthForwardBody>,
912    /// GRPCAuthConfig contains configuration for communication with ext_authz
913    /// protocol-speaking backends.
914    ///
915    /// If unset, implementations must assume the default behavior for each
916    /// included field is intended.
917    #[serde(default, skip_serializing_if = "Option::is_none")]
918    pub grpc: Option<HttpRouteRulesBackendRefsFiltersExternalAuthGrpc>,
919    /// HTTPAuthConfig contains configuration for communication with HTTP-speaking
920    /// backends.
921    ///
922    /// If unset, implementations must assume the default behavior for each
923    /// included field is intended.
924    #[serde(default, skip_serializing_if = "Option::is_none")]
925    pub http: Option<HttpRouteRulesBackendRefsFiltersExternalAuthHttp>,
926    /// ExternalAuthProtocol describes which protocol to use when communicating with an
927    /// ext_authz authorization server.
928    ///
929    /// When this is set to GRPC, each backend must use the Envoy ext_authz protocol
930    /// on the port specified in `backendRefs`. Requests and responses are defined
931    /// in the protobufs explained at:
932    /// <https://www.envoyproxy.io/docs/envoy/latest/api-v3/service/auth/v3/external_auth.proto>
933    ///
934    /// When this is set to HTTP, each backend must respond with a `200` status
935    /// code in on a successful authorization. Any other code is considered
936    /// an authorization failure.
937    ///
938    /// Feature Names:
939    /// GRPC Support - HTTPRouteExternalAuthGRPC
940    /// HTTP Support - HTTPRouteExternalAuthHTTP
941    pub protocol: HttpRouteRulesBackendRefsFiltersExternalAuthProtocol,
942}
943
944/// BackendRef is a reference to a backend to send authorization
945/// requests to.
946///
947/// The backend must speak the selected protocol (GRPC or HTTP) on the
948/// referenced port.
949///
950/// If the backend service requires TLS, use BackendTLSPolicy to tell the
951/// implementation to supply the TLS details to be used to connect to that
952/// backend.
953#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
954pub struct HttpRouteRulesBackendRefsFiltersExternalAuthBackendRef {
955    /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
956    /// When unspecified or empty string, core API group is inferred.
957    #[serde(default, skip_serializing_if = "Option::is_none")]
958    pub group: Option<String>,
959    /// Kind is the Kubernetes resource kind of the referent. For example
960    /// "Service".
961    ///
962    /// Defaults to "Service" when not specified.
963    ///
964    /// ExternalName services can refer to CNAME DNS records that may live
965    /// outside of the cluster and as such are difficult to reason about in
966    /// terms of conformance. They also may not be safe to forward to (see
967    /// CVE-2021-25740 for more information). Implementations SHOULD NOT
968    /// support ExternalName Services.
969    ///
970    /// Support: Core (Services with a type other than ExternalName)
971    ///
972    /// Support: Implementation-specific (Services with type ExternalName)
973    #[serde(default, skip_serializing_if = "Option::is_none")]
974    pub kind: Option<String>,
975    /// Name is the name of the referent.
976    pub name: String,
977    /// Namespace is the namespace of the backend. When unspecified, the local
978    /// namespace is inferred.
979    ///
980    /// Note that when a namespace different than the local namespace is specified,
981    /// a ReferenceGrant object is required in the referent namespace to allow that
982    /// namespace's owner to accept the reference. See the ReferenceGrant
983    /// documentation for details.
984    ///
985    /// Support: Core
986    #[serde(default, skip_serializing_if = "Option::is_none")]
987    pub namespace: Option<String>,
988    /// Port specifies the destination port number to use for this resource.
989    /// Port is required when the referent is a Kubernetes Service. In this
990    /// case, the port number is the service port number, not the target port.
991    /// For other resources, destination port might be derived from the referent
992    /// resource or this field.
993    #[serde(default, skip_serializing_if = "Option::is_none")]
994    pub port: Option<i32>,
995}
996
997/// ForwardBody controls if requests to the authorization server should include
998/// the body of the client request; and if so, how big that body is allowed
999/// to be.
1000///
1001/// It is expected that implementations will buffer the request body up to
1002/// `forwardBody.maxSize` bytes. Bodies over that size must be rejected with a
1003/// 4xx series error (413 or 403 are common examples), and fail processing
1004/// of the filter.
1005///
1006/// If unset, or `forwardBody.maxSize` is set to `0`, then the body will not
1007/// be forwarded.
1008///
1009/// Feature Name: HTTPRouteExternalAuthForwardBody
1010#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1011pub struct HttpRouteRulesBackendRefsFiltersExternalAuthForwardBody {
1012    /// MaxSize specifies how large in bytes the largest body that will be buffered
1013    /// and sent to the authorization server. If the body size is larger than
1014    /// `maxSize`, then the body sent to the authorization server must be
1015    /// truncated to `maxSize` bytes.
1016    ///
1017    /// Experimental note: This behavior needs to be checked against
1018    /// various dataplanes; it may need to be changed.
1019    /// See <https://github.com/kubernetes-sigs/gateway-api/pull/4001#discussion_r2291405746>
1020    /// for more.
1021    ///
1022    /// If 0, the body will not be sent to the authorization server.
1023    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxSize")]
1024    pub max_size: Option<i64>,
1025}
1026
1027/// GRPCAuthConfig contains configuration for communication with ext_authz
1028/// protocol-speaking backends.
1029///
1030/// If unset, implementations must assume the default behavior for each
1031/// included field is intended.
1032#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1033pub struct HttpRouteRulesBackendRefsFiltersExternalAuthGrpc {
1034    /// AllowedRequestHeaders specifies what headers from the client request
1035    /// will be sent to the authorization server.
1036    ///
1037    /// If this list is empty, then all headers must be sent.
1038    ///
1039    /// If the list has entries, only those entries must be sent.
1040    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowedHeaders")]
1041    pub allowed_headers: Option<Vec<String>>,
1042}
1043
1044/// HTTPAuthConfig contains configuration for communication with HTTP-speaking
1045/// backends.
1046///
1047/// If unset, implementations must assume the default behavior for each
1048/// included field is intended.
1049#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1050pub struct HttpRouteRulesBackendRefsFiltersExternalAuthHttp {
1051    /// AllowedRequestHeaders specifies what additional headers from the client request
1052    /// will be sent to the authorization server.
1053    ///
1054    /// The following headers must always be sent to the authorization server,
1055    /// regardless of this setting:
1056    ///
1057    /// * `Host`
1058    /// * `Method`
1059    /// * `Path`
1060    /// * `Content-Length`
1061    /// * `Authorization`
1062    ///
1063    /// If this list is empty, then only those headers must be sent.
1064    ///
1065    /// Note that `Content-Length` has a special behavior, in that the length
1066    /// sent must be correct for the actual request to the external authorization
1067    /// server - that is, it must reflect the actual number of bytes sent in the
1068    /// body of the request to the authorization server.
1069    ///
1070    /// So if the `forwardBody` stanza is unset, or `forwardBody.maxSize` is set
1071    /// to `0`, then `Content-Length` must be `0`. If `forwardBody.maxSize` is set
1072    /// to anything other than `0`, then the `Content-Length` of the authorization
1073    /// request must be set to the actual number of bytes forwarded.
1074    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowedHeaders")]
1075    pub allowed_headers: Option<Vec<String>>,
1076    /// AllowedResponseHeaders specifies what headers from the authorization response
1077    /// will be copied into the request to the backend.
1078    ///
1079    /// If this list is empty, then all headers from the authorization server
1080    /// except Authority or Host must be copied.
1081    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowedResponseHeaders")]
1082    pub allowed_response_headers: Option<Vec<String>>,
1083    /// Path sets the prefix that paths from the client request will have added
1084    /// when forwarded to the authorization server.
1085    ///
1086    /// When empty or unspecified, no prefix is added.
1087    ///
1088    /// Valid values are the same as the "value" regex for path values in the `match`
1089    /// stanza, and the validation regex will screen out invalid paths in the same way.
1090    /// Even with the validation, implementations MUST sanitize this input before using it
1091    /// directly.
1092    #[serde(default, skip_serializing_if = "Option::is_none")]
1093    pub path: Option<String>,
1094}
1095
1096/// ExternalAuth configures settings related to sending request details
1097/// to an external auth service. The external service MUST authenticate
1098/// the request, and MAY authorize the request as well.
1099///
1100/// If there is any problem communicating with the external service,
1101/// this filter MUST fail closed.
1102///
1103/// Support: Extended
1104#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1105pub enum HttpRouteRulesBackendRefsFiltersExternalAuthProtocol {
1106    #[serde(rename = "HTTP")]
1107    Http,
1108    #[serde(rename = "GRPC")]
1109    Grpc,
1110}
1111
1112/// RequestHeaderModifier defines a schema for a filter that modifies request
1113/// headers.
1114///
1115/// Support: Core
1116#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1117pub struct HttpRouteRulesBackendRefsFiltersRequestHeaderModifier {
1118    /// Add adds the given header(s) (name, value) to the request
1119    /// before the action. It appends to any existing values associated
1120    /// with the header name.
1121    ///
1122    /// Input:
1123    ///   GET /foo HTTP/1.1
1124    ///   my-header: foo
1125    ///
1126    /// Config:
1127    ///   add:
1128    ///   - name: "my-header"
1129    ///     value: "bar,baz"
1130    ///
1131    /// Output:
1132    ///   GET /foo HTTP/1.1
1133    ///   my-header: foo,bar,baz
1134    #[serde(default, skip_serializing_if = "Option::is_none")]
1135    pub add: Option<Vec<HttpRouteRulesBackendRefsFiltersRequestHeaderModifierAdd>>,
1136    /// Remove the given header(s) from the HTTP request before the action. The
1137    /// value of Remove is a list of HTTP header names. Note that the header
1138    /// names are case-insensitive (see
1139    /// <https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).>
1140    ///
1141    /// Input:
1142    ///   GET /foo HTTP/1.1
1143    ///   my-header1: foo
1144    ///   my-header2: bar
1145    ///   my-header3: baz
1146    ///
1147    /// Config:
1148    ///   remove: ["my-header1", "my-header3"]
1149    ///
1150    /// Output:
1151    ///   GET /foo HTTP/1.1
1152    ///   my-header2: bar
1153    #[serde(default, skip_serializing_if = "Option::is_none")]
1154    pub remove: Option<Vec<String>>,
1155    /// Set overwrites the request with the given header (name, value)
1156    /// before the action.
1157    ///
1158    /// Input:
1159    ///   GET /foo HTTP/1.1
1160    ///   my-header: foo
1161    ///
1162    /// Config:
1163    ///   set:
1164    ///   - name: "my-header"
1165    ///     value: "bar"
1166    ///
1167    /// Output:
1168    ///   GET /foo HTTP/1.1
1169    ///   my-header: bar
1170    #[serde(default, skip_serializing_if = "Option::is_none")]
1171    pub set: Option<Vec<HttpRouteRulesBackendRefsFiltersRequestHeaderModifierSet>>,
1172}
1173
1174/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1175#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1176pub struct HttpRouteRulesBackendRefsFiltersRequestHeaderModifierAdd {
1177    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1178    /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
1179    ///
1180    /// If multiple entries specify equivalent header names, the first entry with
1181    /// an equivalent name MUST be considered for a match. Subsequent entries
1182    /// with an equivalent header name MUST be ignored. Due to the
1183    /// case-insensitivity of header names, "foo" and "Foo" are considered
1184    /// equivalent.
1185    pub name: String,
1186    /// Value is the value of HTTP Header to be matched.
1187    ///
1188    /// Must consist of printable US-ASCII characters, optionally separated
1189    /// by single tabs or spaces. See: <https://tools.ietf.org/html/rfc7230#section-3.2>
1190    pub value: String,
1191}
1192
1193/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1194#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1195pub struct HttpRouteRulesBackendRefsFiltersRequestHeaderModifierSet {
1196    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1197    /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
1198    ///
1199    /// If multiple entries specify equivalent header names, the first entry with
1200    /// an equivalent name MUST be considered for a match. Subsequent entries
1201    /// with an equivalent header name MUST be ignored. Due to the
1202    /// case-insensitivity of header names, "foo" and "Foo" are considered
1203    /// equivalent.
1204    pub name: String,
1205    /// Value is the value of HTTP Header to be matched.
1206    ///
1207    /// Must consist of printable US-ASCII characters, optionally separated
1208    /// by single tabs or spaces. See: <https://tools.ietf.org/html/rfc7230#section-3.2>
1209    pub value: String,
1210}
1211
1212/// RequestMirror defines a schema for a filter that mirrors requests.
1213/// Requests are sent to the specified destination, but responses from
1214/// that destination are ignored.
1215///
1216/// This filter can be used multiple times within the same rule. Note that
1217/// not all implementations will be able to support mirroring to multiple
1218/// backends.
1219///
1220/// Support: Extended
1221#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1222pub struct HttpRouteRulesBackendRefsFiltersRequestMirror {
1223    /// BackendRef references a resource where mirrored requests are sent.
1224    ///
1225    /// Mirrored requests must be sent only to a single destination endpoint
1226    /// within this BackendRef, irrespective of how many endpoints are present
1227    /// within this BackendRef.
1228    ///
1229    /// If the referent cannot be found, this BackendRef is invalid and must be
1230    /// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
1231    /// condition on the Route status is set to `status: False` and not configure
1232    /// this backend in the underlying implementation.
1233    ///
1234    /// If there is a cross-namespace reference to an *existing* object
1235    /// that is not allowed by a ReferenceGrant, the controller must ensure the
1236    /// "ResolvedRefs"  condition on the Route is set to `status: False`,
1237    /// with the "RefNotPermitted" reason and not configure this backend in the
1238    /// underlying implementation.
1239    ///
1240    /// In either error case, the Message of the `ResolvedRefs` Condition
1241    /// should be used to provide more detail about the problem.
1242    ///
1243    /// Support: Extended for Kubernetes Service
1244    ///
1245    /// Support: Implementation-specific for any other resource
1246    #[serde(rename = "backendRef")]
1247    pub backend_ref: HttpRouteRulesBackendRefsFiltersRequestMirrorBackendRef,
1248    /// Fraction represents the fraction of requests that should be
1249    /// mirrored to BackendRef.
1250    ///
1251    /// Only one of Fraction or Percent may be specified. If neither field
1252    /// is specified, 100% of requests will be mirrored.
1253    #[serde(default, skip_serializing_if = "Option::is_none")]
1254    pub fraction: Option<HttpRouteRulesBackendRefsFiltersRequestMirrorFraction>,
1255    /// Percent represents the percentage of requests that should be
1256    /// mirrored to BackendRef. Its minimum value is 0 (indicating 0% of
1257    /// requests) and its maximum value is 100 (indicating 100% of requests).
1258    ///
1259    /// Only one of Fraction or Percent may be specified. If neither field
1260    /// is specified, 100% of requests will be mirrored.
1261    #[serde(default, skip_serializing_if = "Option::is_none")]
1262    pub percent: Option<i32>,
1263}
1264
1265/// BackendRef references a resource where mirrored requests are sent.
1266///
1267/// Mirrored requests must be sent only to a single destination endpoint
1268/// within this BackendRef, irrespective of how many endpoints are present
1269/// within this BackendRef.
1270///
1271/// If the referent cannot be found, this BackendRef is invalid and must be
1272/// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
1273/// condition on the Route status is set to `status: False` and not configure
1274/// this backend in the underlying implementation.
1275///
1276/// If there is a cross-namespace reference to an *existing* object
1277/// that is not allowed by a ReferenceGrant, the controller must ensure the
1278/// "ResolvedRefs"  condition on the Route is set to `status: False`,
1279/// with the "RefNotPermitted" reason and not configure this backend in the
1280/// underlying implementation.
1281///
1282/// In either error case, the Message of the `ResolvedRefs` Condition
1283/// should be used to provide more detail about the problem.
1284///
1285/// Support: Extended for Kubernetes Service
1286///
1287/// Support: Implementation-specific for any other resource
1288#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1289pub struct HttpRouteRulesBackendRefsFiltersRequestMirrorBackendRef {
1290    /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
1291    /// When unspecified or empty string, core API group is inferred.
1292    #[serde(default, skip_serializing_if = "Option::is_none")]
1293    pub group: Option<String>,
1294    /// Kind is the Kubernetes resource kind of the referent. For example
1295    /// "Service".
1296    ///
1297    /// Defaults to "Service" when not specified.
1298    ///
1299    /// ExternalName services can refer to CNAME DNS records that may live
1300    /// outside of the cluster and as such are difficult to reason about in
1301    /// terms of conformance. They also may not be safe to forward to (see
1302    /// CVE-2021-25740 for more information). Implementations SHOULD NOT
1303    /// support ExternalName Services.
1304    ///
1305    /// Support: Core (Services with a type other than ExternalName)
1306    ///
1307    /// Support: Implementation-specific (Services with type ExternalName)
1308    #[serde(default, skip_serializing_if = "Option::is_none")]
1309    pub kind: Option<String>,
1310    /// Name is the name of the referent.
1311    pub name: String,
1312    /// Namespace is the namespace of the backend. When unspecified, the local
1313    /// namespace is inferred.
1314    ///
1315    /// Note that when a namespace different than the local namespace is specified,
1316    /// a ReferenceGrant object is required in the referent namespace to allow that
1317    /// namespace's owner to accept the reference. See the ReferenceGrant
1318    /// documentation for details.
1319    ///
1320    /// Support: Core
1321    #[serde(default, skip_serializing_if = "Option::is_none")]
1322    pub namespace: Option<String>,
1323    /// Port specifies the destination port number to use for this resource.
1324    /// Port is required when the referent is a Kubernetes Service. In this
1325    /// case, the port number is the service port number, not the target port.
1326    /// For other resources, destination port might be derived from the referent
1327    /// resource or this field.
1328    #[serde(default, skip_serializing_if = "Option::is_none")]
1329    pub port: Option<i32>,
1330}
1331
1332/// Fraction represents the fraction of requests that should be
1333/// mirrored to BackendRef.
1334///
1335/// Only one of Fraction or Percent may be specified. If neither field
1336/// is specified, 100% of requests will be mirrored.
1337#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1338pub struct HttpRouteRulesBackendRefsFiltersRequestMirrorFraction {
1339    #[serde(default, skip_serializing_if = "Option::is_none")]
1340    pub denominator: Option<i32>,
1341    pub numerator: i32,
1342}
1343
1344/// RequestRedirect defines a schema for a filter that responds to the
1345/// request with an HTTP redirection.
1346///
1347/// Support: Core
1348#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1349pub struct HttpRouteRulesBackendRefsFiltersRequestRedirect {
1350    /// Hostname is the hostname to be used in the value of the `Location`
1351    /// header in the response.
1352    /// When empty, the hostname in the `Host` header of the request is used.
1353    ///
1354    /// Support: Core
1355    #[serde(default, skip_serializing_if = "Option::is_none")]
1356    pub hostname: Option<String>,
1357    /// Path defines parameters used to modify the path of the incoming request.
1358    /// The modified path is then used to construct the `Location` header. When
1359    /// empty, the request path is used as-is.
1360    ///
1361    /// Support: Extended
1362    #[serde(default, skip_serializing_if = "Option::is_none")]
1363    pub path: Option<HttpRouteRulesBackendRefsFiltersRequestRedirectPath>,
1364    /// Port is the port to be used in the value of the `Location`
1365    /// header in the response.
1366    ///
1367    /// If no port is specified, the redirect port MUST be derived using the
1368    /// following rules:
1369    ///
1370    /// * If redirect scheme is not-empty, the redirect port MUST be the well-known
1371    ///   port associated with the redirect scheme. Specifically "http" to port 80
1372    ///   and "https" to port 443. If the redirect scheme does not have a
1373    ///   well-known port, the listener port of the Gateway SHOULD be used.
1374    /// * If redirect scheme is empty, the redirect port MUST be the Gateway
1375    ///   Listener port.
1376    ///
1377    /// Implementations SHOULD NOT add the port number in the 'Location'
1378    /// header in the following cases:
1379    ///
1380    /// * A Location header that will use HTTP (whether that is determined via
1381    ///   the Listener protocol or the Scheme field) _and_ use port 80.
1382    /// * A Location header that will use HTTPS (whether that is determined via
1383    ///   the Listener protocol or the Scheme field) _and_ use port 443.
1384    ///
1385    /// Support: Extended
1386    #[serde(default, skip_serializing_if = "Option::is_none")]
1387    pub port: Option<i32>,
1388    /// Scheme is the scheme to be used in the value of the `Location` header in
1389    /// the response. When empty, the scheme of the request is used.
1390    ///
1391    /// Scheme redirects can affect the port of the redirect, for more information,
1392    /// refer to the documentation for the port field of this filter.
1393    ///
1394    /// Note that values may be added to this enum, implementations
1395    /// must ensure that unknown values will not cause a crash.
1396    ///
1397    /// Unknown values here must result in the implementation setting the
1398    /// Accepted Condition for the Route to `status: False`, with a
1399    /// Reason of `UnsupportedValue`.
1400    ///
1401    /// Support: Extended
1402    #[serde(default, skip_serializing_if = "Option::is_none")]
1403    pub scheme: Option<HttpRouteRulesBackendRefsFiltersRequestRedirectScheme>,
1404    /// StatusCode is the HTTP status code to be used in response.
1405    ///
1406    /// Note that values may be added to this enum, implementations
1407    /// must ensure that unknown values will not cause a crash.
1408    ///
1409    /// Unknown values here must result in the implementation setting the
1410    /// Accepted Condition for the Route to `status: False`, with a
1411    /// Reason of `UnsupportedValue`.
1412    ///
1413    /// Support: Core
1414    #[serde(default, skip_serializing_if = "Option::is_none", rename = "statusCode")]
1415    pub status_code: Option<i64>,
1416}
1417
1418/// Path defines parameters used to modify the path of the incoming request.
1419/// The modified path is then used to construct the `Location` header. When
1420/// empty, the request path is used as-is.
1421///
1422/// Support: Extended
1423#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1424pub struct HttpRouteRulesBackendRefsFiltersRequestRedirectPath {
1425    /// ReplaceFullPath specifies the value with which to replace the full path
1426    /// of a request during a rewrite or redirect.
1427    #[serde(default, skip_serializing_if = "Option::is_none", rename = "replaceFullPath")]
1428    pub replace_full_path: Option<String>,
1429    /// ReplacePrefixMatch specifies the value with which to replace the prefix
1430    /// match of a request during a rewrite or redirect. For example, a request
1431    /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
1432    /// of "/xyz" would be modified to "/xyz/bar".
1433    ///
1434    /// Note that this matches the behavior of the PathPrefix match type. This
1435    /// matches full path elements. A path element refers to the list of labels
1436    /// in the path split by the `/` separator. When specified, a trailing `/` is
1437    /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
1438    /// match the prefix `/abc`, but the path `/abcd` would not.
1439    ///
1440    /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
1441    /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
1442    /// the implementation setting the Accepted Condition for the Route to `status: False`.
1443    ///
1444    /// Request Path | Prefix Match | Replace Prefix | Modified Path
1445    #[serde(default, skip_serializing_if = "Option::is_none", rename = "replacePrefixMatch")]
1446    pub replace_prefix_match: Option<String>,
1447    /// Type defines the type of path modifier. Additional types may be
1448    /// added in a future release of the API.
1449    ///
1450    /// Note that values may be added to this enum, implementations
1451    /// must ensure that unknown values will not cause a crash.
1452    ///
1453    /// Unknown values here must result in the implementation setting the
1454    /// Accepted Condition for the Route to `status: False`, with a
1455    /// Reason of `UnsupportedValue`.
1456    #[serde(rename = "type")]
1457    pub r#type: HttpRouteRulesBackendRefsFiltersRequestRedirectPathType,
1458}
1459
1460/// Path defines parameters used to modify the path of the incoming request.
1461/// The modified path is then used to construct the `Location` header. When
1462/// empty, the request path is used as-is.
1463///
1464/// Support: Extended
1465#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1466pub enum HttpRouteRulesBackendRefsFiltersRequestRedirectPathType {
1467    ReplaceFullPath,
1468    ReplacePrefixMatch,
1469}
1470
1471/// RequestRedirect defines a schema for a filter that responds to the
1472/// request with an HTTP redirection.
1473///
1474/// Support: Core
1475#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1476pub enum HttpRouteRulesBackendRefsFiltersRequestRedirectScheme {
1477    #[serde(rename = "http")]
1478    Http,
1479    #[serde(rename = "https")]
1480    Https,
1481}
1482
1483/// RequestRedirect defines a schema for a filter that responds to the
1484/// request with an HTTP redirection.
1485///
1486/// Support: Core
1487#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1488pub enum HttpRouteRulesBackendRefsFiltersRequestRedirectStatusCode {
1489    #[serde(rename = "301")]
1490    r#_301,
1491    #[serde(rename = "302")]
1492    r#_302,
1493    #[serde(rename = "303")]
1494    r#_303,
1495    #[serde(rename = "307")]
1496    r#_307,
1497    #[serde(rename = "308")]
1498    r#_308,
1499}
1500
1501/// ResponseHeaderModifier defines a schema for a filter that modifies response
1502/// headers.
1503///
1504/// Support: Extended
1505#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1506pub struct HttpRouteRulesBackendRefsFiltersResponseHeaderModifier {
1507    /// Add adds the given header(s) (name, value) to the request
1508    /// before the action. It appends to any existing values associated
1509    /// with the header name.
1510    ///
1511    /// Input:
1512    ///   GET /foo HTTP/1.1
1513    ///   my-header: foo
1514    ///
1515    /// Config:
1516    ///   add:
1517    ///   - name: "my-header"
1518    ///     value: "bar,baz"
1519    ///
1520    /// Output:
1521    ///   GET /foo HTTP/1.1
1522    ///   my-header: foo,bar,baz
1523    #[serde(default, skip_serializing_if = "Option::is_none")]
1524    pub add: Option<Vec<HttpRouteRulesBackendRefsFiltersResponseHeaderModifierAdd>>,
1525    /// Remove the given header(s) from the HTTP request before the action. The
1526    /// value of Remove is a list of HTTP header names. Note that the header
1527    /// names are case-insensitive (see
1528    /// <https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).>
1529    ///
1530    /// Input:
1531    ///   GET /foo HTTP/1.1
1532    ///   my-header1: foo
1533    ///   my-header2: bar
1534    ///   my-header3: baz
1535    ///
1536    /// Config:
1537    ///   remove: ["my-header1", "my-header3"]
1538    ///
1539    /// Output:
1540    ///   GET /foo HTTP/1.1
1541    ///   my-header2: bar
1542    #[serde(default, skip_serializing_if = "Option::is_none")]
1543    pub remove: Option<Vec<String>>,
1544    /// Set overwrites the request with the given header (name, value)
1545    /// before the action.
1546    ///
1547    /// Input:
1548    ///   GET /foo HTTP/1.1
1549    ///   my-header: foo
1550    ///
1551    /// Config:
1552    ///   set:
1553    ///   - name: "my-header"
1554    ///     value: "bar"
1555    ///
1556    /// Output:
1557    ///   GET /foo HTTP/1.1
1558    ///   my-header: bar
1559    #[serde(default, skip_serializing_if = "Option::is_none")]
1560    pub set: Option<Vec<HttpRouteRulesBackendRefsFiltersResponseHeaderModifierSet>>,
1561}
1562
1563/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1564#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1565pub struct HttpRouteRulesBackendRefsFiltersResponseHeaderModifierAdd {
1566    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1567    /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
1568    ///
1569    /// If multiple entries specify equivalent header names, the first entry with
1570    /// an equivalent name MUST be considered for a match. Subsequent entries
1571    /// with an equivalent header name MUST be ignored. Due to the
1572    /// case-insensitivity of header names, "foo" and "Foo" are considered
1573    /// equivalent.
1574    pub name: String,
1575    /// Value is the value of HTTP Header to be matched.
1576    ///
1577    /// Must consist of printable US-ASCII characters, optionally separated
1578    /// by single tabs or spaces. See: <https://tools.ietf.org/html/rfc7230#section-3.2>
1579    pub value: String,
1580}
1581
1582/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1583#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1584pub struct HttpRouteRulesBackendRefsFiltersResponseHeaderModifierSet {
1585    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1586    /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
1587    ///
1588    /// If multiple entries specify equivalent header names, the first entry with
1589    /// an equivalent name MUST be considered for a match. Subsequent entries
1590    /// with an equivalent header name MUST be ignored. Due to the
1591    /// case-insensitivity of header names, "foo" and "Foo" are considered
1592    /// equivalent.
1593    pub name: String,
1594    /// Value is the value of HTTP Header to be matched.
1595    ///
1596    /// Must consist of printable US-ASCII characters, optionally separated
1597    /// by single tabs or spaces. See: <https://tools.ietf.org/html/rfc7230#section-3.2>
1598    pub value: String,
1599}
1600
1601/// HTTPRouteFilter defines processing steps that must be completed during the
1602/// request or response lifecycle. HTTPRouteFilters are meant as an extension
1603/// point to express processing that may be done in Gateway implementations. Some
1604/// examples include request or response modification, implementing
1605/// authentication strategies, rate-limiting, and traffic shaping. API
1606/// guarantee/conformance is defined based on the type of the filter.
1607#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1608pub enum HttpRouteRulesBackendRefsFiltersType {
1609    RequestHeaderModifier,
1610    ResponseHeaderModifier,
1611    RequestMirror,
1612    RequestRedirect,
1613    #[serde(rename = "URLRewrite")]
1614    UrlRewrite,
1615    ExtensionRef,
1616    #[serde(rename = "CORS")]
1617    Cors,
1618    ExternalAuth,
1619}
1620
1621/// URLRewrite defines a schema for a filter that modifies a request during forwarding.
1622///
1623/// Support: Extended
1624#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1625pub struct HttpRouteRulesBackendRefsFiltersUrlRewrite {
1626    /// Hostname is the value to be used to replace the Host header value during
1627    /// forwarding.
1628    ///
1629    /// Support: Extended
1630    #[serde(default, skip_serializing_if = "Option::is_none")]
1631    pub hostname: Option<String>,
1632    /// Path defines a path rewrite.
1633    ///
1634    /// Support: Extended
1635    #[serde(default, skip_serializing_if = "Option::is_none")]
1636    pub path: Option<HttpRouteRulesBackendRefsFiltersUrlRewritePath>,
1637}
1638
1639/// Path defines a path rewrite.
1640///
1641/// Support: Extended
1642#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1643pub struct HttpRouteRulesBackendRefsFiltersUrlRewritePath {
1644    /// ReplaceFullPath specifies the value with which to replace the full path
1645    /// of a request during a rewrite or redirect.
1646    #[serde(default, skip_serializing_if = "Option::is_none", rename = "replaceFullPath")]
1647    pub replace_full_path: Option<String>,
1648    /// ReplacePrefixMatch specifies the value with which to replace the prefix
1649    /// match of a request during a rewrite or redirect. For example, a request
1650    /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
1651    /// of "/xyz" would be modified to "/xyz/bar".
1652    ///
1653    /// Note that this matches the behavior of the PathPrefix match type. This
1654    /// matches full path elements. A path element refers to the list of labels
1655    /// in the path split by the `/` separator. When specified, a trailing `/` is
1656    /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
1657    /// match the prefix `/abc`, but the path `/abcd` would not.
1658    ///
1659    /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
1660    /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
1661    /// the implementation setting the Accepted Condition for the Route to `status: False`.
1662    ///
1663    /// Request Path | Prefix Match | Replace Prefix | Modified Path
1664    #[serde(default, skip_serializing_if = "Option::is_none", rename = "replacePrefixMatch")]
1665    pub replace_prefix_match: Option<String>,
1666    /// Type defines the type of path modifier. Additional types may be
1667    /// added in a future release of the API.
1668    ///
1669    /// Note that values may be added to this enum, implementations
1670    /// must ensure that unknown values will not cause a crash.
1671    ///
1672    /// Unknown values here must result in the implementation setting the
1673    /// Accepted Condition for the Route to `status: False`, with a
1674    /// Reason of `UnsupportedValue`.
1675    #[serde(rename = "type")]
1676    pub r#type: HttpRouteRulesBackendRefsFiltersUrlRewritePathType,
1677}
1678
1679/// Path defines a path rewrite.
1680///
1681/// Support: Extended
1682#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1683pub enum HttpRouteRulesBackendRefsFiltersUrlRewritePathType {
1684    ReplaceFullPath,
1685    ReplacePrefixMatch,
1686}
1687
1688/// HTTPRouteFilter defines processing steps that must be completed during the
1689/// request or response lifecycle. HTTPRouteFilters are meant as an extension
1690/// point to express processing that may be done in Gateway implementations. Some
1691/// examples include request or response modification, implementing
1692/// authentication strategies, rate-limiting, and traffic shaping. API
1693/// guarantee/conformance is defined based on the type of the filter.
1694#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1695pub struct HttpRouteRulesFilters {
1696    /// CORS defines a schema for a filter that responds to the
1697    /// cross-origin request based on HTTP response header.
1698    ///
1699    /// Support: Extended
1700    #[serde(default, skip_serializing_if = "Option::is_none")]
1701    pub cors: Option<HttpRouteRulesFiltersCors>,
1702    /// ExtensionRef is an optional, implementation-specific extension to the
1703    /// "filter" behavior.  For example, resource "myroutefilter" in group
1704    /// "networking.example.net"). ExtensionRef MUST NOT be used for core and
1705    /// extended filters.
1706    ///
1707    /// This filter can be used multiple times within the same rule.
1708    ///
1709    /// Support: Implementation-specific
1710    #[serde(default, skip_serializing_if = "Option::is_none", rename = "extensionRef")]
1711    pub extension_ref: Option<HttpRouteRulesFiltersExtensionRef>,
1712    /// ExternalAuth configures settings related to sending request details
1713    /// to an external auth service. The external service MUST authenticate
1714    /// the request, and MAY authorize the request as well.
1715    ///
1716    /// If there is any problem communicating with the external service,
1717    /// this filter MUST fail closed.
1718    ///
1719    /// Support: Extended
1720    #[serde(default, skip_serializing_if = "Option::is_none", rename = "externalAuth")]
1721    pub external_auth: Option<HttpRouteRulesFiltersExternalAuth>,
1722    /// RequestHeaderModifier defines a schema for a filter that modifies request
1723    /// headers.
1724    ///
1725    /// Support: Core
1726    #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestHeaderModifier")]
1727    pub request_header_modifier: Option<HttpRouteRulesFiltersRequestHeaderModifier>,
1728    /// RequestMirror defines a schema for a filter that mirrors requests.
1729    /// Requests are sent to the specified destination, but responses from
1730    /// that destination are ignored.
1731    ///
1732    /// This filter can be used multiple times within the same rule. Note that
1733    /// not all implementations will be able to support mirroring to multiple
1734    /// backends.
1735    ///
1736    /// Support: Extended
1737    #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestMirror")]
1738    pub request_mirror: Option<HttpRouteRulesFiltersRequestMirror>,
1739    /// RequestRedirect defines a schema for a filter that responds to the
1740    /// request with an HTTP redirection.
1741    ///
1742    /// Support: Core
1743    #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestRedirect")]
1744    pub request_redirect: Option<HttpRouteRulesFiltersRequestRedirect>,
1745    /// ResponseHeaderModifier defines a schema for a filter that modifies response
1746    /// headers.
1747    ///
1748    /// Support: Extended
1749    #[serde(default, skip_serializing_if = "Option::is_none", rename = "responseHeaderModifier")]
1750    pub response_header_modifier: Option<HttpRouteRulesFiltersResponseHeaderModifier>,
1751    /// Type identifies the type of filter to apply. As with other API fields,
1752    /// types are classified into three conformance levels:
1753    ///
1754    /// - Core: Filter types and their corresponding configuration defined by
1755    ///   "Support: Core" in this package, e.g. "RequestHeaderModifier". All
1756    ///   implementations must support core filters.
1757    ///
1758    /// - Extended: Filter types and their corresponding configuration defined by
1759    ///   "Support: Extended" in this package, e.g. "RequestMirror". Implementers
1760    ///   are encouraged to support extended filters.
1761    ///
1762    /// - Implementation-specific: Filters that are defined and supported by
1763    ///   specific vendors.
1764    ///   In the future, filters showing convergence in behavior across multiple
1765    ///   implementations will be considered for inclusion in extended or core
1766    ///   conformance levels. Filter-specific configuration for such filters
1767    ///   is specified using the ExtensionRef field. `Type` should be set to
1768    ///   "ExtensionRef" for custom filters.
1769    ///
1770    /// Implementers are encouraged to define custom implementation types to
1771    /// extend the core API with implementation-specific behavior.
1772    ///
1773    /// If a reference to a custom filter type cannot be resolved, the filter
1774    /// MUST NOT be skipped. Instead, requests that would have been processed by
1775    /// that filter MUST receive a HTTP error response.
1776    ///
1777    /// Note that values may be added to this enum, implementations
1778    /// must ensure that unknown values will not cause a crash.
1779    ///
1780    /// Unknown values here must result in the implementation setting the
1781    /// Accepted Condition for the Route to `status: False`, with a
1782    /// Reason of `UnsupportedValue`.
1783    #[serde(rename = "type")]
1784    pub r#type: HttpRouteRulesFiltersType,
1785    /// URLRewrite defines a schema for a filter that modifies a request during forwarding.
1786    ///
1787    /// Support: Extended
1788    #[serde(default, skip_serializing_if = "Option::is_none", rename = "urlRewrite")]
1789    pub url_rewrite: Option<HttpRouteRulesFiltersUrlRewrite>,
1790}
1791
1792/// CORS defines a schema for a filter that responds to the
1793/// cross-origin request based on HTTP response header.
1794///
1795/// Support: Extended
1796#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1797pub struct HttpRouteRulesFiltersCors {
1798    /// AllowCredentials indicates whether the actual cross-origin request allows
1799    /// to include credentials.
1800    ///
1801    /// When set to true, the gateway will include the `Access-Control-Allow-Credentials`
1802    /// response header with value true (case-sensitive).
1803    ///
1804    /// When set to false or omitted the gateway will omit the header
1805    /// `Access-Control-Allow-Credentials` entirely (this is the standard CORS
1806    /// behavior).
1807    ///
1808    /// Support: Extended
1809    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowCredentials")]
1810    pub allow_credentials: Option<bool>,
1811    /// AllowHeaders indicates which HTTP request headers are supported for
1812    /// accessing the requested resource.
1813    ///
1814    /// Header names are not case-sensitive.
1815    ///
1816    /// Multiple header names in the value of the `Access-Control-Allow-Headers`
1817    /// response header are separated by a comma (",").
1818    ///
1819    /// When the `AllowHeaders` field is configured with one or more headers, the
1820    /// gateway must return the `Access-Control-Allow-Headers` response header
1821    /// which value is present in the `AllowHeaders` field.
1822    ///
1823    /// If any header name in the `Access-Control-Request-Headers` request header
1824    /// is not included in the list of header names specified by the response
1825    /// header `Access-Control-Allow-Headers`, it will present an error on the
1826    /// client side.
1827    ///
1828    /// If any header name in the `Access-Control-Allow-Headers` response header
1829    /// does not recognize by the client, it will also occur an error on the
1830    /// client side.
1831    ///
1832    /// A wildcard indicates that the requests with all HTTP headers are allowed.
1833    /// If config contains the wildcard "*" in allowHeaders and the request is
1834    /// not credentialed, the `Access-Control-Allow-Headers` response header
1835    /// can either use the `*` wildcard or the value of
1836    /// Access-Control-Request-Headers from the request.
1837    ///
1838    /// When the request is credentialed, the gateway must not specify the `*`
1839    /// wildcard in the `Access-Control-Allow-Headers` response header. When
1840    /// also the `AllowCredentials` field is true and `AllowHeaders` field
1841    /// is specified with the `*` wildcard, the gateway must specify one or more
1842    /// HTTP headers in the value of the `Access-Control-Allow-Headers` response
1843    /// header. The value of the header `Access-Control-Allow-Headers` is same as
1844    /// the `Access-Control-Request-Headers` header provided by the client. If
1845    /// the header `Access-Control-Request-Headers` is not included in the
1846    /// request, the gateway will omit the `Access-Control-Allow-Headers`
1847    /// response header, instead of specifying the `*` wildcard.
1848    ///
1849    /// Support: Extended
1850    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowHeaders")]
1851    pub allow_headers: Option<Vec<String>>,
1852    /// AllowMethods indicates which HTTP methods are supported for accessing the
1853    /// requested resource.
1854    ///
1855    /// Valid values are any method defined by RFC9110, along with the special
1856    /// value `*`, which represents all HTTP methods are allowed.
1857    ///
1858    /// Method names are case-sensitive, so these values are also case-sensitive.
1859    /// (See <https://www.rfc-editor.org/rfc/rfc2616#section-5.1.1)>
1860    ///
1861    /// Multiple method names in the value of the `Access-Control-Allow-Methods`
1862    /// response header are separated by a comma (",").
1863    ///
1864    /// A CORS-safelisted method is a method that is `GET`, `HEAD`, or `POST`.
1865    /// (See <https://fetch.spec.whatwg.org/#cors-safelisted-method)> The
1866    /// CORS-safelisted methods are always allowed, regardless of whether they
1867    /// are specified in the `AllowMethods` field.
1868    ///
1869    /// When the `AllowMethods` field is configured with one or more methods, the
1870    /// gateway must return the `Access-Control-Allow-Methods` response header
1871    /// which value is present in the `AllowMethods` field.
1872    ///
1873    /// If the HTTP method of the `Access-Control-Request-Method` request header
1874    /// is not included in the list of methods specified by the response header
1875    /// `Access-Control-Allow-Methods`, it will present an error on the client
1876    /// side.
1877    ///
1878    /// If config contains the wildcard "*" in allowMethods and the request is
1879    /// not credentialed, the `Access-Control-Allow-Methods` response header
1880    /// can either use the `*` wildcard or the value of
1881    /// Access-Control-Request-Method from the request.
1882    ///
1883    /// When the request is credentialed, the gateway must not specify the `*`
1884    /// wildcard in the `Access-Control-Allow-Methods` response header. When
1885    /// also the `AllowCredentials` field is true and `AllowMethods` field
1886    /// specified with the `*` wildcard, the gateway must specify one HTTP method
1887    /// in the value of the Access-Control-Allow-Methods response header. The
1888    /// value of the header `Access-Control-Allow-Methods` is same as the
1889    /// `Access-Control-Request-Method` header provided by the client. If the
1890    /// header `Access-Control-Request-Method` is not included in the request,
1891    /// the gateway will omit the `Access-Control-Allow-Methods` response header,
1892    /// instead of specifying the `*` wildcard.
1893    ///
1894    /// Support: Extended
1895    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowMethods")]
1896    pub allow_methods: Option<Vec<String>>,
1897    /// AllowOrigins indicates whether the response can be shared with requested
1898    /// resource from the given `Origin`.
1899    ///
1900    /// The `Origin` consists of a scheme and a host, with an optional port, and
1901    /// takes the form `<scheme>://<host>(:<port>)`.
1902    ///
1903    /// Valid values for scheme are: `http` and `https`.
1904    ///
1905    /// Valid values for port are any integer between 1 and 65535 (the list of
1906    /// available TCP/UDP ports). Note that, if not included, port `80` is
1907    /// assumed for `http` scheme origins, and port `443` is assumed for `https`
1908    /// origins. This may affect origin matching.
1909    ///
1910    /// The host part of the origin may contain the wildcard character `*`. These
1911    /// wildcard characters behave as follows:
1912    ///
1913    /// * `*` is a greedy match to the _left_, including any number of
1914    ///   DNS labels to the left of its position. This also means that
1915    ///   `*` will include any number of period `.` characters to the
1916    ///   left of its position.
1917    /// * A wildcard by itself matches all hosts.
1918    ///
1919    /// An origin value that includes _only_ the `*` character indicates requests
1920    /// from all `Origin`s are allowed.
1921    ///
1922    /// When the `AllowOrigins` field is configured with multiple origins, it
1923    /// means the server supports clients from multiple origins. If the request
1924    /// `Origin` matches the configured allowed origins, the gateway must return
1925    /// the given `Origin` and sets value of the header
1926    /// `Access-Control-Allow-Origin` same as the `Origin` header provided by the
1927    /// client.
1928    ///
1929    /// The status code of a successful response to a "preflight" request is
1930    /// always an OK status (i.e., 204 or 200).
1931    ///
1932    /// If the request `Origin` does not match the configured allowed origins,
1933    /// the gateway returns 204/200 response but doesn't set the relevant
1934    /// cross-origin response headers. Alternatively, the gateway responds with
1935    /// 403 status to the "preflight" request is denied, coupled with omitting
1936    /// the CORS headers. The cross-origin request fails on the client side.
1937    /// Therefore, the client doesn't attempt the actual cross-origin request.
1938    ///
1939    /// Conversely, if the request `Origin` matches one of the configured
1940    /// allowed origins, the gateway sets the response header
1941    /// `Access-Control-Allow-Origin` to the same value as the `Origin`
1942    /// header provided by the client.
1943    ///
1944    /// When config has the wildcard ("*") in allowOrigins, and the request
1945    /// is not credentialed (e.g., it is a preflight request), the
1946    /// `Access-Control-Allow-Origin` response header either contains the
1947    /// wildcard as well or the Origin from the request.
1948    ///
1949    /// When the request is credentialed, the gateway must not specify the `*`
1950    /// wildcard in the `Access-Control-Allow-Origin` response header. When
1951    /// also the `AllowCredentials` field is true and `AllowOrigins` field
1952    /// specified with the `*` wildcard, the gateway must return a single origin
1953    /// in the value of the `Access-Control-Allow-Origin` response header,
1954    /// instead of specifying the `*` wildcard. The value of the header
1955    /// `Access-Control-Allow-Origin` is same as the `Origin` header provided by
1956    /// the client.
1957    ///
1958    /// Support: Extended
1959    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowOrigins")]
1960    pub allow_origins: Option<Vec<String>>,
1961    /// ExposeHeaders indicates which HTTP response headers can be exposed
1962    /// to client-side scripts in response to a cross-origin request.
1963    ///
1964    /// A CORS-safelisted response header is an HTTP header in a CORS response
1965    /// that it is considered safe to expose to the client scripts.
1966    /// The CORS-safelisted response headers include the following headers:
1967    /// `Cache-Control`
1968    /// `Content-Language`
1969    /// `Content-Length`
1970    /// `Content-Type`
1971    /// `Expires`
1972    /// `Last-Modified`
1973    /// `Pragma`
1974    /// (See <https://fetch.spec.whatwg.org/#cors-safelisted-response-header-name)>
1975    /// The CORS-safelisted response headers are exposed to client by default.
1976    ///
1977    /// When an HTTP header name is specified using the `ExposeHeaders` field,
1978    /// this additional header will be exposed as part of the response to the
1979    /// client.
1980    ///
1981    /// Header names are not case-sensitive.
1982    ///
1983    /// Multiple header names in the value of the `Access-Control-Expose-Headers`
1984    /// response header are separated by a comma (",").
1985    ///
1986    /// A wildcard indicates that the responses with all HTTP headers are exposed
1987    /// to clients. The `Access-Control-Expose-Headers` response header can only
1988    /// use `*` wildcard as value when the request is not credentialed.
1989    ///
1990    /// When the `exposeHeaders` config field contains the "*" wildcard and
1991    /// the request is credentialed, the gateway cannot use the `*` wildcard in
1992    /// the `Access-Control-Expose-Headers` response header.
1993    ///
1994    /// Support: Extended
1995    #[serde(default, skip_serializing_if = "Option::is_none", rename = "exposeHeaders")]
1996    pub expose_headers: Option<Vec<String>>,
1997    /// MaxAge indicates the duration (in seconds) for the client to cache the
1998    /// results of a "preflight" request.
1999    ///
2000    /// The information provided by the `Access-Control-Allow-Methods` and
2001    /// `Access-Control-Allow-Headers` response headers can be cached by the
2002    /// client until the time specified by `Access-Control-Max-Age` elapses.
2003    ///
2004    /// The default value of `Access-Control-Max-Age` response header is 5
2005    /// (seconds).
2006    ///
2007    /// When the `MaxAge` field is unspecified, the gateway sets the response
2008    /// header "Access-Control-Max-Age: 5" by default.
2009    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxAge")]
2010    pub max_age: Option<i32>,
2011}
2012
2013/// ExtensionRef is an optional, implementation-specific extension to the
2014/// "filter" behavior.  For example, resource "myroutefilter" in group
2015/// "networking.example.net"). ExtensionRef MUST NOT be used for core and
2016/// extended filters.
2017///
2018/// This filter can be used multiple times within the same rule.
2019///
2020/// Support: Implementation-specific
2021#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2022pub struct HttpRouteRulesFiltersExtensionRef {
2023    /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
2024    /// When unspecified or empty string, core API group is inferred.
2025    pub group: String,
2026    /// Kind is kind of the referent. For example "HTTPRoute" or "Service".
2027    pub kind: String,
2028    /// Name is the name of the referent.
2029    pub name: String,
2030}
2031
2032/// ExternalAuth configures settings related to sending request details
2033/// to an external auth service. The external service MUST authenticate
2034/// the request, and MAY authorize the request as well.
2035///
2036/// If there is any problem communicating with the external service,
2037/// this filter MUST fail closed.
2038///
2039/// Support: Extended
2040#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2041pub struct HttpRouteRulesFiltersExternalAuth {
2042    /// BackendRef is a reference to a backend to send authorization
2043    /// requests to.
2044    ///
2045    /// The backend must speak the selected protocol (GRPC or HTTP) on the
2046    /// referenced port.
2047    ///
2048    /// If the backend service requires TLS, use BackendTLSPolicy to tell the
2049    /// implementation to supply the TLS details to be used to connect to that
2050    /// backend.
2051    #[serde(rename = "backendRef")]
2052    pub backend_ref: HttpRouteRulesFiltersExternalAuthBackendRef,
2053    /// ForwardBody controls if requests to the authorization server should include
2054    /// the body of the client request; and if so, how big that body is allowed
2055    /// to be.
2056    ///
2057    /// It is expected that implementations will buffer the request body up to
2058    /// `forwardBody.maxSize` bytes. Bodies over that size must be rejected with a
2059    /// 4xx series error (413 or 403 are common examples), and fail processing
2060    /// of the filter.
2061    ///
2062    /// If unset, or `forwardBody.maxSize` is set to `0`, then the body will not
2063    /// be forwarded.
2064    ///
2065    /// Feature Name: HTTPRouteExternalAuthForwardBody
2066    #[serde(default, skip_serializing_if = "Option::is_none", rename = "forwardBody")]
2067    pub forward_body: Option<HttpRouteRulesFiltersExternalAuthForwardBody>,
2068    /// GRPCAuthConfig contains configuration for communication with ext_authz
2069    /// protocol-speaking backends.
2070    ///
2071    /// If unset, implementations must assume the default behavior for each
2072    /// included field is intended.
2073    #[serde(default, skip_serializing_if = "Option::is_none")]
2074    pub grpc: Option<HttpRouteRulesFiltersExternalAuthGrpc>,
2075    /// HTTPAuthConfig contains configuration for communication with HTTP-speaking
2076    /// backends.
2077    ///
2078    /// If unset, implementations must assume the default behavior for each
2079    /// included field is intended.
2080    #[serde(default, skip_serializing_if = "Option::is_none")]
2081    pub http: Option<HttpRouteRulesFiltersExternalAuthHttp>,
2082    /// ExternalAuthProtocol describes which protocol to use when communicating with an
2083    /// ext_authz authorization server.
2084    ///
2085    /// When this is set to GRPC, each backend must use the Envoy ext_authz protocol
2086    /// on the port specified in `backendRefs`. Requests and responses are defined
2087    /// in the protobufs explained at:
2088    /// <https://www.envoyproxy.io/docs/envoy/latest/api-v3/service/auth/v3/external_auth.proto>
2089    ///
2090    /// When this is set to HTTP, each backend must respond with a `200` status
2091    /// code in on a successful authorization. Any other code is considered
2092    /// an authorization failure.
2093    ///
2094    /// Feature Names:
2095    /// GRPC Support - HTTPRouteExternalAuthGRPC
2096    /// HTTP Support - HTTPRouteExternalAuthHTTP
2097    pub protocol: HttpRouteRulesFiltersExternalAuthProtocol,
2098}
2099
2100/// BackendRef is a reference to a backend to send authorization
2101/// requests to.
2102///
2103/// The backend must speak the selected protocol (GRPC or HTTP) on the
2104/// referenced port.
2105///
2106/// If the backend service requires TLS, use BackendTLSPolicy to tell the
2107/// implementation to supply the TLS details to be used to connect to that
2108/// backend.
2109#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2110pub struct HttpRouteRulesFiltersExternalAuthBackendRef {
2111    /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
2112    /// When unspecified or empty string, core API group is inferred.
2113    #[serde(default, skip_serializing_if = "Option::is_none")]
2114    pub group: Option<String>,
2115    /// Kind is the Kubernetes resource kind of the referent. For example
2116    /// "Service".
2117    ///
2118    /// Defaults to "Service" when not specified.
2119    ///
2120    /// ExternalName services can refer to CNAME DNS records that may live
2121    /// outside of the cluster and as such are difficult to reason about in
2122    /// terms of conformance. They also may not be safe to forward to (see
2123    /// CVE-2021-25740 for more information). Implementations SHOULD NOT
2124    /// support ExternalName Services.
2125    ///
2126    /// Support: Core (Services with a type other than ExternalName)
2127    ///
2128    /// Support: Implementation-specific (Services with type ExternalName)
2129    #[serde(default, skip_serializing_if = "Option::is_none")]
2130    pub kind: Option<String>,
2131    /// Name is the name of the referent.
2132    pub name: String,
2133    /// Namespace is the namespace of the backend. When unspecified, the local
2134    /// namespace is inferred.
2135    ///
2136    /// Note that when a namespace different than the local namespace is specified,
2137    /// a ReferenceGrant object is required in the referent namespace to allow that
2138    /// namespace's owner to accept the reference. See the ReferenceGrant
2139    /// documentation for details.
2140    ///
2141    /// Support: Core
2142    #[serde(default, skip_serializing_if = "Option::is_none")]
2143    pub namespace: Option<String>,
2144    /// Port specifies the destination port number to use for this resource.
2145    /// Port is required when the referent is a Kubernetes Service. In this
2146    /// case, the port number is the service port number, not the target port.
2147    /// For other resources, destination port might be derived from the referent
2148    /// resource or this field.
2149    #[serde(default, skip_serializing_if = "Option::is_none")]
2150    pub port: Option<i32>,
2151}
2152
2153/// ForwardBody controls if requests to the authorization server should include
2154/// the body of the client request; and if so, how big that body is allowed
2155/// to be.
2156///
2157/// It is expected that implementations will buffer the request body up to
2158/// `forwardBody.maxSize` bytes. Bodies over that size must be rejected with a
2159/// 4xx series error (413 or 403 are common examples), and fail processing
2160/// of the filter.
2161///
2162/// If unset, or `forwardBody.maxSize` is set to `0`, then the body will not
2163/// be forwarded.
2164///
2165/// Feature Name: HTTPRouteExternalAuthForwardBody
2166#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2167pub struct HttpRouteRulesFiltersExternalAuthForwardBody {
2168    /// MaxSize specifies how large in bytes the largest body that will be buffered
2169    /// and sent to the authorization server. If the body size is larger than
2170    /// `maxSize`, then the body sent to the authorization server must be
2171    /// truncated to `maxSize` bytes.
2172    ///
2173    /// Experimental note: This behavior needs to be checked against
2174    /// various dataplanes; it may need to be changed.
2175    /// See <https://github.com/kubernetes-sigs/gateway-api/pull/4001#discussion_r2291405746>
2176    /// for more.
2177    ///
2178    /// If 0, the body will not be sent to the authorization server.
2179    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxSize")]
2180    pub max_size: Option<i64>,
2181}
2182
2183/// GRPCAuthConfig contains configuration for communication with ext_authz
2184/// protocol-speaking backends.
2185///
2186/// If unset, implementations must assume the default behavior for each
2187/// included field is intended.
2188#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2189pub struct HttpRouteRulesFiltersExternalAuthGrpc {
2190    /// AllowedRequestHeaders specifies what headers from the client request
2191    /// will be sent to the authorization server.
2192    ///
2193    /// If this list is empty, then all headers must be sent.
2194    ///
2195    /// If the list has entries, only those entries must be sent.
2196    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowedHeaders")]
2197    pub allowed_headers: Option<Vec<String>>,
2198}
2199
2200/// HTTPAuthConfig contains configuration for communication with HTTP-speaking
2201/// backends.
2202///
2203/// If unset, implementations must assume the default behavior for each
2204/// included field is intended.
2205#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2206pub struct HttpRouteRulesFiltersExternalAuthHttp {
2207    /// AllowedRequestHeaders specifies what additional headers from the client request
2208    /// will be sent to the authorization server.
2209    ///
2210    /// The following headers must always be sent to the authorization server,
2211    /// regardless of this setting:
2212    ///
2213    /// * `Host`
2214    /// * `Method`
2215    /// * `Path`
2216    /// * `Content-Length`
2217    /// * `Authorization`
2218    ///
2219    /// If this list is empty, then only those headers must be sent.
2220    ///
2221    /// Note that `Content-Length` has a special behavior, in that the length
2222    /// sent must be correct for the actual request to the external authorization
2223    /// server - that is, it must reflect the actual number of bytes sent in the
2224    /// body of the request to the authorization server.
2225    ///
2226    /// So if the `forwardBody` stanza is unset, or `forwardBody.maxSize` is set
2227    /// to `0`, then `Content-Length` must be `0`. If `forwardBody.maxSize` is set
2228    /// to anything other than `0`, then the `Content-Length` of the authorization
2229    /// request must be set to the actual number of bytes forwarded.
2230    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowedHeaders")]
2231    pub allowed_headers: Option<Vec<String>>,
2232    /// AllowedResponseHeaders specifies what headers from the authorization response
2233    /// will be copied into the request to the backend.
2234    ///
2235    /// If this list is empty, then all headers from the authorization server
2236    /// except Authority or Host must be copied.
2237    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowedResponseHeaders")]
2238    pub allowed_response_headers: Option<Vec<String>>,
2239    /// Path sets the prefix that paths from the client request will have added
2240    /// when forwarded to the authorization server.
2241    ///
2242    /// When empty or unspecified, no prefix is added.
2243    ///
2244    /// Valid values are the same as the "value" regex for path values in the `match`
2245    /// stanza, and the validation regex will screen out invalid paths in the same way.
2246    /// Even with the validation, implementations MUST sanitize this input before using it
2247    /// directly.
2248    #[serde(default, skip_serializing_if = "Option::is_none")]
2249    pub path: Option<String>,
2250}
2251
2252/// ExternalAuth configures settings related to sending request details
2253/// to an external auth service. The external service MUST authenticate
2254/// the request, and MAY authorize the request as well.
2255///
2256/// If there is any problem communicating with the external service,
2257/// this filter MUST fail closed.
2258///
2259/// Support: Extended
2260#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2261pub enum HttpRouteRulesFiltersExternalAuthProtocol {
2262    #[serde(rename = "HTTP")]
2263    Http,
2264    #[serde(rename = "GRPC")]
2265    Grpc,
2266}
2267
2268/// RequestHeaderModifier defines a schema for a filter that modifies request
2269/// headers.
2270///
2271/// Support: Core
2272#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2273pub struct HttpRouteRulesFiltersRequestHeaderModifier {
2274    /// Add adds the given header(s) (name, value) to the request
2275    /// before the action. It appends to any existing values associated
2276    /// with the header name.
2277    ///
2278    /// Input:
2279    ///   GET /foo HTTP/1.1
2280    ///   my-header: foo
2281    ///
2282    /// Config:
2283    ///   add:
2284    ///   - name: "my-header"
2285    ///     value: "bar,baz"
2286    ///
2287    /// Output:
2288    ///   GET /foo HTTP/1.1
2289    ///   my-header: foo,bar,baz
2290    #[serde(default, skip_serializing_if = "Option::is_none")]
2291    pub add: Option<Vec<HttpRouteRulesFiltersRequestHeaderModifierAdd>>,
2292    /// Remove the given header(s) from the HTTP request before the action. The
2293    /// value of Remove is a list of HTTP header names. Note that the header
2294    /// names are case-insensitive (see
2295    /// <https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).>
2296    ///
2297    /// Input:
2298    ///   GET /foo HTTP/1.1
2299    ///   my-header1: foo
2300    ///   my-header2: bar
2301    ///   my-header3: baz
2302    ///
2303    /// Config:
2304    ///   remove: ["my-header1", "my-header3"]
2305    ///
2306    /// Output:
2307    ///   GET /foo HTTP/1.1
2308    ///   my-header2: bar
2309    #[serde(default, skip_serializing_if = "Option::is_none")]
2310    pub remove: Option<Vec<String>>,
2311    /// Set overwrites the request with the given header (name, value)
2312    /// before the action.
2313    ///
2314    /// Input:
2315    ///   GET /foo HTTP/1.1
2316    ///   my-header: foo
2317    ///
2318    /// Config:
2319    ///   set:
2320    ///   - name: "my-header"
2321    ///     value: "bar"
2322    ///
2323    /// Output:
2324    ///   GET /foo HTTP/1.1
2325    ///   my-header: bar
2326    #[serde(default, skip_serializing_if = "Option::is_none")]
2327    pub set: Option<Vec<HttpRouteRulesFiltersRequestHeaderModifierSet>>,
2328}
2329
2330/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
2331#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2332pub struct HttpRouteRulesFiltersRequestHeaderModifierAdd {
2333    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
2334    /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
2335    ///
2336    /// If multiple entries specify equivalent header names, the first entry with
2337    /// an equivalent name MUST be considered for a match. Subsequent entries
2338    /// with an equivalent header name MUST be ignored. Due to the
2339    /// case-insensitivity of header names, "foo" and "Foo" are considered
2340    /// equivalent.
2341    pub name: String,
2342    /// Value is the value of HTTP Header to be matched.
2343    ///
2344    /// Must consist of printable US-ASCII characters, optionally separated
2345    /// by single tabs or spaces. See: <https://tools.ietf.org/html/rfc7230#section-3.2>
2346    pub value: String,
2347}
2348
2349/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
2350#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2351pub struct HttpRouteRulesFiltersRequestHeaderModifierSet {
2352    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
2353    /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
2354    ///
2355    /// If multiple entries specify equivalent header names, the first entry with
2356    /// an equivalent name MUST be considered for a match. Subsequent entries
2357    /// with an equivalent header name MUST be ignored. Due to the
2358    /// case-insensitivity of header names, "foo" and "Foo" are considered
2359    /// equivalent.
2360    pub name: String,
2361    /// Value is the value of HTTP Header to be matched.
2362    ///
2363    /// Must consist of printable US-ASCII characters, optionally separated
2364    /// by single tabs or spaces. See: <https://tools.ietf.org/html/rfc7230#section-3.2>
2365    pub value: String,
2366}
2367
2368/// RequestMirror defines a schema for a filter that mirrors requests.
2369/// Requests are sent to the specified destination, but responses from
2370/// that destination are ignored.
2371///
2372/// This filter can be used multiple times within the same rule. Note that
2373/// not all implementations will be able to support mirroring to multiple
2374/// backends.
2375///
2376/// Support: Extended
2377#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2378pub struct HttpRouteRulesFiltersRequestMirror {
2379    /// BackendRef references a resource where mirrored requests are sent.
2380    ///
2381    /// Mirrored requests must be sent only to a single destination endpoint
2382    /// within this BackendRef, irrespective of how many endpoints are present
2383    /// within this BackendRef.
2384    ///
2385    /// If the referent cannot be found, this BackendRef is invalid and must be
2386    /// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
2387    /// condition on the Route status is set to `status: False` and not configure
2388    /// this backend in the underlying implementation.
2389    ///
2390    /// If there is a cross-namespace reference to an *existing* object
2391    /// that is not allowed by a ReferenceGrant, the controller must ensure the
2392    /// "ResolvedRefs"  condition on the Route is set to `status: False`,
2393    /// with the "RefNotPermitted" reason and not configure this backend in the
2394    /// underlying implementation.
2395    ///
2396    /// In either error case, the Message of the `ResolvedRefs` Condition
2397    /// should be used to provide more detail about the problem.
2398    ///
2399    /// Support: Extended for Kubernetes Service
2400    ///
2401    /// Support: Implementation-specific for any other resource
2402    #[serde(rename = "backendRef")]
2403    pub backend_ref: HttpRouteRulesFiltersRequestMirrorBackendRef,
2404    /// Fraction represents the fraction of requests that should be
2405    /// mirrored to BackendRef.
2406    ///
2407    /// Only one of Fraction or Percent may be specified. If neither field
2408    /// is specified, 100% of requests will be mirrored.
2409    #[serde(default, skip_serializing_if = "Option::is_none")]
2410    pub fraction: Option<HttpRouteRulesFiltersRequestMirrorFraction>,
2411    /// Percent represents the percentage of requests that should be
2412    /// mirrored to BackendRef. Its minimum value is 0 (indicating 0% of
2413    /// requests) and its maximum value is 100 (indicating 100% of requests).
2414    ///
2415    /// Only one of Fraction or Percent may be specified. If neither field
2416    /// is specified, 100% of requests will be mirrored.
2417    #[serde(default, skip_serializing_if = "Option::is_none")]
2418    pub percent: Option<i32>,
2419}
2420
2421/// BackendRef references a resource where mirrored requests are sent.
2422///
2423/// Mirrored requests must be sent only to a single destination endpoint
2424/// within this BackendRef, irrespective of how many endpoints are present
2425/// within this BackendRef.
2426///
2427/// If the referent cannot be found, this BackendRef is invalid and must be
2428/// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
2429/// condition on the Route status is set to `status: False` and not configure
2430/// this backend in the underlying implementation.
2431///
2432/// If there is a cross-namespace reference to an *existing* object
2433/// that is not allowed by a ReferenceGrant, the controller must ensure the
2434/// "ResolvedRefs"  condition on the Route is set to `status: False`,
2435/// with the "RefNotPermitted" reason and not configure this backend in the
2436/// underlying implementation.
2437///
2438/// In either error case, the Message of the `ResolvedRefs` Condition
2439/// should be used to provide more detail about the problem.
2440///
2441/// Support: Extended for Kubernetes Service
2442///
2443/// Support: Implementation-specific for any other resource
2444#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2445pub struct HttpRouteRulesFiltersRequestMirrorBackendRef {
2446    /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
2447    /// When unspecified or empty string, core API group is inferred.
2448    #[serde(default, skip_serializing_if = "Option::is_none")]
2449    pub group: Option<String>,
2450    /// Kind is the Kubernetes resource kind of the referent. For example
2451    /// "Service".
2452    ///
2453    /// Defaults to "Service" when not specified.
2454    ///
2455    /// ExternalName services can refer to CNAME DNS records that may live
2456    /// outside of the cluster and as such are difficult to reason about in
2457    /// terms of conformance. They also may not be safe to forward to (see
2458    /// CVE-2021-25740 for more information). Implementations SHOULD NOT
2459    /// support ExternalName Services.
2460    ///
2461    /// Support: Core (Services with a type other than ExternalName)
2462    ///
2463    /// Support: Implementation-specific (Services with type ExternalName)
2464    #[serde(default, skip_serializing_if = "Option::is_none")]
2465    pub kind: Option<String>,
2466    /// Name is the name of the referent.
2467    pub name: String,
2468    /// Namespace is the namespace of the backend. When unspecified, the local
2469    /// namespace is inferred.
2470    ///
2471    /// Note that when a namespace different than the local namespace is specified,
2472    /// a ReferenceGrant object is required in the referent namespace to allow that
2473    /// namespace's owner to accept the reference. See the ReferenceGrant
2474    /// documentation for details.
2475    ///
2476    /// Support: Core
2477    #[serde(default, skip_serializing_if = "Option::is_none")]
2478    pub namespace: Option<String>,
2479    /// Port specifies the destination port number to use for this resource.
2480    /// Port is required when the referent is a Kubernetes Service. In this
2481    /// case, the port number is the service port number, not the target port.
2482    /// For other resources, destination port might be derived from the referent
2483    /// resource or this field.
2484    #[serde(default, skip_serializing_if = "Option::is_none")]
2485    pub port: Option<i32>,
2486}
2487
2488/// Fraction represents the fraction of requests that should be
2489/// mirrored to BackendRef.
2490///
2491/// Only one of Fraction or Percent may be specified. If neither field
2492/// is specified, 100% of requests will be mirrored.
2493#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2494pub struct HttpRouteRulesFiltersRequestMirrorFraction {
2495    #[serde(default, skip_serializing_if = "Option::is_none")]
2496    pub denominator: Option<i32>,
2497    pub numerator: i32,
2498}
2499
2500/// RequestRedirect defines a schema for a filter that responds to the
2501/// request with an HTTP redirection.
2502///
2503/// Support: Core
2504#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2505pub struct HttpRouteRulesFiltersRequestRedirect {
2506    /// Hostname is the hostname to be used in the value of the `Location`
2507    /// header in the response.
2508    /// When empty, the hostname in the `Host` header of the request is used.
2509    ///
2510    /// Support: Core
2511    #[serde(default, skip_serializing_if = "Option::is_none")]
2512    pub hostname: Option<String>,
2513    /// Path defines parameters used to modify the path of the incoming request.
2514    /// The modified path is then used to construct the `Location` header. When
2515    /// empty, the request path is used as-is.
2516    ///
2517    /// Support: Extended
2518    #[serde(default, skip_serializing_if = "Option::is_none")]
2519    pub path: Option<HttpRouteRulesFiltersRequestRedirectPath>,
2520    /// Port is the port to be used in the value of the `Location`
2521    /// header in the response.
2522    ///
2523    /// If no port is specified, the redirect port MUST be derived using the
2524    /// following rules:
2525    ///
2526    /// * If redirect scheme is not-empty, the redirect port MUST be the well-known
2527    ///   port associated with the redirect scheme. Specifically "http" to port 80
2528    ///   and "https" to port 443. If the redirect scheme does not have a
2529    ///   well-known port, the listener port of the Gateway SHOULD be used.
2530    /// * If redirect scheme is empty, the redirect port MUST be the Gateway
2531    ///   Listener port.
2532    ///
2533    /// Implementations SHOULD NOT add the port number in the 'Location'
2534    /// header in the following cases:
2535    ///
2536    /// * A Location header that will use HTTP (whether that is determined via
2537    ///   the Listener protocol or the Scheme field) _and_ use port 80.
2538    /// * A Location header that will use HTTPS (whether that is determined via
2539    ///   the Listener protocol or the Scheme field) _and_ use port 443.
2540    ///
2541    /// Support: Extended
2542    #[serde(default, skip_serializing_if = "Option::is_none")]
2543    pub port: Option<i32>,
2544    /// Scheme is the scheme to be used in the value of the `Location` header in
2545    /// the response. When empty, the scheme of the request is used.
2546    ///
2547    /// Scheme redirects can affect the port of the redirect, for more information,
2548    /// refer to the documentation for the port field of this filter.
2549    ///
2550    /// Note that values may be added to this enum, implementations
2551    /// must ensure that unknown values will not cause a crash.
2552    ///
2553    /// Unknown values here must result in the implementation setting the
2554    /// Accepted Condition for the Route to `status: False`, with a
2555    /// Reason of `UnsupportedValue`.
2556    ///
2557    /// Support: Extended
2558    #[serde(default, skip_serializing_if = "Option::is_none")]
2559    pub scheme: Option<HttpRouteRulesFiltersRequestRedirectScheme>,
2560    /// StatusCode is the HTTP status code to be used in response.
2561    ///
2562    /// Note that values may be added to this enum, implementations
2563    /// must ensure that unknown values will not cause a crash.
2564    ///
2565    /// Unknown values here must result in the implementation setting the
2566    /// Accepted Condition for the Route to `status: False`, with a
2567    /// Reason of `UnsupportedValue`.
2568    ///
2569    /// Support: Core
2570    #[serde(default, skip_serializing_if = "Option::is_none", rename = "statusCode")]
2571    pub status_code: Option<i64>,
2572}
2573
2574/// Path defines parameters used to modify the path of the incoming request.
2575/// The modified path is then used to construct the `Location` header. When
2576/// empty, the request path is used as-is.
2577///
2578/// Support: Extended
2579#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2580pub struct HttpRouteRulesFiltersRequestRedirectPath {
2581    /// ReplaceFullPath specifies the value with which to replace the full path
2582    /// of a request during a rewrite or redirect.
2583    #[serde(default, skip_serializing_if = "Option::is_none", rename = "replaceFullPath")]
2584    pub replace_full_path: Option<String>,
2585    /// ReplacePrefixMatch specifies the value with which to replace the prefix
2586    /// match of a request during a rewrite or redirect. For example, a request
2587    /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
2588    /// of "/xyz" would be modified to "/xyz/bar".
2589    ///
2590    /// Note that this matches the behavior of the PathPrefix match type. This
2591    /// matches full path elements. A path element refers to the list of labels
2592    /// in the path split by the `/` separator. When specified, a trailing `/` is
2593    /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
2594    /// match the prefix `/abc`, but the path `/abcd` would not.
2595    ///
2596    /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
2597    /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
2598    /// the implementation setting the Accepted Condition for the Route to `status: False`.
2599    ///
2600    /// Request Path | Prefix Match | Replace Prefix | Modified Path
2601    #[serde(default, skip_serializing_if = "Option::is_none", rename = "replacePrefixMatch")]
2602    pub replace_prefix_match: Option<String>,
2603    /// Type defines the type of path modifier. Additional types may be
2604    /// added in a future release of the API.
2605    ///
2606    /// Note that values may be added to this enum, implementations
2607    /// must ensure that unknown values will not cause a crash.
2608    ///
2609    /// Unknown values here must result in the implementation setting the
2610    /// Accepted Condition for the Route to `status: False`, with a
2611    /// Reason of `UnsupportedValue`.
2612    #[serde(rename = "type")]
2613    pub r#type: HttpRouteRulesFiltersRequestRedirectPathType,
2614}
2615
2616/// Path defines parameters used to modify the path of the incoming request.
2617/// The modified path is then used to construct the `Location` header. When
2618/// empty, the request path is used as-is.
2619///
2620/// Support: Extended
2621#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2622pub enum HttpRouteRulesFiltersRequestRedirectPathType {
2623    ReplaceFullPath,
2624    ReplacePrefixMatch,
2625}
2626
2627/// RequestRedirect defines a schema for a filter that responds to the
2628/// request with an HTTP redirection.
2629///
2630/// Support: Core
2631#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2632pub enum HttpRouteRulesFiltersRequestRedirectScheme {
2633    #[serde(rename = "http")]
2634    Http,
2635    #[serde(rename = "https")]
2636    Https,
2637}
2638
2639/// RequestRedirect defines a schema for a filter that responds to the
2640/// request with an HTTP redirection.
2641///
2642/// Support: Core
2643#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2644pub enum HttpRouteRulesFiltersRequestRedirectStatusCode {
2645    #[serde(rename = "301")]
2646    r#_301,
2647    #[serde(rename = "302")]
2648    r#_302,
2649    #[serde(rename = "303")]
2650    r#_303,
2651    #[serde(rename = "307")]
2652    r#_307,
2653    #[serde(rename = "308")]
2654    r#_308,
2655}
2656
2657/// ResponseHeaderModifier defines a schema for a filter that modifies response
2658/// headers.
2659///
2660/// Support: Extended
2661#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2662pub struct HttpRouteRulesFiltersResponseHeaderModifier {
2663    /// Add adds the given header(s) (name, value) to the request
2664    /// before the action. It appends to any existing values associated
2665    /// with the header name.
2666    ///
2667    /// Input:
2668    ///   GET /foo HTTP/1.1
2669    ///   my-header: foo
2670    ///
2671    /// Config:
2672    ///   add:
2673    ///   - name: "my-header"
2674    ///     value: "bar,baz"
2675    ///
2676    /// Output:
2677    ///   GET /foo HTTP/1.1
2678    ///   my-header: foo,bar,baz
2679    #[serde(default, skip_serializing_if = "Option::is_none")]
2680    pub add: Option<Vec<HttpRouteRulesFiltersResponseHeaderModifierAdd>>,
2681    /// Remove the given header(s) from the HTTP request before the action. The
2682    /// value of Remove is a list of HTTP header names. Note that the header
2683    /// names are case-insensitive (see
2684    /// <https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).>
2685    ///
2686    /// Input:
2687    ///   GET /foo HTTP/1.1
2688    ///   my-header1: foo
2689    ///   my-header2: bar
2690    ///   my-header3: baz
2691    ///
2692    /// Config:
2693    ///   remove: ["my-header1", "my-header3"]
2694    ///
2695    /// Output:
2696    ///   GET /foo HTTP/1.1
2697    ///   my-header2: bar
2698    #[serde(default, skip_serializing_if = "Option::is_none")]
2699    pub remove: Option<Vec<String>>,
2700    /// Set overwrites the request with the given header (name, value)
2701    /// before the action.
2702    ///
2703    /// Input:
2704    ///   GET /foo HTTP/1.1
2705    ///   my-header: foo
2706    ///
2707    /// Config:
2708    ///   set:
2709    ///   - name: "my-header"
2710    ///     value: "bar"
2711    ///
2712    /// Output:
2713    ///   GET /foo HTTP/1.1
2714    ///   my-header: bar
2715    #[serde(default, skip_serializing_if = "Option::is_none")]
2716    pub set: Option<Vec<HttpRouteRulesFiltersResponseHeaderModifierSet>>,
2717}
2718
2719/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
2720#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2721pub struct HttpRouteRulesFiltersResponseHeaderModifierAdd {
2722    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
2723    /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
2724    ///
2725    /// If multiple entries specify equivalent header names, the first entry with
2726    /// an equivalent name MUST be considered for a match. Subsequent entries
2727    /// with an equivalent header name MUST be ignored. Due to the
2728    /// case-insensitivity of header names, "foo" and "Foo" are considered
2729    /// equivalent.
2730    pub name: String,
2731    /// Value is the value of HTTP Header to be matched.
2732    ///
2733    /// Must consist of printable US-ASCII characters, optionally separated
2734    /// by single tabs or spaces. See: <https://tools.ietf.org/html/rfc7230#section-3.2>
2735    pub value: String,
2736}
2737
2738/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
2739#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2740pub struct HttpRouteRulesFiltersResponseHeaderModifierSet {
2741    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
2742    /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
2743    ///
2744    /// If multiple entries specify equivalent header names, the first entry with
2745    /// an equivalent name MUST be considered for a match. Subsequent entries
2746    /// with an equivalent header name MUST be ignored. Due to the
2747    /// case-insensitivity of header names, "foo" and "Foo" are considered
2748    /// equivalent.
2749    pub name: String,
2750    /// Value is the value of HTTP Header to be matched.
2751    ///
2752    /// Must consist of printable US-ASCII characters, optionally separated
2753    /// by single tabs or spaces. See: <https://tools.ietf.org/html/rfc7230#section-3.2>
2754    pub value: String,
2755}
2756
2757/// HTTPRouteFilter defines processing steps that must be completed during the
2758/// request or response lifecycle. HTTPRouteFilters are meant as an extension
2759/// point to express processing that may be done in Gateway implementations. Some
2760/// examples include request or response modification, implementing
2761/// authentication strategies, rate-limiting, and traffic shaping. API
2762/// guarantee/conformance is defined based on the type of the filter.
2763#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2764pub enum HttpRouteRulesFiltersType {
2765    RequestHeaderModifier,
2766    ResponseHeaderModifier,
2767    RequestMirror,
2768    RequestRedirect,
2769    #[serde(rename = "URLRewrite")]
2770    UrlRewrite,
2771    ExtensionRef,
2772    #[serde(rename = "CORS")]
2773    Cors,
2774    ExternalAuth,
2775}
2776
2777/// URLRewrite defines a schema for a filter that modifies a request during forwarding.
2778///
2779/// Support: Extended
2780#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2781pub struct HttpRouteRulesFiltersUrlRewrite {
2782    /// Hostname is the value to be used to replace the Host header value during
2783    /// forwarding.
2784    ///
2785    /// Support: Extended
2786    #[serde(default, skip_serializing_if = "Option::is_none")]
2787    pub hostname: Option<String>,
2788    /// Path defines a path rewrite.
2789    ///
2790    /// Support: Extended
2791    #[serde(default, skip_serializing_if = "Option::is_none")]
2792    pub path: Option<HttpRouteRulesFiltersUrlRewritePath>,
2793}
2794
2795/// Path defines a path rewrite.
2796///
2797/// Support: Extended
2798#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2799pub struct HttpRouteRulesFiltersUrlRewritePath {
2800    /// ReplaceFullPath specifies the value with which to replace the full path
2801    /// of a request during a rewrite or redirect.
2802    #[serde(default, skip_serializing_if = "Option::is_none", rename = "replaceFullPath")]
2803    pub replace_full_path: Option<String>,
2804    /// ReplacePrefixMatch specifies the value with which to replace the prefix
2805    /// match of a request during a rewrite or redirect. For example, a request
2806    /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
2807    /// of "/xyz" would be modified to "/xyz/bar".
2808    ///
2809    /// Note that this matches the behavior of the PathPrefix match type. This
2810    /// matches full path elements. A path element refers to the list of labels
2811    /// in the path split by the `/` separator. When specified, a trailing `/` is
2812    /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
2813    /// match the prefix `/abc`, but the path `/abcd` would not.
2814    ///
2815    /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
2816    /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
2817    /// the implementation setting the Accepted Condition for the Route to `status: False`.
2818    ///
2819    /// Request Path | Prefix Match | Replace Prefix | Modified Path
2820    #[serde(default, skip_serializing_if = "Option::is_none", rename = "replacePrefixMatch")]
2821    pub replace_prefix_match: Option<String>,
2822    /// Type defines the type of path modifier. Additional types may be
2823    /// added in a future release of the API.
2824    ///
2825    /// Note that values may be added to this enum, implementations
2826    /// must ensure that unknown values will not cause a crash.
2827    ///
2828    /// Unknown values here must result in the implementation setting the
2829    /// Accepted Condition for the Route to `status: False`, with a
2830    /// Reason of `UnsupportedValue`.
2831    #[serde(rename = "type")]
2832    pub r#type: HttpRouteRulesFiltersUrlRewritePathType,
2833}
2834
2835/// Path defines a path rewrite.
2836///
2837/// Support: Extended
2838#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2839pub enum HttpRouteRulesFiltersUrlRewritePathType {
2840    ReplaceFullPath,
2841    ReplacePrefixMatch,
2842}
2843
2844/// HTTPRouteMatch defines the predicate used to match requests to a given
2845/// action. Multiple match types are ANDed together, i.e. the match will
2846/// evaluate to true only if all conditions are satisfied.
2847///
2848/// For example, the match below will match a HTTP request only if its path
2849/// starts with `/foo` AND it contains the `version: v1` header:
2850///
2851/// ```text
2852/// match:
2853///
2854/// 	path:
2855/// 	  value: "/foo"
2856/// 	headers:
2857/// 	- name: "version"
2858/// 	  value "v1"
2859/// ```
2860#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2861pub struct HttpRouteRulesMatches {
2862    /// Headers specifies HTTP request header matchers. Multiple match values are
2863    /// ANDed together, meaning, a request must match all the specified headers
2864    /// to select the route.
2865    #[serde(default, skip_serializing_if = "Option::is_none")]
2866    pub headers: Option<Vec<HttpRouteRulesMatchesHeaders>>,
2867    /// Method specifies HTTP method matcher.
2868    /// When specified, this route will be matched only if the request has the
2869    /// specified method.
2870    ///
2871    /// Support: Extended
2872    #[serde(default, skip_serializing_if = "Option::is_none")]
2873    pub method: Option<HttpRouteRulesMatchesMethod>,
2874    /// Path specifies a HTTP request path matcher. If this field is not
2875    /// specified, a default prefix match on the "/" path is provided.
2876    #[serde(default, skip_serializing_if = "Option::is_none")]
2877    pub path: Option<HttpRouteRulesMatchesPath>,
2878    /// QueryParams specifies HTTP query parameter matchers. Multiple match
2879    /// values are ANDed together, meaning, a request must match all the
2880    /// specified query parameters to select the route.
2881    ///
2882    /// Support: Extended
2883    #[serde(default, skip_serializing_if = "Option::is_none", rename = "queryParams")]
2884    pub query_params: Option<Vec<HttpRouteRulesMatchesQueryParams>>,
2885}
2886
2887/// HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request
2888/// headers.
2889#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2890pub struct HttpRouteRulesMatchesHeaders {
2891    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
2892    /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
2893    ///
2894    /// If multiple entries specify equivalent header names, only the first
2895    /// entry with an equivalent name MUST be considered for a match. Subsequent
2896    /// entries with an equivalent header name MUST be ignored. Due to the
2897    /// case-insensitivity of header names, "foo" and "Foo" are considered
2898    /// equivalent.
2899    ///
2900    /// When a header is repeated in an HTTP request, it is
2901    /// implementation-specific behavior as to how this is represented.
2902    /// Generally, proxies should follow the guidance from the RFC:
2903    /// <https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.2> regarding
2904    /// processing a repeated header, with special handling for "Set-Cookie".
2905    pub name: String,
2906    /// Type specifies how to match against the value of the header.
2907    ///
2908    /// Support: Core (Exact)
2909    ///
2910    /// Support: Implementation-specific (RegularExpression)
2911    ///
2912    /// Since RegularExpression HeaderMatchType has implementation-specific
2913    /// conformance, implementations can support POSIX, PCRE or any other dialects
2914    /// of regular expressions. Please read the implementation's documentation to
2915    /// determine the supported dialect.
2916    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
2917    pub r#type: Option<HttpRouteRulesMatchesHeadersType>,
2918    /// Value is the value of HTTP Header to be matched.
2919    ///
2920    /// Must consist of printable US-ASCII characters, optionally separated
2921    /// by single tabs or spaces. See: <https://tools.ietf.org/html/rfc7230#section-3.2>
2922    pub value: String,
2923}
2924
2925/// HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request
2926/// headers.
2927#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2928pub enum HttpRouteRulesMatchesHeadersType {
2929    Exact,
2930    RegularExpression,
2931}
2932
2933/// HTTPRouteMatch defines the predicate used to match requests to a given
2934/// action. Multiple match types are ANDed together, i.e. the match will
2935/// evaluate to true only if all conditions are satisfied.
2936///
2937/// For example, the match below will match a HTTP request only if its path
2938/// starts with `/foo` AND it contains the `version: v1` header:
2939///
2940/// ```text
2941/// match:
2942///
2943/// 	path:
2944/// 	  value: "/foo"
2945/// 	headers:
2946/// 	- name: "version"
2947/// 	  value "v1"
2948/// ```
2949#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2950pub enum HttpRouteRulesMatchesMethod {
2951    #[serde(rename = "GET")]
2952    Get,
2953    #[serde(rename = "HEAD")]
2954    Head,
2955    #[serde(rename = "POST")]
2956    Post,
2957    #[serde(rename = "PUT")]
2958    Put,
2959    #[serde(rename = "DELETE")]
2960    Delete,
2961    #[serde(rename = "CONNECT")]
2962    Connect,
2963    #[serde(rename = "OPTIONS")]
2964    Options,
2965    #[serde(rename = "TRACE")]
2966    Trace,
2967    #[serde(rename = "PATCH")]
2968    Patch,
2969}
2970
2971/// Path specifies a HTTP request path matcher. If this field is not
2972/// specified, a default prefix match on the "/" path is provided.
2973#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2974pub struct HttpRouteRulesMatchesPath {
2975    /// Type specifies how to match against the path Value.
2976    ///
2977    /// Support: Core (Exact, PathPrefix)
2978    ///
2979    /// Support: Implementation-specific (RegularExpression)
2980    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
2981    pub r#type: Option<HttpRouteRulesMatchesPathType>,
2982    /// Value of the HTTP path to match against.
2983    #[serde(default, skip_serializing_if = "Option::is_none")]
2984    pub value: Option<String>,
2985}
2986
2987/// Path specifies a HTTP request path matcher. If this field is not
2988/// specified, a default prefix match on the "/" path is provided.
2989#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2990pub enum HttpRouteRulesMatchesPathType {
2991    Exact,
2992    PathPrefix,
2993    RegularExpression,
2994}
2995
2996/// HTTPQueryParamMatch describes how to select a HTTP route by matching HTTP
2997/// query parameters.
2998#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2999pub struct HttpRouteRulesMatchesQueryParams {
3000    /// Name is the name of the HTTP query param to be matched. This must be an
3001    /// exact string match. (See
3002    /// <https://tools.ietf.org/html/rfc7230#section-2.7.3).>
3003    ///
3004    /// If multiple entries specify equivalent query param names, only the first
3005    /// entry with an equivalent name MUST be considered for a match. Subsequent
3006    /// entries with an equivalent query param name MUST be ignored.
3007    ///
3008    /// If a query param is repeated in an HTTP request, the behavior is
3009    /// purposely left undefined, since different data planes have different
3010    /// capabilities. However, it is *recommended* that implementations should
3011    /// match against the first value of the param if the data plane supports it,
3012    /// as this behavior is expected in other load balancing contexts outside of
3013    /// the Gateway API.
3014    ///
3015    /// Users SHOULD NOT route traffic based on repeated query params to guard
3016    /// themselves against potential differences in the implementations.
3017    pub name: String,
3018    /// Type specifies how to match against the value of the query parameter.
3019    ///
3020    /// Support: Extended (Exact)
3021    ///
3022    /// Support: Implementation-specific (RegularExpression)
3023    ///
3024    /// Since RegularExpression QueryParamMatchType has Implementation-specific
3025    /// conformance, implementations can support POSIX, PCRE or any other
3026    /// dialects of regular expressions. Please read the implementation's
3027    /// documentation to determine the supported dialect.
3028    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
3029    pub r#type: Option<HttpRouteRulesMatchesQueryParamsType>,
3030    /// Value is the value of HTTP query param to be matched.
3031    pub value: String,
3032}
3033
3034/// HTTPQueryParamMatch describes how to select a HTTP route by matching HTTP
3035/// query parameters.
3036#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
3037pub enum HttpRouteRulesMatchesQueryParamsType {
3038    Exact,
3039    RegularExpression,
3040}
3041
3042/// Retry defines the configuration for when to retry an HTTP request.
3043///
3044/// Support: Extended
3045#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
3046pub struct HttpRouteRulesRetry {
3047    /// Attempts specifies the maximum number of times an individual request
3048    /// from the gateway to a backend should be retried.
3049    ///
3050    /// If the maximum number of retries has been attempted without a successful
3051    /// response from the backend, the Gateway MUST return an error.
3052    ///
3053    /// When this field is unspecified, the number of times to attempt to retry
3054    /// a backend request is implementation-specific.
3055    ///
3056    /// Support: Extended
3057    #[serde(default, skip_serializing_if = "Option::is_none")]
3058    pub attempts: Option<i64>,
3059    /// Backoff specifies the minimum duration a Gateway should wait between
3060    /// retry attempts and is represented in Gateway API Duration formatting.
3061    ///
3062    /// For example, setting the `rules[].retry.backoff` field to the value
3063    /// `100ms` will cause a backend request to first be retried approximately
3064    /// 100 milliseconds after timing out or receiving a response code configured
3065    /// to be retriable.
3066    ///
3067    /// An implementation MAY use an exponential or alternative backoff strategy
3068    /// for subsequent retry attempts, MAY cap the maximum backoff duration to
3069    /// some amount greater than the specified minimum, and MAY add arbitrary
3070    /// jitter to stagger requests, as long as unsuccessful backend requests are
3071    /// not retried before the configured minimum duration.
3072    ///
3073    /// If a Request timeout (`rules[].timeouts.request`) is configured on the
3074    /// route, the entire duration of the initial request and any retry attempts
3075    /// MUST not exceed the Request timeout duration. If any retry attempts are
3076    /// still in progress when the Request timeout duration has been reached,
3077    /// these SHOULD be canceled if possible and the Gateway MUST immediately
3078    /// return a timeout error.
3079    ///
3080    /// If a BackendRequest timeout (`rules[].timeouts.backendRequest`) is
3081    /// configured on the route, any retry attempts which reach the configured
3082    /// BackendRequest timeout duration without a response SHOULD be canceled if
3083    /// possible and the Gateway should wait for at least the specified backoff
3084    /// duration before attempting to retry the backend request again.
3085    ///
3086    /// If a BackendRequest timeout is _not_ configured on the route, retry
3087    /// attempts MAY time out after an implementation default duration, or MAY
3088    /// remain pending until a configured Request timeout or implementation
3089    /// default duration for total request time is reached.
3090    ///
3091    /// When this field is unspecified, the time to wait between retry attempts
3092    /// is implementation-specific.
3093    ///
3094    /// Support: Extended
3095    #[serde(default, skip_serializing_if = "Option::is_none")]
3096    pub backoff: Option<String>,
3097    /// Codes defines the HTTP response status codes for which a backend request
3098    /// should be retried.
3099    ///
3100    /// Support: Extended
3101    #[serde(default, skip_serializing_if = "Option::is_none")]
3102    pub codes: Option<Vec<i64>>,
3103}
3104
3105/// SessionPersistence defines and configures session persistence
3106/// for the route rule.
3107///
3108/// Support: Extended
3109#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
3110pub struct HttpRouteRulesSessionPersistence {
3111    /// AbsoluteTimeout defines the absolute timeout of the persistent
3112    /// session. Once the AbsoluteTimeout duration has elapsed, the
3113    /// session becomes invalid.
3114    ///
3115    /// Support: Extended
3116    #[serde(default, skip_serializing_if = "Option::is_none", rename = "absoluteTimeout")]
3117    pub absolute_timeout: Option<String>,
3118    /// CookieConfig provides configuration settings that are specific
3119    /// to cookie-based session persistence.
3120    ///
3121    /// Support: Core
3122    #[serde(default, skip_serializing_if = "Option::is_none", rename = "cookieConfig")]
3123    pub cookie_config: Option<HttpRouteRulesSessionPersistenceCookieConfig>,
3124    /// IdleTimeout defines the idle timeout of the persistent session.
3125    /// Once the session has been idle for more than the specified
3126    /// IdleTimeout duration, the session becomes invalid.
3127    ///
3128    /// Support: Extended
3129    #[serde(default, skip_serializing_if = "Option::is_none", rename = "idleTimeout")]
3130    pub idle_timeout: Option<String>,
3131    /// SessionName defines the name of the persistent session token
3132    /// which may be reflected in the cookie or the header. Users
3133    /// should avoid reusing session names to prevent unintended
3134    /// consequences, such as rejection or unpredictable behavior.
3135    ///
3136    /// Support: Implementation-specific
3137    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sessionName")]
3138    pub session_name: Option<String>,
3139    /// Type defines the type of session persistence such as through
3140    /// the use of a header or cookie. Defaults to cookie based session
3141    /// persistence.
3142    ///
3143    /// Support: Core for "Cookie" type
3144    ///
3145    /// Support: Extended for "Header" type
3146    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
3147    pub r#type: Option<HttpRouteRulesSessionPersistenceType>,
3148}
3149
3150/// CookieConfig provides configuration settings that are specific
3151/// to cookie-based session persistence.
3152///
3153/// Support: Core
3154#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
3155pub struct HttpRouteRulesSessionPersistenceCookieConfig {
3156    /// LifetimeType specifies whether the cookie has a permanent or
3157    /// session-based lifetime. A permanent cookie persists until its
3158    /// specified expiry time, defined by the Expires or Max-Age cookie
3159    /// attributes, while a session cookie is deleted when the current
3160    /// session ends.
3161    ///
3162    /// When set to "Permanent", AbsoluteTimeout indicates the
3163    /// cookie's lifetime via the Expires or Max-Age cookie attributes
3164    /// and is required.
3165    ///
3166    /// When set to "Session", AbsoluteTimeout indicates the
3167    /// absolute lifetime of the cookie tracked by the gateway and
3168    /// is optional.
3169    ///
3170    /// Defaults to "Session".
3171    ///
3172    /// Support: Core for "Session" type
3173    ///
3174    /// Support: Extended for "Permanent" type
3175    #[serde(default, skip_serializing_if = "Option::is_none", rename = "lifetimeType")]
3176    pub lifetime_type: Option<HttpRouteRulesSessionPersistenceCookieConfigLifetimeType>,
3177}
3178
3179/// CookieConfig provides configuration settings that are specific
3180/// to cookie-based session persistence.
3181///
3182/// Support: Core
3183#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
3184pub enum HttpRouteRulesSessionPersistenceCookieConfigLifetimeType {
3185    Permanent,
3186    Session,
3187}
3188
3189/// SessionPersistence defines and configures session persistence
3190/// for the route rule.
3191///
3192/// Support: Extended
3193#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
3194pub enum HttpRouteRulesSessionPersistenceType {
3195    Cookie,
3196    Header,
3197}
3198
3199/// Timeouts defines the timeouts that can be configured for an HTTP request.
3200///
3201/// Support: Extended
3202#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
3203pub struct HttpRouteRulesTimeouts {
3204    /// BackendRequest specifies a timeout for an individual request from the gateway
3205    /// to a backend. This covers the time from when the request first starts being
3206    /// sent from the gateway to when the full response has been received from the backend.
3207    ///
3208    /// Setting a timeout to the zero duration (e.g. "0s") SHOULD disable the timeout
3209    /// completely. Implementations that cannot completely disable the timeout MUST
3210    /// instead interpret the zero duration as the longest possible value to which
3211    /// the timeout can be set.
3212    ///
3213    /// An entire client HTTP transaction with a gateway, covered by the Request timeout,
3214    /// may result in more than one call from the gateway to the destination backend,
3215    /// for example, if automatic retries are supported.
3216    ///
3217    /// The value of BackendRequest must be a Gateway API Duration string as defined by
3218    /// GEP-2257.  When this field is unspecified, its behavior is implementation-specific;
3219    /// when specified, the value of BackendRequest must be no more than the value of the
3220    /// Request timeout (since the Request timeout encompasses the BackendRequest timeout).
3221    ///
3222    /// Support: Extended
3223    #[serde(default, skip_serializing_if = "Option::is_none", rename = "backendRequest")]
3224    pub backend_request: Option<String>,
3225    /// Request specifies the maximum duration for a gateway to respond to an HTTP request.
3226    /// If the gateway has not been able to respond before this deadline is met, the gateway
3227    /// MUST return a timeout error.
3228    ///
3229    /// For example, setting the `rules.timeouts.request` field to the value `10s` in an
3230    /// `HTTPRoute` will cause a timeout if a client request is taking longer than 10 seconds
3231    /// to complete.
3232    ///
3233    /// Setting a timeout to the zero duration (e.g. "0s") SHOULD disable the timeout
3234    /// completely. Implementations that cannot completely disable the timeout MUST
3235    /// instead interpret the zero duration as the longest possible value to which
3236    /// the timeout can be set.
3237    ///
3238    /// This timeout is intended to cover as close to the whole request-response transaction
3239    /// as possible although an implementation MAY choose to start the timeout after the entire
3240    /// request stream has been received instead of immediately after the transaction is
3241    /// initiated by the client.
3242    ///
3243    /// The value of Request is a Gateway API Duration string as defined by GEP-2257. When this
3244    /// field is unspecified, request timeout behavior is implementation-specific.
3245    ///
3246    /// Support: Extended
3247    #[serde(default, skip_serializing_if = "Option::is_none")]
3248    pub request: Option<String>,
3249}
3250
3251/// Spec defines the desired state of HTTPRoute.
3252#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
3253pub enum HttpRouteUseDefaultGateways {
3254    All,
3255    None,
3256}
3257
3258/// Status defines the current state of HTTPRoute.
3259#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
3260pub struct HttpRouteStatus {
3261    /// Parents is a list of parent resources (usually Gateways) that are
3262    /// associated with the route, and the status of the route with respect to
3263    /// each parent. When this route attaches to a parent, the controller that
3264    /// manages the parent must add an entry to this list when the controller
3265    /// first sees the route and should update the entry as appropriate when the
3266    /// route or gateway is modified.
3267    ///
3268    /// Note that parent references that cannot be resolved by an implementation
3269    /// of this API will not be added to this list. Implementations of this API
3270    /// can only populate Route status for the Gateways/parent resources they are
3271    /// responsible for.
3272    ///
3273    /// A maximum of 32 Gateways will be represented in this list. An empty list
3274    /// means the route has not been attached to any Gateway.
3275    pub parents: Vec<HttpRouteStatusParents>,
3276}
3277
3278/// RouteParentStatus describes the status of a route with respect to an
3279/// associated Parent.
3280#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
3281pub struct HttpRouteStatusParents {
3282    /// Conditions describes the status of the route with respect to the Gateway.
3283    /// Note that the route's availability is also subject to the Gateway's own
3284    /// status conditions and listener status.
3285    ///
3286    /// If the Route's ParentRef specifies an existing Gateway that supports
3287    /// Routes of this kind AND that Gateway's controller has sufficient access,
3288    /// then that Gateway's controller MUST set the "Accepted" condition on the
3289    /// Route, to indicate whether the route has been accepted or rejected by the
3290    /// Gateway, and why.
3291    ///
3292    /// A Route MUST be considered "Accepted" if at least one of the Route's
3293    /// rules is implemented by the Gateway.
3294    ///
3295    /// There are a number of cases where the "Accepted" condition may not be set
3296    /// due to lack of controller visibility, that includes when:
3297    ///
3298    /// * The Route refers to a nonexistent parent.
3299    /// * The Route is of a type that the controller does not support.
3300    /// * The Route is in a namespace to which the controller does not have access.
3301    pub conditions: Vec<Condition>,
3302    /// ControllerName is a domain/path string that indicates the name of the
3303    /// controller that wrote this status. This corresponds with the
3304    /// controllerName field on GatewayClass.
3305    ///
3306    /// Example: "example.net/gateway-controller".
3307    ///
3308    /// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are
3309    /// valid Kubernetes names
3310    /// (<https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).>
3311    ///
3312    /// Controllers MUST populate this field when writing status. Controllers should ensure that
3313    /// entries to status populated with their ControllerName are cleaned up when they are no
3314    /// longer necessary.
3315    #[serde(rename = "controllerName")]
3316    pub controller_name: String,
3317    /// ParentRef corresponds with a ParentRef in the spec that this
3318    /// RouteParentStatus struct describes the status of.
3319    #[serde(rename = "parentRef")]
3320    pub parent_ref: HttpRouteStatusParentsParentRef,
3321}
3322
3323/// ParentRef corresponds with a ParentRef in the spec that this
3324/// RouteParentStatus struct describes the status of.
3325#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
3326pub struct HttpRouteStatusParentsParentRef {
3327    /// Group is the group of the referent.
3328    /// When unspecified, "gateway.networking.k8s.io" is inferred.
3329    /// To set the core API group (such as for a "Service" kind referent),
3330    /// Group must be explicitly set to "" (empty string).
3331    ///
3332    /// Support: Core
3333    #[serde(default, skip_serializing_if = "Option::is_none")]
3334    pub group: Option<String>,
3335    /// Kind is kind of the referent.
3336    ///
3337    /// There are two kinds of parent resources with "Core" support:
3338    ///
3339    /// * Gateway (Gateway conformance profile)
3340    /// * Service (Mesh conformance profile, ClusterIP Services only)
3341    ///
3342    /// Support for other resources is Implementation-Specific.
3343    #[serde(default, skip_serializing_if = "Option::is_none")]
3344    pub kind: Option<String>,
3345    /// Name is the name of the referent.
3346    ///
3347    /// Support: Core
3348    pub name: String,
3349    /// Namespace is the namespace of the referent. When unspecified, this refers
3350    /// to the local namespace of the Route.
3351    ///
3352    /// Note that there are specific rules for ParentRefs which cross namespace
3353    /// boundaries. Cross-namespace references are only valid if they are explicitly
3354    /// allowed by something in the namespace they are referring to. For example:
3355    /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
3356    /// generic way to enable any other kind of cross-namespace reference.
3357    ///
3358    ///
3359    /// ParentRefs from a Route to a Service in the same namespace are "producer"
3360    /// routes, which apply default routing rules to inbound connections from
3361    /// any namespace to the Service.
3362    ///
3363    /// ParentRefs from a Route to a Service in a different namespace are
3364    /// "consumer" routes, and these routing rules are only applied to outbound
3365    /// connections originating from the same namespace as the Route, for which
3366    /// the intended destination of the connections are a Service targeted as a
3367    /// ParentRef of the Route.
3368    ///
3369    ///
3370    /// Support: Core
3371    #[serde(default, skip_serializing_if = "Option::is_none")]
3372    pub namespace: Option<String>,
3373    /// Port is the network port this Route targets. It can be interpreted
3374    /// differently based on the type of parent resource.
3375    ///
3376    /// When the parent resource is a Gateway, this targets all listeners
3377    /// listening on the specified port that also support this kind of Route(and
3378    /// select this Route). It's not recommended to set `Port` unless the
3379    /// networking behaviors specified in a Route must apply to a specific port
3380    /// as opposed to a listener(s) whose port(s) may be changed. When both Port
3381    /// and SectionName are specified, the name and port of the selected listener
3382    /// must match both specified values.
3383    ///
3384    ///
3385    /// When the parent resource is a Service, this targets a specific port in the
3386    /// Service spec. When both Port (experimental) and SectionName are specified,
3387    /// the name and port of the selected port must match both specified values.
3388    ///
3389    ///
3390    /// Implementations MAY choose to support other parent resources.
3391    /// Implementations supporting other types of parent resources MUST clearly
3392    /// document how/if Port is interpreted.
3393    ///
3394    /// For the purpose of status, an attachment is considered successful as
3395    /// long as the parent resource accepts it partially. For example, Gateway
3396    /// listeners can restrict which Routes can attach to them by Route kind,
3397    /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
3398    /// from the referencing Route, the Route MUST be considered successfully
3399    /// attached. If no Gateway listeners accept attachment from this Route,
3400    /// the Route MUST be considered detached from the Gateway.
3401    ///
3402    /// Support: Extended
3403    #[serde(default, skip_serializing_if = "Option::is_none")]
3404    pub port: Option<i32>,
3405    /// SectionName is the name of a section within the target resource. In the
3406    /// following resources, SectionName is interpreted as the following:
3407    ///
3408    /// * Gateway: Listener name. When both Port (experimental) and SectionName
3409    /// are specified, the name and port of the selected listener must match
3410    /// both specified values.
3411    /// * Service: Port name. When both Port (experimental) and SectionName
3412    /// are specified, the name and port of the selected listener must match
3413    /// both specified values.
3414    ///
3415    /// Implementations MAY choose to support attaching Routes to other resources.
3416    /// If that is the case, they MUST clearly document how SectionName is
3417    /// interpreted.
3418    ///
3419    /// When unspecified (empty string), this will reference the entire resource.
3420    /// For the purpose of status, an attachment is considered successful if at
3421    /// least one section in the parent resource accepts it. For example, Gateway
3422    /// listeners can restrict which Routes can attach to them by Route kind,
3423    /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
3424    /// the referencing Route, the Route MUST be considered successfully
3425    /// attached. If no Gateway listeners accept attachment from this Route, the
3426    /// Route MUST be considered detached from the Gateway.
3427    ///
3428    /// Support: Core
3429    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sectionName")]
3430    pub section_name: Option<String>,
3431}