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