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