istio-api-rs 0.12.0

A collection of CRDs for api used in Istio.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium -Af resources/istio/v1_11_0/networking/v1beta1/VirtualService.yaml --api-version v1beta1
// kopium version: 0.22.5

#[allow(unused_imports)]
mod prelude {
    pub use kube::CustomResource;
    pub use schemars::JsonSchema;
    pub use serde::{Serialize, Deserialize};
    pub use std::collections::BTreeMap;
}
use self::prelude::*;

/// Configuration affecting label/content routing, sni routing, etc. See more details at: <https://istio.io/docs/reference/config/networking/virtual-service.html>
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema)]
#[kube(group = "networking.istio.io", version = "v1beta1", kind = "VirtualService", plural = "virtualservices")]
#[kube(namespaced)]
pub struct VirtualServiceSpec {
    /// A list of namespaces to which this virtual service is exported.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "exportTo")]
    pub export_to: Option<Vec<String>>,
    /// The names of gateways and sidecars that should apply these routes.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub gateways: Option<Vec<String>>,
    /// The destination hosts to which traffic is being sent.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub hosts: Option<Vec<String>>,
    /// An ordered list of route rules for HTTP traffic.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub http: Option<Vec<VirtualServiceHttp>>,
    /// An ordered list of route rules for opaque TCP traffic.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub tcp: Option<Vec<VirtualServiceTcp>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub tls: Option<Vec<VirtualServiceTls>>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttp {
    /// Cross-Origin Resource Sharing policy (CORS).
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "corsPolicy")]
    pub cors_policy: Option<VirtualServiceHttpCorsPolicy>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub delegate: Option<VirtualServiceHttpDelegate>,
    /// Fault injection policy to apply on HTTP traffic at the client side.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub fault: Option<VirtualServiceHttpFault>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub headers: Option<VirtualServiceHttpHeaders>,
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "match")]
    pub r#match: Option<Vec<VirtualServiceHttpMatch>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub mirror: Option<VirtualServiceHttpMirror>,
    /// Percentage of the traffic to be mirrored by the `mirror` field.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "mirrorPercent")]
    pub mirror_percent: Option<i64>,
    /// Percentage of the traffic to be mirrored by the `mirror` field.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "mirrorPercentage")]
    pub mirror_percentage: Option<VirtualServiceHttpMirrorPercentage>,
    /// Percentage of the traffic to be mirrored by the `mirror` field.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "mirror_percent")]
    pub mirror_percent_x: Option<i64>,
    /// The name assigned to the route for debugging purposes.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// A HTTP rule can either redirect or forward (default) traffic.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub redirect: Option<VirtualServiceHttpRedirect>,
    /// Retry policy for HTTP requests.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub retries: Option<VirtualServiceHttpRetries>,
    /// Rewrite HTTP URIs and Authority headers.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub rewrite: Option<VirtualServiceHttpRewrite>,
    /// A HTTP rule can either redirect or forward (default) traffic.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub route: Option<Vec<VirtualServiceHttpRoute>>,
    /// Timeout for HTTP requests, default is disabled.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub timeout: Option<String>,
}

/// Cross-Origin Resource Sharing policy (CORS).
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpCorsPolicy {
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowCredentials")]
    pub allow_credentials: Option<bool>,
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowHeaders")]
    pub allow_headers: Option<Vec<String>>,
    /// List of HTTP methods allowed to access the resource.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowMethods")]
    pub allow_methods: Option<Vec<String>>,
    /// The list of origins that are allowed to perform CORS requests.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowOrigin")]
    pub allow_origin: Option<Vec<String>>,
    /// String patterns that match allowed origins.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowOrigins")]
    pub allow_origins: Option<Vec<VirtualServiceHttpCorsPolicyAllowOrigins>>,
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "exposeHeaders")]
    pub expose_headers: Option<Vec<String>>,
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxAge")]
    pub max_age: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpCorsPolicyAllowOrigins {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub exact: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub prefix: Option<String>,
    /// RE2 style regex-based match (<https://github.com/google/re2/wiki/Syntax).>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub regex: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpDelegate {
    /// Name specifies the name of the delegate VirtualService.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Namespace specifies the namespace where the delegate VirtualService resides.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub namespace: Option<String>,
}

/// Fault injection policy to apply on HTTP traffic at the client side.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpFault {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub abort: Option<VirtualServiceHttpFaultAbort>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub delay: Option<VirtualServiceHttpFaultDelay>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpFaultAbort {
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "grpcStatus")]
    pub grpc_status: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "http2Error")]
    pub http2_error: Option<String>,
    /// HTTP status code to use to abort the Http request.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "httpStatus")]
    pub http_status: Option<i32>,
    /// Percentage of requests to be aborted with the error code provided.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub percentage: Option<VirtualServiceHttpFaultAbortPercentage>,
}

