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.22.5
4
5#[allow(unused_imports)]
6mod prelude {
7 pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
8 pub use kube::CustomResource;
9 pub use schemars::JsonSchema;
10 pub use serde::{Deserialize, Serialize};
11}
12use self::prelude::*;
13
14/// Spec defines the desired state of HTTPRoute.
15#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
16#[kube(
17 group = "gateway.networking.k8s.io",
18 version = "v1",
19 kind = "HTTPRoute",
20 plural = "httproutes"
21)]
22#[kube(namespaced)]
23#[kube(status = "HttpRouteStatus")]
24#[kube(derive = "Default")]
25#[kube(derive = "PartialEq")]
26pub struct HttpRouteSpec {
27 /// Hostnames defines a set of hostnames that should match against the HTTP Host
28 /// header to select a HTTPRoute used to process the request. Implementations
29 /// MUST ignore any port value specified in the HTTP Host header while
30 /// performing a match and (absent of any applicable header modification
31 /// configuration) MUST forward this header unmodified to the backend.
32 ///
33 /// Valid values for Hostnames are determined by RFC 1123 definition of a
34 /// hostname with 2 notable exceptions:
35 ///
36 /// 1. IPs are not allowed.
37 /// 2. A hostname may be prefixed with a wildcard label (`*.`). The wildcard
38 /// label must appear by itself as the first label.
39 ///
40 /// If a hostname is specified by both the Listener and HTTPRoute, there
41 /// must be at least one intersecting hostname for the HTTPRoute to be
42 /// attached to the Listener. For example:
43 ///
44 /// * A Listener with `test.example.com` as the hostname matches HTTPRoutes
45 /// that have either not specified any hostnames, or have specified at
46 /// least one of `test.example.com` or `*.example.com`.
47 /// * A Listener with `*.example.com` as the hostname matches HTTPRoutes
48 /// that have either not specified any hostnames or have specified at least
49 /// one hostname that matches the Listener hostname. For example,
50 /// `*.example.com`, `test.example.com`, and `foo.test.example.com` would
51 /// all match. On the other hand, `example.com` and `test.example.net` would
52 /// not match.
53 ///
54 /// Hostnames that are prefixed with a wildcard label (`*.`) are interpreted
55 /// as a suffix match. That means that a match for `*.example.com` would match
56 /// both `test.example.com`, and `foo.test.example.com`, but not `example.com`.
57 ///
58 /// If both the Listener and HTTPRoute have specified hostnames, any
59 /// HTTPRoute hostnames that do not match the Listener hostname MUST be
60 /// ignored. For example, if a Listener specified `*.example.com`, and the
61 /// HTTPRoute specified `test.example.com` and `test.example.net`,
62 /// `test.example.net` must not be considered for a match.
63 ///
64 /// If both the Listener and HTTPRoute have specified hostnames, and none
65 /// match with the criteria above, then the HTTPRoute is not accepted. The
66 /// implementation must raise an 'Accepted' Condition with a status of
67 /// `False` in the corresponding RouteParentStatus.
68 ///
69 /// In the event that multiple HTTPRoutes specify intersecting hostnames (e.g.
70 /// overlapping wildcard matching and exact matching hostnames), precedence must
71 /// be given to rules from the HTTPRoute with the largest number of:
72 ///
73 /// * Characters in a matching non-wildcard hostname.
74 /// * Characters in a matching hostname.
75 ///
76 /// If ties exist across multiple Routes, the matching precedence rules for
77 /// HTTPRouteMatches takes over.
78 ///
79 /// Support: Core
80 #[serde(default, skip_serializing_if = "Option::is_none")]
81 pub hostnames: Option<Vec<String>>,
82 /// ParentRefs references the resources (usually Gateways) that a Route wants
83 /// to be attached to. Note that the referenced parent resource needs to
84 /// allow this for the attachment to be complete. For Gateways, that means
85 /// the Gateway needs to allow attachment from Routes of this kind and
86 /// namespace. For Services, that means the Service must either be in the same
87 /// namespace for a "producer" route, or the mesh implementation must support
88 /// and allow "consumer" routes for the referenced Service. ReferenceGrant is
89 /// not applicable for governing ParentRefs to Services - it is not possible to
90 /// create a "producer" route for a Service in a different namespace from the
91 /// Route.
92 ///
93 /// There are two kinds of parent resources with "Core" support:
94 ///
95 /// * Gateway (Gateway conformance profile)
96 /// * Service (Mesh conformance profile, ClusterIP Services only)
97 ///
98 /// This API may be extended in the future to support additional kinds of parent
99 /// resources.
100 ///
101 /// ParentRefs must be _distinct_. This means either that:
102 ///
103 /// * They select different objects. If this is the case, then parentRef
104 /// entries are distinct. In terms of fields, this means that the
105 /// multi-part key defined by `group`, `kind`, `namespace`, and `name` must
106 /// be unique across all parentRef entries in the Route.
107 /// * They do not select different objects, but for each optional field used,
108 /// each ParentRef that selects the same object must set the same set of
109 /// optional fields to different values. If one ParentRef sets a
110 /// combination of optional fields, all must set the same combination.
111 ///
112 /// Some examples:
113 ///
114 /// * If one ParentRef sets `sectionName`, all ParentRefs referencing the
115 /// same object must also set `sectionName`.
116 /// * If one ParentRef sets `port`, all ParentRefs referencing the same
117 /// object must also set `port`.
118 /// * If one ParentRef sets `sectionName` and `port`, all ParentRefs
119 /// referencing the same object must also set `sectionName` and `port`.
120 ///
121 /// It is possible to separately reference multiple distinct objects that may
122 /// be collapsed by an implementation. For example, some implementations may
123 /// choose to merge compatible Gateway Listeners together. If that is the
124 /// case, the list of routes attached to those resources should also be
125 /// merged.
126 ///
127 /// Note that for ParentRefs that cross namespace boundaries, there are specific
128 /// rules. Cross-namespace references are only valid if they are explicitly
129 /// allowed by something in the namespace they are referring to. For example,
130 /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
131 /// generic way to enable other kinds of cross-namespace reference.
132 #[serde(default, skip_serializing_if = "Option::is_none", rename = "parentRefs")]
133 pub parent_refs: Option<Vec<HttpRouteParentRefs>>,
134 /// Rules are a list of HTTP matchers, filters and actions.
135 #[serde(default, skip_serializing_if = "Option::is_none")]
136 pub rules: Option<Vec<HttpRouteRules>>,
137}
138
139/// ParentReference identifies an API object (usually a Gateway) that can be considered
140/// a parent of this resource (usually a route). There are two kinds of parent resources
141/// with "Core" support:
142///
143/// * Gateway (Gateway conformance profile)
144/// * Service (Mesh conformance profile, ClusterIP Services only)
145///
146/// This API may be extended in the future to support additional kinds of parent
147/// resources.
148///
149/// The API object must be valid in the cluster; the Group and Kind must
150/// be registered in the cluster for this reference to be valid.
151#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
152pub struct HttpRouteParentRefs {
153 /// Group is the group of the referent.
154 /// When unspecified, "gateway.networking.k8s.io" is inferred.
155 /// To set the core API group (such as for a "Service" kind referent),
156 /// Group must be explicitly set to "" (empty string).
157 ///
158 /// Support: Core
159 #[serde(default, skip_serializing_if = "Option::is_none")]
160 pub group: Option<String>,
161 /// Kind is kind of the referent.
162 ///
163 /// There are two kinds of parent resources with "Core" support:
164 ///
165 /// * Gateway (Gateway conformance profile)
166 /// * Service (Mesh conformance profile, ClusterIP Services only)
167 ///
168 /// Support for other resources is Implementation-Specific.
169 #[serde(default, skip_serializing_if = "Option::is_none")]
170 pub kind: Option<String>,
171 /// Name is the name of the referent.
172 ///
173 /// Support: Core
174 pub name: String,
175 /// Namespace is the namespace of the referent. When unspecified, this refers
176 /// to the local namespace of the Route.
177 ///
178 /// Note that there are specific rules for ParentRefs which cross namespace
179 /// boundaries. Cross-namespace references are only valid if they are explicitly
180 /// allowed by something in the namespace they are referring to. For example:
181 /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
182 /// generic way to enable any other kind of cross-namespace reference.
183 ///
184 /// Support: Core
185 #[serde(default, skip_serializing_if = "Option::is_none")]
186 pub namespace: Option<String>,
187 /// Port is the network port this Route targets. It can be interpreted
188 /// differently based on the type of parent resource.
189 ///
190 /// When the parent resource is a Gateway, this targets all listeners
191 /// listening on the specified port that also support this kind of Route(and
192 /// select this Route). It's not recommended to set `Port` unless the
193 /// networking behaviors specified in a Route must apply to a specific port
194 /// as opposed to a listener(s) whose port(s) may be changed. When both Port
195 /// and SectionName are specified, the name and port of the selected listener
196 /// must match both specified values.
197 ///
198 /// Implementations MAY choose to support other parent resources.
199 /// Implementations supporting other types of parent resources MUST clearly
200 /// document how/if Port is interpreted.
201 ///
202 /// For the purpose of status, an attachment is considered successful as
203 /// long as the parent resource accepts it partially. For example, Gateway
204 /// listeners can restrict which Routes can attach to them by Route kind,
205 /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
206 /// from the referencing Route, the Route MUST be considered successfully
207 /// attached. If no Gateway listeners accept attachment from this Route,
208 /// the Route MUST be considered detached from the Gateway.
209 ///
210 /// Support: Extended
211 #[serde(default, skip_serializing_if = "Option::is_none")]
212 pub port: Option<i32>,
213 /// SectionName is the name of a section within the target resource. In the
214 /// following resources, SectionName is interpreted as the following:
215 ///
216 /// * Gateway: Listener name. When both Port (experimental) and SectionName
217 /// are specified, the name and port of the selected listener must match
218 /// both specified values.
219 /// * Service: Port name. When both Port (experimental) and SectionName
220 /// are specified, the name and port of the selected listener must match
221 /// both specified values.
222 ///
223 /// Implementations MAY choose to support attaching Routes to other resources.
224 /// If that is the case, they MUST clearly document how SectionName is
225 /// interpreted.
226 ///
227 /// When unspecified (empty string), this will reference the entire resource.
228 /// For the purpose of status, an attachment is considered successful if at
229 /// least one section in the parent resource accepts it. For example, Gateway
230 /// listeners can restrict which Routes can attach to them by Route kind,
231 /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
232 /// the referencing Route, the Route MUST be considered successfully
233 /// attached. If no Gateway listeners accept attachment from this Route, the
234 /// Route MUST be considered detached from the Gateway.
235 ///
236 /// Support: Core
237 #[serde(default, skip_serializing_if = "Option::is_none", rename = "sectionName")]
238 pub section_name: Option<String>,
239}
240
241/// HTTPRouteRule defines semantics for matching an HTTP request based on
242/// conditions (matches), processing it (filters), and forwarding the request to
243/// an API object (backendRefs).
244#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
245pub struct HttpRouteRules {
246 /// BackendRefs defines the backend(s) where matching requests should be
247 /// sent.
248 ///
249 /// Failure behavior here depends on how many BackendRefs are specified and
250 /// how many are invalid.
251 ///
252 /// If *all* entries in BackendRefs are invalid, and there are also no filters
253 /// specified in this route rule, *all* traffic which matches this rule MUST
254 /// receive a 500 status code.
255 ///
256 /// See the HTTPBackendRef definition for the rules about what makes a single
257 /// HTTPBackendRef invalid.
258 ///
259 /// When a HTTPBackendRef is invalid, 500 status codes MUST be returned for
260 /// requests that would have otherwise been routed to an invalid backend. If
261 /// multiple backends are specified, and some are invalid, the proportion of
262 /// requests that would otherwise have been routed to an invalid backend
263 /// MUST receive a 500 status code.
264 ///
265 /// For example, if two backends are specified with equal weights, and one is
266 /// invalid, 50 percent of traffic must receive a 500. Implementations may
267 /// choose how that 50 percent is determined.
268 ///
269 /// When a HTTPBackendRef refers to a Service that has no ready endpoints,
270 /// implementations SHOULD return a 503 for requests to that backend instead.
271 /// If an implementation chooses to do this, all of the above rules for 500 responses
272 /// MUST also apply for responses that return a 503.
273 ///
274 /// Support: Core for Kubernetes Service
275 ///
276 /// Support: Extended for Kubernetes ServiceImport
277 ///
278 /// Support: Implementation-specific for any other resource
279 ///
280 /// Support for weight: Core
281 #[serde(default, skip_serializing_if = "Option::is_none", rename = "backendRefs")]
282 pub backend_refs: Option<Vec<HttpRouteRulesBackendRefs>>,
283 /// Filters define the filters that are applied to requests that match
284 /// this rule.
285 ///
286 /// Wherever possible, implementations SHOULD implement filters in the order
287 /// they are specified.
288 ///
289 /// Implementations MAY choose to implement this ordering strictly, rejecting
290 /// any combination or order of filters that cannot be supported. If implementations
291 /// choose a strict interpretation of filter ordering, they MUST clearly document
292 /// that behavior.
293 ///
294 /// To reject an invalid combination or order of filters, implementations SHOULD
295 /// consider the Route Rules with this configuration invalid. If all Route Rules
296 /// in a Route are invalid, the entire Route would be considered invalid. If only
297 /// a portion of Route Rules are invalid, implementations MUST set the
298 /// "PartiallyInvalid" condition for the Route.
299 ///
300 /// Conformance-levels at this level are defined based on the type of filter:
301 ///
302 /// - ALL core filters MUST be supported by all implementations.
303 /// - Implementers are encouraged to support extended filters.
304 /// - Implementation-specific custom filters have no API guarantees across
305 /// implementations.
306 ///
307 /// Specifying the same filter multiple times is not supported unless explicitly
308 /// indicated in the filter.
309 ///
310 /// All filters are expected to be compatible with each other except for the
311 /// URLRewrite and RequestRedirect filters, which may not be combined. If an
312 /// implementation cannot support other combinations of filters, they must clearly
313 /// document that limitation. In cases where incompatible or unsupported
314 /// filters are specified and cause the `Accepted` condition to be set to status
315 /// `False`, implementations may use the `IncompatibleFilters` reason to specify
316 /// this configuration error.
317 ///
318 /// Support: Core
319 #[serde(default, skip_serializing_if = "Option::is_none")]
320 pub filters: Option<Vec<HttpRouteRulesFilters>>,
321 /// Matches define conditions used for matching the rule against incoming
322 /// HTTP requests. Each match is independent, i.e. this rule will be matched
323 /// if **any** one of the matches is satisfied.
324 ///
325 /// For example, take the following matches configuration:
326 ///
327 /// ```text
328 /// matches:
329 /// - path:
330 /// value: "/foo"
331 /// headers:
332 /// - name: "version"
333 /// value: "v2"
334 /// - path:
335 /// value: "/v2/foo"
336 /// ```
337 ///
338 /// For a request to match against this rule, a request must satisfy
339 /// EITHER of the two conditions:
340 ///
341 /// - path prefixed with `/foo` AND contains the header `version: v2`
342 /// - path prefix of `/v2/foo`
343 ///
344 /// See the documentation for HTTPRouteMatch on how to specify multiple
345 /// match conditions that should be ANDed together.
346 ///
347 /// If no matches are specified, the default is a prefix
348 /// path match on "/", which has the effect of matching every
349 /// HTTP request.
350 ///
351 /// Proxy or Load Balancer routing configuration generated from HTTPRoutes
352 /// MUST prioritize matches based on the following criteria, continuing on
353 /// ties. Across all rules specified on applicable Routes, precedence must be
354 /// given to the match having:
355 ///
356 /// * "Exact" path match.
357 /// * "Prefix" path match with largest number of characters.
358 /// * Method match.
359 /// * Largest number of header matches.
360 /// * Largest number of query param matches.
361 ///
362 /// Note: The precedence of RegularExpression path matches are implementation-specific.
363 ///
364 /// If ties still exist across multiple Routes, matching precedence MUST be
365 /// determined in order of the following criteria, continuing on ties:
366 ///
367 /// * The oldest Route based on creation timestamp.
368 /// * The Route appearing first in alphabetical order by
369 /// "{namespace}/{name}".
370 ///
371 /// If ties still exist within an HTTPRoute, matching precedence MUST be granted
372 /// to the FIRST matching rule (in list order) with a match meeting the above
373 /// criteria.
374 ///
375 /// When no rules matching a request have been successfully attached to the
376 /// parent a request is coming from, a HTTP 404 status code MUST be returned.
377 #[serde(default, skip_serializing_if = "Option::is_none")]
378 pub matches: Option<Vec<HttpRouteRulesMatches>>,
379 /// Name is the name of the route rule. This name MUST be unique within a Route if it is set.
380 ///
381 /// Support: Extended
382 #[serde(default, skip_serializing_if = "Option::is_none")]
383 pub name: Option<String>,
384 /// Timeouts defines the timeouts that can be configured for an HTTP request.
385 ///
386 /// Support: Extended
387 #[serde(default, skip_serializing_if = "Option::is_none")]
388 pub timeouts: Option<HttpRouteRulesTimeouts>,
389}
390
391/// HTTPBackendRef defines how a HTTPRoute forwards a HTTP request.
392///
393/// Note that when a namespace different than the local namespace is specified, a
394/// ReferenceGrant object is required in the referent namespace to allow that
395/// namespace's owner to accept the reference. See the ReferenceGrant
396/// documentation for details.
397#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
398pub struct HttpRouteRulesBackendRefs {
399 /// Filters defined at this level should be executed if and only if the
400 /// request is being forwarded to the backend defined here.
401 ///
402 /// Support: Implementation-specific (For broader support of filters, use the
403 /// Filters field in HTTPRouteRule.)
404 #[serde(default, skip_serializing_if = "Option::is_none")]
405 pub filters: Option<Vec<HttpRouteRulesBackendRefsFilters>>,
406 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
407 /// When unspecified or empty string, core API group is inferred.
408 #[serde(default, skip_serializing_if = "Option::is_none")]
409 pub group: Option<String>,
410 /// Kind is the Kubernetes resource kind of the referent. For example
411 /// "Service".
412 ///
413 /// Defaults to "Service" when not specified.
414 ///
415 /// ExternalName services can refer to CNAME DNS records that may live
416 /// outside of the cluster and as such are difficult to reason about in
417 /// terms of conformance. They also may not be safe to forward to (see
418 /// CVE-2021-25740 for more information). Implementations SHOULD NOT
419 /// support ExternalName Services.
420 ///
421 /// Support: Core (Services with a type other than ExternalName)
422 ///
423 /// Support: Implementation-specific (Services with type ExternalName)
424 #[serde(default, skip_serializing_if = "Option::is_none")]
425 pub kind: Option<String>,
426 /// Name is the name of the referent.
427 pub name: String,
428 /// Namespace is the namespace of the backend. When unspecified, the local
429 /// namespace is inferred.
430 ///
431 /// Note that when a namespace different than the local namespace is specified,
432 /// a ReferenceGrant object is required in the referent namespace to allow that
433 /// namespace's owner to accept the reference. See the ReferenceGrant
434 /// documentation for details.
435 ///
436 /// Support: Core
437 #[serde(default, skip_serializing_if = "Option::is_none")]
438 pub namespace: Option<String>,
439 /// Port specifies the destination port number to use for this resource.
440 /// Port is required when the referent is a Kubernetes Service. In this
441 /// case, the port number is the service port number, not the target port.
442 /// For other resources, destination port might be derived from the referent
443 /// resource or this field.
444 #[serde(default, skip_serializing_if = "Option::is_none")]
445 pub port: Option<i32>,
446 /// Weight specifies the proportion of requests forwarded to the referenced
447 /// backend. This is computed as weight/(sum of all weights in this
448 /// BackendRefs list). For non-zero values, there may be some epsilon from
449 /// the exact proportion defined here depending on the precision an
450 /// implementation supports. Weight is not a percentage and the sum of
451 /// weights does not need to equal 100.
452 ///
453 /// If only one backend is specified and it has a weight greater than 0, 100%
454 /// of the traffic is forwarded to that backend. If weight is set to 0, no
455 /// traffic should be forwarded for this entry. If unspecified, weight
456 /// defaults to 1.
457 ///
458 /// Support for this field varies based on the context where used.
459 #[serde(default, skip_serializing_if = "Option::is_none")]
460 pub weight: Option<i32>,
461}
462
463/// HTTPRouteFilter defines processing steps that must be completed during the
464/// request or response lifecycle. HTTPRouteFilters are meant as an extension
465/// point to express processing that may be done in Gateway implementations. Some
466/// examples include request or response modification, implementing
467/// authentication strategies, rate-limiting, and traffic shaping. API
468/// guarantee/conformance is defined based on the type of the filter.
469#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
470pub struct HttpRouteRulesBackendRefsFilters {
471 /// CORS defines a schema for a filter that responds to the
472 /// cross-origin request based on HTTP response header.
473 ///
474 /// Support: Extended
475 #[serde(default, skip_serializing_if = "Option::is_none")]
476 pub cors: Option<HttpRouteRulesBackendRefsFiltersCors>,
477 /// ExtensionRef is an optional, implementation-specific extension to the
478 /// "filter" behavior. For example, resource "myroutefilter" in group
479 /// "networking.example.net"). ExtensionRef MUST NOT be used for core and
480 /// extended filters.
481 ///
482 /// This filter can be used multiple times within the same rule.
483 ///
484 /// Support: Implementation-specific
485 #[serde(default, skip_serializing_if = "Option::is_none", rename = "extensionRef")]
486 pub extension_ref: Option<HttpRouteRulesBackendRefsFiltersExtensionRef>,
487 /// RequestHeaderModifier defines a schema for a filter that modifies request
488 /// headers.
489 ///
490 /// Support: Core
491 #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestHeaderModifier")]
492 pub request_header_modifier: Option<HttpRouteRulesBackendRefsFiltersRequestHeaderModifier>,
493 /// RequestMirror defines a schema for a filter that mirrors requests.
494 /// Requests are sent to the specified destination, but responses from
495 /// that destination are ignored.
496 ///
497 /// This filter can be used multiple times within the same rule. Note that
498 /// not all implementations will be able to support mirroring to multiple
499 /// backends.
500 ///
501 /// Support: Extended
502 #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestMirror")]
503 pub request_mirror: Option<HttpRouteRulesBackendRefsFiltersRequestMirror>,
504 /// RequestRedirect defines a schema for a filter that responds to the
505 /// request with an HTTP redirection.
506 ///
507 /// Support: Core
508 #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestRedirect")]
509 pub request_redirect: Option<HttpRouteRulesBackendRefsFiltersRequestRedirect>,
510 /// ResponseHeaderModifier defines a schema for a filter that modifies response
511 /// headers.
512 ///
513 /// Support: Extended
514 #[serde(default, skip_serializing_if = "Option::is_none", rename = "responseHeaderModifier")]
515 pub response_header_modifier: Option<HttpRouteRulesBackendRefsFiltersResponseHeaderModifier>,
516 /// Type identifies the type of filter to apply. As with other API fields,
517 /// types are classified into three conformance levels:
518 ///
519 /// - Core: Filter types and their corresponding configuration defined by
520 /// "Support: Core" in this package, e.g. "RequestHeaderModifier". All
521 /// implementations must support core filters.
522 ///
523 /// - Extended: Filter types and their corresponding configuration defined by
524 /// "Support: Extended" in this package, e.g. "RequestMirror". Implementers
525 /// are encouraged to support extended filters.
526 ///
527 /// - Implementation-specific: Filters that are defined and supported by
528 /// specific vendors.
529 /// In the future, filters showing convergence in behavior across multiple
530 /// implementations will be considered for inclusion in extended or core
531 /// conformance levels. Filter-specific configuration for such filters
532 /// is specified using the ExtensionRef field. `Type` should be set to
533 /// "ExtensionRef" for custom filters.
534 ///
535 /// Implementers are encouraged to define custom implementation types to
536 /// extend the core API with implementation-specific behavior.
537 ///
538 /// If a reference to a custom filter type cannot be resolved, the filter
539 /// MUST NOT be skipped. Instead, requests that would have been processed by
540 /// that filter MUST receive a HTTP error response.
541 ///
542 /// Note that values may be added to this enum, implementations
543 /// must ensure that unknown values will not cause a crash.
544 ///
545 /// Unknown values here must result in the implementation setting the
546 /// Accepted Condition for the Route to `status: False`, with a
547 /// Reason of `UnsupportedValue`.
548 #[serde(rename = "type")]
549 pub r#type: HttpRouteRulesBackendRefsFiltersType,
550 /// URLRewrite defines a schema for a filter that modifies a request during forwarding.
551 ///
552 /// Support: Extended
553 #[serde(default, skip_serializing_if = "Option::is_none", rename = "urlRewrite")]
554 pub url_rewrite: Option<HttpRouteRulesBackendRefsFiltersUrlRewrite>,
555}
556
557/// CORS defines a schema for a filter that responds to the
558/// cross-origin request based on HTTP response header.
559///
560/// Support: Extended
561#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
562pub struct HttpRouteRulesBackendRefsFiltersCors {
563 /// AllowCredentials indicates whether the actual cross-origin request allows
564 /// to include credentials.
565 ///
566 /// When set to true, the gateway will include the `Access-Control-Allow-Credentials`
567 /// response header with value true (case-sensitive).
568 ///
569 /// When set to false or omitted the gateway will omit the header
570 /// `Access-Control-Allow-Credentials` entirely (this is the standard CORS
571 /// behavior).
572 ///
573 /// Support: Extended
574 #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowCredentials")]
575 pub allow_credentials: Option<bool>,
576 /// AllowHeaders indicates which HTTP request headers are supported for
577 /// accessing the requested resource.
578 ///
579 /// Header names are not case-sensitive.
580 ///
581 /// Multiple header names in the value of the `Access-Control-Allow-Headers`
582 /// response header are separated by a comma (",").
583 ///
584 /// When the `AllowHeaders` field is configured with one or more headers, the
585 /// gateway must return the `Access-Control-Allow-Headers` response header
586 /// which value is present in the `AllowHeaders` field.
587 ///
588 /// If any header name in the `Access-Control-Request-Headers` request header
589 /// is not included in the list of header names specified by the response
590 /// header `Access-Control-Allow-Headers`, it will present an error on the
591 /// client side.
592 ///
593 /// If any header name in the `Access-Control-Allow-Headers` response header
594 /// does not recognize by the client, it will also occur an error on the
595 /// client side.
596 ///
597 /// A wildcard indicates that the requests with all HTTP headers are allowed.
598 /// If config contains the wildcard "*" in allowHeaders and the request is
599 /// not credentialed, the `Access-Control-Allow-Headers` response header
600 /// can either use the `*` wildcard or the value of
601 /// Access-Control-Request-Headers from the request.
602 ///
603 /// When the request is credentialed, the gateway must not specify the `*`
604 /// wildcard in the `Access-Control-Allow-Headers` response header. When
605 /// also the `AllowCredentials` field is true and `AllowHeaders` field
606 /// is specified with the `*` wildcard, the gateway must specify one or more
607 /// HTTP headers in the value of the `Access-Control-Allow-Headers` response
608 /// header. The value of the header `Access-Control-Allow-Headers` is same as
609 /// the `Access-Control-Request-Headers` header provided by the client. If
610 /// the header `Access-Control-Request-Headers` is not included in the
611 /// request, the gateway will omit the `Access-Control-Allow-Headers`
612 /// response header, instead of specifying the `*` wildcard.
613 ///
614 /// Support: Extended
615 #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowHeaders")]
616 pub allow_headers: Option<Vec<String>>,
617 /// AllowMethods indicates which HTTP methods are supported for accessing the
618 /// requested resource.
619 ///
620 /// Valid values are any method defined by RFC9110, along with the special
621 /// value `*`, which represents all HTTP methods are allowed.
622 ///
623 /// Method names are case-sensitive, so these values are also case-sensitive.
624 /// (See <https://www.rfc-editor.org/rfc/rfc2616#section-5.1.1)>
625 ///
626 /// Multiple method names in the value of the `Access-Control-Allow-Methods`
627 /// response header are separated by a comma (",").
628 ///
629 /// A CORS-safelisted method is a method that is `GET`, `HEAD`, or `POST`.
630 /// (See <https://fetch.spec.whatwg.org/#cors-safelisted-method)> The
631 /// CORS-safelisted methods are always allowed, regardless of whether they
632 /// are specified in the `AllowMethods` field.
633 ///
634 /// When the `AllowMethods` field is configured with one or more methods, the
635 /// gateway must return the `Access-Control-Allow-Methods` response header
636 /// which value is present in the `AllowMethods` field.
637 ///
638 /// If the HTTP method of the `Access-Control-Request-Method` request header
639 /// is not included in the list of methods specified by the response header
640 /// `Access-Control-Allow-Methods`, it will present an error on the client
641 /// side.
642 ///
643 /// If config contains the wildcard "*" in allowMethods and the request is
644 /// not credentialed, the `Access-Control-Allow-Methods` response header
645 /// can either use the `*` wildcard or the value of
646 /// Access-Control-Request-Method from the request.
647 ///
648 /// When the request is credentialed, the gateway must not specify the `*`
649 /// wildcard in the `Access-Control-Allow-Methods` response header. When
650 /// also the `AllowCredentials` field is true and `AllowMethods` field
651 /// specified with the `*` wildcard, the gateway must specify one HTTP method
652 /// in the value of the Access-Control-Allow-Methods response header. The
653 /// value of the header `Access-Control-Allow-Methods` is same as the
654 /// `Access-Control-Request-Method` header provided by the client. If the
655 /// header `Access-Control-Request-Method` is not included in the request,
656 /// the gateway will omit the `Access-Control-Allow-Methods` response header,
657 /// instead of specifying the `*` wildcard.
658 ///
659 /// Support: Extended
660 #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowMethods")]
661 pub allow_methods: Option<Vec<String>>,
662 /// AllowOrigins indicates whether the response can be shared with requested
663 /// resource from the given `Origin`.
664 ///
665 /// The `Origin` consists of a scheme and a host, with an optional port, and
666 /// takes the form `<scheme>://<host>(:<port>)`.
667 ///
668 /// Valid values for scheme are: `http` and `https`.
669 ///
670 /// Valid values for port are any integer between 1 and 65535 (the list of
671 /// available TCP/UDP ports). Note that, if not included, port `80` is
672 /// assumed for `http` scheme origins, and port `443` is assumed for `https`
673 /// origins. This may affect origin matching.
674 ///
675 /// The host part of the origin may contain the wildcard character `*`. These
676 /// wildcard characters behave as follows:
677 ///
678 /// * `*` is a greedy match to the _left_, including any number of
679 /// DNS labels to the left of its position. This also means that
680 /// `*` will include any number of period `.` characters to the
681 /// left of its position.
682 /// * A wildcard by itself matches all hosts.
683 ///
684 /// An origin value that includes _only_ the `*` character indicates requests
685 /// from all `Origin`s are allowed.
686 ///
687 /// When the `AllowOrigins` field is configured with multiple origins, it
688 /// means the server supports clients from multiple origins. If the request
689 /// `Origin` matches the configured allowed origins, the gateway must return
690 /// the given `Origin` and sets value of the header
691 /// `Access-Control-Allow-Origin` same as the `Origin` header provided by the
692 /// client.
693 ///
694 /// The status code of a successful response to a "preflight" request is
695 /// always an OK status (i.e., 204 or 200).
696 ///
697 /// If the request `Origin` does not match the configured allowed origins,
698 /// the gateway returns 204/200 response but doesn't set the relevant
699 /// cross-origin response headers. Alternatively, the gateway responds with
700 /// 403 status to the "preflight" request is denied, coupled with omitting
701 /// the CORS headers. The cross-origin request fails on the client side.
702 /// Therefore, the client doesn't attempt the actual cross-origin request.
703 ///
704 /// Conversely, if the request `Origin` matches one of the configured
705 /// allowed origins, the gateway sets the response header
706 /// `Access-Control-Allow-Origin` to the same value as the `Origin`
707 /// header provided by the client.
708 ///
709 /// When config has the wildcard ("*") in allowOrigins, and the request
710 /// is not credentialed (e.g., it is a preflight request), the
711 /// `Access-Control-Allow-Origin` response header either contains the
712 /// wildcard as well or the Origin from the request.
713 ///
714 /// When the request is credentialed, the gateway must not specify the `*`
715 /// wildcard in the `Access-Control-Allow-Origin` response header. When
716 /// also the `AllowCredentials` field is true and `AllowOrigins` field
717 /// specified with the `*` wildcard, the gateway must return a single origin
718 /// in the value of the `Access-Control-Allow-Origin` response header,
719 /// instead of specifying the `*` wildcard. The value of the header
720 /// `Access-Control-Allow-Origin` is same as the `Origin` header provided by
721 /// the client.
722 ///
723 /// Support: Extended
724 #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowOrigins")]
725 pub allow_origins: Option<Vec<String>>,
726 /// ExposeHeaders indicates which HTTP response headers can be exposed
727 /// to client-side scripts in response to a cross-origin request.
728 ///
729 /// A CORS-safelisted response header is an HTTP header in a CORS response
730 /// that it is considered safe to expose to the client scripts.
731 /// The CORS-safelisted response headers include the following headers:
732 /// `Cache-Control`
733 /// `Content-Language`
734 /// `Content-Length`
735 /// `Content-Type`
736 /// `Expires`
737 /// `Last-Modified`
738 /// `Pragma`
739 /// (See <https://fetch.spec.whatwg.org/#cors-safelisted-response-header-name)>
740 /// The CORS-safelisted response headers are exposed to client by default.
741 ///
742 /// When an HTTP header name is specified using the `ExposeHeaders` field,
743 /// this additional header will be exposed as part of the response to the
744 /// client.
745 ///
746 /// Header names are not case-sensitive.
747 ///
748 /// Multiple header names in the value of the `Access-Control-Expose-Headers`
749 /// response header are separated by a comma (",").
750 ///
751 /// A wildcard indicates that the responses with all HTTP headers are exposed
752 /// to clients. The `Access-Control-Expose-Headers` response header can only
753 /// use `*` wildcard as value when the request is not credentialed.
754 ///
755 /// When the `exposeHeaders` config field contains the "*" wildcard and
756 /// the request is credentialed, the gateway cannot use the `*` wildcard in
757 /// the `Access-Control-Expose-Headers` response header.
758 ///
759 /// Support: Extended
760 #[serde(default, skip_serializing_if = "Option::is_none", rename = "exposeHeaders")]
761 pub expose_headers: Option<Vec<String>>,
762 /// MaxAge indicates the duration (in seconds) for the client to cache the
763 /// results of a "preflight" request.
764 ///
765 /// The information provided by the `Access-Control-Allow-Methods` and
766 /// `Access-Control-Allow-Headers` response headers can be cached by the
767 /// client until the time specified by `Access-Control-Max-Age` elapses.
768 ///
769 /// The default value of `Access-Control-Max-Age` response header is 5
770 /// (seconds).
771 ///
772 /// When the `MaxAge` field is unspecified, the gateway sets the response
773 /// header "Access-Control-Max-Age: 5" by default.
774 #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxAge")]
775 pub max_age: Option<i32>,
776}
777
778/// ExtensionRef is an optional, implementation-specific extension to the
779/// "filter" behavior. For example, resource "myroutefilter" in group
780/// "networking.example.net"). ExtensionRef MUST NOT be used for core and
781/// extended filters.
782///
783/// This filter can be used multiple times within the same rule.
784///
785/// Support: Implementation-specific
786#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
787pub struct HttpRouteRulesBackendRefsFiltersExtensionRef {
788 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
789 /// When unspecified or empty string, core API group is inferred.
790 pub group: String,
791 /// Kind is kind of the referent. For example "HTTPRoute" or "Service".
792 pub kind: String,
793 /// Name is the name of the referent.
794 pub name: String,
795}
796
797/// RequestHeaderModifier defines a schema for a filter that modifies request
798/// headers.
799///
800/// Support: Core
801#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
802pub struct HttpRouteRulesBackendRefsFiltersRequestHeaderModifier {
803 /// Add adds the given header(s) (name, value) to the request
804 /// before the action. It appends to any existing values associated
805 /// with the header name.
806 ///
807 /// Input:
808 /// GET /foo HTTP/1.1
809 /// my-header: foo
810 ///
811 /// Config:
812 /// add:
813 /// - name: "my-header"
814 /// value: "bar,baz"
815 ///
816 /// Output:
817 /// GET /foo HTTP/1.1
818 /// my-header: foo,bar,baz
819 #[serde(default, skip_serializing_if = "Option::is_none")]
820 pub add: Option<Vec<HttpRouteRulesBackendRefsFiltersRequestHeaderModifierAdd>>,
821 /// Remove the given header(s) from the HTTP request before the action. The
822 /// value of Remove is a list of HTTP header names. Note that the header
823 /// names are case-insensitive (see
824 /// <https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).>
825 ///
826 /// Input:
827 /// GET /foo HTTP/1.1
828 /// my-header1: foo
829 /// my-header2: bar
830 /// my-header3: baz
831 ///
832 /// Config:
833 /// remove: ["my-header1", "my-header3"]
834 ///
835 /// Output:
836 /// GET /foo HTTP/1.1
837 /// my-header2: bar
838 #[serde(default, skip_serializing_if = "Option::is_none")]
839 pub remove: Option<Vec<String>>,
840 /// Set overwrites the request with the given header (name, value)
841 /// before the action.
842 ///
843 /// Input:
844 /// GET /foo HTTP/1.1
845 /// my-header: foo
846 ///
847 /// Config:
848 /// set:
849 /// - name: "my-header"
850 /// value: "bar"
851 ///
852 /// Output:
853 /// GET /foo HTTP/1.1
854 /// my-header: bar
855 #[serde(default, skip_serializing_if = "Option::is_none")]
856 pub set: Option<Vec<HttpRouteRulesBackendRefsFiltersRequestHeaderModifierSet>>,
857}
858
859/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
860#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
861pub struct HttpRouteRulesBackendRefsFiltersRequestHeaderModifierAdd {
862 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
863 /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
864 ///
865 /// If multiple entries specify equivalent header names, the first entry with
866 /// an equivalent name MUST be considered for a match. Subsequent entries
867 /// with an equivalent header name MUST be ignored. Due to the
868 /// case-insensitivity of header names, "foo" and "Foo" are considered
869 /// equivalent.
870 pub name: String,
871 /// Value is the value of HTTP Header to be matched.
872 pub value: String,
873}
874
875/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
876#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
877pub struct HttpRouteRulesBackendRefsFiltersRequestHeaderModifierSet {
878 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
879 /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
880 ///
881 /// If multiple entries specify equivalent header names, the first entry with
882 /// an equivalent name MUST be considered for a match. Subsequent entries
883 /// with an equivalent header name MUST be ignored. Due to the
884 /// case-insensitivity of header names, "foo" and "Foo" are considered
885 /// equivalent.
886 pub name: String,
887 /// Value is the value of HTTP Header to be matched.
888 pub value: String,
889}
890
891/// RequestMirror defines a schema for a filter that mirrors requests.
892/// Requests are sent to the specified destination, but responses from
893/// that destination are ignored.
894///
895/// This filter can be used multiple times within the same rule. Note that
896/// not all implementations will be able to support mirroring to multiple
897/// backends.
898///
899/// Support: Extended
900#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
901pub struct HttpRouteRulesBackendRefsFiltersRequestMirror {
902 /// BackendRef references a resource where mirrored requests are sent.
903 ///
904 /// Mirrored requests must be sent only to a single destination endpoint
905 /// within this BackendRef, irrespective of how many endpoints are present
906 /// within this BackendRef.
907 ///
908 /// If the referent cannot be found, this BackendRef is invalid and must be
909 /// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
910 /// condition on the Route status is set to `status: False` and not configure
911 /// this backend in the underlying implementation.
912 ///
913 /// If there is a cross-namespace reference to an *existing* object
914 /// that is not allowed by a ReferenceGrant, the controller must ensure the
915 /// "ResolvedRefs" condition on the Route is set to `status: False`,
916 /// with the "RefNotPermitted" reason and not configure this backend in the
917 /// underlying implementation.
918 ///
919 /// In either error case, the Message of the `ResolvedRefs` Condition
920 /// should be used to provide more detail about the problem.
921 ///
922 /// Support: Extended for Kubernetes Service
923 ///
924 /// Support: Implementation-specific for any other resource
925 #[serde(rename = "backendRef")]
926 pub backend_ref: HttpRouteRulesBackendRefsFiltersRequestMirrorBackendRef,
927 /// Fraction represents the fraction of requests that should be
928 /// mirrored to BackendRef.
929 ///
930 /// Only one of Fraction or Percent may be specified. If neither field
931 /// is specified, 100% of requests will be mirrored.
932 #[serde(default, skip_serializing_if = "Option::is_none")]
933 pub fraction: Option<HttpRouteRulesBackendRefsFiltersRequestMirrorFraction>,
934 /// Percent represents the percentage of requests that should be
935 /// mirrored to BackendRef. Its minimum value is 0 (indicating 0% of
936 /// requests) and its maximum value is 100 (indicating 100% of requests).
937 ///
938 /// Only one of Fraction or Percent may be specified. If neither field
939 /// is specified, 100% of requests will be mirrored.
940 #[serde(default, skip_serializing_if = "Option::is_none")]
941 pub percent: Option<i32>,
942}
943
944/// BackendRef references a resource where mirrored requests are sent.
945///
946/// Mirrored requests must be sent only to a single destination endpoint
947/// within this BackendRef, irrespective of how many endpoints are present
948/// within this BackendRef.
949///
950/// If the referent cannot be found, this BackendRef is invalid and must be
951/// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
952/// condition on the Route status is set to `status: False` and not configure
953/// this backend in the underlying implementation.
954///
955/// If there is a cross-namespace reference to an *existing* object
956/// that is not allowed by a ReferenceGrant, the controller must ensure the
957/// "ResolvedRefs" condition on the Route is set to `status: False`,
958/// with the "RefNotPermitted" reason and not configure this backend in the
959/// underlying implementation.
960///
961/// In either error case, the Message of the `ResolvedRefs` Condition
962/// should be used to provide more detail about the problem.
963///
964/// Support: Extended for Kubernetes Service
965///
966/// Support: Implementation-specific for any other resource
967#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
968pub struct HttpRouteRulesBackendRefsFiltersRequestMirrorBackendRef {
969 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
970 /// When unspecified or empty string, core API group is inferred.
971 #[serde(default, skip_serializing_if = "Option::is_none")]
972 pub group: Option<String>,
973 /// Kind is the Kubernetes resource kind of the referent. For example
974 /// "Service".
975 ///
976 /// Defaults to "Service" when not specified.
977 ///
978 /// ExternalName services can refer to CNAME DNS records that may live
979 /// outside of the cluster and as such are difficult to reason about in
980 /// terms of conformance. They also may not be safe to forward to (see
981 /// CVE-2021-25740 for more information). Implementations SHOULD NOT
982 /// support ExternalName Services.
983 ///
984 /// Support: Core (Services with a type other than ExternalName)
985 ///
986 /// Support: Implementation-specific (Services with type ExternalName)
987 #[serde(default, skip_serializing_if = "Option::is_none")]
988 pub kind: Option<String>,
989 /// Name is the name of the referent.
990 pub name: String,
991 /// Namespace is the namespace of the backend. When unspecified, the local
992 /// namespace is inferred.
993 ///
994 /// Note that when a namespace different than the local namespace is specified,
995 /// a ReferenceGrant object is required in the referent namespace to allow that
996 /// namespace's owner to accept the reference. See the ReferenceGrant
997 /// documentation for details.
998 ///
999 /// Support: Core
1000 #[serde(default, skip_serializing_if = "Option::is_none")]
1001 pub namespace: Option<String>,
1002 /// Port specifies the destination port number to use for this resource.
1003 /// Port is required when the referent is a Kubernetes Service. In this
1004 /// case, the port number is the service port number, not the target port.
1005 /// For other resources, destination port might be derived from the referent
1006 /// resource or this field.
1007 #[serde(default, skip_serializing_if = "Option::is_none")]
1008 pub port: Option<i32>,
1009}
1010
1011/// Fraction represents the fraction of requests that should be
1012/// mirrored to BackendRef.
1013///
1014/// Only one of Fraction or Percent may be specified. If neither field
1015/// is specified, 100% of requests will be mirrored.
1016#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1017pub struct HttpRouteRulesBackendRefsFiltersRequestMirrorFraction {
1018 #[serde(default, skip_serializing_if = "Option::is_none")]
1019 pub denominator: Option<i32>,
1020 pub numerator: i32,
1021}
1022
1023/// RequestRedirect defines a schema for a filter that responds to the
1024/// request with an HTTP redirection.
1025///
1026/// Support: Core
1027#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1028pub struct HttpRouteRulesBackendRefsFiltersRequestRedirect {
1029 /// Hostname is the hostname to be used in the value of the `Location`
1030 /// header in the response.
1031 /// When empty, the hostname in the `Host` header of the request is used.
1032 ///
1033 /// Support: Core
1034 #[serde(default, skip_serializing_if = "Option::is_none")]
1035 pub hostname: Option<String>,
1036 /// Path defines parameters used to modify the path of the incoming request.
1037 /// The modified path is then used to construct the `Location` header. When
1038 /// empty, the request path is used as-is.
1039 ///
1040 /// Support: Extended
1041 #[serde(default, skip_serializing_if = "Option::is_none")]
1042 pub path: Option<HttpRouteRulesBackendRefsFiltersRequestRedirectPath>,
1043 /// Port is the port to be used in the value of the `Location`
1044 /// header in the response.
1045 ///
1046 /// If no port is specified, the redirect port MUST be derived using the
1047 /// following rules:
1048 ///
1049 /// * If redirect scheme is not-empty, the redirect port MUST be the well-known
1050 /// port associated with the redirect scheme. Specifically "http" to port 80
1051 /// and "https" to port 443. If the redirect scheme does not have a
1052 /// well-known port, the listener port of the Gateway SHOULD be used.
1053 /// * If redirect scheme is empty, the redirect port MUST be the Gateway
1054 /// Listener port.
1055 ///
1056 /// Implementations SHOULD NOT add the port number in the 'Location'
1057 /// header in the following cases:
1058 ///
1059 /// * A Location header that will use HTTP (whether that is determined via
1060 /// the Listener protocol or the Scheme field) _and_ use port 80.
1061 /// * A Location header that will use HTTPS (whether that is determined via
1062 /// the Listener protocol or the Scheme field) _and_ use port 443.
1063 ///
1064 /// Support: Extended
1065 #[serde(default, skip_serializing_if = "Option::is_none")]
1066 pub port: Option<i32>,
1067 /// Scheme is the scheme to be used in the value of the `Location` header in
1068 /// the response. When empty, the scheme of the request is used.
1069 ///
1070 /// Scheme redirects can affect the port of the redirect, for more information,
1071 /// refer to the documentation for the port field of this filter.
1072 ///
1073 /// Note that values may be added to this enum, implementations
1074 /// must ensure that unknown values will not cause a crash.
1075 ///
1076 /// Unknown values here must result in the implementation setting the
1077 /// Accepted Condition for the Route to `status: False`, with a
1078 /// Reason of `UnsupportedValue`.
1079 ///
1080 /// Support: Extended
1081 #[serde(default, skip_serializing_if = "Option::is_none")]
1082 pub scheme: Option<HttpRouteRulesBackendRefsFiltersRequestRedirectScheme>,
1083 /// StatusCode is the HTTP status code to be used in response.
1084 ///
1085 /// Note that values may be added to this enum, implementations
1086 /// must ensure that unknown values will not cause a crash.
1087 ///
1088 /// Unknown values here must result in the implementation setting the
1089 /// Accepted Condition for the Route to `status: False`, with a
1090 /// Reason of `UnsupportedValue`.
1091 ///
1092 /// Support: Core
1093 #[serde(default, skip_serializing_if = "Option::is_none", rename = "statusCode")]
1094 pub status_code: Option<i64>,
1095}
1096
1097/// Path defines parameters used to modify the path of the incoming request.
1098/// The modified path is then used to construct the `Location` header. When
1099/// empty, the request path is used as-is.
1100///
1101/// Support: Extended
1102#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1103pub struct HttpRouteRulesBackendRefsFiltersRequestRedirectPath {
1104 /// ReplaceFullPath specifies the value with which to replace the full path
1105 /// of a request during a rewrite or redirect.
1106 #[serde(default, skip_serializing_if = "Option::is_none", rename = "replaceFullPath")]
1107 pub replace_full_path: Option<String>,
1108 /// ReplacePrefixMatch specifies the value with which to replace the prefix
1109 /// match of a request during a rewrite or redirect. For example, a request
1110 /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
1111 /// of "/xyz" would be modified to "/xyz/bar".
1112 ///
1113 /// Note that this matches the behavior of the PathPrefix match type. This
1114 /// matches full path elements. A path element refers to the list of labels
1115 /// in the path split by the `/` separator. When specified, a trailing `/` is
1116 /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
1117 /// match the prefix `/abc`, but the path `/abcd` would not.
1118 ///
1119 /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
1120 /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
1121 /// the implementation setting the Accepted Condition for the Route to `status: False`.
1122 ///
1123 /// Request Path | Prefix Match | Replace Prefix | Modified Path
1124 #[serde(default, skip_serializing_if = "Option::is_none", rename = "replacePrefixMatch")]
1125 pub replace_prefix_match: Option<String>,
1126 /// Type defines the type of path modifier. Additional types may be
1127 /// added in a future release of the API.
1128 ///
1129 /// Note that values may be added to this enum, implementations
1130 /// must ensure that unknown values will not cause a crash.
1131 ///
1132 /// Unknown values here must result in the implementation setting the
1133 /// Accepted Condition for the Route to `status: False`, with a
1134 /// Reason of `UnsupportedValue`.
1135 #[serde(rename = "type")]
1136 pub r#type: HttpRouteRulesBackendRefsFiltersRequestRedirectPathType,
1137}
1138
1139/// Path defines parameters used to modify the path of the incoming request.
1140/// The modified path is then used to construct the `Location` header. When
1141/// empty, the request path is used as-is.
1142///
1143/// Support: Extended
1144#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1145pub enum HttpRouteRulesBackendRefsFiltersRequestRedirectPathType {
1146 ReplaceFullPath,
1147 ReplacePrefixMatch,
1148}
1149
1150/// RequestRedirect defines a schema for a filter that responds to the
1151/// request with an HTTP redirection.
1152///
1153/// Support: Core
1154#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1155pub enum HttpRouteRulesBackendRefsFiltersRequestRedirectScheme {
1156 #[serde(rename = "http")]
1157 Http,
1158 #[serde(rename = "https")]
1159 Https,
1160}
1161
1162/// RequestRedirect defines a schema for a filter that responds to the
1163/// request with an HTTP redirection.
1164///
1165/// Support: Core
1166#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1167pub enum HttpRouteRulesBackendRefsFiltersRequestRedirectStatusCode {
1168 #[serde(rename = "301")]
1169 r#_301,
1170 #[serde(rename = "302")]
1171 r#_302,
1172 #[serde(rename = "303")]
1173 r#_303,
1174 #[serde(rename = "307")]
1175 r#_307,
1176 #[serde(rename = "308")]
1177 r#_308,
1178}
1179
1180/// ResponseHeaderModifier defines a schema for a filter that modifies response
1181/// headers.
1182///
1183/// Support: Extended
1184#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1185pub struct HttpRouteRulesBackendRefsFiltersResponseHeaderModifier {
1186 /// Add adds the given header(s) (name, value) to the request
1187 /// before the action. It appends to any existing values associated
1188 /// with the header name.
1189 ///
1190 /// Input:
1191 /// GET /foo HTTP/1.1
1192 /// my-header: foo
1193 ///
1194 /// Config:
1195 /// add:
1196 /// - name: "my-header"
1197 /// value: "bar,baz"
1198 ///
1199 /// Output:
1200 /// GET /foo HTTP/1.1
1201 /// my-header: foo,bar,baz
1202 #[serde(default, skip_serializing_if = "Option::is_none")]
1203 pub add: Option<Vec<HttpRouteRulesBackendRefsFiltersResponseHeaderModifierAdd>>,
1204 /// Remove the given header(s) from the HTTP request before the action. The
1205 /// value of Remove is a list of HTTP header names. Note that the header
1206 /// names are case-insensitive (see
1207 /// <https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).>
1208 ///
1209 /// Input:
1210 /// GET /foo HTTP/1.1
1211 /// my-header1: foo
1212 /// my-header2: bar
1213 /// my-header3: baz
1214 ///
1215 /// Config:
1216 /// remove: ["my-header1", "my-header3"]
1217 ///
1218 /// Output:
1219 /// GET /foo HTTP/1.1
1220 /// my-header2: bar
1221 #[serde(default, skip_serializing_if = "Option::is_none")]
1222 pub remove: Option<Vec<String>>,
1223 /// Set overwrites the request with the given header (name, value)
1224 /// before the action.
1225 ///
1226 /// Input:
1227 /// GET /foo HTTP/1.1
1228 /// my-header: foo
1229 ///
1230 /// Config:
1231 /// set:
1232 /// - name: "my-header"
1233 /// value: "bar"
1234 ///
1235 /// Output:
1236 /// GET /foo HTTP/1.1
1237 /// my-header: bar
1238 #[serde(default, skip_serializing_if = "Option::is_none")]
1239 pub set: Option<Vec<HttpRouteRulesBackendRefsFiltersResponseHeaderModifierSet>>,
1240}
1241
1242/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1243#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1244pub struct HttpRouteRulesBackendRefsFiltersResponseHeaderModifierAdd {
1245 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1246 /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
1247 ///
1248 /// If multiple entries specify equivalent header names, the first entry with
1249 /// an equivalent name MUST be considered for a match. Subsequent entries
1250 /// with an equivalent header name MUST be ignored. Due to the
1251 /// case-insensitivity of header names, "foo" and "Foo" are considered
1252 /// equivalent.
1253 pub name: String,
1254 /// Value is the value of HTTP Header to be matched.
1255 pub value: String,
1256}
1257
1258/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1259#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1260pub struct HttpRouteRulesBackendRefsFiltersResponseHeaderModifierSet {
1261 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1262 /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
1263 ///
1264 /// If multiple entries specify equivalent header names, the first entry with
1265 /// an equivalent name MUST be considered for a match. Subsequent entries
1266 /// with an equivalent header name MUST be ignored. Due to the
1267 /// case-insensitivity of header names, "foo" and "Foo" are considered
1268 /// equivalent.
1269 pub name: String,
1270 /// Value is the value of HTTP Header to be matched.
1271 pub value: String,
1272}
1273
1274/// HTTPRouteFilter defines processing steps that must be completed during the
1275/// request or response lifecycle. HTTPRouteFilters are meant as an extension
1276/// point to express processing that may be done in Gateway implementations. Some
1277/// examples include request or response modification, implementing
1278/// authentication strategies, rate-limiting, and traffic shaping. API
1279/// guarantee/conformance is defined based on the type of the filter.
1280#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1281pub enum HttpRouteRulesBackendRefsFiltersType {
1282 RequestHeaderModifier,
1283 ResponseHeaderModifier,
1284 RequestMirror,
1285 RequestRedirect,
1286 #[serde(rename = "URLRewrite")]
1287 UrlRewrite,
1288 ExtensionRef,
1289 #[serde(rename = "CORS")]
1290 Cors,
1291}
1292
1293/// URLRewrite defines a schema for a filter that modifies a request during forwarding.
1294///
1295/// Support: Extended
1296#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1297pub struct HttpRouteRulesBackendRefsFiltersUrlRewrite {
1298 /// Hostname is the value to be used to replace the Host header value during
1299 /// forwarding.
1300 ///
1301 /// Support: Extended
1302 #[serde(default, skip_serializing_if = "Option::is_none")]
1303 pub hostname: Option<String>,
1304 /// Path defines a path rewrite.
1305 ///
1306 /// Support: Extended
1307 #[serde(default, skip_serializing_if = "Option::is_none")]
1308 pub path: Option<HttpRouteRulesBackendRefsFiltersUrlRewritePath>,
1309}
1310
1311/// Path defines a path rewrite.
1312///
1313/// Support: Extended
1314#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1315pub struct HttpRouteRulesBackendRefsFiltersUrlRewritePath {
1316 /// ReplaceFullPath specifies the value with which to replace the full path
1317 /// of a request during a rewrite or redirect.
1318 #[serde(default, skip_serializing_if = "Option::is_none", rename = "replaceFullPath")]
1319 pub replace_full_path: Option<String>,
1320 /// ReplacePrefixMatch specifies the value with which to replace the prefix
1321 /// match of a request during a rewrite or redirect. For example, a request
1322 /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
1323 /// of "/xyz" would be modified to "/xyz/bar".
1324 ///
1325 /// Note that this matches the behavior of the PathPrefix match type. This
1326 /// matches full path elements. A path element refers to the list of labels
1327 /// in the path split by the `/` separator. When specified, a trailing `/` is
1328 /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
1329 /// match the prefix `/abc`, but the path `/abcd` would not.
1330 ///
1331 /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
1332 /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
1333 /// the implementation setting the Accepted Condition for the Route to `status: False`.
1334 ///
1335 /// Request Path | Prefix Match | Replace Prefix | Modified Path
1336 #[serde(default, skip_serializing_if = "Option::is_none", rename = "replacePrefixMatch")]
1337 pub replace_prefix_match: Option<String>,
1338 /// Type defines the type of path modifier. Additional types may be
1339 /// added in a future release of the API.
1340 ///
1341 /// Note that values may be added to this enum, implementations
1342 /// must ensure that unknown values will not cause a crash.
1343 ///
1344 /// Unknown values here must result in the implementation setting the
1345 /// Accepted Condition for the Route to `status: False`, with a
1346 /// Reason of `UnsupportedValue`.
1347 #[serde(rename = "type")]
1348 pub r#type: HttpRouteRulesBackendRefsFiltersUrlRewritePathType,
1349}
1350
1351/// Path defines a path rewrite.
1352///
1353/// Support: Extended
1354#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1355pub enum HttpRouteRulesBackendRefsFiltersUrlRewritePathType {
1356 ReplaceFullPath,
1357 ReplacePrefixMatch,
1358}
1359
1360/// HTTPRouteFilter defines processing steps that must be completed during the
1361/// request or response lifecycle. HTTPRouteFilters are meant as an extension
1362/// point to express processing that may be done in Gateway implementations. Some
1363/// examples include request or response modification, implementing
1364/// authentication strategies, rate-limiting, and traffic shaping. API
1365/// guarantee/conformance is defined based on the type of the filter.
1366#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1367pub struct HttpRouteRulesFilters {
1368 /// CORS defines a schema for a filter that responds to the
1369 /// cross-origin request based on HTTP response header.
1370 ///
1371 /// Support: Extended
1372 #[serde(default, skip_serializing_if = "Option::is_none")]
1373 pub cors: Option<HttpRouteRulesFiltersCors>,
1374 /// ExtensionRef is an optional, implementation-specific extension to the
1375 /// "filter" behavior. For example, resource "myroutefilter" in group
1376 /// "networking.example.net"). ExtensionRef MUST NOT be used for core and
1377 /// extended filters.
1378 ///
1379 /// This filter can be used multiple times within the same rule.
1380 ///
1381 /// Support: Implementation-specific
1382 #[serde(default, skip_serializing_if = "Option::is_none", rename = "extensionRef")]
1383 pub extension_ref: Option<HttpRouteRulesFiltersExtensionRef>,
1384 /// RequestHeaderModifier defines a schema for a filter that modifies request
1385 /// headers.
1386 ///
1387 /// Support: Core
1388 #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestHeaderModifier")]
1389 pub request_header_modifier: Option<HttpRouteRulesFiltersRequestHeaderModifier>,
1390 /// RequestMirror defines a schema for a filter that mirrors requests.
1391 /// Requests are sent to the specified destination, but responses from
1392 /// that destination are ignored.
1393 ///
1394 /// This filter can be used multiple times within the same rule. Note that
1395 /// not all implementations will be able to support mirroring to multiple
1396 /// backends.
1397 ///
1398 /// Support: Extended
1399 #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestMirror")]
1400 pub request_mirror: Option<HttpRouteRulesFiltersRequestMirror>,
1401 /// RequestRedirect defines a schema for a filter that responds to the
1402 /// request with an HTTP redirection.
1403 ///
1404 /// Support: Core
1405 #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestRedirect")]
1406 pub request_redirect: Option<HttpRouteRulesFiltersRequestRedirect>,
1407 /// ResponseHeaderModifier defines a schema for a filter that modifies response
1408 /// headers.
1409 ///
1410 /// Support: Extended
1411 #[serde(default, skip_serializing_if = "Option::is_none", rename = "responseHeaderModifier")]
1412 pub response_header_modifier: Option<HttpRouteRulesFiltersResponseHeaderModifier>,
1413 /// Type identifies the type of filter to apply. As with other API fields,
1414 /// types are classified into three conformance levels:
1415 ///
1416 /// - Core: Filter types and their corresponding configuration defined by
1417 /// "Support: Core" in this package, e.g. "RequestHeaderModifier". All
1418 /// implementations must support core filters.
1419 ///
1420 /// - Extended: Filter types and their corresponding configuration defined by
1421 /// "Support: Extended" in this package, e.g. "RequestMirror". Implementers
1422 /// are encouraged to support extended filters.
1423 ///
1424 /// - Implementation-specific: Filters that are defined and supported by
1425 /// specific vendors.
1426 /// In the future, filters showing convergence in behavior across multiple
1427 /// implementations will be considered for inclusion in extended or core
1428 /// conformance levels. Filter-specific configuration for such filters
1429 /// is specified using the ExtensionRef field. `Type` should be set to
1430 /// "ExtensionRef" for custom filters.
1431 ///
1432 /// Implementers are encouraged to define custom implementation types to
1433 /// extend the core API with implementation-specific behavior.
1434 ///
1435 /// If a reference to a custom filter type cannot be resolved, the filter
1436 /// MUST NOT be skipped. Instead, requests that would have been processed by
1437 /// that filter MUST receive a HTTP error response.
1438 ///
1439 /// Note that values may be added to this enum, implementations
1440 /// must ensure that unknown values will not cause a crash.
1441 ///
1442 /// Unknown values here must result in the implementation setting the
1443 /// Accepted Condition for the Route to `status: False`, with a
1444 /// Reason of `UnsupportedValue`.
1445 #[serde(rename = "type")]
1446 pub r#type: HttpRouteRulesFiltersType,
1447 /// URLRewrite defines a schema for a filter that modifies a request during forwarding.
1448 ///
1449 /// Support: Extended
1450 #[serde(default, skip_serializing_if = "Option::is_none", rename = "urlRewrite")]
1451 pub url_rewrite: Option<HttpRouteRulesFiltersUrlRewrite>,
1452}
1453
1454/// CORS defines a schema for a filter that responds to the
1455/// cross-origin request based on HTTP response header.
1456///
1457/// Support: Extended
1458#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1459pub struct HttpRouteRulesFiltersCors {
1460 /// AllowCredentials indicates whether the actual cross-origin request allows
1461 /// to include credentials.
1462 ///
1463 /// When set to true, the gateway will include the `Access-Control-Allow-Credentials`
1464 /// response header with value true (case-sensitive).
1465 ///
1466 /// When set to false or omitted the gateway will omit the header
1467 /// `Access-Control-Allow-Credentials` entirely (this is the standard CORS
1468 /// behavior).
1469 ///
1470 /// Support: Extended
1471 #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowCredentials")]
1472 pub allow_credentials: Option<bool>,
1473 /// AllowHeaders indicates which HTTP request headers are supported for
1474 /// accessing the requested resource.
1475 ///
1476 /// Header names are not case-sensitive.
1477 ///
1478 /// Multiple header names in the value of the `Access-Control-Allow-Headers`
1479 /// response header are separated by a comma (",").
1480 ///
1481 /// When the `AllowHeaders` field is configured with one or more headers, the
1482 /// gateway must return the `Access-Control-Allow-Headers` response header
1483 /// which value is present in the `AllowHeaders` field.
1484 ///
1485 /// If any header name in the `Access-Control-Request-Headers` request header
1486 /// is not included in the list of header names specified by the response
1487 /// header `Access-Control-Allow-Headers`, it will present an error on the
1488 /// client side.
1489 ///
1490 /// If any header name in the `Access-Control-Allow-Headers` response header
1491 /// does not recognize by the client, it will also occur an error on the
1492 /// client side.
1493 ///
1494 /// A wildcard indicates that the requests with all HTTP headers are allowed.
1495 /// If config contains the wildcard "*" in allowHeaders and the request is
1496 /// not credentialed, the `Access-Control-Allow-Headers` response header
1497 /// can either use the `*` wildcard or the value of
1498 /// Access-Control-Request-Headers from the request.
1499 ///
1500 /// When the request is credentialed, the gateway must not specify the `*`
1501 /// wildcard in the `Access-Control-Allow-Headers` response header. When
1502 /// also the `AllowCredentials` field is true and `AllowHeaders` field
1503 /// is specified with the `*` wildcard, the gateway must specify one or more
1504 /// HTTP headers in the value of the `Access-Control-Allow-Headers` response
1505 /// header. The value of the header `Access-Control-Allow-Headers` is same as
1506 /// the `Access-Control-Request-Headers` header provided by the client. If
1507 /// the header `Access-Control-Request-Headers` is not included in the
1508 /// request, the gateway will omit the `Access-Control-Allow-Headers`
1509 /// response header, instead of specifying the `*` wildcard.
1510 ///
1511 /// Support: Extended
1512 #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowHeaders")]
1513 pub allow_headers: Option<Vec<String>>,
1514 /// AllowMethods indicates which HTTP methods are supported for accessing the
1515 /// requested resource.
1516 ///
1517 /// Valid values are any method defined by RFC9110, along with the special
1518 /// value `*`, which represents all HTTP methods are allowed.
1519 ///
1520 /// Method names are case-sensitive, so these values are also case-sensitive.
1521 /// (See <https://www.rfc-editor.org/rfc/rfc2616#section-5.1.1)>
1522 ///
1523 /// Multiple method names in the value of the `Access-Control-Allow-Methods`
1524 /// response header are separated by a comma (",").
1525 ///
1526 /// A CORS-safelisted method is a method that is `GET`, `HEAD`, or `POST`.
1527 /// (See <https://fetch.spec.whatwg.org/#cors-safelisted-method)> The
1528 /// CORS-safelisted methods are always allowed, regardless of whether they
1529 /// are specified in the `AllowMethods` field.
1530 ///
1531 /// When the `AllowMethods` field is configured with one or more methods, the
1532 /// gateway must return the `Access-Control-Allow-Methods` response header
1533 /// which value is present in the `AllowMethods` field.
1534 ///
1535 /// If the HTTP method of the `Access-Control-Request-Method` request header
1536 /// is not included in the list of methods specified by the response header
1537 /// `Access-Control-Allow-Methods`, it will present an error on the client
1538 /// side.
1539 ///
1540 /// If config contains the wildcard "*" in allowMethods and the request is
1541 /// not credentialed, the `Access-Control-Allow-Methods` response header
1542 /// can either use the `*` wildcard or the value of
1543 /// Access-Control-Request-Method from the request.
1544 ///
1545 /// When the request is credentialed, the gateway must not specify the `*`
1546 /// wildcard in the `Access-Control-Allow-Methods` response header. When
1547 /// also the `AllowCredentials` field is true and `AllowMethods` field
1548 /// specified with the `*` wildcard, the gateway must specify one HTTP method
1549 /// in the value of the Access-Control-Allow-Methods response header. The
1550 /// value of the header `Access-Control-Allow-Methods` is same as the
1551 /// `Access-Control-Request-Method` header provided by the client. If the
1552 /// header `Access-Control-Request-Method` is not included in the request,
1553 /// the gateway will omit the `Access-Control-Allow-Methods` response header,
1554 /// instead of specifying the `*` wildcard.
1555 ///
1556 /// Support: Extended
1557 #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowMethods")]
1558 pub allow_methods: Option<Vec<String>>,
1559 /// AllowOrigins indicates whether the response can be shared with requested
1560 /// resource from the given `Origin`.
1561 ///
1562 /// The `Origin` consists of a scheme and a host, with an optional port, and
1563 /// takes the form `<scheme>://<host>(:<port>)`.
1564 ///
1565 /// Valid values for scheme are: `http` and `https`.
1566 ///
1567 /// Valid values for port are any integer between 1 and 65535 (the list of
1568 /// available TCP/UDP ports). Note that, if not included, port `80` is
1569 /// assumed for `http` scheme origins, and port `443` is assumed for `https`
1570 /// origins. This may affect origin matching.
1571 ///
1572 /// The host part of the origin may contain the wildcard character `*`. These
1573 /// wildcard characters behave as follows:
1574 ///
1575 /// * `*` is a greedy match to the _left_, including any number of
1576 /// DNS labels to the left of its position. This also means that
1577 /// `*` will include any number of period `.` characters to the
1578 /// left of its position.
1579 /// * A wildcard by itself matches all hosts.
1580 ///
1581 /// An origin value that includes _only_ the `*` character indicates requests
1582 /// from all `Origin`s are allowed.
1583 ///
1584 /// When the `AllowOrigins` field is configured with multiple origins, it
1585 /// means the server supports clients from multiple origins. If the request
1586 /// `Origin` matches the configured allowed origins, the gateway must return
1587 /// the given `Origin` and sets value of the header
1588 /// `Access-Control-Allow-Origin` same as the `Origin` header provided by the
1589 /// client.
1590 ///
1591 /// The status code of a successful response to a "preflight" request is
1592 /// always an OK status (i.e., 204 or 200).
1593 ///
1594 /// If the request `Origin` does not match the configured allowed origins,
1595 /// the gateway returns 204/200 response but doesn't set the relevant
1596 /// cross-origin response headers. Alternatively, the gateway responds with
1597 /// 403 status to the "preflight" request is denied, coupled with omitting
1598 /// the CORS headers. The cross-origin request fails on the client side.
1599 /// Therefore, the client doesn't attempt the actual cross-origin request.
1600 ///
1601 /// Conversely, if the request `Origin` matches one of the configured
1602 /// allowed origins, the gateway sets the response header
1603 /// `Access-Control-Allow-Origin` to the same value as the `Origin`
1604 /// header provided by the client.
1605 ///
1606 /// When config has the wildcard ("*") in allowOrigins, and the request
1607 /// is not credentialed (e.g., it is a preflight request), the
1608 /// `Access-Control-Allow-Origin` response header either contains the
1609 /// wildcard as well or the Origin from the request.
1610 ///
1611 /// When the request is credentialed, the gateway must not specify the `*`
1612 /// wildcard in the `Access-Control-Allow-Origin` response header. When
1613 /// also the `AllowCredentials` field is true and `AllowOrigins` field
1614 /// specified with the `*` wildcard, the gateway must return a single origin
1615 /// in the value of the `Access-Control-Allow-Origin` response header,
1616 /// instead of specifying the `*` wildcard. The value of the header
1617 /// `Access-Control-Allow-Origin` is same as the `Origin` header provided by
1618 /// the client.
1619 ///
1620 /// Support: Extended
1621 #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowOrigins")]
1622 pub allow_origins: Option<Vec<String>>,
1623 /// ExposeHeaders indicates which HTTP response headers can be exposed
1624 /// to client-side scripts in response to a cross-origin request.
1625 ///
1626 /// A CORS-safelisted response header is an HTTP header in a CORS response
1627 /// that it is considered safe to expose to the client scripts.
1628 /// The CORS-safelisted response headers include the following headers:
1629 /// `Cache-Control`
1630 /// `Content-Language`
1631 /// `Content-Length`
1632 /// `Content-Type`
1633 /// `Expires`
1634 /// `Last-Modified`
1635 /// `Pragma`
1636 /// (See <https://fetch.spec.whatwg.org/#cors-safelisted-response-header-name)>
1637 /// The CORS-safelisted response headers are exposed to client by default.
1638 ///
1639 /// When an HTTP header name is specified using the `ExposeHeaders` field,
1640 /// this additional header will be exposed as part of the response to the
1641 /// client.
1642 ///
1643 /// Header names are not case-sensitive.
1644 ///
1645 /// Multiple header names in the value of the `Access-Control-Expose-Headers`
1646 /// response header are separated by a comma (",").
1647 ///
1648 /// A wildcard indicates that the responses with all HTTP headers are exposed
1649 /// to clients. The `Access-Control-Expose-Headers` response header can only
1650 /// use `*` wildcard as value when the request is not credentialed.
1651 ///
1652 /// When the `exposeHeaders` config field contains the "*" wildcard and
1653 /// the request is credentialed, the gateway cannot use the `*` wildcard in
1654 /// the `Access-Control-Expose-Headers` response header.
1655 ///
1656 /// Support: Extended
1657 #[serde(default, skip_serializing_if = "Option::is_none", rename = "exposeHeaders")]
1658 pub expose_headers: Option<Vec<String>>,
1659 /// MaxAge indicates the duration (in seconds) for the client to cache the
1660 /// results of a "preflight" request.
1661 ///
1662 /// The information provided by the `Access-Control-Allow-Methods` and
1663 /// `Access-Control-Allow-Headers` response headers can be cached by the
1664 /// client until the time specified by `Access-Control-Max-Age` elapses.
1665 ///
1666 /// The default value of `Access-Control-Max-Age` response header is 5
1667 /// (seconds).
1668 ///
1669 /// When the `MaxAge` field is unspecified, the gateway sets the response
1670 /// header "Access-Control-Max-Age: 5" by default.
1671 #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxAge")]
1672 pub max_age: Option<i32>,
1673}
1674
1675/// ExtensionRef is an optional, implementation-specific extension to the
1676/// "filter" behavior. For example, resource "myroutefilter" in group
1677/// "networking.example.net"). ExtensionRef MUST NOT be used for core and
1678/// extended filters.
1679///
1680/// This filter can be used multiple times within the same rule.
1681///
1682/// Support: Implementation-specific
1683#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1684pub struct HttpRouteRulesFiltersExtensionRef {
1685 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
1686 /// When unspecified or empty string, core API group is inferred.
1687 pub group: String,
1688 /// Kind is kind of the referent. For example "HTTPRoute" or "Service".
1689 pub kind: String,
1690 /// Name is the name of the referent.
1691 pub name: String,
1692}
1693
1694/// RequestHeaderModifier defines a schema for a filter that modifies request
1695/// headers.
1696///
1697/// Support: Core
1698#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1699pub struct HttpRouteRulesFiltersRequestHeaderModifier {
1700 /// Add adds the given header(s) (name, value) to the request
1701 /// before the action. It appends to any existing values associated
1702 /// with the header name.
1703 ///
1704 /// Input:
1705 /// GET /foo HTTP/1.1
1706 /// my-header: foo
1707 ///
1708 /// Config:
1709 /// add:
1710 /// - name: "my-header"
1711 /// value: "bar,baz"
1712 ///
1713 /// Output:
1714 /// GET /foo HTTP/1.1
1715 /// my-header: foo,bar,baz
1716 #[serde(default, skip_serializing_if = "Option::is_none")]
1717 pub add: Option<Vec<HttpRouteRulesFiltersRequestHeaderModifierAdd>>,
1718 /// Remove the given header(s) from the HTTP request before the action. The
1719 /// value of Remove is a list of HTTP header names. Note that the header
1720 /// names are case-insensitive (see
1721 /// <https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).>
1722 ///
1723 /// Input:
1724 /// GET /foo HTTP/1.1
1725 /// my-header1: foo
1726 /// my-header2: bar
1727 /// my-header3: baz
1728 ///
1729 /// Config:
1730 /// remove: ["my-header1", "my-header3"]
1731 ///
1732 /// Output:
1733 /// GET /foo HTTP/1.1
1734 /// my-header2: bar
1735 #[serde(default, skip_serializing_if = "Option::is_none")]
1736 pub remove: Option<Vec<String>>,
1737 /// Set overwrites the request with the given header (name, value)
1738 /// before the action.
1739 ///
1740 /// Input:
1741 /// GET /foo HTTP/1.1
1742 /// my-header: foo
1743 ///
1744 /// Config:
1745 /// set:
1746 /// - name: "my-header"
1747 /// value: "bar"
1748 ///
1749 /// Output:
1750 /// GET /foo HTTP/1.1
1751 /// my-header: bar
1752 #[serde(default, skip_serializing_if = "Option::is_none")]
1753 pub set: Option<Vec<HttpRouteRulesFiltersRequestHeaderModifierSet>>,
1754}
1755
1756/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1757#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1758pub struct HttpRouteRulesFiltersRequestHeaderModifierAdd {
1759 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1760 /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
1761 ///
1762 /// If multiple entries specify equivalent header names, the first entry with
1763 /// an equivalent name MUST be considered for a match. Subsequent entries
1764 /// with an equivalent header name MUST be ignored. Due to the
1765 /// case-insensitivity of header names, "foo" and "Foo" are considered
1766 /// equivalent.
1767 pub name: String,
1768 /// Value is the value of HTTP Header to be matched.
1769 pub value: String,
1770}
1771
1772/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1773#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1774pub struct HttpRouteRulesFiltersRequestHeaderModifierSet {
1775 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1776 /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
1777 ///
1778 /// If multiple entries specify equivalent header names, the first entry with
1779 /// an equivalent name MUST be considered for a match. Subsequent entries
1780 /// with an equivalent header name MUST be ignored. Due to the
1781 /// case-insensitivity of header names, "foo" and "Foo" are considered
1782 /// equivalent.
1783 pub name: String,
1784 /// Value is the value of HTTP Header to be matched.
1785 pub value: String,
1786}
1787
1788/// RequestMirror defines a schema for a filter that mirrors requests.
1789/// Requests are sent to the specified destination, but responses from
1790/// that destination are ignored.
1791///
1792/// This filter can be used multiple times within the same rule. Note that
1793/// not all implementations will be able to support mirroring to multiple
1794/// backends.
1795///
1796/// Support: Extended
1797#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1798pub struct HttpRouteRulesFiltersRequestMirror {
1799 /// BackendRef references a resource where mirrored requests are sent.
1800 ///
1801 /// Mirrored requests must be sent only to a single destination endpoint
1802 /// within this BackendRef, irrespective of how many endpoints are present
1803 /// within this BackendRef.
1804 ///
1805 /// If the referent cannot be found, this BackendRef is invalid and must be
1806 /// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
1807 /// condition on the Route status is set to `status: False` and not configure
1808 /// this backend in the underlying implementation.
1809 ///
1810 /// If there is a cross-namespace reference to an *existing* object
1811 /// that is not allowed by a ReferenceGrant, the controller must ensure the
1812 /// "ResolvedRefs" condition on the Route is set to `status: False`,
1813 /// with the "RefNotPermitted" reason and not configure this backend in the
1814 /// underlying implementation.
1815 ///
1816 /// In either error case, the Message of the `ResolvedRefs` Condition
1817 /// should be used to provide more detail about the problem.
1818 ///
1819 /// Support: Extended for Kubernetes Service
1820 ///
1821 /// Support: Implementation-specific for any other resource
1822 #[serde(rename = "backendRef")]
1823 pub backend_ref: HttpRouteRulesFiltersRequestMirrorBackendRef,
1824 /// Fraction represents the fraction of requests that should be
1825 /// mirrored to BackendRef.
1826 ///
1827 /// Only one of Fraction or Percent may be specified. If neither field
1828 /// is specified, 100% of requests will be mirrored.
1829 #[serde(default, skip_serializing_if = "Option::is_none")]
1830 pub fraction: Option<HttpRouteRulesFiltersRequestMirrorFraction>,
1831 /// Percent represents the percentage of requests that should be
1832 /// mirrored to BackendRef. Its minimum value is 0 (indicating 0% of
1833 /// requests) and its maximum value is 100 (indicating 100% of requests).
1834 ///
1835 /// Only one of Fraction or Percent may be specified. If neither field
1836 /// is specified, 100% of requests will be mirrored.
1837 #[serde(default, skip_serializing_if = "Option::is_none")]
1838 pub percent: Option<i32>,
1839}
1840
1841/// BackendRef references a resource where mirrored requests are sent.
1842///
1843/// Mirrored requests must be sent only to a single destination endpoint
1844/// within this BackendRef, irrespective of how many endpoints are present
1845/// within this BackendRef.
1846///
1847/// If the referent cannot be found, this BackendRef is invalid and must be
1848/// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
1849/// condition on the Route status is set to `status: False` and not configure
1850/// this backend in the underlying implementation.
1851///
1852/// If there is a cross-namespace reference to an *existing* object
1853/// that is not allowed by a ReferenceGrant, the controller must ensure the
1854/// "ResolvedRefs" condition on the Route is set to `status: False`,
1855/// with the "RefNotPermitted" reason and not configure this backend in the
1856/// underlying implementation.
1857///
1858/// In either error case, the Message of the `ResolvedRefs` Condition
1859/// should be used to provide more detail about the problem.
1860///
1861/// Support: Extended for Kubernetes Service
1862///
1863/// Support: Implementation-specific for any other resource
1864#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1865pub struct HttpRouteRulesFiltersRequestMirrorBackendRef {
1866 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
1867 /// When unspecified or empty string, core API group is inferred.
1868 #[serde(default, skip_serializing_if = "Option::is_none")]
1869 pub group: Option<String>,
1870 /// Kind is the Kubernetes resource kind of the referent. For example
1871 /// "Service".
1872 ///
1873 /// Defaults to "Service" when not specified.
1874 ///
1875 /// ExternalName services can refer to CNAME DNS records that may live
1876 /// outside of the cluster and as such are difficult to reason about in
1877 /// terms of conformance. They also may not be safe to forward to (see
1878 /// CVE-2021-25740 for more information). Implementations SHOULD NOT
1879 /// support ExternalName Services.
1880 ///
1881 /// Support: Core (Services with a type other than ExternalName)
1882 ///
1883 /// Support: Implementation-specific (Services with type ExternalName)
1884 #[serde(default, skip_serializing_if = "Option::is_none")]
1885 pub kind: Option<String>,
1886 /// Name is the name of the referent.
1887 pub name: String,
1888 /// Namespace is the namespace of the backend. When unspecified, the local
1889 /// namespace is inferred.
1890 ///
1891 /// Note that when a namespace different than the local namespace is specified,
1892 /// a ReferenceGrant object is required in the referent namespace to allow that
1893 /// namespace's owner to accept the reference. See the ReferenceGrant
1894 /// documentation for details.
1895 ///
1896 /// Support: Core
1897 #[serde(default, skip_serializing_if = "Option::is_none")]
1898 pub namespace: Option<String>,
1899 /// Port specifies the destination port number to use for this resource.
1900 /// Port is required when the referent is a Kubernetes Service. In this
1901 /// case, the port number is the service port number, not the target port.
1902 /// For other resources, destination port might be derived from the referent
1903 /// resource or this field.
1904 #[serde(default, skip_serializing_if = "Option::is_none")]
1905 pub port: Option<i32>,
1906}
1907
1908/// Fraction represents the fraction of requests that should be
1909/// mirrored to BackendRef.
1910///
1911/// Only one of Fraction or Percent may be specified. If neither field
1912/// is specified, 100% of requests will be mirrored.
1913#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1914pub struct HttpRouteRulesFiltersRequestMirrorFraction {
1915 #[serde(default, skip_serializing_if = "Option::is_none")]
1916 pub denominator: Option<i32>,
1917 pub numerator: i32,
1918}
1919
1920/// RequestRedirect defines a schema for a filter that responds to the
1921/// request with an HTTP redirection.
1922///
1923/// Support: Core
1924#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1925pub struct HttpRouteRulesFiltersRequestRedirect {
1926 /// Hostname is the hostname to be used in the value of the `Location`
1927 /// header in the response.
1928 /// When empty, the hostname in the `Host` header of the request is used.
1929 ///
1930 /// Support: Core
1931 #[serde(default, skip_serializing_if = "Option::is_none")]
1932 pub hostname: Option<String>,
1933 /// Path defines parameters used to modify the path of the incoming request.
1934 /// The modified path is then used to construct the `Location` header. When
1935 /// empty, the request path is used as-is.
1936 ///
1937 /// Support: Extended
1938 #[serde(default, skip_serializing_if = "Option::is_none")]
1939 pub path: Option<HttpRouteRulesFiltersRequestRedirectPath>,
1940 /// Port is the port to be used in the value of the `Location`
1941 /// header in the response.
1942 ///
1943 /// If no port is specified, the redirect port MUST be derived using the
1944 /// following rules:
1945 ///
1946 /// * If redirect scheme is not-empty, the redirect port MUST be the well-known
1947 /// port associated with the redirect scheme. Specifically "http" to port 80
1948 /// and "https" to port 443. If the redirect scheme does not have a
1949 /// well-known port, the listener port of the Gateway SHOULD be used.
1950 /// * If redirect scheme is empty, the redirect port MUST be the Gateway
1951 /// Listener port.
1952 ///
1953 /// Implementations SHOULD NOT add the port number in the 'Location'
1954 /// header in the following cases:
1955 ///
1956 /// * A Location header that will use HTTP (whether that is determined via
1957 /// the Listener protocol or the Scheme field) _and_ use port 80.
1958 /// * A Location header that will use HTTPS (whether that is determined via
1959 /// the Listener protocol or the Scheme field) _and_ use port 443.
1960 ///
1961 /// Support: Extended
1962 #[serde(default, skip_serializing_if = "Option::is_none")]
1963 pub port: Option<i32>,
1964 /// Scheme is the scheme to be used in the value of the `Location` header in
1965 /// the response. When empty, the scheme of the request is used.
1966 ///
1967 /// Scheme redirects can affect the port of the redirect, for more information,
1968 /// refer to the documentation for the port field of this filter.
1969 ///
1970 /// Note that values may be added to this enum, implementations
1971 /// must ensure that unknown values will not cause a crash.
1972 ///
1973 /// Unknown values here must result in the implementation setting the
1974 /// Accepted Condition for the Route to `status: False`, with a
1975 /// Reason of `UnsupportedValue`.
1976 ///
1977 /// Support: Extended
1978 #[serde(default, skip_serializing_if = "Option::is_none")]
1979 pub scheme: Option<HttpRouteRulesFiltersRequestRedirectScheme>,
1980 /// StatusCode is the HTTP status code to be used in response.
1981 ///
1982 /// Note that values may be added to this enum, implementations
1983 /// must ensure that unknown values will not cause a crash.
1984 ///
1985 /// Unknown values here must result in the implementation setting the
1986 /// Accepted Condition for the Route to `status: False`, with a
1987 /// Reason of `UnsupportedValue`.
1988 ///
1989 /// Support: Core
1990 #[serde(default, skip_serializing_if = "Option::is_none", rename = "statusCode")]
1991 pub status_code: Option<i64>,
1992}
1993
1994/// Path defines parameters used to modify the path of the incoming request.
1995/// The modified path is then used to construct the `Location` header. When
1996/// empty, the request path is used as-is.
1997///
1998/// Support: Extended
1999#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2000pub struct HttpRouteRulesFiltersRequestRedirectPath {
2001 /// ReplaceFullPath specifies the value with which to replace the full path
2002 /// of a request during a rewrite or redirect.
2003 #[serde(default, skip_serializing_if = "Option::is_none", rename = "replaceFullPath")]
2004 pub replace_full_path: Option<String>,
2005 /// ReplacePrefixMatch specifies the value with which to replace the prefix
2006 /// match of a request during a rewrite or redirect. For example, a request
2007 /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
2008 /// of "/xyz" would be modified to "/xyz/bar".
2009 ///
2010 /// Note that this matches the behavior of the PathPrefix match type. This
2011 /// matches full path elements. A path element refers to the list of labels
2012 /// in the path split by the `/` separator. When specified, a trailing `/` is
2013 /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
2014 /// match the prefix `/abc`, but the path `/abcd` would not.
2015 ///
2016 /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
2017 /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
2018 /// the implementation setting the Accepted Condition for the Route to `status: False`.
2019 ///
2020 /// Request Path | Prefix Match | Replace Prefix | Modified Path
2021 #[serde(default, skip_serializing_if = "Option::is_none", rename = "replacePrefixMatch")]
2022 pub replace_prefix_match: Option<String>,
2023 /// Type defines the type of path modifier. Additional types may be
2024 /// added in a future release of the API.
2025 ///
2026 /// Note that values may be added to this enum, implementations
2027 /// must ensure that unknown values will not cause a crash.
2028 ///
2029 /// Unknown values here must result in the implementation setting the
2030 /// Accepted Condition for the Route to `status: False`, with a
2031 /// Reason of `UnsupportedValue`.
2032 #[serde(rename = "type")]
2033 pub r#type: HttpRouteRulesFiltersRequestRedirectPathType,
2034}
2035
2036/// Path defines parameters used to modify the path of the incoming request.
2037/// The modified path is then used to construct the `Location` header. When
2038/// empty, the request path is used as-is.
2039///
2040/// Support: Extended
2041#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2042pub enum HttpRouteRulesFiltersRequestRedirectPathType {
2043 ReplaceFullPath,
2044 ReplacePrefixMatch,
2045}
2046
2047/// RequestRedirect defines a schema for a filter that responds to the
2048/// request with an HTTP redirection.
2049///
2050/// Support: Core
2051#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2052pub enum HttpRouteRulesFiltersRequestRedirectScheme {
2053 #[serde(rename = "http")]
2054 Http,
2055 #[serde(rename = "https")]
2056 Https,
2057}
2058
2059/// RequestRedirect defines a schema for a filter that responds to the
2060/// request with an HTTP redirection.
2061///
2062/// Support: Core
2063#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2064pub enum HttpRouteRulesFiltersRequestRedirectStatusCode {
2065 #[serde(rename = "301")]
2066 r#_301,
2067 #[serde(rename = "302")]
2068 r#_302,
2069 #[serde(rename = "303")]
2070 r#_303,
2071 #[serde(rename = "307")]
2072 r#_307,
2073 #[serde(rename = "308")]
2074 r#_308,
2075}
2076
2077/// ResponseHeaderModifier defines a schema for a filter that modifies response
2078/// headers.
2079///
2080/// Support: Extended
2081#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2082pub struct HttpRouteRulesFiltersResponseHeaderModifier {
2083 /// Add adds the given header(s) (name, value) to the request
2084 /// before the action. It appends to any existing values associated
2085 /// with the header name.
2086 ///
2087 /// Input:
2088 /// GET /foo HTTP/1.1
2089 /// my-header: foo
2090 ///
2091 /// Config:
2092 /// add:
2093 /// - name: "my-header"
2094 /// value: "bar,baz"
2095 ///
2096 /// Output:
2097 /// GET /foo HTTP/1.1
2098 /// my-header: foo,bar,baz
2099 #[serde(default, skip_serializing_if = "Option::is_none")]
2100 pub add: Option<Vec<HttpRouteRulesFiltersResponseHeaderModifierAdd>>,
2101 /// Remove the given header(s) from the HTTP request before the action. The
2102 /// value of Remove is a list of HTTP header names. Note that the header
2103 /// names are case-insensitive (see
2104 /// <https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).>
2105 ///
2106 /// Input:
2107 /// GET /foo HTTP/1.1
2108 /// my-header1: foo
2109 /// my-header2: bar
2110 /// my-header3: baz
2111 ///
2112 /// Config:
2113 /// remove: ["my-header1", "my-header3"]
2114 ///
2115 /// Output:
2116 /// GET /foo HTTP/1.1
2117 /// my-header2: bar
2118 #[serde(default, skip_serializing_if = "Option::is_none")]
2119 pub remove: Option<Vec<String>>,
2120 /// Set overwrites the request with the given header (name, value)
2121 /// before the action.
2122 ///
2123 /// Input:
2124 /// GET /foo HTTP/1.1
2125 /// my-header: foo
2126 ///
2127 /// Config:
2128 /// set:
2129 /// - name: "my-header"
2130 /// value: "bar"
2131 ///
2132 /// Output:
2133 /// GET /foo HTTP/1.1
2134 /// my-header: bar
2135 #[serde(default, skip_serializing_if = "Option::is_none")]
2136 pub set: Option<Vec<HttpRouteRulesFiltersResponseHeaderModifierSet>>,
2137}
2138
2139/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
2140#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2141pub struct HttpRouteRulesFiltersResponseHeaderModifierAdd {
2142 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
2143 /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
2144 ///
2145 /// If multiple entries specify equivalent header names, the first entry with
2146 /// an equivalent name MUST be considered for a match. Subsequent entries
2147 /// with an equivalent header name MUST be ignored. Due to the
2148 /// case-insensitivity of header names, "foo" and "Foo" are considered
2149 /// equivalent.
2150 pub name: String,
2151 /// Value is the value of HTTP Header to be matched.
2152 pub value: String,
2153}
2154
2155/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
2156#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2157pub struct HttpRouteRulesFiltersResponseHeaderModifierSet {
2158 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
2159 /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
2160 ///
2161 /// If multiple entries specify equivalent header names, the first entry with
2162 /// an equivalent name MUST be considered for a match. Subsequent entries
2163 /// with an equivalent header name MUST be ignored. Due to the
2164 /// case-insensitivity of header names, "foo" and "Foo" are considered
2165 /// equivalent.
2166 pub name: String,
2167 /// Value is the value of HTTP Header to be matched.
2168 pub value: String,
2169}
2170
2171/// HTTPRouteFilter defines processing steps that must be completed during the
2172/// request or response lifecycle. HTTPRouteFilters are meant as an extension
2173/// point to express processing that may be done in Gateway implementations. Some
2174/// examples include request or response modification, implementing
2175/// authentication strategies, rate-limiting, and traffic shaping. API
2176/// guarantee/conformance is defined based on the type of the filter.
2177#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2178pub enum HttpRouteRulesFiltersType {
2179 RequestHeaderModifier,
2180 ResponseHeaderModifier,
2181 RequestMirror,
2182 RequestRedirect,
2183 #[serde(rename = "URLRewrite")]
2184 UrlRewrite,
2185 ExtensionRef,
2186 #[serde(rename = "CORS")]
2187 Cors,
2188}
2189
2190/// URLRewrite defines a schema for a filter that modifies a request during forwarding.
2191///
2192/// Support: Extended
2193#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2194pub struct HttpRouteRulesFiltersUrlRewrite {
2195 /// Hostname is the value to be used to replace the Host header value during
2196 /// forwarding.
2197 ///
2198 /// Support: Extended
2199 #[serde(default, skip_serializing_if = "Option::is_none")]
2200 pub hostname: Option<String>,
2201 /// Path defines a path rewrite.
2202 ///
2203 /// Support: Extended
2204 #[serde(default, skip_serializing_if = "Option::is_none")]
2205 pub path: Option<HttpRouteRulesFiltersUrlRewritePath>,
2206}
2207
2208/// Path defines a path rewrite.
2209///
2210/// Support: Extended
2211#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2212pub struct HttpRouteRulesFiltersUrlRewritePath {
2213 /// ReplaceFullPath specifies the value with which to replace the full path
2214 /// of a request during a rewrite or redirect.
2215 #[serde(default, skip_serializing_if = "Option::is_none", rename = "replaceFullPath")]
2216 pub replace_full_path: Option<String>,
2217 /// ReplacePrefixMatch specifies the value with which to replace the prefix
2218 /// match of a request during a rewrite or redirect. For example, a request
2219 /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
2220 /// of "/xyz" would be modified to "/xyz/bar".
2221 ///
2222 /// Note that this matches the behavior of the PathPrefix match type. This
2223 /// matches full path elements. A path element refers to the list of labels
2224 /// in the path split by the `/` separator. When specified, a trailing `/` is
2225 /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
2226 /// match the prefix `/abc`, but the path `/abcd` would not.
2227 ///
2228 /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
2229 /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
2230 /// the implementation setting the Accepted Condition for the Route to `status: False`.
2231 ///
2232 /// Request Path | Prefix Match | Replace Prefix | Modified Path
2233 #[serde(default, skip_serializing_if = "Option::is_none", rename = "replacePrefixMatch")]
2234 pub replace_prefix_match: Option<String>,
2235 /// Type defines the type of path modifier. Additional types may be
2236 /// added in a future release of the API.
2237 ///
2238 /// Note that values may be added to this enum, implementations
2239 /// must ensure that unknown values will not cause a crash.
2240 ///
2241 /// Unknown values here must result in the implementation setting the
2242 /// Accepted Condition for the Route to `status: False`, with a
2243 /// Reason of `UnsupportedValue`.
2244 #[serde(rename = "type")]
2245 pub r#type: HttpRouteRulesFiltersUrlRewritePathType,
2246}
2247
2248/// Path defines a path rewrite.
2249///
2250/// Support: Extended
2251#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2252pub enum HttpRouteRulesFiltersUrlRewritePathType {
2253 ReplaceFullPath,
2254 ReplacePrefixMatch,
2255}
2256
2257/// HTTPRouteMatch defines the predicate used to match requests to a given
2258/// action. Multiple match types are ANDed together, i.e. the match will
2259/// evaluate to true only if all conditions are satisfied.
2260///
2261/// For example, the match below will match a HTTP request only if its path
2262/// starts with `/foo` AND it contains the `version: v1` header:
2263///
2264/// ```text
2265/// match:
2266///
2267/// path:
2268/// value: "/foo"
2269/// headers:
2270/// - name: "version"
2271/// value "v1"
2272/// ```
2273#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2274pub struct HttpRouteRulesMatches {
2275 /// Headers specifies HTTP request header matchers. Multiple match values are
2276 /// ANDed together, meaning, a request must match all the specified headers
2277 /// to select the route.
2278 #[serde(default, skip_serializing_if = "Option::is_none")]
2279 pub headers: Option<Vec<HttpRouteRulesMatchesHeaders>>,
2280 /// Method specifies HTTP method matcher.
2281 /// When specified, this route will be matched only if the request has the
2282 /// specified method.
2283 ///
2284 /// Support: Extended
2285 #[serde(default, skip_serializing_if = "Option::is_none")]
2286 pub method: Option<HttpRouteRulesMatchesMethod>,
2287 /// Path specifies a HTTP request path matcher. If this field is not
2288 /// specified, a default prefix match on the "/" path is provided.
2289 #[serde(default, skip_serializing_if = "Option::is_none")]
2290 pub path: Option<HttpRouteRulesMatchesPath>,
2291 /// QueryParams specifies HTTP query parameter matchers. Multiple match
2292 /// values are ANDed together, meaning, a request must match all the
2293 /// specified query parameters to select the route.
2294 ///
2295 /// Support: Extended
2296 #[serde(default, skip_serializing_if = "Option::is_none", rename = "queryParams")]
2297 pub query_params: Option<Vec<HttpRouteRulesMatchesQueryParams>>,
2298}
2299
2300/// HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request
2301/// headers.
2302#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2303pub struct HttpRouteRulesMatchesHeaders {
2304 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
2305 /// case-insensitive. (See <https://tools.ietf.org/html/rfc7230#section-3.2).>
2306 ///
2307 /// If multiple entries specify equivalent header names, only the first
2308 /// entry with an equivalent name MUST be considered for a match. Subsequent
2309 /// entries with an equivalent header name MUST be ignored. Due to the
2310 /// case-insensitivity of header names, "foo" and "Foo" are considered
2311 /// equivalent.
2312 ///
2313 /// When a header is repeated in an HTTP request, it is
2314 /// implementation-specific behavior as to how this is represented.
2315 /// Generally, proxies should follow the guidance from the RFC:
2316 /// <https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.2> regarding
2317 /// processing a repeated header, with special handling for "Set-Cookie".
2318 pub name: String,
2319 /// Type specifies how to match against the value of the header.
2320 ///
2321 /// Support: Core (Exact)
2322 ///
2323 /// Support: Implementation-specific (RegularExpression)
2324 ///
2325 /// Since RegularExpression HeaderMatchType has implementation-specific
2326 /// conformance, implementations can support POSIX, PCRE or any other dialects
2327 /// of regular expressions. Please read the implementation's documentation to
2328 /// determine the supported dialect.
2329 #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
2330 pub r#type: Option<HttpRouteRulesMatchesHeadersType>,
2331 /// Value is the value of HTTP Header to be matched.
2332 pub value: String,
2333}
2334
2335/// HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request
2336/// headers.
2337#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2338pub enum HttpRouteRulesMatchesHeadersType {
2339 Exact,
2340 RegularExpression,
2341}
2342
2343/// HTTPRouteMatch defines the predicate used to match requests to a given
2344/// action. Multiple match types are ANDed together, i.e. the match will
2345/// evaluate to true only if all conditions are satisfied.
2346///
2347/// For example, the match below will match a HTTP request only if its path
2348/// starts with `/foo` AND it contains the `version: v1` header:
2349///
2350/// ```text
2351/// match:
2352///
2353/// path:
2354/// value: "/foo"
2355/// headers:
2356/// - name: "version"
2357/// value "v1"
2358/// ```
2359#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2360pub enum HttpRouteRulesMatchesMethod {
2361 #[serde(rename = "GET")]
2362 Get,
2363 #[serde(rename = "HEAD")]
2364 Head,
2365 #[serde(rename = "POST")]
2366 Post,
2367 #[serde(rename = "PUT")]
2368 Put,
2369 #[serde(rename = "DELETE")]
2370 Delete,
2371 #[serde(rename = "CONNECT")]
2372 Connect,
2373 #[serde(rename = "OPTIONS")]
2374 Options,
2375 #[serde(rename = "TRACE")]
2376 Trace,
2377 #[serde(rename = "PATCH")]
2378 Patch,
2379}
2380
2381/// Path specifies a HTTP request path matcher. If this field is not
2382/// specified, a default prefix match on the "/" path is provided.
2383#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2384pub struct HttpRouteRulesMatchesPath {
2385 /// Type specifies how to match against the path Value.
2386 ///
2387 /// Support: Core (Exact, PathPrefix)
2388 ///
2389 /// Support: Implementation-specific (RegularExpression)
2390 #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
2391 pub r#type: Option<HttpRouteRulesMatchesPathType>,
2392 /// Value of the HTTP path to match against.
2393 #[serde(default, skip_serializing_if = "Option::is_none")]
2394 pub value: Option<String>,
2395}
2396
2397/// Path specifies a HTTP request path matcher. If this field is not
2398/// specified, a default prefix match on the "/" path is provided.
2399#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2400pub enum HttpRouteRulesMatchesPathType {
2401 Exact,
2402 PathPrefix,
2403 RegularExpression,
2404}
2405
2406/// HTTPQueryParamMatch describes how to select a HTTP route by matching HTTP
2407/// query parameters.
2408#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2409pub struct HttpRouteRulesMatchesQueryParams {
2410 /// Name is the name of the HTTP query param to be matched. This must be an
2411 /// exact string match. (See
2412 /// <https://tools.ietf.org/html/rfc7230#section-2.7.3).>
2413 ///
2414 /// If multiple entries specify equivalent query param names, only the first
2415 /// entry with an equivalent name MUST be considered for a match. Subsequent
2416 /// entries with an equivalent query param name MUST be ignored.
2417 ///
2418 /// If a query param is repeated in an HTTP request, the behavior is
2419 /// purposely left undefined, since different data planes have different
2420 /// capabilities. However, it is *recommended* that implementations should
2421 /// match against the first value of the param if the data plane supports it,
2422 /// as this behavior is expected in other load balancing contexts outside of
2423 /// the Gateway API.
2424 ///
2425 /// Users SHOULD NOT route traffic based on repeated query params to guard
2426 /// themselves against potential differences in the implementations.
2427 pub name: String,
2428 /// Type specifies how to match against the value of the query parameter.
2429 ///
2430 /// Support: Extended (Exact)
2431 ///
2432 /// Support: Implementation-specific (RegularExpression)
2433 ///
2434 /// Since RegularExpression QueryParamMatchType has Implementation-specific
2435 /// conformance, implementations can support POSIX, PCRE or any other
2436 /// dialects of regular expressions. Please read the implementation's
2437 /// documentation to determine the supported dialect.
2438 #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
2439 pub r#type: Option<HttpRouteRulesMatchesQueryParamsType>,
2440 /// Value is the value of HTTP query param to be matched.
2441 pub value: String,
2442}
2443
2444/// HTTPQueryParamMatch describes how to select a HTTP route by matching HTTP
2445/// query parameters.
2446#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2447pub enum HttpRouteRulesMatchesQueryParamsType {
2448 Exact,
2449 RegularExpression,
2450}
2451
2452/// Timeouts defines the timeouts that can be configured for an HTTP request.
2453///
2454/// Support: Extended
2455#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2456pub struct HttpRouteRulesTimeouts {
2457 /// BackendRequest specifies a timeout for an individual request from the gateway
2458 /// to a backend. This covers the time from when the request first starts being
2459 /// sent from the gateway to when the full response has been received from the backend.
2460 ///
2461 /// Setting a timeout to the zero duration (e.g. "0s") SHOULD disable the timeout
2462 /// completely. Implementations that cannot completely disable the timeout MUST
2463 /// instead interpret the zero duration as the longest possible value to which
2464 /// the timeout can be set.
2465 ///
2466 /// An entire client HTTP transaction with a gateway, covered by the Request timeout,
2467 /// may result in more than one call from the gateway to the destination backend,
2468 /// for example, if automatic retries are supported.
2469 ///
2470 /// The value of BackendRequest must be a Gateway API Duration string as defined by
2471 /// GEP-2257. When this field is unspecified, its behavior is implementation-specific;
2472 /// when specified, the value of BackendRequest must be no more than the value of the
2473 /// Request timeout (since the Request timeout encompasses the BackendRequest timeout).
2474 ///
2475 /// Support: Extended
2476 #[serde(default, skip_serializing_if = "Option::is_none", rename = "backendRequest")]
2477 pub backend_request: Option<String>,
2478 /// Request specifies the maximum duration for a gateway to respond to an HTTP request.
2479 /// If the gateway has not been able to respond before this deadline is met, the gateway
2480 /// MUST return a timeout error.
2481 ///
2482 /// For example, setting the `rules.timeouts.request` field to the value `10s` in an
2483 /// `HTTPRoute` will cause a timeout if a client request is taking longer than 10 seconds
2484 /// to complete.
2485 ///
2486 /// Setting a timeout to the zero duration (e.g. "0s") SHOULD disable the timeout
2487 /// completely. Implementations that cannot completely disable the timeout MUST
2488 /// instead interpret the zero duration as the longest possible value to which
2489 /// the timeout can be set.
2490 ///
2491 /// This timeout is intended to cover as close to the whole request-response transaction
2492 /// as possible although an implementation MAY choose to start the timeout after the entire
2493 /// request stream has been received instead of immediately after the transaction is
2494 /// initiated by the client.
2495 ///
2496 /// The value of Request is a Gateway API Duration string as defined by GEP-2257. When this
2497 /// field is unspecified, request timeout behavior is implementation-specific.
2498 ///
2499 /// Support: Extended
2500 #[serde(default, skip_serializing_if = "Option::is_none")]
2501 pub request: Option<String>,
2502}
2503
2504/// Status defines the current state of HTTPRoute.
2505#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2506pub struct HttpRouteStatus {
2507 /// Parents is a list of parent resources (usually Gateways) that are
2508 /// associated with the route, and the status of the route with respect to
2509 /// each parent. When this route attaches to a parent, the controller that
2510 /// manages the parent must add an entry to this list when the controller
2511 /// first sees the route and should update the entry as appropriate when the
2512 /// route or gateway is modified.
2513 ///
2514 /// Note that parent references that cannot be resolved by an implementation
2515 /// of this API will not be added to this list. Implementations of this API
2516 /// can only populate Route status for the Gateways/parent resources they are
2517 /// responsible for.
2518 ///
2519 /// A maximum of 32 Gateways will be represented in this list. An empty list
2520 /// means the route has not been attached to any Gateway.
2521 pub parents: Vec<HttpRouteStatusParents>,
2522}
2523
2524/// RouteParentStatus describes the status of a route with respect to an
2525/// associated Parent.
2526#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2527pub struct HttpRouteStatusParents {
2528 /// Conditions describes the status of the route with respect to the Gateway.
2529 /// Note that the route's availability is also subject to the Gateway's own
2530 /// status conditions and listener status.
2531 ///
2532 /// If the Route's ParentRef specifies an existing Gateway that supports
2533 /// Routes of this kind AND that Gateway's controller has sufficient access,
2534 /// then that Gateway's controller MUST set the "Accepted" condition on the
2535 /// Route, to indicate whether the route has been accepted or rejected by the
2536 /// Gateway, and why.
2537 ///
2538 /// A Route MUST be considered "Accepted" if at least one of the Route's
2539 /// rules is implemented by the Gateway.
2540 ///
2541 /// There are a number of cases where the "Accepted" condition may not be set
2542 /// due to lack of controller visibility, that includes when:
2543 ///
2544 /// * The Route refers to a nonexistent parent.
2545 /// * The Route is of a type that the controller does not support.
2546 /// * The Route is in a namespace to which the controller does not have access.
2547 pub conditions: Vec<Condition>,
2548 /// ControllerName is a domain/path string that indicates the name of the
2549 /// controller that wrote this status. This corresponds with the
2550 /// controllerName field on GatewayClass.
2551 ///
2552 /// Example: "example.net/gateway-controller".
2553 ///
2554 /// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are
2555 /// valid Kubernetes names
2556 /// (<https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).>
2557 ///
2558 /// Controllers MUST populate this field when writing status. Controllers should ensure that
2559 /// entries to status populated with their ControllerName are cleaned up when they are no
2560 /// longer necessary.
2561 #[serde(rename = "controllerName")]
2562 pub controller_name: String,
2563 /// ParentRef corresponds with a ParentRef in the spec that this
2564 /// RouteParentStatus struct describes the status of.
2565 #[serde(rename = "parentRef")]
2566 pub parent_ref: HttpRouteStatusParentsParentRef,
2567}
2568
2569/// ParentRef corresponds with a ParentRef in the spec that this
2570/// RouteParentStatus struct describes the status of.
2571#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2572pub struct HttpRouteStatusParentsParentRef {
2573 /// Group is the group of the referent.
2574 /// When unspecified, "gateway.networking.k8s.io" is inferred.
2575 /// To set the core API group (such as for a "Service" kind referent),
2576 /// Group must be explicitly set to "" (empty string).
2577 ///
2578 /// Support: Core
2579 #[serde(default, skip_serializing_if = "Option::is_none")]
2580 pub group: Option<String>,
2581 /// Kind is kind of the referent.
2582 ///
2583 /// There are two kinds of parent resources with "Core" support:
2584 ///
2585 /// * Gateway (Gateway conformance profile)
2586 /// * Service (Mesh conformance profile, ClusterIP Services only)
2587 ///
2588 /// Support for other resources is Implementation-Specific.
2589 #[serde(default, skip_serializing_if = "Option::is_none")]
2590 pub kind: Option<String>,
2591 /// Name is the name of the referent.
2592 ///
2593 /// Support: Core
2594 pub name: String,
2595 /// Namespace is the namespace of the referent. When unspecified, this refers
2596 /// to the local namespace of the Route.
2597 ///
2598 /// Note that there are specific rules for ParentRefs which cross namespace
2599 /// boundaries. Cross-namespace references are only valid if they are explicitly
2600 /// allowed by something in the namespace they are referring to. For example:
2601 /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
2602 /// generic way to enable any other kind of cross-namespace reference.
2603 ///
2604 /// Support: Core
2605 #[serde(default, skip_serializing_if = "Option::is_none")]
2606 pub namespace: Option<String>,
2607 /// Port is the network port this Route targets. It can be interpreted
2608 /// differently based on the type of parent resource.
2609 ///
2610 /// When the parent resource is a Gateway, this targets all listeners
2611 /// listening on the specified port that also support this kind of Route(and
2612 /// select this Route). It's not recommended to set `Port` unless the
2613 /// networking behaviors specified in a Route must apply to a specific port
2614 /// as opposed to a listener(s) whose port(s) may be changed. When both Port
2615 /// and SectionName are specified, the name and port of the selected listener
2616 /// must match both specified values.
2617 ///
2618 /// Implementations MAY choose to support other parent resources.
2619 /// Implementations supporting other types of parent resources MUST clearly
2620 /// document how/if Port is interpreted.
2621 ///
2622 /// For the purpose of status, an attachment is considered successful as
2623 /// long as the parent resource accepts it partially. For example, Gateway
2624 /// listeners can restrict which Routes can attach to them by Route kind,
2625 /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
2626 /// from the referencing Route, the Route MUST be considered successfully
2627 /// attached. If no Gateway listeners accept attachment from this Route,
2628 /// the Route MUST be considered detached from the Gateway.
2629 ///
2630 /// Support: Extended
2631 #[serde(default, skip_serializing_if = "Option::is_none")]
2632 pub port: Option<i32>,
2633 /// SectionName is the name of a section within the target resource. In the
2634 /// following resources, SectionName is interpreted as the following:
2635 ///
2636 /// * Gateway: Listener name. When both Port (experimental) and SectionName
2637 /// are specified, the name and port of the selected listener must match
2638 /// both specified values.
2639 /// * Service: Port name. When both Port (experimental) and SectionName
2640 /// are specified, the name and port of the selected listener must match
2641 /// both specified values.
2642 ///
2643 /// Implementations MAY choose to support attaching Routes to other resources.
2644 /// If that is the case, they MUST clearly document how SectionName is
2645 /// interpreted.
2646 ///
2647 /// When unspecified (empty string), this will reference the entire resource.
2648 /// For the purpose of status, an attachment is considered successful if at
2649 /// least one section in the parent resource accepts it. For example, Gateway
2650 /// listeners can restrict which Routes can attach to them by Route kind,
2651 /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
2652 /// the referencing Route, the Route MUST be considered successfully
2653 /// attached. If no Gateway listeners accept attachment from this Route, the
2654 /// Route MUST be considered detached from the Gateway.
2655 ///
2656 /// Support: Core
2657 #[serde(default, skip_serializing_if = "Option::is_none", rename = "sectionName")]
2658 pub section_name: Option<String>,
2659}