gateway_api/apis/standard/
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.21.2
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    #[serde(
133        default,
134        skip_serializing_if = "Option::is_none",
135        rename = "parentRefs"
136    )]
137    pub parent_refs: Option<Vec<HTTPRouteParentRefs>>,
138    /// Rules are a list of HTTP matchers, filters and actions.
139    #[serde(default, skip_serializing_if = "Option::is_none")]
140    pub rules: Option<Vec<HTTPRouteRules>>,
141}
142
143/// ParentReference identifies an API object (usually a Gateway) that can be considered
144/// a parent of this resource (usually a route). There are two kinds of parent resources
145/// with "Core" support:
146///
147/// * Gateway (Gateway conformance profile)
148/// * Service (Mesh conformance profile, ClusterIP Services only)
149///
150/// This API may be extended in the future to support additional kinds of parent
151/// resources.
152///
153/// The API object must be valid in the cluster; the Group and Kind must
154/// be registered in the cluster for this reference to be valid.
155#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
156pub struct HTTPRouteParentRefs {
157    /// Group is the group of the referent.
158    /// When unspecified, "gateway.networking.k8s.io" is inferred.
159    /// To set the core API group (such as for a "Service" kind referent),
160    /// Group must be explicitly set to "" (empty string).
161    ///
162    /// Support: Core
163    #[serde(default, skip_serializing_if = "Option::is_none")]
164    pub group: Option<String>,
165    /// Kind is kind of the referent.
166    ///
167    /// There are two kinds of parent resources with "Core" support:
168    ///
169    /// * Gateway (Gateway conformance profile)
170    /// * Service (Mesh conformance profile, ClusterIP Services only)
171    ///
172    /// Support for other resources is Implementation-Specific.
173    #[serde(default, skip_serializing_if = "Option::is_none")]
174    pub kind: Option<String>,
175    /// Name is the name of the referent.
176    ///
177    /// Support: Core
178    pub name: String,
179    /// Namespace is the namespace of the referent. When unspecified, this refers
180    /// to the local namespace of the Route.
181    ///
182    /// Note that there are specific rules for ParentRefs which cross namespace
183    /// boundaries. Cross-namespace references are only valid if they are explicitly
184    /// allowed by something in the namespace they are referring to. For example:
185    /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
186    /// generic way to enable any other kind of cross-namespace reference.
187    ///
188    /// Support: Core
189    #[serde(default, skip_serializing_if = "Option::is_none")]
190    pub namespace: Option<String>,
191    /// Port is the network port this Route targets. It can be interpreted
192    /// differently based on the type of parent resource.
193    ///
194    /// When the parent resource is a Gateway, this targets all listeners
195    /// listening on the specified port that also support this kind of Route(and
196    /// select this Route). It's not recommended to set `Port` unless the
197    /// networking behaviors specified in a Route must apply to a specific port
198    /// as opposed to a listener(s) whose port(s) may be changed. When both Port
199    /// and SectionName are specified, the name and port of the selected listener
200    /// must match both specified values.
201    ///
202    /// Implementations MAY choose to support other parent resources.
203    /// Implementations supporting other types of parent resources MUST clearly
204    /// document how/if Port is interpreted.
205    ///
206    /// For the purpose of status, an attachment is considered successful as
207    /// long as the parent resource accepts it partially. For example, Gateway
208    /// listeners can restrict which Routes can attach to them by Route kind,
209    /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
210    /// from the referencing Route, the Route MUST be considered successfully
211    /// attached. If no Gateway listeners accept attachment from this Route,
212    /// the Route MUST be considered detached from the Gateway.
213    ///
214    /// Support: Extended
215    #[serde(default, skip_serializing_if = "Option::is_none")]
216    pub port: Option<i32>,
217    /// SectionName is the name of a section within the target resource. In the
218    /// following resources, SectionName is interpreted as the following:
219    ///
220    /// * Gateway: Listener name. When both Port (experimental) and SectionName
221    /// are specified, the name and port of the selected listener must match
222    /// both specified values.
223    /// * Service: Port name. When both Port (experimental) and SectionName
224    /// are specified, the name and port of the selected listener must match
225    /// both specified values.
226    ///
227    /// Implementations MAY choose to support attaching Routes to other resources.
228    /// If that is the case, they MUST clearly document how SectionName is
229    /// interpreted.
230    ///
231    /// When unspecified (empty string), this will reference the entire resource.
232    /// For the purpose of status, an attachment is considered successful if at
233    /// least one section in the parent resource accepts it. For example, Gateway
234    /// listeners can restrict which Routes can attach to them by Route kind,
235    /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
236    /// the referencing Route, the Route MUST be considered successfully
237    /// attached. If no Gateway listeners accept attachment from this Route, the
238    /// Route MUST be considered detached from the Gateway.
239    ///
240    /// Support: Core
241    #[serde(
242        default,
243        skip_serializing_if = "Option::is_none",
244        rename = "sectionName"
245    )]
246    pub section_name: Option<String>,
247}
248
249/// HTTPRouteRule defines semantics for matching an HTTP request based on
250/// conditions (matches), processing it (filters), and forwarding the request to
251/// an API object (backendRefs).
252#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
253pub struct HTTPRouteRules {
254    /// BackendRefs defines the backend(s) where matching requests should be
255    /// sent.
256    ///
257    /// Failure behavior here depends on how many BackendRefs are specified and
258    /// how many are invalid.
259    ///
260    /// If *all* entries in BackendRefs are invalid, and there are also no filters
261    /// specified in this route rule, *all* traffic which matches this rule MUST
262    /// receive a 500 status code.
263    ///
264    /// See the HTTPBackendRef definition for the rules about what makes a single
265    /// HTTPBackendRef invalid.
266    ///
267    /// When a HTTPBackendRef is invalid, 500 status codes MUST be returned for
268    /// requests that would have otherwise been routed to an invalid backend. If
269    /// multiple backends are specified, and some are invalid, the proportion of
270    /// requests that would otherwise have been routed to an invalid backend
271    /// MUST receive a 500 status code.
272    ///
273    /// For example, if two backends are specified with equal weights, and one is
274    /// invalid, 50 percent of traffic must receive a 500. Implementations may
275    /// choose how that 50 percent is determined.
276    ///
277    /// When a HTTPBackendRef refers to a Service that has no ready endpoints,
278    /// implementations SHOULD return a 503 for requests to that backend instead.
279    /// If an implementation chooses to do this, all of the above rules for 500 responses
280    /// MUST also apply for responses that return a 503.
281    ///
282    /// Support: Core for Kubernetes Service
283    ///
284    /// Support: Extended for Kubernetes ServiceImport
285    ///
286    /// Support: Implementation-specific for any other resource
287    ///
288    /// Support for weight: Core
289    #[serde(
290        default,
291        skip_serializing_if = "Option::is_none",
292        rename = "backendRefs"
293    )]
294    pub backend_refs: Option<Vec<HTTPRouteRulesBackendRefs>>,
295    /// Filters define the filters that are applied to requests that match
296    /// this rule.
297    ///
298    /// Wherever possible, implementations SHOULD implement filters in the order
299    /// they are specified.
300    ///
301    /// Implementations MAY choose to implement this ordering strictly, rejecting
302    /// any combination or order of filters that cannot be supported. If implementations
303    /// choose a strict interpretation of filter ordering, they MUST clearly document
304    /// that behavior.
305    ///
306    /// To reject an invalid combination or order of filters, implementations SHOULD
307    /// consider the Route Rules with this configuration invalid. If all Route Rules
308    /// in a Route are invalid, the entire Route would be considered invalid. If only
309    /// a portion of Route Rules are invalid, implementations MUST set the
310    /// "PartiallyInvalid" condition for the Route.
311    ///
312    /// Conformance-levels at this level are defined based on the type of filter:
313    ///
314    /// - ALL core filters MUST be supported by all implementations.
315    /// - Implementers are encouraged to support extended filters.
316    /// - Implementation-specific custom filters have no API guarantees across
317    ///   implementations.
318    ///
319    /// Specifying the same filter multiple times is not supported unless explicitly
320    /// indicated in the filter.
321    ///
322    /// All filters are expected to be compatible with each other except for the
323    /// URLRewrite and RequestRedirect filters, which may not be combined. If an
324    /// implementation cannot support other combinations of filters, they must clearly
325    /// document that limitation. In cases where incompatible or unsupported
326    /// filters are specified and cause the `Accepted` condition to be set to status
327    /// `False`, implementations may use the `IncompatibleFilters` reason to specify
328    /// this configuration error.
329    ///
330    /// Support: Core
331    #[serde(default, skip_serializing_if = "Option::is_none")]
332    pub filters: Option<Vec<HTTPRouteRulesFilters>>,
333    /// Matches define conditions used for matching the rule against incoming
334    /// HTTP requests. Each match is independent, i.e. this rule will be matched
335    /// if **any** one of the matches is satisfied.
336    ///
337    /// For example, take the following matches configuration:
338    ///
339    /// ```text
340    /// matches:
341    /// - path:
342    ///     value: "/foo"
343    ///   headers:
344    ///   - name: "version"
345    ///     value: "v2"
346    /// - path:
347    ///     value: "/v2/foo"
348    /// ```
349    ///
350    /// For a request to match against this rule, a request must satisfy
351    /// EITHER of the two conditions:
352    ///
353    /// - path prefixed with `/foo` AND contains the header `version: v2`
354    /// - path prefix of `/v2/foo`
355    ///
356    /// See the documentation for HTTPRouteMatch on how to specify multiple
357    /// match conditions that should be ANDed together.
358    ///
359    /// If no matches are specified, the default is a prefix
360    /// path match on "/", which has the effect of matching every
361    /// HTTP request.
362    ///
363    /// Proxy or Load Balancer routing configuration generated from HTTPRoutes
364    /// MUST prioritize matches based on the following criteria, continuing on
365    /// ties. Across all rules specified on applicable Routes, precedence must be
366    /// given to the match having:
367    ///
368    /// * "Exact" path match.
369    /// * "Prefix" path match with largest number of characters.
370    /// * Method match.
371    /// * Largest number of header matches.
372    /// * Largest number of query param matches.
373    ///
374    /// Note: The precedence of RegularExpression path matches are implementation-specific.
375    ///
376    /// If ties still exist across multiple Routes, matching precedence MUST be
377    /// determined in order of the following criteria, continuing on ties:
378    ///
379    /// * The oldest Route based on creation timestamp.
380    /// * The Route appearing first in alphabetical order by
381    ///   "{namespace}/{name}".
382    ///
383    /// If ties still exist within an HTTPRoute, matching precedence MUST be granted
384    /// to the FIRST matching rule (in list order) with a match meeting the above
385    /// criteria.
386    ///
387    /// When no rules matching a request have been successfully attached to the
388    /// parent a request is coming from, a HTTP 404 status code MUST be returned.
389    #[serde(default, skip_serializing_if = "Option::is_none")]
390    pub matches: Option<Vec<HTTPRouteRulesMatches>>,
391    /// Name is the name of the route rule. This name MUST be unique within a Route if it is set.
392    ///
393    /// Support: Extended
394    #[serde(default, skip_serializing_if = "Option::is_none")]
395    pub name: Option<String>,
396    /// Timeouts defines the timeouts that can be configured for an HTTP request.
397    ///
398    /// Support: Extended
399    #[serde(default, skip_serializing_if = "Option::is_none")]
400    pub timeouts: Option<HTTPRouteRulesTimeouts>,
401}
402
403/// HTTPBackendRef defines how a HTTPRoute forwards a HTTP request.
404///
405/// Note that when a namespace different than the local namespace is specified, a
406/// ReferenceGrant object is required in the referent namespace to allow that
407/// namespace's owner to accept the reference. See the ReferenceGrant
408/// documentation for details.
409#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
410pub struct HTTPRouteRulesBackendRefs {
411    /// Filters defined at this level should be executed if and only if the
412    /// request is being forwarded to the backend defined here.
413    ///
414    /// Support: Implementation-specific (For broader support of filters, use the
415    /// Filters field in HTTPRouteRule.)
416    #[serde(default, skip_serializing_if = "Option::is_none")]
417    pub filters: Option<Vec<HTTPRouteRulesBackendRefsFilters>>,
418    /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
419    /// When unspecified or empty string, core API group is inferred.
420    #[serde(default, skip_serializing_if = "Option::is_none")]
421    pub group: Option<String>,
422    /// Kind is the Kubernetes resource kind of the referent. For example
423    /// "Service".
424    ///
425    /// Defaults to "Service" when not specified.
426    ///
427    /// ExternalName services can refer to CNAME DNS records that may live
428    /// outside of the cluster and as such are difficult to reason about in
429    /// terms of conformance. They also may not be safe to forward to (see
430    /// CVE-2021-25740 for more information). Implementations SHOULD NOT
431    /// support ExternalName Services.
432    ///
433    /// Support: Core (Services with a type other than ExternalName)
434    ///
435    /// Support: Implementation-specific (Services with type ExternalName)
436    #[serde(default, skip_serializing_if = "Option::is_none")]
437    pub kind: Option<String>,
438    /// Name is the name of the referent.
439    pub name: String,
440    /// Namespace is the namespace of the backend. When unspecified, the local
441    /// namespace is inferred.
442    ///
443    /// Note that when a namespace different than the local namespace is specified,
444    /// a ReferenceGrant object is required in the referent namespace to allow that
445    /// namespace's owner to accept the reference. See the ReferenceGrant
446    /// documentation for details.
447    ///
448    /// Support: Core
449    #[serde(default, skip_serializing_if = "Option::is_none")]
450    pub namespace: Option<String>,
451    /// Port specifies the destination port number to use for this resource.
452    /// Port is required when the referent is a Kubernetes Service. In this
453    /// case, the port number is the service port number, not the target port.
454    /// For other resources, destination port might be derived from the referent
455    /// resource or this field.
456    #[serde(default, skip_serializing_if = "Option::is_none")]
457    pub port: Option<i32>,
458    /// Weight specifies the proportion of requests forwarded to the referenced
459    /// backend. This is computed as weight/(sum of all weights in this
460    /// BackendRefs list). For non-zero values, there may be some epsilon from
461    /// the exact proportion defined here depending on the precision an
462    /// implementation supports. Weight is not a percentage and the sum of
463    /// weights does not need to equal 100.
464    ///
465    /// If only one backend is specified and it has a weight greater than 0, 100%
466    /// of the traffic is forwarded to that backend. If weight is set to 0, no
467    /// traffic should be forwarded for this entry. If unspecified, weight
468    /// defaults to 1.
469    ///
470    /// Support for this field varies based on the context where used.
471    #[serde(default, skip_serializing_if = "Option::is_none")]
472    pub weight: Option<i32>,
473}
474
475/// HTTPRouteFilter defines processing steps that must be completed during the
476/// request or response lifecycle. HTTPRouteFilters are meant as an extension
477/// point to express processing that may be done in Gateway implementations. Some
478/// examples include request or response modification, implementing
479/// authentication strategies, rate-limiting, and traffic shaping. API
480/// guarantee/conformance is defined based on the type of the filter.
481#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
482pub struct HTTPRouteRulesBackendRefsFilters {
483    /// ExtensionRef is an optional, implementation-specific extension to the
484    /// "filter" behavior.  For example, resource "myroutefilter" in group
485    /// "networking.example.net"). ExtensionRef MUST NOT be used for core and
486    /// extended filters.
487    ///
488    /// This filter can be used multiple times within the same rule.
489    ///
490    /// Support: Implementation-specific
491    #[serde(
492        default,
493        skip_serializing_if = "Option::is_none",
494        rename = "extensionRef"
495    )]
496    pub extension_ref: Option<HTTPRouteRulesBackendRefsFiltersExtensionRef>,
497    /// RequestHeaderModifier defines a schema for a filter that modifies request
498    /// headers.
499    ///
500    /// Support: Core
501    #[serde(
502        default,
503        skip_serializing_if = "Option::is_none",
504        rename = "requestHeaderModifier"
505    )]
506    pub request_header_modifier: Option<HTTPRouteRulesBackendRefsFiltersRequestHeaderModifier>,
507    /// RequestMirror defines a schema for a filter that mirrors requests.
508    /// Requests are sent to the specified destination, but responses from
509    /// that destination are ignored.
510    ///
511    /// This filter can be used multiple times within the same rule. Note that
512    /// not all implementations will be able to support mirroring to multiple
513    /// backends.
514    ///
515    /// Support: Extended
516    #[serde(
517        default,
518        skip_serializing_if = "Option::is_none",
519        rename = "requestMirror"
520    )]
521    pub request_mirror: Option<HTTPRouteRulesBackendRefsFiltersRequestMirror>,
522    /// RequestRedirect defines a schema for a filter that responds to the
523    /// request with an HTTP redirection.
524    ///
525    /// Support: Core
526    #[serde(
527        default,
528        skip_serializing_if = "Option::is_none",
529        rename = "requestRedirect"
530    )]
531    pub request_redirect: Option<HTTPRouteRulesBackendRefsFiltersRequestRedirect>,
532    /// ResponseHeaderModifier defines a schema for a filter that modifies response
533    /// headers.
534    ///
535    /// Support: Extended
536    #[serde(
537        default,
538        skip_serializing_if = "Option::is_none",
539        rename = "responseHeaderModifier"
540    )]
541    pub response_header_modifier: Option<HTTPRouteRulesBackendRefsFiltersResponseHeaderModifier>,
542    /// Type identifies the type of filter to apply. As with other API fields,
543    /// types are classified into three conformance levels:
544    ///
545    /// - Core: Filter types and their corresponding configuration defined by
546    ///   "Support: Core" in this package, e.g. "RequestHeaderModifier". All
547    ///   implementations must support core filters.
548    ///
549    /// - Extended: Filter types and their corresponding configuration defined by
550    ///   "Support: Extended" in this package, e.g. "RequestMirror". Implementers
551    ///   are encouraged to support extended filters.
552    ///
553    /// - Implementation-specific: Filters that are defined and supported by
554    ///   specific vendors.
555    ///   In the future, filters showing convergence in behavior across multiple
556    ///   implementations will be considered for inclusion in extended or core
557    ///   conformance levels. Filter-specific configuration for such filters
558    ///   is specified using the ExtensionRef field. `Type` should be set to
559    ///   "ExtensionRef" for custom filters.
560    ///
561    /// Implementers are encouraged to define custom implementation types to
562    /// extend the core API with implementation-specific behavior.
563    ///
564    /// If a reference to a custom filter type cannot be resolved, the filter
565    /// MUST NOT be skipped. Instead, requests that would have been processed by
566    /// that filter MUST receive a HTTP error response.
567    ///
568    /// Note that values may be added to this enum, implementations
569    /// must ensure that unknown values will not cause a crash.
570    ///
571    /// Unknown values here must result in the implementation setting the
572    /// Accepted Condition for the Route to `status: False`, with a
573    /// Reason of `UnsupportedValue`.
574    #[serde(rename = "type")]
575    pub r#type: HTTPRouteRulesBackendRefsFiltersType,
576    /// URLRewrite defines a schema for a filter that modifies a request during forwarding.
577    ///
578    /// Support: Extended
579    #[serde(
580        default,
581        skip_serializing_if = "Option::is_none",
582        rename = "urlRewrite"
583    )]
584    pub url_rewrite: Option<HTTPRouteRulesBackendRefsFiltersUrlRewrite>,
585}
586
587/// ExtensionRef is an optional, implementation-specific extension to the
588/// "filter" behavior.  For example, resource "myroutefilter" in group
589/// "networking.example.net"). ExtensionRef MUST NOT be used for core and
590/// extended filters.
591///
592/// This filter can be used multiple times within the same rule.
593///
594/// Support: Implementation-specific
595#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
596pub struct HTTPRouteRulesBackendRefsFiltersExtensionRef {
597    /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
598    /// When unspecified or empty string, core API group is inferred.
599    pub group: String,
600    /// Kind is kind of the referent. For example "HTTPRoute" or "Service".
601    pub kind: String,
602    /// Name is the name of the referent.
603    pub name: String,
604}
605
606/// RequestHeaderModifier defines a schema for a filter that modifies request
607/// headers.
608///
609/// Support: Core
610#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
611pub struct HTTPRouteRulesBackendRefsFiltersRequestHeaderModifier {
612    /// Add adds the given header(s) (name, value) to the request
613    /// before the action. It appends to any existing values associated
614    /// with the header name.
615    ///
616    /// Input:
617    ///   GET /foo HTTP/1.1
618    ///   my-header: foo
619    ///
620    /// Config:
621    ///   add:
622    ///   - name: "my-header"
623    ///     value: "bar,baz"
624    ///
625    /// Output:
626    ///   GET /foo HTTP/1.1
627    ///   my-header: foo,bar,baz
628    #[serde(default, skip_serializing_if = "Option::is_none")]
629    pub add: Option<Vec<HTTPRouteRulesBackendRefsFiltersRequestHeaderModifierAdd>>,
630    /// Remove the given header(s) from the HTTP request before the action. The
631    /// value of Remove is a list of HTTP header names. Note that the header
632    /// names are case-insensitive (see
633    /// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).
634    ///
635    /// Input:
636    ///   GET /foo HTTP/1.1
637    ///   my-header1: foo
638    ///   my-header2: bar
639    ///   my-header3: baz
640    ///
641    /// Config:
642    ///   remove: ["my-header1", "my-header3"]
643    ///
644    /// Output:
645    ///   GET /foo HTTP/1.1
646    ///   my-header2: bar
647    #[serde(default, skip_serializing_if = "Option::is_none")]
648    pub remove: Option<Vec<String>>,
649    /// Set overwrites the request with the given header (name, value)
650    /// before the action.
651    ///
652    /// Input:
653    ///   GET /foo HTTP/1.1
654    ///   my-header: foo
655    ///
656    /// Config:
657    ///   set:
658    ///   - name: "my-header"
659    ///     value: "bar"
660    ///
661    /// Output:
662    ///   GET /foo HTTP/1.1
663    ///   my-header: bar
664    #[serde(default, skip_serializing_if = "Option::is_none")]
665    pub set: Option<Vec<HTTPRouteRulesBackendRefsFiltersRequestHeaderModifierSet>>,
666}
667
668/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
669#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
670pub struct HTTPRouteRulesBackendRefsFiltersRequestHeaderModifierAdd {
671    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
672    /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
673    ///
674    /// If multiple entries specify equivalent header names, the first entry with
675    /// an equivalent name MUST be considered for a match. Subsequent entries
676    /// with an equivalent header name MUST be ignored. Due to the
677    /// case-insensitivity of header names, "foo" and "Foo" are considered
678    /// equivalent.
679    pub name: String,
680    /// Value is the value of HTTP Header to be matched.
681    pub value: String,
682}
683
684/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
685#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
686pub struct HTTPRouteRulesBackendRefsFiltersRequestHeaderModifierSet {
687    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
688    /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
689    ///
690    /// If multiple entries specify equivalent header names, the first entry with
691    /// an equivalent name MUST be considered for a match. Subsequent entries
692    /// with an equivalent header name MUST be ignored. Due to the
693    /// case-insensitivity of header names, "foo" and "Foo" are considered
694    /// equivalent.
695    pub name: String,
696    /// Value is the value of HTTP Header to be matched.
697    pub value: String,
698}
699
700/// RequestMirror defines a schema for a filter that mirrors requests.
701/// Requests are sent to the specified destination, but responses from
702/// that destination are ignored.
703///
704/// This filter can be used multiple times within the same rule. Note that
705/// not all implementations will be able to support mirroring to multiple
706/// backends.
707///
708/// Support: Extended
709#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
710pub struct HTTPRouteRulesBackendRefsFiltersRequestMirror {
711    /// BackendRef references a resource where mirrored requests are sent.
712    ///
713    /// Mirrored requests must be sent only to a single destination endpoint
714    /// within this BackendRef, irrespective of how many endpoints are present
715    /// within this BackendRef.
716    ///
717    /// If the referent cannot be found, this BackendRef is invalid and must be
718    /// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
719    /// condition on the Route status is set to `status: False` and not configure
720    /// this backend in the underlying implementation.
721    ///
722    /// If there is a cross-namespace reference to an *existing* object
723    /// that is not allowed by a ReferenceGrant, the controller must ensure the
724    /// "ResolvedRefs"  condition on the Route is set to `status: False`,
725    /// with the "RefNotPermitted" reason and not configure this backend in the
726    /// underlying implementation.
727    ///
728    /// In either error case, the Message of the `ResolvedRefs` Condition
729    /// should be used to provide more detail about the problem.
730    ///
731    /// Support: Extended for Kubernetes Service
732    ///
733    /// Support: Implementation-specific for any other resource
734    #[serde(rename = "backendRef")]
735    pub backend_ref: HTTPRouteRulesBackendRefsFiltersRequestMirrorBackendRef,
736    /// Fraction represents the fraction of requests that should be
737    /// mirrored to BackendRef.
738    ///
739    /// Only one of Fraction or Percent may be specified. If neither field
740    /// is specified, 100% of requests will be mirrored.
741    #[serde(default, skip_serializing_if = "Option::is_none")]
742    pub fraction: Option<HTTPRouteRulesBackendRefsFiltersRequestMirrorFraction>,
743    /// Percent represents the percentage of requests that should be
744    /// mirrored to BackendRef. Its minimum value is 0 (indicating 0% of
745    /// requests) and its maximum value is 100 (indicating 100% of requests).
746    ///
747    /// Only one of Fraction or Percent may be specified. If neither field
748    /// is specified, 100% of requests will be mirrored.
749    #[serde(default, skip_serializing_if = "Option::is_none")]
750    pub percent: Option<i32>,
751}
752
753/// BackendRef references a resource where mirrored requests are sent.
754///
755/// Mirrored requests must be sent only to a single destination endpoint
756/// within this BackendRef, irrespective of how many endpoints are present
757/// within this BackendRef.
758///
759/// If the referent cannot be found, this BackendRef is invalid and must be
760/// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
761/// condition on the Route status is set to `status: False` and not configure
762/// this backend in the underlying implementation.
763///
764/// If there is a cross-namespace reference to an *existing* object
765/// that is not allowed by a ReferenceGrant, the controller must ensure the
766/// "ResolvedRefs"  condition on the Route is set to `status: False`,
767/// with the "RefNotPermitted" reason and not configure this backend in the
768/// underlying implementation.
769///
770/// In either error case, the Message of the `ResolvedRefs` Condition
771/// should be used to provide more detail about the problem.
772///
773/// Support: Extended for Kubernetes Service
774///
775/// Support: Implementation-specific for any other resource
776#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
777pub struct HTTPRouteRulesBackendRefsFiltersRequestMirrorBackendRef {
778    /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
779    /// When unspecified or empty string, core API group is inferred.
780    #[serde(default, skip_serializing_if = "Option::is_none")]
781    pub group: Option<String>,
782    /// Kind is the Kubernetes resource kind of the referent. For example
783    /// "Service".
784    ///
785    /// Defaults to "Service" when not specified.
786    ///
787    /// ExternalName services can refer to CNAME DNS records that may live
788    /// outside of the cluster and as such are difficult to reason about in
789    /// terms of conformance. They also may not be safe to forward to (see
790    /// CVE-2021-25740 for more information). Implementations SHOULD NOT
791    /// support ExternalName Services.
792    ///
793    /// Support: Core (Services with a type other than ExternalName)
794    ///
795    /// Support: Implementation-specific (Services with type ExternalName)
796    #[serde(default, skip_serializing_if = "Option::is_none")]
797    pub kind: Option<String>,
798    /// Name is the name of the referent.
799    pub name: String,
800    /// Namespace is the namespace of the backend. When unspecified, the local
801    /// namespace is inferred.
802    ///
803    /// Note that when a namespace different than the local namespace is specified,
804    /// a ReferenceGrant object is required in the referent namespace to allow that
805    /// namespace's owner to accept the reference. See the ReferenceGrant
806    /// documentation for details.
807    ///
808    /// Support: Core
809    #[serde(default, skip_serializing_if = "Option::is_none")]
810    pub namespace: Option<String>,
811    /// Port specifies the destination port number to use for this resource.
812    /// Port is required when the referent is a Kubernetes Service. In this
813    /// case, the port number is the service port number, not the target port.
814    /// For other resources, destination port might be derived from the referent
815    /// resource or this field.
816    #[serde(default, skip_serializing_if = "Option::is_none")]
817    pub port: Option<i32>,
818}
819
820/// Fraction represents the fraction of requests that should be
821/// mirrored to BackendRef.
822///
823/// Only one of Fraction or Percent may be specified. If neither field
824/// is specified, 100% of requests will be mirrored.
825#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
826pub struct HTTPRouteRulesBackendRefsFiltersRequestMirrorFraction {
827    #[serde(default, skip_serializing_if = "Option::is_none")]
828    pub denominator: Option<i32>,
829    pub numerator: i32,
830}
831
832/// RequestRedirect defines a schema for a filter that responds to the
833/// request with an HTTP redirection.
834///
835/// Support: Core
836#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
837pub struct HTTPRouteRulesBackendRefsFiltersRequestRedirect {
838    /// Hostname is the hostname to be used in the value of the `Location`
839    /// header in the response.
840    /// When empty, the hostname in the `Host` header of the request is used.
841    ///
842    /// Support: Core
843    #[serde(default, skip_serializing_if = "Option::is_none")]
844    pub hostname: Option<String>,
845    /// Path defines parameters used to modify the path of the incoming request.
846    /// The modified path is then used to construct the `Location` header. When
847    /// empty, the request path is used as-is.
848    ///
849    /// Support: Extended
850    #[serde(default, skip_serializing_if = "Option::is_none")]
851    pub path: Option<HTTPRouteRulesBackendRefsFiltersRequestRedirectPath>,
852    /// Port is the port to be used in the value of the `Location`
853    /// header in the response.
854    ///
855    /// If no port is specified, the redirect port MUST be derived using the
856    /// following rules:
857    ///
858    /// * If redirect scheme is not-empty, the redirect port MUST be the well-known
859    ///   port associated with the redirect scheme. Specifically "http" to port 80
860    ///   and "https" to port 443. If the redirect scheme does not have a
861    ///   well-known port, the listener port of the Gateway SHOULD be used.
862    /// * If redirect scheme is empty, the redirect port MUST be the Gateway
863    ///   Listener port.
864    ///
865    /// Implementations SHOULD NOT add the port number in the 'Location'
866    /// header in the following cases:
867    ///
868    /// * A Location header that will use HTTP (whether that is determined via
869    ///   the Listener protocol or the Scheme field) _and_ use port 80.
870    /// * A Location header that will use HTTPS (whether that is determined via
871    ///   the Listener protocol or the Scheme field) _and_ use port 443.
872    ///
873    /// Support: Extended
874    #[serde(default, skip_serializing_if = "Option::is_none")]
875    pub port: Option<i32>,
876    /// Scheme is the scheme to be used in the value of the `Location` header in
877    /// the response. When empty, the scheme of the request is used.
878    ///
879    /// Scheme redirects can affect the port of the redirect, for more information,
880    /// refer to the documentation for the port field of this filter.
881    ///
882    /// Note that values may be added to this enum, implementations
883    /// must ensure that unknown values will not cause a crash.
884    ///
885    /// Unknown values here must result in the implementation setting the
886    /// Accepted Condition for the Route to `status: False`, with a
887    /// Reason of `UnsupportedValue`.
888    ///
889    /// Support: Extended
890    #[serde(default, skip_serializing_if = "Option::is_none")]
891    pub scheme: Option<HTTPRouteRulesBackendRefsFiltersRequestRedirectScheme>,
892    /// StatusCode is the HTTP status code to be used in response.
893    ///
894    /// Note that values may be added to this enum, implementations
895    /// must ensure that unknown values will not cause a crash.
896    ///
897    /// Unknown values here must result in the implementation setting the
898    /// Accepted Condition for the Route to `status: False`, with a
899    /// Reason of `UnsupportedValue`.
900    ///
901    /// Support: Core
902    #[serde(
903        default,
904        skip_serializing_if = "Option::is_none",
905        rename = "statusCode"
906    )]
907    pub status_code: Option<i64>,
908}
909
910/// Path defines parameters used to modify the path of the incoming request.
911/// The modified path is then used to construct the `Location` header. When
912/// empty, the request path is used as-is.
913///
914/// Support: Extended
915#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
916pub struct HTTPRouteRulesBackendRefsFiltersRequestRedirectPath {
917    /// ReplaceFullPath specifies the value with which to replace the full path
918    /// of a request during a rewrite or redirect.
919    #[serde(
920        default,
921        skip_serializing_if = "Option::is_none",
922        rename = "replaceFullPath"
923    )]
924    pub replace_full_path: Option<String>,
925    /// ReplacePrefixMatch specifies the value with which to replace the prefix
926    /// match of a request during a rewrite or redirect. For example, a request
927    /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
928    /// of "/xyz" would be modified to "/xyz/bar".
929    ///
930    /// Note that this matches the behavior of the PathPrefix match type. This
931    /// matches full path elements. A path element refers to the list of labels
932    /// in the path split by the `/` separator. When specified, a trailing `/` is
933    /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
934    /// match the prefix `/abc`, but the path `/abcd` would not.
935    ///
936    /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
937    /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
938    /// the implementation setting the Accepted Condition for the Route to `status: False`.
939    ///
940    /// Request Path | Prefix Match | Replace Prefix | Modified Path
941    #[serde(
942        default,
943        skip_serializing_if = "Option::is_none",
944        rename = "replacePrefixMatch"
945    )]
946    pub replace_prefix_match: Option<String>,
947    /// Type defines the type of path modifier. Additional types may be
948    /// added in a future release of the API.
949    ///
950    /// Note that values may be added to this enum, implementations
951    /// must ensure that unknown values will not cause a crash.
952    ///
953    /// Unknown values here must result in the implementation setting the
954    /// Accepted Condition for the Route to `status: False`, with a
955    /// Reason of `UnsupportedValue`.
956    #[serde(rename = "type")]
957    pub r#type: HTTPRouteRulesBackendRefsFiltersRequestRedirectPathType,
958}
959
960/// Path defines parameters used to modify the path of the incoming request.
961/// The modified path is then used to construct the `Location` header. When
962/// empty, the request path is used as-is.
963///
964/// Support: Extended
965#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
966pub enum HTTPRouteRulesBackendRefsFiltersRequestRedirectPathType {
967    ReplaceFullPath,
968    ReplacePrefixMatch,
969}
970
971/// RequestRedirect defines a schema for a filter that responds to the
972/// request with an HTTP redirection.
973///
974/// Support: Core
975#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
976pub enum HTTPRouteRulesBackendRefsFiltersRequestRedirectScheme {
977    #[serde(rename = "http")]
978    Http,
979    #[serde(rename = "https")]
980    Https,
981}
982
983/// RequestRedirect defines a schema for a filter that responds to the
984/// request with an HTTP redirection.
985///
986/// Support: Core
987#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
988pub enum HTTPRouteRulesBackendRefsFiltersRequestRedirectStatusCode {
989    #[serde(rename = "301")]
990    r#_301,
991    #[serde(rename = "302")]
992    r#_302,
993}
994
995/// ResponseHeaderModifier defines a schema for a filter that modifies response
996/// headers.
997///
998/// Support: Extended
999#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1000pub struct HTTPRouteRulesBackendRefsFiltersResponseHeaderModifier {
1001    /// Add adds the given header(s) (name, value) to the request
1002    /// before the action. It appends to any existing values associated
1003    /// with the header name.
1004    ///
1005    /// Input:
1006    ///   GET /foo HTTP/1.1
1007    ///   my-header: foo
1008    ///
1009    /// Config:
1010    ///   add:
1011    ///   - name: "my-header"
1012    ///     value: "bar,baz"
1013    ///
1014    /// Output:
1015    ///   GET /foo HTTP/1.1
1016    ///   my-header: foo,bar,baz
1017    #[serde(default, skip_serializing_if = "Option::is_none")]
1018    pub add: Option<Vec<HTTPRouteRulesBackendRefsFiltersResponseHeaderModifierAdd>>,
1019    /// Remove the given header(s) from the HTTP request before the action. The
1020    /// value of Remove is a list of HTTP header names. Note that the header
1021    /// names are case-insensitive (see
1022    /// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).
1023    ///
1024    /// Input:
1025    ///   GET /foo HTTP/1.1
1026    ///   my-header1: foo
1027    ///   my-header2: bar
1028    ///   my-header3: baz
1029    ///
1030    /// Config:
1031    ///   remove: ["my-header1", "my-header3"]
1032    ///
1033    /// Output:
1034    ///   GET /foo HTTP/1.1
1035    ///   my-header2: bar
1036    #[serde(default, skip_serializing_if = "Option::is_none")]
1037    pub remove: Option<Vec<String>>,
1038    /// Set overwrites the request with the given header (name, value)
1039    /// before the action.
1040    ///
1041    /// Input:
1042    ///   GET /foo HTTP/1.1
1043    ///   my-header: foo
1044    ///
1045    /// Config:
1046    ///   set:
1047    ///   - name: "my-header"
1048    ///     value: "bar"
1049    ///
1050    /// Output:
1051    ///   GET /foo HTTP/1.1
1052    ///   my-header: bar
1053    #[serde(default, skip_serializing_if = "Option::is_none")]
1054    pub set: Option<Vec<HTTPRouteRulesBackendRefsFiltersResponseHeaderModifierSet>>,
1055}
1056
1057/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1058#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1059pub struct HTTPRouteRulesBackendRefsFiltersResponseHeaderModifierAdd {
1060    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1061    /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1062    ///
1063    /// If multiple entries specify equivalent header names, the first entry with
1064    /// an equivalent name MUST be considered for a match. Subsequent entries
1065    /// with an equivalent header name MUST be ignored. Due to the
1066    /// case-insensitivity of header names, "foo" and "Foo" are considered
1067    /// equivalent.
1068    pub name: String,
1069    /// Value is the value of HTTP Header to be matched.
1070    pub value: String,
1071}
1072
1073/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1074#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1075pub struct HTTPRouteRulesBackendRefsFiltersResponseHeaderModifierSet {
1076    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1077    /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1078    ///
1079    /// If multiple entries specify equivalent header names, the first entry with
1080    /// an equivalent name MUST be considered for a match. Subsequent entries
1081    /// with an equivalent header name MUST be ignored. Due to the
1082    /// case-insensitivity of header names, "foo" and "Foo" are considered
1083    /// equivalent.
1084    pub name: String,
1085    /// Value is the value of HTTP Header to be matched.
1086    pub value: String,
1087}
1088
1089/// HTTPRouteFilter defines processing steps that must be completed during the
1090/// request or response lifecycle. HTTPRouteFilters are meant as an extension
1091/// point to express processing that may be done in Gateway implementations. Some
1092/// examples include request or response modification, implementing
1093/// authentication strategies, rate-limiting, and traffic shaping. API
1094/// guarantee/conformance is defined based on the type of the filter.
1095#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1096pub enum HTTPRouteRulesBackendRefsFiltersType {
1097    RequestHeaderModifier,
1098    ResponseHeaderModifier,
1099    RequestMirror,
1100    RequestRedirect,
1101    #[serde(rename = "URLRewrite")]
1102    UrlRewrite,
1103    ExtensionRef,
1104}
1105
1106/// URLRewrite defines a schema for a filter that modifies a request during forwarding.
1107///
1108/// Support: Extended
1109#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1110pub struct HTTPRouteRulesBackendRefsFiltersUrlRewrite {
1111    /// Hostname is the value to be used to replace the Host header value during
1112    /// forwarding.
1113    ///
1114    /// Support: Extended
1115    #[serde(default, skip_serializing_if = "Option::is_none")]
1116    pub hostname: Option<String>,
1117    /// Path defines a path rewrite.
1118    ///
1119    /// Support: Extended
1120    #[serde(default, skip_serializing_if = "Option::is_none")]
1121    pub path: Option<HTTPRouteRulesBackendRefsFiltersUrlRewritePath>,
1122}
1123
1124/// Path defines a path rewrite.
1125///
1126/// Support: Extended
1127#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1128pub struct HTTPRouteRulesBackendRefsFiltersUrlRewritePath {
1129    /// ReplaceFullPath specifies the value with which to replace the full path
1130    /// of a request during a rewrite or redirect.
1131    #[serde(
1132        default,
1133        skip_serializing_if = "Option::is_none",
1134        rename = "replaceFullPath"
1135    )]
1136    pub replace_full_path: Option<String>,
1137    /// ReplacePrefixMatch specifies the value with which to replace the prefix
1138    /// match of a request during a rewrite or redirect. For example, a request
1139    /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
1140    /// of "/xyz" would be modified to "/xyz/bar".
1141    ///
1142    /// Note that this matches the behavior of the PathPrefix match type. This
1143    /// matches full path elements. A path element refers to the list of labels
1144    /// in the path split by the `/` separator. When specified, a trailing `/` is
1145    /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
1146    /// match the prefix `/abc`, but the path `/abcd` would not.
1147    ///
1148    /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
1149    /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
1150    /// the implementation setting the Accepted Condition for the Route to `status: False`.
1151    ///
1152    /// Request Path | Prefix Match | Replace Prefix | Modified Path
1153    #[serde(
1154        default,
1155        skip_serializing_if = "Option::is_none",
1156        rename = "replacePrefixMatch"
1157    )]
1158    pub replace_prefix_match: Option<String>,
1159    /// Type defines the type of path modifier. Additional types may be
1160    /// added in a future release of the API.
1161    ///
1162    /// Note that values may be added to this enum, implementations
1163    /// must ensure that unknown values will not cause a crash.
1164    ///
1165    /// Unknown values here must result in the implementation setting the
1166    /// Accepted Condition for the Route to `status: False`, with a
1167    /// Reason of `UnsupportedValue`.
1168    #[serde(rename = "type")]
1169    pub r#type: HTTPRouteRulesBackendRefsFiltersUrlRewritePathType,
1170}
1171
1172/// Path defines a path rewrite.
1173///
1174/// Support: Extended
1175#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1176pub enum HTTPRouteRulesBackendRefsFiltersUrlRewritePathType {
1177    ReplaceFullPath,
1178    ReplacePrefixMatch,
1179}
1180
1181/// HTTPRouteFilter defines processing steps that must be completed during the
1182/// request or response lifecycle. HTTPRouteFilters are meant as an extension
1183/// point to express processing that may be done in Gateway implementations. Some
1184/// examples include request or response modification, implementing
1185/// authentication strategies, rate-limiting, and traffic shaping. API
1186/// guarantee/conformance is defined based on the type of the filter.
1187#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1188pub struct HTTPRouteRulesFilters {
1189    /// ExtensionRef is an optional, implementation-specific extension to the
1190    /// "filter" behavior.  For example, resource "myroutefilter" in group
1191    /// "networking.example.net"). ExtensionRef MUST NOT be used for core and
1192    /// extended filters.
1193    ///
1194    /// This filter can be used multiple times within the same rule.
1195    ///
1196    /// Support: Implementation-specific
1197    #[serde(
1198        default,
1199        skip_serializing_if = "Option::is_none",
1200        rename = "extensionRef"
1201    )]
1202    pub extension_ref: Option<HTTPRouteRulesFiltersExtensionRef>,
1203    /// RequestHeaderModifier defines a schema for a filter that modifies request
1204    /// headers.
1205    ///
1206    /// Support: Core
1207    #[serde(
1208        default,
1209        skip_serializing_if = "Option::is_none",
1210        rename = "requestHeaderModifier"
1211    )]
1212    pub request_header_modifier: Option<HTTPRouteRulesFiltersRequestHeaderModifier>,
1213    /// RequestMirror defines a schema for a filter that mirrors requests.
1214    /// Requests are sent to the specified destination, but responses from
1215    /// that destination are ignored.
1216    ///
1217    /// This filter can be used multiple times within the same rule. Note that
1218    /// not all implementations will be able to support mirroring to multiple
1219    /// backends.
1220    ///
1221    /// Support: Extended
1222    #[serde(
1223        default,
1224        skip_serializing_if = "Option::is_none",
1225        rename = "requestMirror"
1226    )]
1227    pub request_mirror: Option<HTTPRouteRulesFiltersRequestMirror>,
1228    /// RequestRedirect defines a schema for a filter that responds to the
1229    /// request with an HTTP redirection.
1230    ///
1231    /// Support: Core
1232    #[serde(
1233        default,
1234        skip_serializing_if = "Option::is_none",
1235        rename = "requestRedirect"
1236    )]
1237    pub request_redirect: Option<HTTPRouteRulesFiltersRequestRedirect>,
1238    /// ResponseHeaderModifier defines a schema for a filter that modifies response
1239    /// headers.
1240    ///
1241    /// Support: Extended
1242    #[serde(
1243        default,
1244        skip_serializing_if = "Option::is_none",
1245        rename = "responseHeaderModifier"
1246    )]
1247    pub response_header_modifier: Option<HTTPRouteRulesFiltersResponseHeaderModifier>,
1248    /// Type identifies the type of filter to apply. As with other API fields,
1249    /// types are classified into three conformance levels:
1250    ///
1251    /// - Core: Filter types and their corresponding configuration defined by
1252    ///   "Support: Core" in this package, e.g. "RequestHeaderModifier". All
1253    ///   implementations must support core filters.
1254    ///
1255    /// - Extended: Filter types and their corresponding configuration defined by
1256    ///   "Support: Extended" in this package, e.g. "RequestMirror". Implementers
1257    ///   are encouraged to support extended filters.
1258    ///
1259    /// - Implementation-specific: Filters that are defined and supported by
1260    ///   specific vendors.
1261    ///   In the future, filters showing convergence in behavior across multiple
1262    ///   implementations will be considered for inclusion in extended or core
1263    ///   conformance levels. Filter-specific configuration for such filters
1264    ///   is specified using the ExtensionRef field. `Type` should be set to
1265    ///   "ExtensionRef" for custom filters.
1266    ///
1267    /// Implementers are encouraged to define custom implementation types to
1268    /// extend the core API with implementation-specific behavior.
1269    ///
1270    /// If a reference to a custom filter type cannot be resolved, the filter
1271    /// MUST NOT be skipped. Instead, requests that would have been processed by
1272    /// that filter MUST receive a HTTP error response.
1273    ///
1274    /// Note that values may be added to this enum, implementations
1275    /// must ensure that unknown values will not cause a crash.
1276    ///
1277    /// Unknown values here must result in the implementation setting the
1278    /// Accepted Condition for the Route to `status: False`, with a
1279    /// Reason of `UnsupportedValue`.
1280    #[serde(rename = "type")]
1281    pub r#type: HTTPRouteRulesFiltersType,
1282    /// URLRewrite defines a schema for a filter that modifies a request during forwarding.
1283    ///
1284    /// Support: Extended
1285    #[serde(
1286        default,
1287        skip_serializing_if = "Option::is_none",
1288        rename = "urlRewrite"
1289    )]
1290    pub url_rewrite: Option<HTTPRouteRulesFiltersUrlRewrite>,
1291}
1292
1293/// ExtensionRef is an optional, implementation-specific extension to the
1294/// "filter" behavior.  For example, resource "myroutefilter" in group
1295/// "networking.example.net"). ExtensionRef MUST NOT be used for core and
1296/// extended filters.
1297///
1298/// This filter can be used multiple times within the same rule.
1299///
1300/// Support: Implementation-specific
1301#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1302pub struct HTTPRouteRulesFiltersExtensionRef {
1303    /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
1304    /// When unspecified or empty string, core API group is inferred.
1305    pub group: String,
1306    /// Kind is kind of the referent. For example "HTTPRoute" or "Service".
1307    pub kind: String,
1308    /// Name is the name of the referent.
1309    pub name: String,
1310}
1311
1312/// RequestHeaderModifier defines a schema for a filter that modifies request
1313/// headers.
1314///
1315/// Support: Core
1316#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1317pub struct HTTPRouteRulesFiltersRequestHeaderModifier {
1318    /// Add adds the given header(s) (name, value) to the request
1319    /// before the action. It appends to any existing values associated
1320    /// with the header name.
1321    ///
1322    /// Input:
1323    ///   GET /foo HTTP/1.1
1324    ///   my-header: foo
1325    ///
1326    /// Config:
1327    ///   add:
1328    ///   - name: "my-header"
1329    ///     value: "bar,baz"
1330    ///
1331    /// Output:
1332    ///   GET /foo HTTP/1.1
1333    ///   my-header: foo,bar,baz
1334    #[serde(default, skip_serializing_if = "Option::is_none")]
1335    pub add: Option<Vec<HTTPRouteRulesFiltersRequestHeaderModifierAdd>>,
1336    /// Remove the given header(s) from the HTTP request before the action. The
1337    /// value of Remove is a list of HTTP header names. Note that the header
1338    /// names are case-insensitive (see
1339    /// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).
1340    ///
1341    /// Input:
1342    ///   GET /foo HTTP/1.1
1343    ///   my-header1: foo
1344    ///   my-header2: bar
1345    ///   my-header3: baz
1346    ///
1347    /// Config:
1348    ///   remove: ["my-header1", "my-header3"]
1349    ///
1350    /// Output:
1351    ///   GET /foo HTTP/1.1
1352    ///   my-header2: bar
1353    #[serde(default, skip_serializing_if = "Option::is_none")]
1354    pub remove: Option<Vec<String>>,
1355    /// Set overwrites the request with the given header (name, value)
1356    /// before the action.
1357    ///
1358    /// Input:
1359    ///   GET /foo HTTP/1.1
1360    ///   my-header: foo
1361    ///
1362    /// Config:
1363    ///   set:
1364    ///   - name: "my-header"
1365    ///     value: "bar"
1366    ///
1367    /// Output:
1368    ///   GET /foo HTTP/1.1
1369    ///   my-header: bar
1370    #[serde(default, skip_serializing_if = "Option::is_none")]
1371    pub set: Option<Vec<HTTPRouteRulesFiltersRequestHeaderModifierSet>>,
1372}
1373
1374/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1375#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1376pub struct HTTPRouteRulesFiltersRequestHeaderModifierAdd {
1377    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1378    /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1379    ///
1380    /// If multiple entries specify equivalent header names, the first entry with
1381    /// an equivalent name MUST be considered for a match. Subsequent entries
1382    /// with an equivalent header name MUST be ignored. Due to the
1383    /// case-insensitivity of header names, "foo" and "Foo" are considered
1384    /// equivalent.
1385    pub name: String,
1386    /// Value is the value of HTTP Header to be matched.
1387    pub value: String,
1388}
1389
1390/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1391#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1392pub struct HTTPRouteRulesFiltersRequestHeaderModifierSet {
1393    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1394    /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1395    ///
1396    /// If multiple entries specify equivalent header names, the first entry with
1397    /// an equivalent name MUST be considered for a match. Subsequent entries
1398    /// with an equivalent header name MUST be ignored. Due to the
1399    /// case-insensitivity of header names, "foo" and "Foo" are considered
1400    /// equivalent.
1401    pub name: String,
1402    /// Value is the value of HTTP Header to be matched.
1403    pub value: String,
1404}
1405
1406/// RequestMirror defines a schema for a filter that mirrors requests.
1407/// Requests are sent to the specified destination, but responses from
1408/// that destination are ignored.
1409///
1410/// This filter can be used multiple times within the same rule. Note that
1411/// not all implementations will be able to support mirroring to multiple
1412/// backends.
1413///
1414/// Support: Extended
1415#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1416pub struct HTTPRouteRulesFiltersRequestMirror {
1417    /// BackendRef references a resource where mirrored requests are sent.
1418    ///
1419    /// Mirrored requests must be sent only to a single destination endpoint
1420    /// within this BackendRef, irrespective of how many endpoints are present
1421    /// within this BackendRef.
1422    ///
1423    /// If the referent cannot be found, this BackendRef is invalid and must be
1424    /// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
1425    /// condition on the Route status is set to `status: False` and not configure
1426    /// this backend in the underlying implementation.
1427    ///
1428    /// If there is a cross-namespace reference to an *existing* object
1429    /// that is not allowed by a ReferenceGrant, the controller must ensure the
1430    /// "ResolvedRefs"  condition on the Route is set to `status: False`,
1431    /// with the "RefNotPermitted" reason and not configure this backend in the
1432    /// underlying implementation.
1433    ///
1434    /// In either error case, the Message of the `ResolvedRefs` Condition
1435    /// should be used to provide more detail about the problem.
1436    ///
1437    /// Support: Extended for Kubernetes Service
1438    ///
1439    /// Support: Implementation-specific for any other resource
1440    #[serde(rename = "backendRef")]
1441    pub backend_ref: HTTPRouteRulesFiltersRequestMirrorBackendRef,
1442    /// Fraction represents the fraction of requests that should be
1443    /// mirrored to BackendRef.
1444    ///
1445    /// Only one of Fraction or Percent may be specified. If neither field
1446    /// is specified, 100% of requests will be mirrored.
1447    #[serde(default, skip_serializing_if = "Option::is_none")]
1448    pub fraction: Option<HTTPRouteRulesFiltersRequestMirrorFraction>,
1449    /// Percent represents the percentage of requests that should be
1450    /// mirrored to BackendRef. Its minimum value is 0 (indicating 0% of
1451    /// requests) and its maximum value is 100 (indicating 100% of requests).
1452    ///
1453    /// Only one of Fraction or Percent may be specified. If neither field
1454    /// is specified, 100% of requests will be mirrored.
1455    #[serde(default, skip_serializing_if = "Option::is_none")]
1456    pub percent: Option<i32>,
1457}
1458
1459/// BackendRef references a resource where mirrored requests are sent.
1460///
1461/// Mirrored requests must be sent only to a single destination endpoint
1462/// within this BackendRef, irrespective of how many endpoints are present
1463/// within this BackendRef.
1464///
1465/// If the referent cannot be found, this BackendRef is invalid and must be
1466/// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
1467/// condition on the Route status is set to `status: False` and not configure
1468/// this backend in the underlying implementation.
1469///
1470/// If there is a cross-namespace reference to an *existing* object
1471/// that is not allowed by a ReferenceGrant, the controller must ensure the
1472/// "ResolvedRefs"  condition on the Route is set to `status: False`,
1473/// with the "RefNotPermitted" reason and not configure this backend in the
1474/// underlying implementation.
1475///
1476/// In either error case, the Message of the `ResolvedRefs` Condition
1477/// should be used to provide more detail about the problem.
1478///
1479/// Support: Extended for Kubernetes Service
1480///
1481/// Support: Implementation-specific for any other resource
1482#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1483pub struct HTTPRouteRulesFiltersRequestMirrorBackendRef {
1484    /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
1485    /// When unspecified or empty string, core API group is inferred.
1486    #[serde(default, skip_serializing_if = "Option::is_none")]
1487    pub group: Option<String>,
1488    /// Kind is the Kubernetes resource kind of the referent. For example
1489    /// "Service".
1490    ///
1491    /// Defaults to "Service" when not specified.
1492    ///
1493    /// ExternalName services can refer to CNAME DNS records that may live
1494    /// outside of the cluster and as such are difficult to reason about in
1495    /// terms of conformance. They also may not be safe to forward to (see
1496    /// CVE-2021-25740 for more information). Implementations SHOULD NOT
1497    /// support ExternalName Services.
1498    ///
1499    /// Support: Core (Services with a type other than ExternalName)
1500    ///
1501    /// Support: Implementation-specific (Services with type ExternalName)
1502    #[serde(default, skip_serializing_if = "Option::is_none")]
1503    pub kind: Option<String>,
1504    /// Name is the name of the referent.
1505    pub name: String,
1506    /// Namespace is the namespace of the backend. When unspecified, the local
1507    /// namespace is inferred.
1508    ///
1509    /// Note that when a namespace different than the local namespace is specified,
1510    /// a ReferenceGrant object is required in the referent namespace to allow that
1511    /// namespace's owner to accept the reference. See the ReferenceGrant
1512    /// documentation for details.
1513    ///
1514    /// Support: Core
1515    #[serde(default, skip_serializing_if = "Option::is_none")]
1516    pub namespace: Option<String>,
1517    /// Port specifies the destination port number to use for this resource.
1518    /// Port is required when the referent is a Kubernetes Service. In this
1519    /// case, the port number is the service port number, not the target port.
1520    /// For other resources, destination port might be derived from the referent
1521    /// resource or this field.
1522    #[serde(default, skip_serializing_if = "Option::is_none")]
1523    pub port: Option<i32>,
1524}
1525
1526/// Fraction represents the fraction of requests that should be
1527/// mirrored to BackendRef.
1528///
1529/// Only one of Fraction or Percent may be specified. If neither field
1530/// is specified, 100% of requests will be mirrored.
1531#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1532pub struct HTTPRouteRulesFiltersRequestMirrorFraction {
1533    #[serde(default, skip_serializing_if = "Option::is_none")]
1534    pub denominator: Option<i32>,
1535    pub numerator: i32,
1536}
1537
1538/// RequestRedirect defines a schema for a filter that responds to the
1539/// request with an HTTP redirection.
1540///
1541/// Support: Core
1542#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1543pub struct HTTPRouteRulesFiltersRequestRedirect {
1544    /// Hostname is the hostname to be used in the value of the `Location`
1545    /// header in the response.
1546    /// When empty, the hostname in the `Host` header of the request is used.
1547    ///
1548    /// Support: Core
1549    #[serde(default, skip_serializing_if = "Option::is_none")]
1550    pub hostname: Option<String>,
1551    /// Path defines parameters used to modify the path of the incoming request.
1552    /// The modified path is then used to construct the `Location` header. When
1553    /// empty, the request path is used as-is.
1554    ///
1555    /// Support: Extended
1556    #[serde(default, skip_serializing_if = "Option::is_none")]
1557    pub path: Option<HTTPRouteRulesFiltersRequestRedirectPath>,
1558    /// Port is the port to be used in the value of the `Location`
1559    /// header in the response.
1560    ///
1561    /// If no port is specified, the redirect port MUST be derived using the
1562    /// following rules:
1563    ///
1564    /// * If redirect scheme is not-empty, the redirect port MUST be the well-known
1565    ///   port associated with the redirect scheme. Specifically "http" to port 80
1566    ///   and "https" to port 443. If the redirect scheme does not have a
1567    ///   well-known port, the listener port of the Gateway SHOULD be used.
1568    /// * If redirect scheme is empty, the redirect port MUST be the Gateway
1569    ///   Listener port.
1570    ///
1571    /// Implementations SHOULD NOT add the port number in the 'Location'
1572    /// header in the following cases:
1573    ///
1574    /// * A Location header that will use HTTP (whether that is determined via
1575    ///   the Listener protocol or the Scheme field) _and_ use port 80.
1576    /// * A Location header that will use HTTPS (whether that is determined via
1577    ///   the Listener protocol or the Scheme field) _and_ use port 443.
1578    ///
1579    /// Support: Extended
1580    #[serde(default, skip_serializing_if = "Option::is_none")]
1581    pub port: Option<i32>,
1582    /// Scheme is the scheme to be used in the value of the `Location` header in
1583    /// the response. When empty, the scheme of the request is used.
1584    ///
1585    /// Scheme redirects can affect the port of the redirect, for more information,
1586    /// refer to the documentation for the port field of this filter.
1587    ///
1588    /// Note that values may be added to this enum, implementations
1589    /// must ensure that unknown values will not cause a crash.
1590    ///
1591    /// Unknown values here must result in the implementation setting the
1592    /// Accepted Condition for the Route to `status: False`, with a
1593    /// Reason of `UnsupportedValue`.
1594    ///
1595    /// Support: Extended
1596    #[serde(default, skip_serializing_if = "Option::is_none")]
1597    pub scheme: Option<HTTPRouteRulesFiltersRequestRedirectScheme>,
1598    /// StatusCode is the HTTP status code to be used in response.
1599    ///
1600    /// Note that values may be added to this enum, implementations
1601    /// must ensure that unknown values will not cause a crash.
1602    ///
1603    /// Unknown values here must result in the implementation setting the
1604    /// Accepted Condition for the Route to `status: False`, with a
1605    /// Reason of `UnsupportedValue`.
1606    ///
1607    /// Support: Core
1608    #[serde(
1609        default,
1610        skip_serializing_if = "Option::is_none",
1611        rename = "statusCode"
1612    )]
1613    pub status_code: Option<i64>,
1614}
1615
1616/// Path defines parameters used to modify the path of the incoming request.
1617/// The modified path is then used to construct the `Location` header. When
1618/// empty, the request path is used as-is.
1619///
1620/// Support: Extended
1621#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1622pub struct HTTPRouteRulesFiltersRequestRedirectPath {
1623    /// ReplaceFullPath specifies the value with which to replace the full path
1624    /// of a request during a rewrite or redirect.
1625    #[serde(
1626        default,
1627        skip_serializing_if = "Option::is_none",
1628        rename = "replaceFullPath"
1629    )]
1630    pub replace_full_path: Option<String>,
1631    /// ReplacePrefixMatch specifies the value with which to replace the prefix
1632    /// match of a request during a rewrite or redirect. For example, a request
1633    /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
1634    /// of "/xyz" would be modified to "/xyz/bar".
1635    ///
1636    /// Note that this matches the behavior of the PathPrefix match type. This
1637    /// matches full path elements. A path element refers to the list of labels
1638    /// in the path split by the `/` separator. When specified, a trailing `/` is
1639    /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
1640    /// match the prefix `/abc`, but the path `/abcd` would not.
1641    ///
1642    /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
1643    /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
1644    /// the implementation setting the Accepted Condition for the Route to `status: False`.
1645    ///
1646    /// Request Path | Prefix Match | Replace Prefix | Modified Path
1647    #[serde(
1648        default,
1649        skip_serializing_if = "Option::is_none",
1650        rename = "replacePrefixMatch"
1651    )]
1652    pub replace_prefix_match: Option<String>,
1653    /// Type defines the type of path modifier. Additional types may be
1654    /// added in a future release of the API.
1655    ///
1656    /// Note that values may be added to this enum, implementations
1657    /// must ensure that unknown values will not cause a crash.
1658    ///
1659    /// Unknown values here must result in the implementation setting the
1660    /// Accepted Condition for the Route to `status: False`, with a
1661    /// Reason of `UnsupportedValue`.
1662    #[serde(rename = "type")]
1663    pub r#type: HTTPRouteRulesFiltersRequestRedirectPathType,
1664}
1665
1666/// Path defines parameters used to modify the path of the incoming request.
1667/// The modified path is then used to construct the `Location` header. When
1668/// empty, the request path is used as-is.
1669///
1670/// Support: Extended
1671#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1672pub enum HTTPRouteRulesFiltersRequestRedirectPathType {
1673    ReplaceFullPath,
1674    ReplacePrefixMatch,
1675}
1676
1677/// RequestRedirect defines a schema for a filter that responds to the
1678/// request with an HTTP redirection.
1679///
1680/// Support: Core
1681#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1682pub enum HTTPRouteRulesFiltersRequestRedirectScheme {
1683    #[serde(rename = "http")]
1684    Http,
1685    #[serde(rename = "https")]
1686    Https,
1687}
1688
1689/// RequestRedirect defines a schema for a filter that responds to the
1690/// request with an HTTP redirection.
1691///
1692/// Support: Core
1693#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1694pub enum HTTPRouteRulesFiltersRequestRedirectStatusCode {
1695    #[serde(rename = "301")]
1696    r#_301,
1697    #[serde(rename = "302")]
1698    r#_302,
1699}
1700
1701/// ResponseHeaderModifier defines a schema for a filter that modifies response
1702/// headers.
1703///
1704/// Support: Extended
1705#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1706pub struct HTTPRouteRulesFiltersResponseHeaderModifier {
1707    /// Add adds the given header(s) (name, value) to the request
1708    /// before the action. It appends to any existing values associated
1709    /// with the header name.
1710    ///
1711    /// Input:
1712    ///   GET /foo HTTP/1.1
1713    ///   my-header: foo
1714    ///
1715    /// Config:
1716    ///   add:
1717    ///   - name: "my-header"
1718    ///     value: "bar,baz"
1719    ///
1720    /// Output:
1721    ///   GET /foo HTTP/1.1
1722    ///   my-header: foo,bar,baz
1723    #[serde(default, skip_serializing_if = "Option::is_none")]
1724    pub add: Option<Vec<HTTPRouteRulesFiltersResponseHeaderModifierAdd>>,
1725    /// Remove the given header(s) from the HTTP request before the action. The
1726    /// value of Remove is a list of HTTP header names. Note that the header
1727    /// names are case-insensitive (see
1728    /// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).
1729    ///
1730    /// Input:
1731    ///   GET /foo HTTP/1.1
1732    ///   my-header1: foo
1733    ///   my-header2: bar
1734    ///   my-header3: baz
1735    ///
1736    /// Config:
1737    ///   remove: ["my-header1", "my-header3"]
1738    ///
1739    /// Output:
1740    ///   GET /foo HTTP/1.1
1741    ///   my-header2: bar
1742    #[serde(default, skip_serializing_if = "Option::is_none")]
1743    pub remove: Option<Vec<String>>,
1744    /// Set overwrites the request with the given header (name, value)
1745    /// before the action.
1746    ///
1747    /// Input:
1748    ///   GET /foo HTTP/1.1
1749    ///   my-header: foo
1750    ///
1751    /// Config:
1752    ///   set:
1753    ///   - name: "my-header"
1754    ///     value: "bar"
1755    ///
1756    /// Output:
1757    ///   GET /foo HTTP/1.1
1758    ///   my-header: bar
1759    #[serde(default, skip_serializing_if = "Option::is_none")]
1760    pub set: Option<Vec<HTTPRouteRulesFiltersResponseHeaderModifierSet>>,
1761}
1762
1763/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1764#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1765pub struct HTTPRouteRulesFiltersResponseHeaderModifierAdd {
1766    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1767    /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1768    ///
1769    /// If multiple entries specify equivalent header names, the first entry with
1770    /// an equivalent name MUST be considered for a match. Subsequent entries
1771    /// with an equivalent header name MUST be ignored. Due to the
1772    /// case-insensitivity of header names, "foo" and "Foo" are considered
1773    /// equivalent.
1774    pub name: String,
1775    /// Value is the value of HTTP Header to be matched.
1776    pub value: String,
1777}
1778
1779/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1780#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1781pub struct HTTPRouteRulesFiltersResponseHeaderModifierSet {
1782    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1783    /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1784    ///
1785    /// If multiple entries specify equivalent header names, the first entry with
1786    /// an equivalent name MUST be considered for a match. Subsequent entries
1787    /// with an equivalent header name MUST be ignored. Due to the
1788    /// case-insensitivity of header names, "foo" and "Foo" are considered
1789    /// equivalent.
1790    pub name: String,
1791    /// Value is the value of HTTP Header to be matched.
1792    pub value: String,
1793}
1794
1795/// HTTPRouteFilter defines processing steps that must be completed during the
1796/// request or response lifecycle. HTTPRouteFilters are meant as an extension
1797/// point to express processing that may be done in Gateway implementations. Some
1798/// examples include request or response modification, implementing
1799/// authentication strategies, rate-limiting, and traffic shaping. API
1800/// guarantee/conformance is defined based on the type of the filter.
1801#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1802pub enum HTTPRouteRulesFiltersType {
1803    RequestHeaderModifier,
1804    ResponseHeaderModifier,
1805    RequestMirror,
1806    RequestRedirect,
1807    #[serde(rename = "URLRewrite")]
1808    UrlRewrite,
1809    ExtensionRef,
1810}
1811
1812/// URLRewrite defines a schema for a filter that modifies a request during forwarding.
1813///
1814/// Support: Extended
1815#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1816pub struct HTTPRouteRulesFiltersUrlRewrite {
1817    /// Hostname is the value to be used to replace the Host header value during
1818    /// forwarding.
1819    ///
1820    /// Support: Extended
1821    #[serde(default, skip_serializing_if = "Option::is_none")]
1822    pub hostname: Option<String>,
1823    /// Path defines a path rewrite.
1824    ///
1825    /// Support: Extended
1826    #[serde(default, skip_serializing_if = "Option::is_none")]
1827    pub path: Option<HTTPRouteRulesFiltersUrlRewritePath>,
1828}
1829
1830/// Path defines a path rewrite.
1831///
1832/// Support: Extended
1833#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1834pub struct HTTPRouteRulesFiltersUrlRewritePath {
1835    /// ReplaceFullPath specifies the value with which to replace the full path
1836    /// of a request during a rewrite or redirect.
1837    #[serde(
1838        default,
1839        skip_serializing_if = "Option::is_none",
1840        rename = "replaceFullPath"
1841    )]
1842    pub replace_full_path: Option<String>,
1843    /// ReplacePrefixMatch specifies the value with which to replace the prefix
1844    /// match of a request during a rewrite or redirect. For example, a request
1845    /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
1846    /// of "/xyz" would be modified to "/xyz/bar".
1847    ///
1848    /// Note that this matches the behavior of the PathPrefix match type. This
1849    /// matches full path elements. A path element refers to the list of labels
1850    /// in the path split by the `/` separator. When specified, a trailing `/` is
1851    /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
1852    /// match the prefix `/abc`, but the path `/abcd` would not.
1853    ///
1854    /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
1855    /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
1856    /// the implementation setting the Accepted Condition for the Route to `status: False`.
1857    ///
1858    /// Request Path | Prefix Match | Replace Prefix | Modified Path
1859    #[serde(
1860        default,
1861        skip_serializing_if = "Option::is_none",
1862        rename = "replacePrefixMatch"
1863    )]
1864    pub replace_prefix_match: Option<String>,
1865    /// Type defines the type of path modifier. Additional types may be
1866    /// added in a future release of the API.
1867    ///
1868    /// Note that values may be added to this enum, implementations
1869    /// must ensure that unknown values will not cause a crash.
1870    ///
1871    /// Unknown values here must result in the implementation setting the
1872    /// Accepted Condition for the Route to `status: False`, with a
1873    /// Reason of `UnsupportedValue`.
1874    #[serde(rename = "type")]
1875    pub r#type: HTTPRouteRulesFiltersUrlRewritePathType,
1876}
1877
1878/// Path defines a path rewrite.
1879///
1880/// Support: Extended
1881#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1882pub enum HTTPRouteRulesFiltersUrlRewritePathType {
1883    ReplaceFullPath,
1884    ReplacePrefixMatch,
1885}
1886
1887/// HTTPRouteMatch defines the predicate used to match requests to a given
1888/// action. Multiple match types are ANDed together, i.e. the match will
1889/// evaluate to true only if all conditions are satisfied.
1890///
1891/// For example, the match below will match a HTTP request only if its path
1892/// starts with `/foo` AND it contains the `version: v1` header:
1893///
1894/// ```text
1895/// match:
1896///
1897/// 	path:
1898/// 	  value: "/foo"
1899/// 	headers:
1900/// 	- name: "version"
1901/// 	  value "v1"
1902///
1903/// ```
1904#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1905pub struct HTTPRouteRulesMatches {
1906    /// Headers specifies HTTP request header matchers. Multiple match values are
1907    /// ANDed together, meaning, a request must match all the specified headers
1908    /// to select the route.
1909    #[serde(default, skip_serializing_if = "Option::is_none")]
1910    pub headers: Option<Vec<HTTPRouteRulesMatchesHeaders>>,
1911    /// Method specifies HTTP method matcher.
1912    /// When specified, this route will be matched only if the request has the
1913    /// specified method.
1914    ///
1915    /// Support: Extended
1916    #[serde(default, skip_serializing_if = "Option::is_none")]
1917    pub method: Option<HTTPRouteRulesMatchesMethod>,
1918    /// Path specifies a HTTP request path matcher. If this field is not
1919    /// specified, a default prefix match on the "/" path is provided.
1920    #[serde(default, skip_serializing_if = "Option::is_none")]
1921    pub path: Option<HTTPRouteRulesMatchesPath>,
1922    /// QueryParams specifies HTTP query parameter matchers. Multiple match
1923    /// values are ANDed together, meaning, a request must match all the
1924    /// specified query parameters to select the route.
1925    ///
1926    /// Support: Extended
1927    #[serde(
1928        default,
1929        skip_serializing_if = "Option::is_none",
1930        rename = "queryParams"
1931    )]
1932    pub query_params: Option<Vec<HTTPRouteRulesMatchesQueryParams>>,
1933}
1934
1935/// HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request
1936/// headers.
1937#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1938pub struct HTTPRouteRulesMatchesHeaders {
1939    /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1940    /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1941    ///
1942    /// If multiple entries specify equivalent header names, only the first
1943    /// entry with an equivalent name MUST be considered for a match. Subsequent
1944    /// entries with an equivalent header name MUST be ignored. Due to the
1945    /// case-insensitivity of header names, "foo" and "Foo" are considered
1946    /// equivalent.
1947    ///
1948    /// When a header is repeated in an HTTP request, it is
1949    /// implementation-specific behavior as to how this is represented.
1950    /// Generally, proxies should follow the guidance from the RFC:
1951    /// https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.2 regarding
1952    /// processing a repeated header, with special handling for "Set-Cookie".
1953    pub name: String,
1954    /// Type specifies how to match against the value of the header.
1955    ///
1956    /// Support: Core (Exact)
1957    ///
1958    /// Support: Implementation-specific (RegularExpression)
1959    ///
1960    /// Since RegularExpression HeaderMatchType has implementation-specific
1961    /// conformance, implementations can support POSIX, PCRE or any other dialects
1962    /// of regular expressions. Please read the implementation's documentation to
1963    /// determine the supported dialect.
1964    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
1965    pub r#type: Option<HTTPRouteRulesMatchesHeadersType>,
1966    /// Value is the value of HTTP Header to be matched.
1967    pub value: String,
1968}
1969
1970/// HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request
1971/// headers.
1972#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1973pub enum HTTPRouteRulesMatchesHeadersType {
1974    Exact,
1975    RegularExpression,
1976}
1977
1978/// HTTPRouteMatch defines the predicate used to match requests to a given
1979/// action. Multiple match types are ANDed together, i.e. the match will
1980/// evaluate to true only if all conditions are satisfied.
1981///
1982/// For example, the match below will match a HTTP request only if its path
1983/// starts with `/foo` AND it contains the `version: v1` header:
1984///
1985/// ```text
1986/// match:
1987///
1988/// 	path:
1989/// 	  value: "/foo"
1990/// 	headers:
1991/// 	- name: "version"
1992/// 	  value "v1"
1993///
1994/// ```
1995#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1996pub enum HTTPRouteRulesMatchesMethod {
1997    #[serde(rename = "GET")]
1998    Get,
1999    #[serde(rename = "HEAD")]
2000    Head,
2001    #[serde(rename = "POST")]
2002    Post,
2003    #[serde(rename = "PUT")]
2004    Put,
2005    #[serde(rename = "DELETE")]
2006    Delete,
2007    #[serde(rename = "CONNECT")]
2008    Connect,
2009    #[serde(rename = "OPTIONS")]
2010    Options,
2011    #[serde(rename = "TRACE")]
2012    Trace,
2013    #[serde(rename = "PATCH")]
2014    Patch,
2015}
2016
2017/// Path specifies a HTTP request path matcher. If this field is not
2018/// specified, a default prefix match on the "/" path is provided.
2019#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2020pub struct HTTPRouteRulesMatchesPath {
2021    /// Type specifies how to match against the path Value.
2022    ///
2023    /// Support: Core (Exact, PathPrefix)
2024    ///
2025    /// Support: Implementation-specific (RegularExpression)
2026    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
2027    pub r#type: Option<HTTPRouteRulesMatchesPathType>,
2028    /// Value of the HTTP path to match against.
2029    #[serde(default, skip_serializing_if = "Option::is_none")]
2030    pub value: Option<String>,
2031}
2032
2033/// Path specifies a HTTP request path matcher. If this field is not
2034/// specified, a default prefix match on the "/" path is provided.
2035#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2036pub enum HTTPRouteRulesMatchesPathType {
2037    Exact,
2038    PathPrefix,
2039    RegularExpression,
2040}
2041
2042/// HTTPQueryParamMatch describes how to select a HTTP route by matching HTTP
2043/// query parameters.
2044#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2045pub struct HTTPRouteRulesMatchesQueryParams {
2046    /// Name is the name of the HTTP query param to be matched. This must be an
2047    /// exact string match. (See
2048    /// https://tools.ietf.org/html/rfc7230#section-2.7.3).
2049    ///
2050    /// If multiple entries specify equivalent query param names, only the first
2051    /// entry with an equivalent name MUST be considered for a match. Subsequent
2052    /// entries with an equivalent query param name MUST be ignored.
2053    ///
2054    /// If a query param is repeated in an HTTP request, the behavior is
2055    /// purposely left undefined, since different data planes have different
2056    /// capabilities. However, it is *recommended* that implementations should
2057    /// match against the first value of the param if the data plane supports it,
2058    /// as this behavior is expected in other load balancing contexts outside of
2059    /// the Gateway API.
2060    ///
2061    /// Users SHOULD NOT route traffic based on repeated query params to guard
2062    /// themselves against potential differences in the implementations.
2063    pub name: String,
2064    /// Type specifies how to match against the value of the query parameter.
2065    ///
2066    /// Support: Extended (Exact)
2067    ///
2068    /// Support: Implementation-specific (RegularExpression)
2069    ///
2070    /// Since RegularExpression QueryParamMatchType has Implementation-specific
2071    /// conformance, implementations can support POSIX, PCRE or any other
2072    /// dialects of regular expressions. Please read the implementation's
2073    /// documentation to determine the supported dialect.
2074    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
2075    pub r#type: Option<HTTPRouteRulesMatchesQueryParamsType>,
2076    /// Value is the value of HTTP query param to be matched.
2077    pub value: String,
2078}
2079
2080/// HTTPQueryParamMatch describes how to select a HTTP route by matching HTTP
2081/// query parameters.
2082#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2083pub enum HTTPRouteRulesMatchesQueryParamsType {
2084    Exact,
2085    RegularExpression,
2086}
2087
2088/// Timeouts defines the timeouts that can be configured for an HTTP request.
2089///
2090/// Support: Extended
2091#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2092pub struct HTTPRouteRulesTimeouts {
2093    /// BackendRequest specifies a timeout for an individual request from the gateway
2094    /// to a backend. This covers the time from when the request first starts being
2095    /// sent from the gateway to when the full response has been received from the backend.
2096    ///
2097    /// Setting a timeout to the zero duration (e.g. "0s") SHOULD disable the timeout
2098    /// completely. Implementations that cannot completely disable the timeout MUST
2099    /// instead interpret the zero duration as the longest possible value to which
2100    /// the timeout can be set.
2101    ///
2102    /// An entire client HTTP transaction with a gateway, covered by the Request timeout,
2103    /// may result in more than one call from the gateway to the destination backend,
2104    /// for example, if automatic retries are supported.
2105    ///
2106    /// The value of BackendRequest must be a Gateway API Duration string as defined by
2107    /// GEP-2257.  When this field is unspecified, its behavior is implementation-specific;
2108    /// when specified, the value of BackendRequest must be no more than the value of the
2109    /// Request timeout (since the Request timeout encompasses the BackendRequest timeout).
2110    ///
2111    /// Support: Extended
2112    #[serde(
2113        default,
2114        skip_serializing_if = "Option::is_none",
2115        rename = "backendRequest"
2116    )]
2117    pub backend_request: Option<String>,
2118    /// Request specifies the maximum duration for a gateway to respond to an HTTP request.
2119    /// If the gateway has not been able to respond before this deadline is met, the gateway
2120    /// MUST return a timeout error.
2121    ///
2122    /// For example, setting the `rules.timeouts.request` field to the value `10s` in an
2123    /// `HTTPRoute` will cause a timeout if a client request is taking longer than 10 seconds
2124    /// to complete.
2125    ///
2126    /// Setting a timeout to the zero duration (e.g. "0s") SHOULD disable the timeout
2127    /// completely. Implementations that cannot completely disable the timeout MUST
2128    /// instead interpret the zero duration as the longest possible value to which
2129    /// the timeout can be set.
2130    ///
2131    /// This timeout is intended to cover as close to the whole request-response transaction
2132    /// as possible although an implementation MAY choose to start the timeout after the entire
2133    /// request stream has been received instead of immediately after the transaction is
2134    /// initiated by the client.
2135    ///
2136    /// The value of Request is a Gateway API Duration string as defined by GEP-2257. When this
2137    /// field is unspecified, request timeout behavior is implementation-specific.
2138    ///
2139    /// Support: Extended
2140    #[serde(default, skip_serializing_if = "Option::is_none")]
2141    pub request: Option<String>,
2142}
2143
2144/// Status defines the current state of HTTPRoute.
2145#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2146pub struct HTTPRouteStatus {
2147    /// Parents is a list of parent resources (usually Gateways) that are
2148    /// associated with the route, and the status of the route with respect to
2149    /// each parent. When this route attaches to a parent, the controller that
2150    /// manages the parent must add an entry to this list when the controller
2151    /// first sees the route and should update the entry as appropriate when the
2152    /// route or gateway is modified.
2153    ///
2154    /// Note that parent references that cannot be resolved by an implementation
2155    /// of this API will not be added to this list. Implementations of this API
2156    /// can only populate Route status for the Gateways/parent resources they are
2157    /// responsible for.
2158    ///
2159    /// A maximum of 32 Gateways will be represented in this list. An empty list
2160    /// means the route has not been attached to any Gateway.
2161    pub parents: Vec<HTTPRouteStatusParents>,
2162}
2163
2164/// RouteParentStatus describes the status of a route with respect to an
2165/// associated Parent.
2166#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2167pub struct HTTPRouteStatusParents {
2168    /// Conditions describes the status of the route with respect to the Gateway.
2169    /// Note that the route's availability is also subject to the Gateway's own
2170    /// status conditions and listener status.
2171    ///
2172    /// If the Route's ParentRef specifies an existing Gateway that supports
2173    /// Routes of this kind AND that Gateway's controller has sufficient access,
2174    /// then that Gateway's controller MUST set the "Accepted" condition on the
2175    /// Route, to indicate whether the route has been accepted or rejected by the
2176    /// Gateway, and why.
2177    ///
2178    /// A Route MUST be considered "Accepted" if at least one of the Route's
2179    /// rules is implemented by the Gateway.
2180    ///
2181    /// There are a number of cases where the "Accepted" condition may not be set
2182    /// due to lack of controller visibility, that includes when:
2183    ///
2184    /// * The Route refers to a nonexistent parent.
2185    /// * The Route is of a type that the controller does not support.
2186    /// * The Route is in a namespace the controller does not have access to.
2187    pub conditions: Vec<Condition>,
2188    /// ControllerName is a domain/path string that indicates the name of the
2189    /// controller that wrote this status. This corresponds with the
2190    /// controllerName field on GatewayClass.
2191    ///
2192    /// Example: "example.net/gateway-controller".
2193    ///
2194    /// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are
2195    /// valid Kubernetes names
2196    /// (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
2197    ///
2198    /// Controllers MUST populate this field when writing status. Controllers should ensure that
2199    /// entries to status populated with their ControllerName are cleaned up when they are no
2200    /// longer necessary.
2201    #[serde(rename = "controllerName")]
2202    pub controller_name: String,
2203    /// ParentRef corresponds with a ParentRef in the spec that this
2204    /// RouteParentStatus struct describes the status of.
2205    #[serde(rename = "parentRef")]
2206    pub parent_ref: HTTPRouteStatusParentsParentRef,
2207}
2208
2209/// ParentRef corresponds with a ParentRef in the spec that this
2210/// RouteParentStatus struct describes the status of.
2211#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2212pub struct HTTPRouteStatusParentsParentRef {
2213    /// Group is the group of the referent.
2214    /// When unspecified, "gateway.networking.k8s.io" is inferred.
2215    /// To set the core API group (such as for a "Service" kind referent),
2216    /// Group must be explicitly set to "" (empty string).
2217    ///
2218    /// Support: Core
2219    #[serde(default, skip_serializing_if = "Option::is_none")]
2220    pub group: Option<String>,
2221    /// Kind is kind of the referent.
2222    ///
2223    /// There are two kinds of parent resources with "Core" support:
2224    ///
2225    /// * Gateway (Gateway conformance profile)
2226    /// * Service (Mesh conformance profile, ClusterIP Services only)
2227    ///
2228    /// Support for other resources is Implementation-Specific.
2229    #[serde(default, skip_serializing_if = "Option::is_none")]
2230    pub kind: Option<String>,
2231    /// Name is the name of the referent.
2232    ///
2233    /// Support: Core
2234    pub name: String,
2235    /// Namespace is the namespace of the referent. When unspecified, this refers
2236    /// to the local namespace of the Route.
2237    ///
2238    /// Note that there are specific rules for ParentRefs which cross namespace
2239    /// boundaries. Cross-namespace references are only valid if they are explicitly
2240    /// allowed by something in the namespace they are referring to. For example:
2241    /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
2242    /// generic way to enable any other kind of cross-namespace reference.
2243    ///
2244    /// Support: Core
2245    #[serde(default, skip_serializing_if = "Option::is_none")]
2246    pub namespace: Option<String>,
2247    /// Port is the network port this Route targets. It can be interpreted
2248    /// differently based on the type of parent resource.
2249    ///
2250    /// When the parent resource is a Gateway, this targets all listeners
2251    /// listening on the specified port that also support this kind of Route(and
2252    /// select this Route). It's not recommended to set `Port` unless the
2253    /// networking behaviors specified in a Route must apply to a specific port
2254    /// as opposed to a listener(s) whose port(s) may be changed. When both Port
2255    /// and SectionName are specified, the name and port of the selected listener
2256    /// must match both specified values.
2257    ///
2258    /// Implementations MAY choose to support other parent resources.
2259    /// Implementations supporting other types of parent resources MUST clearly
2260    /// document how/if Port is interpreted.
2261    ///
2262    /// For the purpose of status, an attachment is considered successful as
2263    /// long as the parent resource accepts it partially. For example, Gateway
2264    /// listeners can restrict which Routes can attach to them by Route kind,
2265    /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
2266    /// from the referencing Route, the Route MUST be considered successfully
2267    /// attached. If no Gateway listeners accept attachment from this Route,
2268    /// the Route MUST be considered detached from the Gateway.
2269    ///
2270    /// Support: Extended
2271    #[serde(default, skip_serializing_if = "Option::is_none")]
2272    pub port: Option<i32>,
2273    /// SectionName is the name of a section within the target resource. In the
2274    /// following resources, SectionName is interpreted as the following:
2275    ///
2276    /// * Gateway: Listener name. When both Port (experimental) and SectionName
2277    /// are specified, the name and port of the selected listener must match
2278    /// both specified values.
2279    /// * Service: Port name. When both Port (experimental) and SectionName
2280    /// are specified, the name and port of the selected listener must match
2281    /// both specified values.
2282    ///
2283    /// Implementations MAY choose to support attaching Routes to other resources.
2284    /// If that is the case, they MUST clearly document how SectionName is
2285    /// interpreted.
2286    ///
2287    /// When unspecified (empty string), this will reference the entire resource.
2288    /// For the purpose of status, an attachment is considered successful if at
2289    /// least one section in the parent resource accepts it. For example, Gateway
2290    /// listeners can restrict which Routes can attach to them by Route kind,
2291    /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
2292    /// the referencing Route, the Route MUST be considered successfully
2293    /// attached. If no Gateway listeners accept attachment from this Route, the
2294    /// Route MUST be considered detached from the Gateway.
2295    ///
2296    /// Support: Core
2297    #[serde(
2298        default,
2299        skip_serializing_if = "Option::is_none",
2300        rename = "sectionName"
2301    )]
2302    pub section_name: Option<String>,
2303}