/// Percentage of requests to be aborted with the error code provided.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpFaultAbortPercentage {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub value: Option<f64>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpFaultDelay {
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "exponentialDelay")]
    pub exponential_delay: Option<String>,
    /// Add a fixed delay before forwarding the request.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "fixedDelay")]
    pub fixed_delay: Option<String>,
    /// Percentage of requests on which the delay will be injected (0-100).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub percent: Option<i32>,
    /// Percentage of requests on which the delay will be injected.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub percentage: Option<VirtualServiceHttpFaultDelayPercentage>,
}

/// Percentage of requests on which the delay will be injected.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpFaultDelayPercentage {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub value: Option<f64>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpHeaders {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub request: Option<VirtualServiceHttpHeadersRequest>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub response: Option<VirtualServiceHttpHeadersResponse>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpHeadersRequest {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub add: Option<BTreeMap<String, String>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub remove: Option<Vec<String>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub set: Option<BTreeMap<String, String>>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpHeadersResponse {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub add: Option<BTreeMap<String, String>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub remove: Option<Vec<String>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub set: Option<BTreeMap<String, String>>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpMatch {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub authority: Option<VirtualServiceHttpMatchAuthority>,
    /// Names of gateways where the rule should be applied.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub gateways: Option<Vec<String>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub headers: Option<BTreeMap<String, VirtualServiceHttpMatchHeaders>>,
    /// Flag to specify whether the URI matching should be case-insensitive.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ignoreUriCase")]
    pub ignore_uri_case: Option<bool>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub method: Option<VirtualServiceHttpMatchMethod>,
    /// The name assigned to a match.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Specifies the ports on the host that is being addressed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub port: Option<i64>,
    /// Query parameters for matching.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "queryParams")]
    pub query_params: Option<BTreeMap<String, VirtualServiceHttpMatchQueryParams>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub scheme: Option<VirtualServiceHttpMatchScheme>,
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sourceLabels")]
    pub source_labels: Option<BTreeMap<String, String>>,
    /// Source namespace constraining the applicability of a rule to workloads in that namespace.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sourceNamespace")]
    pub source_namespace: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub uri: Option<VirtualServiceHttpMatchUri>,
    /// withoutHeader has the same syntax with the header, but has opposite meaning.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "withoutHeaders")]
    pub without_headers: Option<BTreeMap<String, VirtualServiceHttpMatchWithoutHeaders>>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpMatchAuthority {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub exact: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub prefix: Option<String>,
    /// RE2 style regex-based match (<https://github.com/google/re2/wiki/Syntax).>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub regex: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpMatchHeaders {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub exact: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub prefix: Option<String>,
    /// RE2 style regex-based match (<https://github.com/google/re2/wiki/Syntax).>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub regex: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpMatchMethod {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub exact: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub prefix: Option<String>,
    /// RE2 style regex-based match (<https://github.com/google/re2/wiki/Syntax).>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub regex: Option<String>,
}

/// Query parameters for matching.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpMatchQueryParams {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub exact: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub prefix: Option<String>,
    /// RE2 style regex-based match (<https://github.com/google/re2/wiki/Syntax).>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub regex: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpMatchScheme {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub exact: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub prefix: Option<String>,
    /// RE2 style regex-based match (<https://github.com/google/re2/wiki/Syntax).>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub regex: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpMatchUri {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub exact: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub prefix: Option<String>,
    /// RE2 style regex-based match (<https://github.com/google/re2/wiki/Syntax).>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub regex: Option<String>,
}

/// withoutHeader has the same syntax with the header, but has opposite meaning.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpMatchWithoutHeaders {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub exact: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub prefix: Option<String>,
    /// RE2 style regex-based match (<https://github.com/google/re2/wiki/Syntax).>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub regex: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpMirror {
    /// The name of a service from the service registry.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub host: Option<String>,
    /// Specifies the port on the host that is being addressed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub port: Option<VirtualServiceHttpMirrorPort>,
    /// The name of a subset within the service.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub subset: Option<String>,
}

/// Specifies the port on the host that is being addressed.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpMirrorPort {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub number: Option<i64>,
}

/// Percentage of the traffic to be mirrored by the `mirror` field.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpMirrorPercentage {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub value: Option<f64>,
}

/// A HTTP rule can either redirect or forward (default) traffic.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpRedirect {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub authority: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "redirectCode")]
    pub redirect_code: Option<i64>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub uri: Option<String>,
}

