k8s_traefik_api/
middlewares.rs

1// WARNING: generated by kopium - manual changes will be overwritten
2// kopium command: kopium middlewares.traefik.io -A -b --derive=Default --derive=PartialEq --smart-derive-elision
3// kopium version: 0.21.2
4
5#[allow(unused_imports)]
6mod prelude {
7    pub use kube::CustomResource;
8    pub use typed_builder::TypedBuilder;
9    pub use schemars::JsonSchema;
10    pub use serde::{Serialize, Deserialize};
11    pub use std::collections::BTreeMap;
12    pub use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
13}
14use self::prelude::*;
15
16/// MiddlewareSpec defines the desired state of a Middleware.
17#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
18#[kube(group = "traefik.io", version = "v1alpha1", kind = "Middleware", plural = "middlewares")]
19#[kube(namespaced)]
20#[kube(derive="Default")]
21#[kube(derive="PartialEq")]
22pub struct MiddlewareSpec {
23    /// AddPrefix holds the add prefix middleware configuration.
24    /// This middleware updates the path of a request before forwarding it.
25    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/addprefix/
26    #[serde(default, skip_serializing_if = "Option::is_none", rename = "addPrefix")]
27    #[builder(default, setter(strip_option))]
28    pub add_prefix: Option<MiddlewareAddPrefix>,
29    /// BasicAuth holds the basic auth middleware configuration.
30    /// This middleware restricts access to your services to known users.
31    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/basicauth/
32    #[serde(default, skip_serializing_if = "Option::is_none", rename = "basicAuth")]
33    #[builder(default, setter(strip_option))]
34    pub basic_auth: Option<MiddlewareBasicAuth>,
35    /// Buffering holds the buffering middleware configuration.
36    /// This middleware retries or limits the size of requests that can be forwarded to backends.
37    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/buffering/#maxrequestbodybytes
38    #[serde(default, skip_serializing_if = "Option::is_none")]
39    #[builder(default, setter(strip_option))]
40    pub buffering: Option<MiddlewareBuffering>,
41    /// Chain holds the configuration of the chain middleware.
42    /// This middleware enables to define reusable combinations of other pieces of middleware.
43    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/chain/
44    #[serde(default, skip_serializing_if = "Option::is_none")]
45    #[builder(default, setter(strip_option))]
46    pub chain: Option<MiddlewareChain>,
47    /// CircuitBreaker holds the circuit breaker configuration.
48    #[serde(default, skip_serializing_if = "Option::is_none", rename = "circuitBreaker")]
49    #[builder(default, setter(strip_option))]
50    pub circuit_breaker: Option<MiddlewareCircuitBreaker>,
51    /// Compress holds the compress middleware configuration.
52    /// This middleware compresses responses before sending them to the client, using gzip, brotli, or zstd compression.
53    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/compress/
54    #[serde(default, skip_serializing_if = "Option::is_none")]
55    #[builder(default, setter(strip_option))]
56    pub compress: Option<MiddlewareCompress>,
57    /// ContentType holds the content-type middleware configuration.
58    /// This middleware exists to enable the correct behavior until at least the default one can be changed in a future version.
59    #[serde(default, skip_serializing_if = "Option::is_none", rename = "contentType")]
60    #[builder(default, setter(strip_option))]
61    pub content_type: Option<MiddlewareContentType>,
62    /// DigestAuth holds the digest auth middleware configuration.
63    /// This middleware restricts access to your services to known users.
64    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/digestauth/
65    #[serde(default, skip_serializing_if = "Option::is_none", rename = "digestAuth")]
66    #[builder(default, setter(strip_option))]
67    pub digest_auth: Option<MiddlewareDigestAuth>,
68    /// ErrorPage holds the custom error middleware configuration.
69    /// This middleware returns a custom page in lieu of the default, according to configured ranges of HTTP Status codes.
70    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/errorpages/
71    #[serde(default, skip_serializing_if = "Option::is_none")]
72    #[builder(default, setter(strip_option))]
73    pub errors: Option<MiddlewareErrors>,
74    /// ForwardAuth holds the forward auth middleware configuration.
75    /// This middleware delegates the request authentication to a Service.
76    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/forwardauth/
77    #[serde(default, skip_serializing_if = "Option::is_none", rename = "forwardAuth")]
78    #[builder(default, setter(strip_option))]
79    pub forward_auth: Option<MiddlewareForwardAuth>,
80    /// GrpcWeb holds the gRPC web middleware configuration.
81    /// This middleware converts a gRPC web request to an HTTP/2 gRPC request.
82    #[serde(default, skip_serializing_if = "Option::is_none", rename = "grpcWeb")]
83    #[builder(default, setter(strip_option))]
84    pub grpc_web: Option<MiddlewareGrpcWeb>,
85    /// Headers holds the headers middleware configuration.
86    /// This middleware manages the requests and responses headers.
87    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/headers/#customrequestheaders
88    #[serde(default, skip_serializing_if = "Option::is_none")]
89    #[builder(default, setter(strip_option))]
90    pub headers: Option<MiddlewareHeaders>,
91    /// InFlightReq holds the in-flight request middleware configuration.
92    /// This middleware limits the number of requests being processed and served concurrently.
93    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/inflightreq/
94    #[serde(default, skip_serializing_if = "Option::is_none", rename = "inFlightReq")]
95    #[builder(default, setter(strip_option))]
96    pub in_flight_req: Option<MiddlewareInFlightReq>,
97    /// IPAllowList holds the IP allowlist middleware configuration.
98    /// This middleware limits allowed requests based on the client IP.
99    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ipallowlist/
100    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ipAllowList")]
101    #[builder(default, setter(strip_option))]
102    pub ip_allow_list: Option<MiddlewareIpAllowList>,
103    /// Deprecated: please use IPAllowList instead.
104    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ipWhiteList")]
105    #[builder(default, setter(strip_option))]
106    pub ip_white_list: Option<MiddlewareIpWhiteList>,
107    /// PassTLSClientCert holds the pass TLS client cert middleware configuration.
108    /// This middleware adds the selected data from the passed client TLS certificate to a header.
109    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/passtlsclientcert/
110    #[serde(default, skip_serializing_if = "Option::is_none", rename = "passTLSClientCert")]
111    #[builder(default, setter(strip_option))]
112    pub pass_tls_client_cert: Option<MiddlewarePassTlsClientCert>,
113    /// Plugin defines the middleware plugin configuration.
114    /// More info: https://doc.traefik.io/traefik/plugins/
115    #[serde(default, skip_serializing_if = "Option::is_none")]
116    #[builder(default, setter(strip_option))]
117    pub plugin: Option<BTreeMap<String, serde_json::Value>>,
118    /// RateLimit holds the rate limit configuration.
119    /// This middleware ensures that services will receive a fair amount of requests, and allows one to define what fair is.
120    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ratelimit/
121    #[serde(default, skip_serializing_if = "Option::is_none", rename = "rateLimit")]
122    #[builder(default, setter(strip_option))]
123    pub rate_limit: Option<MiddlewareRateLimit>,
124    /// RedirectRegex holds the redirect regex middleware configuration.
125    /// This middleware redirects a request using regex matching and replacement.
126    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/redirectregex/#regex
127    #[serde(default, skip_serializing_if = "Option::is_none", rename = "redirectRegex")]
128    #[builder(default, setter(strip_option))]
129    pub redirect_regex: Option<MiddlewareRedirectRegex>,
130    /// RedirectScheme holds the redirect scheme middleware configuration.
131    /// This middleware redirects requests from a scheme/port to another.
132    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/redirectscheme/
133    #[serde(default, skip_serializing_if = "Option::is_none", rename = "redirectScheme")]
134    #[builder(default, setter(strip_option))]
135    pub redirect_scheme: Option<MiddlewareRedirectScheme>,
136    /// ReplacePath holds the replace path middleware configuration.
137    /// This middleware replaces the path of the request URL and store the original path in an X-Replaced-Path header.
138    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/replacepath/
139    #[serde(default, skip_serializing_if = "Option::is_none", rename = "replacePath")]
140    #[builder(default, setter(strip_option))]
141    pub replace_path: Option<MiddlewareReplacePath>,
142    /// ReplacePathRegex holds the replace path regex middleware configuration.
143    /// This middleware replaces the path of a URL using regex matching and replacement.
144    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/replacepathregex/
145    #[serde(default, skip_serializing_if = "Option::is_none", rename = "replacePathRegex")]
146    #[builder(default, setter(strip_option))]
147    pub replace_path_regex: Option<MiddlewareReplacePathRegex>,
148    /// Retry holds the retry middleware configuration.
149    /// This middleware reissues requests a given number of times to a backend server if that server does not reply.
150    /// As soon as the server answers, the middleware stops retrying, regardless of the response status.
151    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/retry/
152    #[serde(default, skip_serializing_if = "Option::is_none")]
153    #[builder(default, setter(strip_option))]
154    pub retry: Option<MiddlewareRetry>,
155    /// StripPrefix holds the strip prefix middleware configuration.
156    /// This middleware removes the specified prefixes from the URL path.
157    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/stripprefix/
158    #[serde(default, skip_serializing_if = "Option::is_none", rename = "stripPrefix")]
159    #[builder(default, setter(strip_option))]
160    pub strip_prefix: Option<MiddlewareStripPrefix>,
161    /// StripPrefixRegex holds the strip prefix regex middleware configuration.
162    /// This middleware removes the matching prefixes from the URL path.
163    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/stripprefixregex/
164    #[serde(default, skip_serializing_if = "Option::is_none", rename = "stripPrefixRegex")]
165    #[builder(default, setter(strip_option))]
166    pub strip_prefix_regex: Option<MiddlewareStripPrefixRegex>,
167}
168
169/// AddPrefix holds the add prefix middleware configuration.
170/// This middleware updates the path of a request before forwarding it.
171/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/addprefix/
172#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
173pub struct MiddlewareAddPrefix {
174    /// Prefix is the string to add before the current path in the requested URL.
175    /// It should include a leading slash (/).
176    #[serde(default, skip_serializing_if = "Option::is_none")]
177    #[builder(default, setter(strip_option))]
178    pub prefix: Option<String>,
179}
180
181/// BasicAuth holds the basic auth middleware configuration.
182/// This middleware restricts access to your services to known users.
183/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/basicauth/
184#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
185pub struct MiddlewareBasicAuth {
186    /// HeaderField defines a header field to store the authenticated user.
187    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/basicauth/#headerfield
188    #[serde(default, skip_serializing_if = "Option::is_none", rename = "headerField")]
189    #[builder(default, setter(strip_option))]
190    pub header_field: Option<String>,
191    /// Realm allows the protected resources on a server to be partitioned into a set of protection spaces, each with its own authentication scheme.
192    /// Default: traefik.
193    #[serde(default, skip_serializing_if = "Option::is_none")]
194    #[builder(default, setter(strip_option))]
195    pub realm: Option<String>,
196    /// RemoveHeader sets the removeHeader option to true to remove the authorization header before forwarding the request to your service.
197    /// Default: false.
198    #[serde(default, skip_serializing_if = "Option::is_none", rename = "removeHeader")]
199    #[builder(default, setter(strip_option))]
200    pub remove_header: Option<bool>,
201    /// Secret is the name of the referenced Kubernetes Secret containing user credentials.
202    #[serde(default, skip_serializing_if = "Option::is_none")]
203    #[builder(default, setter(strip_option))]
204    pub secret: Option<String>,
205}
206
207/// Buffering holds the buffering middleware configuration.
208/// This middleware retries or limits the size of requests that can be forwarded to backends.
209/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/buffering/#maxrequestbodybytes
210#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
211pub struct MiddlewareBuffering {
212    /// MaxRequestBodyBytes defines the maximum allowed body size for the request (in bytes).
213    /// If the request exceeds the allowed size, it is not forwarded to the service, and the client gets a 413 (Request Entity Too Large) response.
214    /// Default: 0 (no maximum).
215    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxRequestBodyBytes")]
216    #[builder(default, setter(strip_option))]
217    pub max_request_body_bytes: Option<i64>,
218    /// MaxResponseBodyBytes defines the maximum allowed response size from the service (in bytes).
219    /// If the response exceeds the allowed size, it is not forwarded to the client. The client gets a 500 (Internal Server Error) response instead.
220    /// Default: 0 (no maximum).
221    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxResponseBodyBytes")]
222    #[builder(default, setter(strip_option))]
223    pub max_response_body_bytes: Option<i64>,
224    /// MemRequestBodyBytes defines the threshold (in bytes) from which the request will be buffered on disk instead of in memory.
225    /// Default: 1048576 (1Mi).
226    #[serde(default, skip_serializing_if = "Option::is_none", rename = "memRequestBodyBytes")]
227    #[builder(default, setter(strip_option))]
228    pub mem_request_body_bytes: Option<i64>,
229    /// MemResponseBodyBytes defines the threshold (in bytes) from which the response will be buffered on disk instead of in memory.
230    /// Default: 1048576 (1Mi).
231    #[serde(default, skip_serializing_if = "Option::is_none", rename = "memResponseBodyBytes")]
232    #[builder(default, setter(strip_option))]
233    pub mem_response_body_bytes: Option<i64>,
234    /// RetryExpression defines the retry conditions.
235    /// It is a logical combination of functions with operators AND (&&) and OR (||).
236    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/buffering/#retryexpression
237    #[serde(default, skip_serializing_if = "Option::is_none", rename = "retryExpression")]
238    #[builder(default, setter(strip_option))]
239    pub retry_expression: Option<String>,
240}
241
242/// Chain holds the configuration of the chain middleware.
243/// This middleware enables to define reusable combinations of other pieces of middleware.
244/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/chain/
245#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
246pub struct MiddlewareChain {
247    /// Middlewares is the list of MiddlewareRef which composes the chain.
248    #[serde(default, skip_serializing_if = "Option::is_none")]
249    #[builder(default, setter(strip_option))]
250    pub middlewares: Option<Vec<MiddlewareChainMiddlewares>>,
251}
252
253/// MiddlewareRef is a reference to a Middleware resource.
254#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
255pub struct MiddlewareChainMiddlewares {
256    /// Name defines the name of the referenced Middleware resource.
257    pub name: String,
258    /// Namespace defines the namespace of the referenced Middleware resource.
259    #[serde(default, skip_serializing_if = "Option::is_none")]
260    #[builder(default, setter(strip_option))]
261    pub namespace: Option<String>,
262}
263
264/// CircuitBreaker holds the circuit breaker configuration.
265#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
266pub struct MiddlewareCircuitBreaker {
267    /// CheckPeriod is the interval between successive checks of the circuit breaker condition (when in standby state).
268    #[serde(default, skip_serializing_if = "Option::is_none", rename = "checkPeriod")]
269    #[builder(default, setter(strip_option))]
270    pub check_period: Option<IntOrString>,
271    /// Expression is the condition that triggers the tripped state.
272    #[serde(default, skip_serializing_if = "Option::is_none")]
273    #[builder(default, setter(strip_option))]
274    pub expression: Option<String>,
275    /// FallbackDuration is the duration for which the circuit breaker will wait before trying to recover (from a tripped state).
276    #[serde(default, skip_serializing_if = "Option::is_none", rename = "fallbackDuration")]
277    #[builder(default, setter(strip_option))]
278    pub fallback_duration: Option<IntOrString>,
279    /// RecoveryDuration is the duration for which the circuit breaker will try to recover (as soon as it is in recovering state).
280    #[serde(default, skip_serializing_if = "Option::is_none", rename = "recoveryDuration")]
281    #[builder(default, setter(strip_option))]
282    pub recovery_duration: Option<IntOrString>,
283    /// ResponseCode is the status code that the circuit breaker will return while it is in the open state.
284    #[serde(default, skip_serializing_if = "Option::is_none", rename = "responseCode")]
285    #[builder(default, setter(strip_option))]
286    pub response_code: Option<i64>,
287}
288
289/// Compress holds the compress middleware configuration.
290/// This middleware compresses responses before sending them to the client, using gzip, brotli, or zstd compression.
291/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/compress/
292#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
293pub struct MiddlewareCompress {
294    /// DefaultEncoding specifies the default encoding if the `Accept-Encoding` header is not in the request or contains a wildcard (`*`).
295    #[serde(default, skip_serializing_if = "Option::is_none", rename = "defaultEncoding")]
296    #[builder(default, setter(strip_option))]
297    pub default_encoding: Option<String>,
298    /// Encodings defines the list of supported compression algorithms.
299    #[serde(default, skip_serializing_if = "Option::is_none")]
300    #[builder(default, setter(strip_option))]
301    pub encodings: Option<Vec<String>>,
302    /// ExcludedContentTypes defines the list of content types to compare the Content-Type header of the incoming requests and responses before compressing.
303    /// `application/grpc` is always excluded.
304    #[serde(default, skip_serializing_if = "Option::is_none", rename = "excludedContentTypes")]
305    #[builder(default, setter(strip_option))]
306    pub excluded_content_types: Option<Vec<String>>,
307    /// IncludedContentTypes defines the list of content types to compare the Content-Type header of the responses before compressing.
308    #[serde(default, skip_serializing_if = "Option::is_none", rename = "includedContentTypes")]
309    #[builder(default, setter(strip_option))]
310    pub included_content_types: Option<Vec<String>>,
311    /// MinResponseBodyBytes defines the minimum amount of bytes a response body must have to be compressed.
312    /// Default: 1024.
313    #[serde(default, skip_serializing_if = "Option::is_none", rename = "minResponseBodyBytes")]
314    #[builder(default, setter(strip_option))]
315    pub min_response_body_bytes: Option<i64>,
316}
317
318/// ContentType holds the content-type middleware configuration.
319/// This middleware exists to enable the correct behavior until at least the default one can be changed in a future version.
320#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
321pub struct MiddlewareContentType {
322    /// AutoDetect specifies whether to let the `Content-Type` header, if it has not been set by the backend,
323    /// be automatically set to a value derived from the contents of the response.
324    /// Deprecated: AutoDetect option is deprecated, Content-Type middleware is only meant to be used to enable the content-type detection, please remove any usage of this option.
325    #[serde(default, skip_serializing_if = "Option::is_none", rename = "autoDetect")]
326    #[builder(default, setter(strip_option))]
327    pub auto_detect: Option<bool>,
328}
329
330/// DigestAuth holds the digest auth middleware configuration.
331/// This middleware restricts access to your services to known users.
332/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/digestauth/
333#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
334pub struct MiddlewareDigestAuth {
335    /// HeaderField defines a header field to store the authenticated user.
336    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/basicauth/#headerfield
337    #[serde(default, skip_serializing_if = "Option::is_none", rename = "headerField")]
338    #[builder(default, setter(strip_option))]
339    pub header_field: Option<String>,
340    /// Realm allows the protected resources on a server to be partitioned into a set of protection spaces, each with its own authentication scheme.
341    /// Default: traefik.
342    #[serde(default, skip_serializing_if = "Option::is_none")]
343    #[builder(default, setter(strip_option))]
344    pub realm: Option<String>,
345    /// RemoveHeader defines whether to remove the authorization header before forwarding the request to the backend.
346    #[serde(default, skip_serializing_if = "Option::is_none", rename = "removeHeader")]
347    #[builder(default, setter(strip_option))]
348    pub remove_header: Option<bool>,
349    /// Secret is the name of the referenced Kubernetes Secret containing user credentials.
350    #[serde(default, skip_serializing_if = "Option::is_none")]
351    #[builder(default, setter(strip_option))]
352    pub secret: Option<String>,
353}
354
355/// ErrorPage holds the custom error middleware configuration.
356/// This middleware returns a custom page in lieu of the default, according to configured ranges of HTTP Status codes.
357/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/errorpages/
358#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
359pub struct MiddlewareErrors {
360    /// Query defines the URL for the error page (hosted by service).
361    /// The {status} variable can be used in order to insert the status code in the URL.
362    #[serde(default, skip_serializing_if = "Option::is_none")]
363    #[builder(default, setter(strip_option))]
364    pub query: Option<String>,
365    /// Service defines the reference to a Kubernetes Service that will serve the error page.
366    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/errorpages/#service
367    #[serde(default, skip_serializing_if = "Option::is_none")]
368    #[builder(default, setter(strip_option))]
369    pub service: Option<MiddlewareErrorsService>,
370    /// Status defines which status or range of statuses should result in an error page.
371    /// It can be either a status code as a number (500),
372    /// as multiple comma-separated numbers (500,502),
373    /// as ranges by separating two codes with a dash (500-599),
374    /// or a combination of the two (404,418,500-599).
375    #[serde(default, skip_serializing_if = "Option::is_none")]
376    #[builder(default, setter(strip_option))]
377    pub status: Option<Vec<String>>,
378}
379
380/// Service defines the reference to a Kubernetes Service that will serve the error page.
381/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/errorpages/#service
382#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
383pub struct MiddlewareErrorsService {
384    /// Healthcheck defines health checks for ExternalName services.
385    #[serde(default, skip_serializing_if = "Option::is_none", rename = "healthCheck")]
386    #[builder(default, setter(strip_option))]
387    pub health_check: Option<MiddlewareErrorsServiceHealthCheck>,
388    /// Kind defines the kind of the Service.
389    #[serde(default, skip_serializing_if = "Option::is_none")]
390    #[builder(default, setter(strip_option))]
391    pub kind: Option<MiddlewareErrorsServiceKind>,
392    /// Name defines the name of the referenced Kubernetes Service or TraefikService.
393    /// The differentiation between the two is specified in the Kind field.
394    pub name: String,
395    /// Namespace defines the namespace of the referenced Kubernetes Service or TraefikService.
396    #[serde(default, skip_serializing_if = "Option::is_none")]
397    #[builder(default, setter(strip_option))]
398    pub namespace: Option<String>,
399    /// NativeLB controls, when creating the load-balancer,
400    /// whether the LB's children are directly the pods IPs or if the only child is the Kubernetes Service clusterIP.
401    /// The Kubernetes Service itself does load-balance to the pods.
402    /// By default, NativeLB is false.
403    #[serde(default, skip_serializing_if = "Option::is_none", rename = "nativeLB")]
404    #[builder(default, setter(strip_option))]
405    pub native_lb: Option<bool>,
406    /// NodePortLB controls, when creating the load-balancer,
407    /// whether the LB's children are directly the nodes internal IPs using the nodePort when the service type is NodePort.
408    /// It allows services to be reachable when Traefik runs externally from the Kubernetes cluster but within the same network of the nodes.
409    /// By default, NodePortLB is false.
410    #[serde(default, skip_serializing_if = "Option::is_none", rename = "nodePortLB")]
411    #[builder(default, setter(strip_option))]
412    pub node_port_lb: Option<bool>,
413    /// PassHostHeader defines whether the client Host header is forwarded to the upstream Kubernetes Service.
414    /// By default, passHostHeader is true.
415    #[serde(default, skip_serializing_if = "Option::is_none", rename = "passHostHeader")]
416    #[builder(default, setter(strip_option))]
417    pub pass_host_header: Option<bool>,
418    /// Port defines the port of a Kubernetes Service.
419    /// This can be a reference to a named port.
420    #[serde(default, skip_serializing_if = "Option::is_none")]
421    #[builder(default, setter(strip_option))]
422    pub port: Option<IntOrString>,
423    /// ResponseForwarding defines how Traefik forwards the response from the upstream Kubernetes Service to the client.
424    #[serde(default, skip_serializing_if = "Option::is_none", rename = "responseForwarding")]
425    #[builder(default, setter(strip_option))]
426    pub response_forwarding: Option<MiddlewareErrorsServiceResponseForwarding>,
427    /// Scheme defines the scheme to use for the request to the upstream Kubernetes Service.
428    /// It defaults to https when Kubernetes Service port is 443, http otherwise.
429    #[serde(default, skip_serializing_if = "Option::is_none")]
430    #[builder(default, setter(strip_option))]
431    pub scheme: Option<String>,
432    /// ServersTransport defines the name of ServersTransport resource to use.
433    /// It allows to configure the transport between Traefik and your servers.
434    /// Can only be used on a Kubernetes Service.
435    #[serde(default, skip_serializing_if = "Option::is_none", rename = "serversTransport")]
436    #[builder(default, setter(strip_option))]
437    pub servers_transport: Option<String>,
438    /// Sticky defines the sticky sessions configuration.
439    /// More info: https://doc.traefik.io/traefik/v3.3/routing/services/#sticky-sessions
440    #[serde(default, skip_serializing_if = "Option::is_none")]
441    #[builder(default, setter(strip_option))]
442    pub sticky: Option<MiddlewareErrorsServiceSticky>,
443    /// Strategy defines the load balancing strategy between the servers.
444    /// RoundRobin is the only supported value at the moment.
445    #[serde(default, skip_serializing_if = "Option::is_none")]
446    #[builder(default, setter(strip_option))]
447    pub strategy: Option<String>,
448    /// Weight defines the weight and should only be specified when Name references a TraefikService object
449    /// (and to be precise, one that embeds a Weighted Round Robin).
450    #[serde(default, skip_serializing_if = "Option::is_none")]
451    #[builder(default, setter(strip_option))]
452    pub weight: Option<i64>,
453}
454
455/// Healthcheck defines health checks for ExternalName services.
456#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
457pub struct MiddlewareErrorsServiceHealthCheck {
458    /// FollowRedirects defines whether redirects should be followed during the health check calls.
459    /// Default: true
460    #[serde(default, skip_serializing_if = "Option::is_none", rename = "followRedirects")]
461    #[builder(default, setter(strip_option))]
462    pub follow_redirects: Option<bool>,
463    /// Headers defines custom headers to be sent to the health check endpoint.
464    #[serde(default, skip_serializing_if = "Option::is_none")]
465    #[builder(default, setter(strip_option))]
466    pub headers: Option<BTreeMap<String, String>>,
467    /// Hostname defines the value of hostname in the Host header of the health check request.
468    #[serde(default, skip_serializing_if = "Option::is_none")]
469    #[builder(default, setter(strip_option))]
470    pub hostname: Option<String>,
471    /// Interval defines the frequency of the health check calls.
472    /// Default: 30s
473    #[serde(default, skip_serializing_if = "Option::is_none")]
474    #[builder(default, setter(strip_option))]
475    pub interval: Option<IntOrString>,
476    /// Method defines the healthcheck method.
477    #[serde(default, skip_serializing_if = "Option::is_none")]
478    #[builder(default, setter(strip_option))]
479    pub method: Option<String>,
480    /// Mode defines the health check mode.
481    /// If defined to grpc, will use the gRPC health check protocol to probe the server.
482    /// Default: http
483    #[serde(default, skip_serializing_if = "Option::is_none")]
484    #[builder(default, setter(strip_option))]
485    pub mode: Option<String>,
486    /// Path defines the server URL path for the health check endpoint.
487    #[serde(default, skip_serializing_if = "Option::is_none")]
488    #[builder(default, setter(strip_option))]
489    pub path: Option<String>,
490    /// Port defines the server URL port for the health check endpoint.
491    #[serde(default, skip_serializing_if = "Option::is_none")]
492    #[builder(default, setter(strip_option))]
493    pub port: Option<i64>,
494    /// Scheme replaces the server URL scheme for the health check endpoint.
495    #[serde(default, skip_serializing_if = "Option::is_none")]
496    #[builder(default, setter(strip_option))]
497    pub scheme: Option<String>,
498    /// Status defines the expected HTTP status code of the response to the health check request.
499    #[serde(default, skip_serializing_if = "Option::is_none")]
500    #[builder(default, setter(strip_option))]
501    pub status: Option<i64>,
502    /// Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy.
503    /// Default: 5s
504    #[serde(default, skip_serializing_if = "Option::is_none")]
505    #[builder(default, setter(strip_option))]
506    pub timeout: Option<IntOrString>,
507}
508
509/// Service defines the reference to a Kubernetes Service that will serve the error page.
510/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/errorpages/#service
511#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
512pub enum MiddlewareErrorsServiceKind {
513    Service,
514    TraefikService,
515}
516
517/// ResponseForwarding defines how Traefik forwards the response from the upstream Kubernetes Service to the client.
518#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
519pub struct MiddlewareErrorsServiceResponseForwarding {
520    /// FlushInterval defines the interval, in milliseconds, in between flushes to the client while copying the response body.
521    /// A negative value means to flush immediately after each write to the client.
522    /// This configuration is ignored when ReverseProxy recognizes a response as a streaming response;
523    /// for such responses, writes are flushed to the client immediately.
524    /// Default: 100ms
525    #[serde(default, skip_serializing_if = "Option::is_none", rename = "flushInterval")]
526    #[builder(default, setter(strip_option))]
527    pub flush_interval: Option<String>,
528}
529
530/// Sticky defines the sticky sessions configuration.
531/// More info: https://doc.traefik.io/traefik/v3.3/routing/services/#sticky-sessions
532#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
533pub struct MiddlewareErrorsServiceSticky {
534    /// Cookie defines the sticky cookie configuration.
535    #[serde(default, skip_serializing_if = "Option::is_none")]
536    #[builder(default, setter(strip_option))]
537    pub cookie: Option<MiddlewareErrorsServiceStickyCookie>,
538}
539
540/// Cookie defines the sticky cookie configuration.
541#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
542pub struct MiddlewareErrorsServiceStickyCookie {
543    /// HTTPOnly defines whether the cookie can be accessed by client-side APIs, such as JavaScript.
544    #[serde(default, skip_serializing_if = "Option::is_none", rename = "httpOnly")]
545    #[builder(default, setter(strip_option))]
546    pub http_only: Option<bool>,
547    /// MaxAge defines the number of seconds until the cookie expires.
548    /// When set to a negative number, the cookie expires immediately.
549    /// When set to zero, the cookie never expires.
550    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxAge")]
551    #[builder(default, setter(strip_option))]
552    pub max_age: Option<i64>,
553    /// Name defines the Cookie name.
554    #[serde(default, skip_serializing_if = "Option::is_none")]
555    #[builder(default, setter(strip_option))]
556    pub name: Option<String>,
557    /// Path defines the path that must exist in the requested URL for the browser to send the Cookie header.
558    /// When not provided the cookie will be sent on every request to the domain.
559    /// More info: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#pathpath-value
560    #[serde(default, skip_serializing_if = "Option::is_none")]
561    #[builder(default, setter(strip_option))]
562    pub path: Option<String>,
563    /// SameSite defines the same site policy.
564    /// More info: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
565    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sameSite")]
566    #[builder(default, setter(strip_option))]
567    pub same_site: Option<String>,
568    /// Secure defines whether the cookie can only be transmitted over an encrypted connection (i.e. HTTPS).
569    #[serde(default, skip_serializing_if = "Option::is_none")]
570    #[builder(default, setter(strip_option))]
571    pub secure: Option<bool>,
572}
573
574/// ForwardAuth holds the forward auth middleware configuration.
575/// This middleware delegates the request authentication to a Service.
576/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/forwardauth/
577#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
578pub struct MiddlewareForwardAuth {
579    /// AddAuthCookiesToResponse defines the list of cookies to copy from the authentication server response to the response.
580    #[serde(default, skip_serializing_if = "Option::is_none", rename = "addAuthCookiesToResponse")]
581    #[builder(default, setter(strip_option))]
582    pub add_auth_cookies_to_response: Option<Vec<String>>,
583    /// Address defines the authentication server address.
584    #[serde(default, skip_serializing_if = "Option::is_none")]
585    #[builder(default, setter(strip_option))]
586    pub address: Option<String>,
587    /// AuthRequestHeaders defines the list of the headers to copy from the request to the authentication server.
588    /// If not set or empty then all request headers are passed.
589    #[serde(default, skip_serializing_if = "Option::is_none", rename = "authRequestHeaders")]
590    #[builder(default, setter(strip_option))]
591    pub auth_request_headers: Option<Vec<String>>,
592    /// AuthResponseHeaders defines the list of headers to copy from the authentication server response and set on forwarded request, replacing any existing conflicting headers.
593    #[serde(default, skip_serializing_if = "Option::is_none", rename = "authResponseHeaders")]
594    #[builder(default, setter(strip_option))]
595    pub auth_response_headers: Option<Vec<String>>,
596    /// AuthResponseHeadersRegex defines the regex to match headers to copy from the authentication server response and set on forwarded request, after stripping all headers that match the regex.
597    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/forwardauth/#authresponseheadersregex
598    #[serde(default, skip_serializing_if = "Option::is_none", rename = "authResponseHeadersRegex")]
599    #[builder(default, setter(strip_option))]
600    pub auth_response_headers_regex: Option<String>,
601    /// ForwardBody defines whether to send the request body to the authentication server.
602    #[serde(default, skip_serializing_if = "Option::is_none", rename = "forwardBody")]
603    #[builder(default, setter(strip_option))]
604    pub forward_body: Option<bool>,
605    /// MaxBodySize defines the maximum body size in bytes allowed to be forwarded to the authentication server.
606    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxBodySize")]
607    #[builder(default, setter(strip_option))]
608    pub max_body_size: Option<i64>,
609    /// PreserveLocationHeader defines whether to forward the Location header to the client as is or prefix it with the domain name of the authentication server.
610    #[serde(default, skip_serializing_if = "Option::is_none", rename = "preserveLocationHeader")]
611    #[builder(default, setter(strip_option))]
612    pub preserve_location_header: Option<bool>,
613    /// TLS defines the configuration used to secure the connection to the authentication server.
614    #[serde(default, skip_serializing_if = "Option::is_none")]
615    #[builder(default, setter(strip_option))]
616    pub tls: Option<MiddlewareForwardAuthTls>,
617    /// TrustForwardHeader defines whether to trust (ie: forward) all X-Forwarded-* headers.
618    #[serde(default, skip_serializing_if = "Option::is_none", rename = "trustForwardHeader")]
619    #[builder(default, setter(strip_option))]
620    pub trust_forward_header: Option<bool>,
621}
622
623/// TLS defines the configuration used to secure the connection to the authentication server.
624#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
625pub struct MiddlewareForwardAuthTls {
626    /// Deprecated: TLS client authentication is a server side option (see https://github.com/golang/go/blob/740a490f71d026bb7d2d13cb8fa2d6d6e0572b70/src/crypto/tls/common.go#L634).
627    #[serde(default, skip_serializing_if = "Option::is_none", rename = "caOptional")]
628    #[builder(default, setter(strip_option))]
629    pub ca_optional: Option<bool>,
630    /// CASecret is the name of the referenced Kubernetes Secret containing the CA to validate the server certificate.
631    /// The CA certificate is extracted from key `tls.ca` or `ca.crt`.
632    #[serde(default, skip_serializing_if = "Option::is_none", rename = "caSecret")]
633    #[builder(default, setter(strip_option))]
634    pub ca_secret: Option<String>,
635    /// CertSecret is the name of the referenced Kubernetes Secret containing the client certificate.
636    /// The client certificate is extracted from the keys `tls.crt` and `tls.key`.
637    #[serde(default, skip_serializing_if = "Option::is_none", rename = "certSecret")]
638    #[builder(default, setter(strip_option))]
639    pub cert_secret: Option<String>,
640    /// InsecureSkipVerify defines whether the server certificates should be validated.
641    #[serde(default, skip_serializing_if = "Option::is_none", rename = "insecureSkipVerify")]
642    #[builder(default, setter(strip_option))]
643    pub insecure_skip_verify: Option<bool>,
644}
645
646/// GrpcWeb holds the gRPC web middleware configuration.
647/// This middleware converts a gRPC web request to an HTTP/2 gRPC request.
648#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
649pub struct MiddlewareGrpcWeb {
650    /// AllowOrigins is a list of allowable origins.
651    /// Can also be a wildcard origin "*".
652    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowOrigins")]
653    #[builder(default, setter(strip_option))]
654    pub allow_origins: Option<Vec<String>>,
655}
656
657/// Headers holds the headers middleware configuration.
658/// This middleware manages the requests and responses headers.
659/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/headers/#customrequestheaders
660#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
661pub struct MiddlewareHeaders {
662    /// AccessControlAllowCredentials defines whether the request can include user credentials.
663    #[serde(default, skip_serializing_if = "Option::is_none", rename = "accessControlAllowCredentials")]
664    #[builder(default, setter(strip_option))]
665    pub access_control_allow_credentials: Option<bool>,
666    /// AccessControlAllowHeaders defines the Access-Control-Request-Headers values sent in preflight response.
667    #[serde(default, skip_serializing_if = "Option::is_none", rename = "accessControlAllowHeaders")]
668    #[builder(default, setter(strip_option))]
669    pub access_control_allow_headers: Option<Vec<String>>,
670    /// AccessControlAllowMethods defines the Access-Control-Request-Method values sent in preflight response.
671    #[serde(default, skip_serializing_if = "Option::is_none", rename = "accessControlAllowMethods")]
672    #[builder(default, setter(strip_option))]
673    pub access_control_allow_methods: Option<Vec<String>>,
674    /// AccessControlAllowOriginList is a list of allowable origins. Can also be a wildcard origin "*".
675    #[serde(default, skip_serializing_if = "Option::is_none", rename = "accessControlAllowOriginList")]
676    #[builder(default, setter(strip_option))]
677    pub access_control_allow_origin_list: Option<Vec<String>>,
678    /// AccessControlAllowOriginListRegex is a list of allowable origins written following the Regular Expression syntax (https://golang.org/pkg/regexp/).
679    #[serde(default, skip_serializing_if = "Option::is_none", rename = "accessControlAllowOriginListRegex")]
680    #[builder(default, setter(strip_option))]
681    pub access_control_allow_origin_list_regex: Option<Vec<String>>,
682    /// AccessControlExposeHeaders defines the Access-Control-Expose-Headers values sent in preflight response.
683    #[serde(default, skip_serializing_if = "Option::is_none", rename = "accessControlExposeHeaders")]
684    #[builder(default, setter(strip_option))]
685    pub access_control_expose_headers: Option<Vec<String>>,
686    /// AccessControlMaxAge defines the time that a preflight request may be cached.
687    #[serde(default, skip_serializing_if = "Option::is_none", rename = "accessControlMaxAge")]
688    #[builder(default, setter(strip_option))]
689    pub access_control_max_age: Option<i64>,
690    /// AddVaryHeader defines whether the Vary header is automatically added/updated when the AccessControlAllowOriginList is set.
691    #[serde(default, skip_serializing_if = "Option::is_none", rename = "addVaryHeader")]
692    #[builder(default, setter(strip_option))]
693    pub add_vary_header: Option<bool>,
694    /// AllowedHosts defines the fully qualified list of allowed domain names.
695    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowedHosts")]
696    #[builder(default, setter(strip_option))]
697    pub allowed_hosts: Option<Vec<String>>,
698    /// BrowserXSSFilter defines whether to add the X-XSS-Protection header with the value 1; mode=block.
699    #[serde(default, skip_serializing_if = "Option::is_none", rename = "browserXssFilter")]
700    #[builder(default, setter(strip_option))]
701    pub browser_xss_filter: Option<bool>,
702    /// ContentSecurityPolicy defines the Content-Security-Policy header value.
703    #[serde(default, skip_serializing_if = "Option::is_none", rename = "contentSecurityPolicy")]
704    #[builder(default, setter(strip_option))]
705    pub content_security_policy: Option<String>,
706    /// ContentSecurityPolicyReportOnly defines the Content-Security-Policy-Report-Only header value.
707    #[serde(default, skip_serializing_if = "Option::is_none", rename = "contentSecurityPolicyReportOnly")]
708    #[builder(default, setter(strip_option))]
709    pub content_security_policy_report_only: Option<String>,
710    /// ContentTypeNosniff defines whether to add the X-Content-Type-Options header with the nosniff value.
711    #[serde(default, skip_serializing_if = "Option::is_none", rename = "contentTypeNosniff")]
712    #[builder(default, setter(strip_option))]
713    pub content_type_nosniff: Option<bool>,
714    /// CustomBrowserXSSValue defines the X-XSS-Protection header value.
715    /// This overrides the BrowserXssFilter option.
716    #[serde(default, skip_serializing_if = "Option::is_none", rename = "customBrowserXSSValue")]
717    #[builder(default, setter(strip_option))]
718    pub custom_browser_xss_value: Option<String>,
719    /// CustomFrameOptionsValue defines the X-Frame-Options header value.
720    /// This overrides the FrameDeny option.
721    #[serde(default, skip_serializing_if = "Option::is_none", rename = "customFrameOptionsValue")]
722    #[builder(default, setter(strip_option))]
723    pub custom_frame_options_value: Option<String>,
724    /// CustomRequestHeaders defines the header names and values to apply to the request.
725    #[serde(default, skip_serializing_if = "Option::is_none", rename = "customRequestHeaders")]
726    #[builder(default, setter(strip_option))]
727    pub custom_request_headers: Option<BTreeMap<String, String>>,
728    /// CustomResponseHeaders defines the header names and values to apply to the response.
729    #[serde(default, skip_serializing_if = "Option::is_none", rename = "customResponseHeaders")]
730    #[builder(default, setter(strip_option))]
731    pub custom_response_headers: Option<BTreeMap<String, String>>,
732    /// Deprecated: FeaturePolicy option is deprecated, please use PermissionsPolicy instead.
733    #[serde(default, skip_serializing_if = "Option::is_none", rename = "featurePolicy")]
734    #[builder(default, setter(strip_option))]
735    pub feature_policy: Option<String>,
736    /// ForceSTSHeader defines whether to add the STS header even when the connection is HTTP.
737    #[serde(default, skip_serializing_if = "Option::is_none", rename = "forceSTSHeader")]
738    #[builder(default, setter(strip_option))]
739    pub force_sts_header: Option<bool>,
740    /// FrameDeny defines whether to add the X-Frame-Options header with the DENY value.
741    #[serde(default, skip_serializing_if = "Option::is_none", rename = "frameDeny")]
742    #[builder(default, setter(strip_option))]
743    pub frame_deny: Option<bool>,
744    /// HostsProxyHeaders defines the header keys that may hold a proxied hostname value for the request.
745    #[serde(default, skip_serializing_if = "Option::is_none", rename = "hostsProxyHeaders")]
746    #[builder(default, setter(strip_option))]
747    pub hosts_proxy_headers: Option<Vec<String>>,
748    /// IsDevelopment defines whether to mitigate the unwanted effects of the AllowedHosts, SSL, and STS options when developing.
749    /// Usually testing takes place using HTTP, not HTTPS, and on localhost, not your production domain.
750    /// If you would like your development environment to mimic production with complete Host blocking, SSL redirects,
751    /// and STS headers, leave this as false.
752    #[serde(default, skip_serializing_if = "Option::is_none", rename = "isDevelopment")]
753    #[builder(default, setter(strip_option))]
754    pub is_development: Option<bool>,
755    /// PermissionsPolicy defines the Permissions-Policy header value.
756    /// This allows sites to control browser features.
757    #[serde(default, skip_serializing_if = "Option::is_none", rename = "permissionsPolicy")]
758    #[builder(default, setter(strip_option))]
759    pub permissions_policy: Option<String>,
760    /// PublicKey is the public key that implements HPKP to prevent MITM attacks with forged certificates.
761    #[serde(default, skip_serializing_if = "Option::is_none", rename = "publicKey")]
762    #[builder(default, setter(strip_option))]
763    pub public_key: Option<String>,
764    /// ReferrerPolicy defines the Referrer-Policy header value.
765    /// This allows sites to control whether browsers forward the Referer header to other sites.
766    #[serde(default, skip_serializing_if = "Option::is_none", rename = "referrerPolicy")]
767    #[builder(default, setter(strip_option))]
768    pub referrer_policy: Option<String>,
769    /// Deprecated: SSLForceHost option is deprecated, please use RedirectRegex instead.
770    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sslForceHost")]
771    #[builder(default, setter(strip_option))]
772    pub ssl_force_host: Option<bool>,
773    /// Deprecated: SSLHost option is deprecated, please use RedirectRegex instead.
774    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sslHost")]
775    #[builder(default, setter(strip_option))]
776    pub ssl_host: Option<String>,
777    /// SSLProxyHeaders defines the header keys with associated values that would indicate a valid HTTPS request.
778    /// It can be useful when using other proxies (example: "X-Forwarded-Proto": "https").
779    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sslProxyHeaders")]
780    #[builder(default, setter(strip_option))]
781    pub ssl_proxy_headers: Option<BTreeMap<String, String>>,
782    /// Deprecated: SSLRedirect option is deprecated, please use EntryPoint redirection or RedirectScheme instead.
783    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sslRedirect")]
784    #[builder(default, setter(strip_option))]
785    pub ssl_redirect: Option<bool>,
786    /// Deprecated: SSLTemporaryRedirect option is deprecated, please use EntryPoint redirection or RedirectScheme instead.
787    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sslTemporaryRedirect")]
788    #[builder(default, setter(strip_option))]
789    pub ssl_temporary_redirect: Option<bool>,
790    /// STSIncludeSubdomains defines whether the includeSubDomains directive is appended to the Strict-Transport-Security header.
791    #[serde(default, skip_serializing_if = "Option::is_none", rename = "stsIncludeSubdomains")]
792    #[builder(default, setter(strip_option))]
793    pub sts_include_subdomains: Option<bool>,
794    /// STSPreload defines whether the preload flag is appended to the Strict-Transport-Security header.
795    #[serde(default, skip_serializing_if = "Option::is_none", rename = "stsPreload")]
796    #[builder(default, setter(strip_option))]
797    pub sts_preload: Option<bool>,
798    /// STSSeconds defines the max-age of the Strict-Transport-Security header.
799    /// If set to 0, the header is not set.
800    #[serde(default, skip_serializing_if = "Option::is_none", rename = "stsSeconds")]
801    #[builder(default, setter(strip_option))]
802    pub sts_seconds: Option<i64>,
803}
804
805/// InFlightReq holds the in-flight request middleware configuration.
806/// This middleware limits the number of requests being processed and served concurrently.
807/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/inflightreq/
808#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
809pub struct MiddlewareInFlightReq {
810    /// Amount defines the maximum amount of allowed simultaneous in-flight request.
811    /// The middleware responds with HTTP 429 Too Many Requests if there are already amount requests in progress (based on the same sourceCriterion strategy).
812    #[serde(default, skip_serializing_if = "Option::is_none")]
813    #[builder(default, setter(strip_option))]
814    pub amount: Option<i64>,
815    /// SourceCriterion defines what criterion is used to group requests as originating from a common source.
816    /// If several strategies are defined at the same time, an error will be raised.
817    /// If none are set, the default is to use the requestHost.
818    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/inflightreq/#sourcecriterion
819    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sourceCriterion")]
820    #[builder(default, setter(strip_option))]
821    pub source_criterion: Option<MiddlewareInFlightReqSourceCriterion>,
822}
823
824/// SourceCriterion defines what criterion is used to group requests as originating from a common source.
825/// If several strategies are defined at the same time, an error will be raised.
826/// If none are set, the default is to use the requestHost.
827/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/inflightreq/#sourcecriterion
828#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
829pub struct MiddlewareInFlightReqSourceCriterion {
830    /// IPStrategy holds the IP strategy configuration used by Traefik to determine the client IP.
831    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ipallowlist/#ipstrategy
832    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ipStrategy")]
833    #[builder(default, setter(strip_option))]
834    pub ip_strategy: Option<MiddlewareInFlightReqSourceCriterionIpStrategy>,
835    /// RequestHeaderName defines the name of the header used to group incoming requests.
836    #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestHeaderName")]
837    #[builder(default, setter(strip_option))]
838    pub request_header_name: Option<String>,
839    /// RequestHost defines whether to consider the request Host as the source.
840    #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestHost")]
841    #[builder(default, setter(strip_option))]
842    pub request_host: Option<bool>,
843}
844
845/// IPStrategy holds the IP strategy configuration used by Traefik to determine the client IP.
846/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ipallowlist/#ipstrategy
847#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
848pub struct MiddlewareInFlightReqSourceCriterionIpStrategy {
849    /// Depth tells Traefik to use the X-Forwarded-For header and take the IP located at the depth position (starting from the right).
850    #[serde(default, skip_serializing_if = "Option::is_none")]
851    #[builder(default, setter(strip_option))]
852    pub depth: Option<i64>,
853    /// ExcludedIPs configures Traefik to scan the X-Forwarded-For header and select the first IP not in the list.
854    #[serde(default, skip_serializing_if = "Option::is_none", rename = "excludedIPs")]
855    #[builder(default, setter(strip_option))]
856    pub excluded_i_ps: Option<Vec<String>>,
857    /// IPv6Subnet configures Traefik to consider all IPv6 addresses from the defined subnet as originating from the same IP. Applies to RemoteAddrStrategy and DepthStrategy.
858    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ipv6Subnet")]
859    #[builder(default, setter(strip_option))]
860    pub ipv6_subnet: Option<i64>,
861}
862
863/// IPAllowList holds the IP allowlist middleware configuration.
864/// This middleware limits allowed requests based on the client IP.
865/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ipallowlist/
866#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
867pub struct MiddlewareIpAllowList {
868    /// IPStrategy holds the IP strategy configuration used by Traefik to determine the client IP.
869    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ipallowlist/#ipstrategy
870    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ipStrategy")]
871    #[builder(default, setter(strip_option))]
872    pub ip_strategy: Option<MiddlewareIpAllowListIpStrategy>,
873    /// RejectStatusCode defines the HTTP status code used for refused requests.
874    /// If not set, the default is 403 (Forbidden).
875    #[serde(default, skip_serializing_if = "Option::is_none", rename = "rejectStatusCode")]
876    #[builder(default, setter(strip_option))]
877    pub reject_status_code: Option<i64>,
878    /// SourceRange defines the set of allowed IPs (or ranges of allowed IPs by using CIDR notation).
879    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sourceRange")]
880    #[builder(default, setter(strip_option))]
881    pub source_range: Option<Vec<String>>,
882}
883
884/// IPStrategy holds the IP strategy configuration used by Traefik to determine the client IP.
885/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ipallowlist/#ipstrategy
886#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
887pub struct MiddlewareIpAllowListIpStrategy {
888    /// Depth tells Traefik to use the X-Forwarded-For header and take the IP located at the depth position (starting from the right).
889    #[serde(default, skip_serializing_if = "Option::is_none")]
890    #[builder(default, setter(strip_option))]
891    pub depth: Option<i64>,
892    /// ExcludedIPs configures Traefik to scan the X-Forwarded-For header and select the first IP not in the list.
893    #[serde(default, skip_serializing_if = "Option::is_none", rename = "excludedIPs")]
894    #[builder(default, setter(strip_option))]
895    pub excluded_i_ps: Option<Vec<String>>,
896    /// IPv6Subnet configures Traefik to consider all IPv6 addresses from the defined subnet as originating from the same IP. Applies to RemoteAddrStrategy and DepthStrategy.
897    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ipv6Subnet")]
898    #[builder(default, setter(strip_option))]
899    pub ipv6_subnet: Option<i64>,
900}
901
902/// Deprecated: please use IPAllowList instead.
903#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
904pub struct MiddlewareIpWhiteList {
905    /// IPStrategy holds the IP strategy configuration used by Traefik to determine the client IP.
906    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ipallowlist/#ipstrategy
907    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ipStrategy")]
908    #[builder(default, setter(strip_option))]
909    pub ip_strategy: Option<MiddlewareIpWhiteListIpStrategy>,
910    /// SourceRange defines the set of allowed IPs (or ranges of allowed IPs by using CIDR notation). Required.
911    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sourceRange")]
912    #[builder(default, setter(strip_option))]
913    pub source_range: Option<Vec<String>>,
914}
915
916/// IPStrategy holds the IP strategy configuration used by Traefik to determine the client IP.
917/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ipallowlist/#ipstrategy
918#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
919pub struct MiddlewareIpWhiteListIpStrategy {
920    /// Depth tells Traefik to use the X-Forwarded-For header and take the IP located at the depth position (starting from the right).
921    #[serde(default, skip_serializing_if = "Option::is_none")]
922    #[builder(default, setter(strip_option))]
923    pub depth: Option<i64>,
924    /// ExcludedIPs configures Traefik to scan the X-Forwarded-For header and select the first IP not in the list.
925    #[serde(default, skip_serializing_if = "Option::is_none", rename = "excludedIPs")]
926    #[builder(default, setter(strip_option))]
927    pub excluded_i_ps: Option<Vec<String>>,
928    /// IPv6Subnet configures Traefik to consider all IPv6 addresses from the defined subnet as originating from the same IP. Applies to RemoteAddrStrategy and DepthStrategy.
929    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ipv6Subnet")]
930    #[builder(default, setter(strip_option))]
931    pub ipv6_subnet: Option<i64>,
932}
933
934/// PassTLSClientCert holds the pass TLS client cert middleware configuration.
935/// This middleware adds the selected data from the passed client TLS certificate to a header.
936/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/passtlsclientcert/
937#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
938pub struct MiddlewarePassTlsClientCert {
939    /// Info selects the specific client certificate details you want to add to the X-Forwarded-Tls-Client-Cert-Info header.
940    #[serde(default, skip_serializing_if = "Option::is_none")]
941    #[builder(default, setter(strip_option))]
942    pub info: Option<MiddlewarePassTlsClientCertInfo>,
943    /// PEM sets the X-Forwarded-Tls-Client-Cert header with the certificate.
944    #[serde(default, skip_serializing_if = "Option::is_none")]
945    #[builder(default, setter(strip_option))]
946    pub pem: Option<bool>,
947}
948
949/// Info selects the specific client certificate details you want to add to the X-Forwarded-Tls-Client-Cert-Info header.
950#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
951pub struct MiddlewarePassTlsClientCertInfo {
952    /// Issuer defines the client certificate issuer details to add to the X-Forwarded-Tls-Client-Cert-Info header.
953    #[serde(default, skip_serializing_if = "Option::is_none")]
954    #[builder(default, setter(strip_option))]
955    pub issuer: Option<MiddlewarePassTlsClientCertInfoIssuer>,
956    /// NotAfter defines whether to add the Not After information from the Validity part.
957    #[serde(default, skip_serializing_if = "Option::is_none", rename = "notAfter")]
958    #[builder(default, setter(strip_option))]
959    pub not_after: Option<bool>,
960    /// NotBefore defines whether to add the Not Before information from the Validity part.
961    #[serde(default, skip_serializing_if = "Option::is_none", rename = "notBefore")]
962    #[builder(default, setter(strip_option))]
963    pub not_before: Option<bool>,
964    /// Sans defines whether to add the Subject Alternative Name information from the Subject Alternative Name part.
965    #[serde(default, skip_serializing_if = "Option::is_none")]
966    #[builder(default, setter(strip_option))]
967    pub sans: Option<bool>,
968    /// SerialNumber defines whether to add the client serialNumber information.
969    #[serde(default, skip_serializing_if = "Option::is_none", rename = "serialNumber")]
970    #[builder(default, setter(strip_option))]
971    pub serial_number: Option<bool>,
972    /// Subject defines the client certificate subject details to add to the X-Forwarded-Tls-Client-Cert-Info header.
973    #[serde(default, skip_serializing_if = "Option::is_none")]
974    #[builder(default, setter(strip_option))]
975    pub subject: Option<MiddlewarePassTlsClientCertInfoSubject>,
976}
977
978/// Issuer defines the client certificate issuer details to add to the X-Forwarded-Tls-Client-Cert-Info header.
979#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
980pub struct MiddlewarePassTlsClientCertInfoIssuer {
981    /// CommonName defines whether to add the organizationalUnit information into the issuer.
982    #[serde(default, skip_serializing_if = "Option::is_none", rename = "commonName")]
983    #[builder(default, setter(strip_option))]
984    pub common_name: Option<bool>,
985    /// Country defines whether to add the country information into the issuer.
986    #[serde(default, skip_serializing_if = "Option::is_none")]
987    #[builder(default, setter(strip_option))]
988    pub country: Option<bool>,
989    /// DomainComponent defines whether to add the domainComponent information into the issuer.
990    #[serde(default, skip_serializing_if = "Option::is_none", rename = "domainComponent")]
991    #[builder(default, setter(strip_option))]
992    pub domain_component: Option<bool>,
993    /// Locality defines whether to add the locality information into the issuer.
994    #[serde(default, skip_serializing_if = "Option::is_none")]
995    #[builder(default, setter(strip_option))]
996    pub locality: Option<bool>,
997    /// Organization defines whether to add the organization information into the issuer.
998    #[serde(default, skip_serializing_if = "Option::is_none")]
999    #[builder(default, setter(strip_option))]
1000    pub organization: Option<bool>,
1001    /// Province defines whether to add the province information into the issuer.
1002    #[serde(default, skip_serializing_if = "Option::is_none")]
1003    #[builder(default, setter(strip_option))]
1004    pub province: Option<bool>,
1005    /// SerialNumber defines whether to add the serialNumber information into the issuer.
1006    #[serde(default, skip_serializing_if = "Option::is_none", rename = "serialNumber")]
1007    #[builder(default, setter(strip_option))]
1008    pub serial_number: Option<bool>,
1009}
1010
1011/// Subject defines the client certificate subject details to add to the X-Forwarded-Tls-Client-Cert-Info header.
1012#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
1013pub struct MiddlewarePassTlsClientCertInfoSubject {
1014    /// CommonName defines whether to add the organizationalUnit information into the subject.
1015    #[serde(default, skip_serializing_if = "Option::is_none", rename = "commonName")]
1016    #[builder(default, setter(strip_option))]
1017    pub common_name: Option<bool>,
1018    /// Country defines whether to add the country information into the subject.
1019    #[serde(default, skip_serializing_if = "Option::is_none")]
1020    #[builder(default, setter(strip_option))]
1021    pub country: Option<bool>,
1022    /// DomainComponent defines whether to add the domainComponent information into the subject.
1023    #[serde(default, skip_serializing_if = "Option::is_none", rename = "domainComponent")]
1024    #[builder(default, setter(strip_option))]
1025    pub domain_component: Option<bool>,
1026    /// Locality defines whether to add the locality information into the subject.
1027    #[serde(default, skip_serializing_if = "Option::is_none")]
1028    #[builder(default, setter(strip_option))]
1029    pub locality: Option<bool>,
1030    /// Organization defines whether to add the organization information into the subject.
1031    #[serde(default, skip_serializing_if = "Option::is_none")]
1032    #[builder(default, setter(strip_option))]
1033    pub organization: Option<bool>,
1034    /// OrganizationalUnit defines whether to add the organizationalUnit information into the subject.
1035    #[serde(default, skip_serializing_if = "Option::is_none", rename = "organizationalUnit")]
1036    #[builder(default, setter(strip_option))]
1037    pub organizational_unit: Option<bool>,
1038    /// Province defines whether to add the province information into the subject.
1039    #[serde(default, skip_serializing_if = "Option::is_none")]
1040    #[builder(default, setter(strip_option))]
1041    pub province: Option<bool>,
1042    /// SerialNumber defines whether to add the serialNumber information into the subject.
1043    #[serde(default, skip_serializing_if = "Option::is_none", rename = "serialNumber")]
1044    #[builder(default, setter(strip_option))]
1045    pub serial_number: Option<bool>,
1046}
1047
1048/// RateLimit holds the rate limit configuration.
1049/// This middleware ensures that services will receive a fair amount of requests, and allows one to define what fair is.
1050/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ratelimit/
1051#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
1052pub struct MiddlewareRateLimit {
1053    /// Average is the maximum rate, by default in requests/s, allowed for the given source.
1054    /// It defaults to 0, which means no rate limiting.
1055    /// The rate is actually defined by dividing Average by Period. So for a rate below 1req/s,
1056    /// one needs to define a Period larger than a second.
1057    #[serde(default, skip_serializing_if = "Option::is_none")]
1058    #[builder(default, setter(strip_option))]
1059    pub average: Option<i64>,
1060    /// Burst is the maximum number of requests allowed to arrive in the same arbitrarily small period of time.
1061    /// It defaults to 1.
1062    #[serde(default, skip_serializing_if = "Option::is_none")]
1063    #[builder(default, setter(strip_option))]
1064    pub burst: Option<i64>,
1065    /// Period, in combination with Average, defines the actual maximum rate, such as:
1066    /// r = Average / Period. It defaults to a second.
1067    #[serde(default, skip_serializing_if = "Option::is_none")]
1068    #[builder(default, setter(strip_option))]
1069    pub period: Option<IntOrString>,
1070    /// SourceCriterion defines what criterion is used to group requests as originating from a common source.
1071    /// If several strategies are defined at the same time, an error will be raised.
1072    /// If none are set, the default is to use the request's remote address field (as an ipStrategy).
1073    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sourceCriterion")]
1074    #[builder(default, setter(strip_option))]
1075    pub source_criterion: Option<MiddlewareRateLimitSourceCriterion>,
1076}
1077
1078/// SourceCriterion defines what criterion is used to group requests as originating from a common source.
1079/// If several strategies are defined at the same time, an error will be raised.
1080/// If none are set, the default is to use the request's remote address field (as an ipStrategy).
1081#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
1082pub struct MiddlewareRateLimitSourceCriterion {
1083    /// IPStrategy holds the IP strategy configuration used by Traefik to determine the client IP.
1084    /// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ipallowlist/#ipstrategy
1085    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ipStrategy")]
1086    #[builder(default, setter(strip_option))]
1087    pub ip_strategy: Option<MiddlewareRateLimitSourceCriterionIpStrategy>,
1088    /// RequestHeaderName defines the name of the header used to group incoming requests.
1089    #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestHeaderName")]
1090    #[builder(default, setter(strip_option))]
1091    pub request_header_name: Option<String>,
1092    /// RequestHost defines whether to consider the request Host as the source.
1093    #[serde(default, skip_serializing_if = "Option::is_none", rename = "requestHost")]
1094    #[builder(default, setter(strip_option))]
1095    pub request_host: Option<bool>,
1096}
1097
1098/// IPStrategy holds the IP strategy configuration used by Traefik to determine the client IP.
1099/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ipallowlist/#ipstrategy
1100#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
1101pub struct MiddlewareRateLimitSourceCriterionIpStrategy {
1102    /// Depth tells Traefik to use the X-Forwarded-For header and take the IP located at the depth position (starting from the right).
1103    #[serde(default, skip_serializing_if = "Option::is_none")]
1104    #[builder(default, setter(strip_option))]
1105    pub depth: Option<i64>,
1106    /// ExcludedIPs configures Traefik to scan the X-Forwarded-For header and select the first IP not in the list.
1107    #[serde(default, skip_serializing_if = "Option::is_none", rename = "excludedIPs")]
1108    #[builder(default, setter(strip_option))]
1109    pub excluded_i_ps: Option<Vec<String>>,
1110    /// IPv6Subnet configures Traefik to consider all IPv6 addresses from the defined subnet as originating from the same IP. Applies to RemoteAddrStrategy and DepthStrategy.
1111    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ipv6Subnet")]
1112    #[builder(default, setter(strip_option))]
1113    pub ipv6_subnet: Option<i64>,
1114}
1115
1116/// RedirectRegex holds the redirect regex middleware configuration.
1117/// This middleware redirects a request using regex matching and replacement.
1118/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/redirectregex/#regex
1119#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
1120pub struct MiddlewareRedirectRegex {
1121    /// Permanent defines whether the redirection is permanent (301).
1122    #[serde(default, skip_serializing_if = "Option::is_none")]
1123    #[builder(default, setter(strip_option))]
1124    pub permanent: Option<bool>,
1125    /// Regex defines the regex used to match and capture elements from the request URL.
1126    #[serde(default, skip_serializing_if = "Option::is_none")]
1127    #[builder(default, setter(strip_option))]
1128    pub regex: Option<String>,
1129    /// Replacement defines how to modify the URL to have the new target URL.
1130    #[serde(default, skip_serializing_if = "Option::is_none")]
1131    #[builder(default, setter(strip_option))]
1132    pub replacement: Option<String>,
1133}
1134
1135/// RedirectScheme holds the redirect scheme middleware configuration.
1136/// This middleware redirects requests from a scheme/port to another.
1137/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/redirectscheme/
1138#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
1139pub struct MiddlewareRedirectScheme {
1140    /// Permanent defines whether the redirection is permanent (301).
1141    #[serde(default, skip_serializing_if = "Option::is_none")]
1142    #[builder(default, setter(strip_option))]
1143    pub permanent: Option<bool>,
1144    /// Port defines the port of the new URL.
1145    #[serde(default, skip_serializing_if = "Option::is_none")]
1146    #[builder(default, setter(strip_option))]
1147    pub port: Option<String>,
1148    /// Scheme defines the scheme of the new URL.
1149    #[serde(default, skip_serializing_if = "Option::is_none")]
1150    #[builder(default, setter(strip_option))]
1151    pub scheme: Option<String>,
1152}
1153
1154/// ReplacePath holds the replace path middleware configuration.
1155/// This middleware replaces the path of the request URL and store the original path in an X-Replaced-Path header.
1156/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/replacepath/
1157#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
1158pub struct MiddlewareReplacePath {
1159    /// Path defines the path to use as replacement in the request URL.
1160    #[serde(default, skip_serializing_if = "Option::is_none")]
1161    #[builder(default, setter(strip_option))]
1162    pub path: Option<String>,
1163}
1164
1165/// ReplacePathRegex holds the replace path regex middleware configuration.
1166/// This middleware replaces the path of a URL using regex matching and replacement.
1167/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/replacepathregex/
1168#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
1169pub struct MiddlewareReplacePathRegex {
1170    /// Regex defines the regular expression used to match and capture the path from the request URL.
1171    #[serde(default, skip_serializing_if = "Option::is_none")]
1172    #[builder(default, setter(strip_option))]
1173    pub regex: Option<String>,
1174    /// Replacement defines the replacement path format, which can include captured variables.
1175    #[serde(default, skip_serializing_if = "Option::is_none")]
1176    #[builder(default, setter(strip_option))]
1177    pub replacement: Option<String>,
1178}
1179
1180/// Retry holds the retry middleware configuration.
1181/// This middleware reissues requests a given number of times to a backend server if that server does not reply.
1182/// As soon as the server answers, the middleware stops retrying, regardless of the response status.
1183/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/retry/
1184#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
1185pub struct MiddlewareRetry {
1186    /// Attempts defines how many times the request should be retried.
1187    #[serde(default, skip_serializing_if = "Option::is_none")]
1188    #[builder(default, setter(strip_option))]
1189    pub attempts: Option<i64>,
1190    /// InitialInterval defines the first wait time in the exponential backoff series.
1191    /// The maximum interval is calculated as twice the initialInterval.
1192    /// If unspecified, requests will be retried immediately.
1193    /// The value of initialInterval should be provided in seconds or as a valid duration format,
1194    /// see https://pkg.go.dev/time#ParseDuration.
1195    #[serde(default, skip_serializing_if = "Option::is_none", rename = "initialInterval")]
1196    #[builder(default, setter(strip_option))]
1197    pub initial_interval: Option<IntOrString>,
1198}
1199
1200/// StripPrefix holds the strip prefix middleware configuration.
1201/// This middleware removes the specified prefixes from the URL path.
1202/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/stripprefix/
1203#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
1204pub struct MiddlewareStripPrefix {
1205    /// Deprecated: ForceSlash option is deprecated, please remove any usage of this option.
1206    /// ForceSlash ensures that the resulting stripped path is not the empty string, by replacing it with / when necessary.
1207    /// Default: true.
1208    #[serde(default, skip_serializing_if = "Option::is_none", rename = "forceSlash")]
1209    #[builder(default, setter(strip_option))]
1210    pub force_slash: Option<bool>,
1211    /// Prefixes defines the prefixes to strip from the request URL.
1212    #[serde(default, skip_serializing_if = "Option::is_none")]
1213    #[builder(default, setter(strip_option))]
1214    pub prefixes: Option<Vec<String>>,
1215}
1216
1217/// StripPrefixRegex holds the strip prefix regex middleware configuration.
1218/// This middleware removes the matching prefixes from the URL path.
1219/// More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/stripprefixregex/
1220#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
1221pub struct MiddlewareStripPrefixRegex {
1222    /// Regex defines the regular expression to match the path prefix from the request URL.
1223    #[serde(default, skip_serializing_if = "Option::is_none")]
1224    #[builder(default, setter(strip_option))]
1225    pub regex: Option<Vec<String>>,
1226}
1227