/// Retry policy for HTTP requests.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpRetries {
    /// Number of retries to be allowed for a given request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub attempts: Option<i32>,
    /// Timeout per attempt for a given request, including the initial call and any retries.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "perTryTimeout")]
    pub per_try_timeout: Option<String>,
    /// Specifies the conditions under which retry takes place.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "retryOn")]
    pub retry_on: Option<String>,
    /// Flag to specify whether the retries should retry to other localities.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "retryRemoteLocalities")]
    pub retry_remote_localities: Option<bool>,
}

/// Rewrite HTTP URIs and Authority headers.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpRewrite {
    /// rewrite the Authority/Host header with this value.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub authority: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub uri: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpRoute {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub destination: Option<VirtualServiceHttpRouteDestination>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub headers: Option<VirtualServiceHttpRouteHeaders>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub weight: Option<i32>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpRouteDestination {
    /// The name of a service from the service registry.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub host: Option<String>,
    /// Specifies the port on the host that is being addressed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub port: Option<VirtualServiceHttpRouteDestinationPort>,
    /// The name of a subset within the service.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub subset: Option<String>,
}

/// Specifies the port on the host that is being addressed.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpRouteDestinationPort {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub number: Option<i64>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpRouteHeaders {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub request: Option<VirtualServiceHttpRouteHeadersRequest>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub response: Option<VirtualServiceHttpRouteHeadersResponse>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpRouteHeadersRequest {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub add: Option<BTreeMap<String, String>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub remove: Option<Vec<String>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub set: Option<BTreeMap<String, String>>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceHttpRouteHeadersResponse {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub add: Option<BTreeMap<String, String>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub remove: Option<Vec<String>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub set: Option<BTreeMap<String, String>>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceTcp {
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "match")]
    pub r#match: Option<Vec<VirtualServiceTcpMatch>>,
    /// The destination to which the connection should be forwarded to.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub route: Option<Vec<VirtualServiceTcpRoute>>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceTcpMatch {
    /// IPv4 or IPv6 ip addresses of destination with optional subnet.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "destinationSubnets")]
    pub destination_subnets: Option<Vec<String>>,
    /// Names of gateways where the rule should be applied.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub gateways: Option<Vec<String>>,
    /// Specifies the port on the host that is being addressed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub port: Option<i64>,
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sourceLabels")]
    pub source_labels: Option<BTreeMap<String, String>>,
    /// Source namespace constraining the applicability of a rule to workloads in that namespace.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sourceNamespace")]
    pub source_namespace: Option<String>,
    /// IPv4 or IPv6 ip address of source with optional subnet.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sourceSubnet")]
    pub source_subnet: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceTcpRoute {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub destination: Option<VirtualServiceTcpRouteDestination>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub weight: Option<i32>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceTcpRouteDestination {
    /// The name of a service from the service registry.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub host: Option<String>,
    /// Specifies the port on the host that is being addressed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub port: Option<VirtualServiceTcpRouteDestinationPort>,
    /// The name of a subset within the service.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub subset: Option<String>,
}

/// Specifies the port on the host that is being addressed.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceTcpRouteDestinationPort {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub number: Option<i64>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceTls {
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "match")]
    pub r#match: Option<Vec<VirtualServiceTlsMatch>>,
    /// The destination to which the connection should be forwarded to.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub route: Option<Vec<VirtualServiceTlsRoute>>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceTlsMatch {
    /// IPv4 or IPv6 ip addresses of destination with optional subnet.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "destinationSubnets")]
    pub destination_subnets: Option<Vec<String>>,
    /// Names of gateways where the rule should be applied.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub gateways: Option<Vec<String>>,
    /// Specifies the port on the host that is being addressed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub port: Option<i64>,
    /// SNI (server name indicator) to match on.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sniHosts")]
    pub sni_hosts: Option<Vec<String>>,
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sourceLabels")]
    pub source_labels: Option<BTreeMap<String, String>>,
    /// Source namespace constraining the applicability of a rule to workloads in that namespace.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sourceNamespace")]
    pub source_namespace: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceTlsRoute {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub destination: Option<VirtualServiceTlsRouteDestination>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub weight: Option<i32>,
}

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceTlsRouteDestination {
    /// The name of a service from the service registry.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub host: Option<String>,
    /// Specifies the port on the host that is being addressed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub port: Option<VirtualServiceTlsRouteDestinationPort>,
    /// The name of a subset within the service.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub subset: Option<String>,
}

/// Specifies the port on the host that is being addressed.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
pub struct VirtualServiceTlsRouteDestinationPort {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub number: Option<i64>,
}