tusktsk 2.1.3

🦀 TuskTsk Enhanced - Ultra-fast Rust configuration parser with maximum syntax flexibility
Documentation
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
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
use k8s_openapi::api::core::v1::{Container, ResourceRequirements, SecurityContext, PodSecurityContext};
use k8s_openapi::api::apps::v1::Deployment;
use k8s_openapi::api::networking::v1::Ingress;
use k8s_openapi::api::rbac::v1::{Role, RoleBinding, ServiceAccount};
use k8s_openapi::apimachinery::pkg::apis::meta::v1::{ObjectMeta, LabelSelector};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TuskLangApp {
    pub metadata: ObjectMeta,
    pub spec: TuskLangAppSpec,
    pub status: Option<TuskLangAppStatus>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TuskLangAppSpec {
    // Core application configuration
    pub replicas: Option<i32>,
    pub image: String,
    pub image_pull_policy: Option<String>,
    pub image_pull_secrets: Option<Vec<String>>,
    
    // Resource configuration
    pub resources: Option<ResourceRequirements>,
    pub security_context: Option<SecurityContext>,
    pub pod_security_context: Option<PodSecurityContext>,
    
    // Environment and configuration
    pub env: Option<Vec<EnvVar>>,
    pub config_maps: Option<Vec<String>>,
    pub secrets: Option<Vec<String>>,
    
    // Networking
    pub ports: Option<Vec<Port>>,
    pub service_type: Option<String>,
    pub ingress: Option<IngressConfig>,
    
    // Cloud provider integration
    pub cloud_provider: Option<CloudProviderConfig>,
    
    // Service mesh integration
    pub service_mesh: Option<ServiceMeshConfig>,
    
    // Observability
    pub observability: Option<ObservabilityConfig>,
    
    // GitOps configuration
    pub gitops: Option<GitOpsConfig>,
    
    // Helm configuration
    pub helm: Option<HelmConfig>,
    
    // Container configuration
    pub containers: Option<Vec<Container>>,
    pub init_containers: Option<Vec<Container>>,
    pub sidecar_containers: Option<Vec<Container>>,
    
    // High availability
    pub high_availability: Option<HighAvailabilityConfig>,
    
    // Database configuration
    pub database: Option<DatabaseConfig>,
    
    // Security
    pub security: Option<SecurityConfig>,
    
    // Monitoring and alerting
    pub monitoring: Option<MonitoringConfig>,
    
    // Backup and disaster recovery
    pub backup: Option<BackupConfig>,
    
    // Debug and development
    pub debug: Option<DebugConfig>,
    
    // Custom configurations
    pub custom: Option<HashMap<String, serde_json::Value>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TuskLangAppStatus {
    pub phase: String,
    pub conditions: Vec<AppCondition>,
    pub replicas: i32,
    pub available_replicas: i32,
    pub ready_replicas: i32,
    pub updated_replicas: i32,
    pub observed_generation: i64,
    pub last_update_time: Option<String>,
    pub cloud_provider_status: Option<CloudProviderStatus>,
    pub service_mesh_status: Option<ServiceMeshStatus>,
    pub observability_status: Option<ObservabilityStatus>,
    pub gitops_status: Option<GitOpsStatus>,
    pub helm_status: Option<HelmStatus>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct EnvVar {
    pub name: String,
    pub value: Option<String>,
    pub value_from: Option<EnvVarSource>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct EnvVarSource {
    pub field_ref: Option<ObjectFieldSelector>,
    pub resource_field_ref: Option<ResourceFieldSelector>,
    pub config_map_key_ref: Option<ConfigMapKeySelector>,
    pub secret_key_ref: Option<SecretKeySelector>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ObjectFieldSelector {
    pub api_version: Option<String>,
    pub field_path: String,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ResourceFieldSelector {
    pub container_name: Option<String>,
    pub resource: String,
    pub divisor: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ConfigMapKeySelector {
    pub name: String,
    pub key: String,
    pub optional: Option<bool>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct SecretKeySelector {
    pub name: String,
    pub key: String,
    pub optional: Option<bool>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Port {
    pub name: String,
    pub container_port: i32,
    pub protocol: Option<String>,
    pub host_port: Option<i32>,
    pub host_ip: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IngressConfig {
    pub enabled: bool,
    pub annotations: Option<HashMap<String, String>>,
    pub hosts: Vec<IngressHost>,
    pub tls: Option<Vec<IngressTLS>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IngressHost {
    pub host: String,
    pub paths: Vec<IngressPath>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IngressPath {
    pub path: String,
    pub path_type: Option<String>,
    pub backend: IngressBackend,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IngressBackend {
    pub service: Option<IngressServiceBackend>,
    pub resource: Option<IngressResourceBackend>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IngressServiceBackend {
    pub name: String,
    pub port: IngressServiceBackendPort,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IngressServiceBackendPort {
    pub number: i32,
    pub name: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IngressResourceBackend {
    pub api_group: Option<String>,
    pub kind: String,
    pub name: String,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IngressTLS {
    pub hosts: Option<Vec<String>>,
    pub secret_name: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CloudProviderConfig {
    pub provider: String, // aws, gcp, azure
    pub region: Option<String>,
    pub credentials: Option<CloudCredentials>,
    pub services: Option<CloudServices>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CloudCredentials {
    pub access_key_id: Option<String>,
    pub secret_access_key: Option<String>,
    pub session_token: Option<String>,
    pub role_arn: Option<String>,
    pub profile: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CloudServices {
    pub s3: Option<S3Config>,
    pub secrets_manager: Option<SecretsManagerConfig>,
    pub parameter_store: Option<ParameterStoreConfig>,
    pub lambda: Option<LambdaConfig>,
    pub ecr: Option<ECRConfig>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct S3Config {
    pub bucket: String,
    pub prefix: Option<String>,
    pub region: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct SecretsManagerConfig {
    pub region: Option<String>,
    pub prefix: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ParameterStoreConfig {
    pub region: Option<String>,
    pub prefix: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct LambdaConfig {
    pub region: Option<String>,
    pub function_name: Option<String>,
    pub timeout: Option<i32>,
    pub memory_size: Option<i32>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ECRConfig {
    pub region: Option<String>,
    pub repository: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ServiceMeshConfig {
    pub provider: String, // istio, linkerd, consul
    pub enabled: bool,
    pub namespace: Option<String>,
    pub virtual_service: Option<VirtualServiceConfig>,
    pub destination_rule: Option<DestinationRuleConfig>,
    pub peer_authentication: Option<PeerAuthenticationConfig>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct VirtualServiceConfig {
    pub hosts: Vec<String>,
    pub gateways: Option<Vec<String>>,
    pub http: Option<Vec<HTTPRoute>>,
    pub tcp: Option<Vec<TCPRoute>>,
    pub tls: Option<Vec<TLSRoute>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HTTPRoute {
    pub match_: Option<Vec<HTTPMatchRequest>>,
    pub route: Option<Vec<HTTPRouteDestination>>,
    pub redirect: Option<HTTPRedirect>,
    pub rewrite: Option<HTTPRewrite>,
    pub timeout: Option<String>,
    pub retries: Option<HTTPRetry>,
    pub fault: Option<HTTPFaultInjection>,
    pub mirror: Option<Destination>,
    pub mirror_percent: Option<f64>,
    pub cors_policy: Option<CorsPolicy>,
    pub headers: Option<Headers>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HTTPMatchRequest {
    pub uri: Option<StringMatch>,
    pub scheme: Option<StringMatch>,
    pub method: Option<StringMatch>,
    pub authority: Option<StringMatch>,
    pub headers: Option<HashMap<String, StringMatch>>,
    pub port: Option<u32>,
    pub source_labels: Option<HashMap<String, String>>,
    pub gateways: Option<Vec<String>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct StringMatch {
    pub exact: Option<String>,
    pub prefix: Option<String>,
    pub regex: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HTTPRouteDestination {
    pub destination: Destination,
    pub weight: Option<i32>,
    pub headers: Option<Headers>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Destination {
    pub host: String,
    pub subset: Option<String>,
    pub port: Option<PortSelector>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PortSelector {
    pub number: Option<u32>,
    pub name: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HTTPRedirect {
    pub uri: Option<String>,
    pub authority: Option<String>,
    pub port: Option<u32>,
    pub scheme: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HTTPRewrite {
    pub uri: Option<String>,
    pub authority: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HTTPRetry {
    pub attempts: i32,
    pub per_try_timeout: Option<String>,
    pub retry_on: Option<String>,
    pub retry_remote_localities: Option<bool>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HTTPFaultInjection {
    pub delay: Option<InjectDelay>,
    pub abort: Option<InjectAbort>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct InjectDelay {
    pub percentage: Option<Percent>,
    pub fixed_delay: Option<String>,
    pub exponential_delay: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct InjectAbort {
    pub percentage: Option<Percent>,
    pub http_status: Option<i32>,
    pub grpc_status: Option<String>,
    pub http2_error: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Percent {
    pub value: f64,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CorsPolicy {
    pub allow_origin: Option<Vec<String>>,
    pub allow_methods: Option<Vec<String>>,
    pub allow_headers: Option<Vec<String>>,
    pub expose_headers: Option<Vec<String>>,
    pub max_age: Option<String>,
    pub allow_credentials: Option<bool>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Headers {
    pub request: Option<HeaderOperations>,
    pub response: Option<HeaderOperations>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HeaderOperations {
    pub set: Option<HashMap<String, String>>,
    pub add: Option<HashMap<String, String>>,
    pub remove: Option<Vec<String>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TCPRoute {
    pub match_: Option<Vec<L4MatchAttributes>>,
    pub route: Option<Vec<RouteDestination>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct L4MatchAttributes {
    pub destination_subnets: Option<Vec<String>>,
    pub port: Option<u32>,
    pub source_labels: Option<HashMap<String, String>>,
    pub gateways: Option<Vec<String>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RouteDestination {
    pub destination: Destination,
    pub weight: Option<i32>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TLSRoute {
    pub match_: Option<Vec<TLSMatchAttributes>>,
    pub route: Option<Vec<RouteDestination>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TLSMatchAttributes {
    pub sni_hosts: Option<Vec<String>>,
    pub destination_subnets: Option<Vec<String>>,
    pub port: Option<u32>,
    pub source_labels: Option<HashMap<String, String>>,
    pub gateways: Option<Vec<String>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DestinationRuleConfig {
    pub host: String,
    pub traffic_policy: Option<TrafficPolicy>,
    pub subsets: Option<Vec<Subset>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TrafficPolicy {
    pub load_balancer: Option<LoadBalancerSettings>,
    pub connection_pool: Option<ConnectionPoolSettings>,
    pub outlier_detection: Option<OutlierDetection>,
    pub tls: Option<ClientTLSSettings>,
    pub port_level_settings: Option<Vec<PortTrafficPolicy>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct LoadBalancerSettings {
    pub simple: Option<String>,
    pub consistent_hash: Option<ConsistentHashLB>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ConsistentHashLB {
    pub http_header_name: Option<String>,
    pub http_cookie: Option<HTTPCookie>,
    pub use_source_ip: Option<bool>,
    pub http_query_parameter_name: Option<String>,
    pub minimum_ring_size: Option<u64>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HTTPCookie {
    pub name: String,
    pub path: Option<String>,
    pub ttl: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ConnectionPoolSettings {
    pub tcp: Option<TCPSettings>,
    pub http: Option<HTTPSettings>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TCPSettings {
    pub max_connections: Option<i32>,
    pub connect_timeout: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HTTPSettings {
    pub http1_max_pending_requests: Option<i32>,
    pub http2_max_requests: Option<i32>,
    pub max_requests_per_connection: Option<i32>,
    pub max_retries: Option<i32>,
    pub idle_timeout: Option<String>,
    pub h2_upgrade_policy: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OutlierDetection {
    pub consecutive_5xx_errors: Option<u32>,
    pub interval: Option<String>,
    pub base_ejection_time: Option<String>,
    pub max_ejection_percent: Option<u32>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ClientTLSSettings {
    pub mode: String,
    pub client_certificate: Option<String>,
    pub private_key: Option<String>,
    pub ca_certificates: Option<String>,
    pub subject_alt_names: Option<Vec<String>>,
    pub sni: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PortTrafficPolicy {
    pub port: Option<PortSelector>,
    pub load_balancer: Option<LoadBalancerSettings>,
    pub connection_pool: Option<ConnectionPoolSettings>,
    pub outlier_detection: Option<OutlierDetection>,
    pub tls: Option<ClientTLSSettings>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Subset {
    pub name: String,
    pub labels: Option<HashMap<String, String>>,
    pub traffic_policy: Option<TrafficPolicy>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PeerAuthenticationConfig {
    pub mtls: Option<PeerAuthenticationMutualTLS>,
    pub port_level_mtls: Option<HashMap<String, PeerAuthenticationMutualTLS>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PeerAuthenticationMutualTLS {
    pub mode: String,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ObservabilityConfig {
    pub tracing: Option<TracingConfig>,
    pub metrics: Option<MetricsConfig>,
    pub logging: Option<LoggingConfig>,
    pub health_checks: Option<HealthCheckConfig>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TracingConfig {
    pub enabled: bool,
    pub provider: String, // jaeger, zipkin, otel
    pub endpoint: Option<String>,
    pub sampling_rate: Option<f64>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct MetricsConfig {
    pub enabled: bool,
    pub provider: String, // prometheus, statsd
    pub endpoint: Option<String>,
    pub port: Option<i32>,
    pub path: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct LoggingConfig {
    pub level: Option<String>,
    pub format: Option<String>, // json, text
    pub output: Option<String>, // stdout, stderr, file
    pub file_path: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HealthCheckConfig {
    pub liveness_probe: Option<Probe>,
    pub readiness_probe: Option<Probe>,
    pub startup_probe: Option<Probe>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Probe {
    pub http_get: Option<HTTPGetAction>,
    pub tcp_socket: Option<TCPSocketAction>,
    pub exec: Option<ExecAction>,
    pub initial_delay_seconds: Option<i32>,
    pub timeout_seconds: Option<i32>,
    pub period_seconds: Option<i32>,
    pub success_threshold: Option<i32>,
    pub failure_threshold: Option<i32>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HTTPGetAction {
    pub path: String,
    pub port: IntOrString,
    pub host: Option<String>,
    pub scheme: Option<String>,
    pub http_headers: Option<Vec<HTTPHeader>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IntOrString {
    pub int_val: Option<i32>,
    pub str_val: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HTTPHeader {
    pub name: String,
    pub value: String,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TCPSocketAction {
    pub port: IntOrString,
    pub host: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ExecAction {
    pub command: Vec<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GitOpsConfig {
    pub enabled: bool,
    pub provider: String, // argocd, flux
    pub repository: Option<String>,
    pub branch: Option<String>,
    pub path: Option<String>,
    pub sync_policy: Option<SyncPolicy>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct SyncPolicy {
    pub automated: Option<AutomatedSyncPolicy>,
    pub sync_options: Option<Vec<String>>,
    pub retry: Option<RetryStrategy>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct AutomatedSyncPolicy {
    pub prune: Option<bool>,
    pub self_heal: Option<bool>,
    pub allow_empty: Option<bool>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RetryStrategy {
    pub limit: Option<i32>,
    pub backoff: Option<Backoff>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Backoff {
    pub duration: Option<String>,
    pub factor: Option<i32>,
    pub max_duration: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HelmConfig {
    pub enabled: bool,
    pub chart: Option<String>,
    pub version: Option<String>,
    pub values: Option<HashMap<String, serde_json::Value>>,
    pub repository: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HighAvailabilityConfig {
    pub enabled: bool,
    pub replicas: Option<i32>,
    pub pod_disruption_budget: Option<PodDisruptionBudgetConfig>,
    pub horizontal_pod_autoscaler: Option<HorizontalPodAutoscalerConfig>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PodDisruptionBudgetConfig {
    pub min_available: Option<i32>,
    pub max_unavailable: Option<i32>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HorizontalPodAutoscalerConfig {
    pub min_replicas: Option<i32>,
    pub max_replicas: Option<i32>,
    pub target_cpu_utilization_percentage: Option<i32>,
    pub target_memory_utilization_percentage: Option<i32>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DatabaseConfig {
    pub enabled: bool,
    pub type_: Option<String>, // postgres, mysql, sqlite
    pub host: Option<String>,
    pub port: Option<i32>,
    pub name: Option<String>,
    pub username: Option<String>,
    pub password: Option<String>,
    pub ssl_mode: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct SecurityConfig {
    pub pod_security_standards: Option<PodSecurityStandards>,
    pub network_policies: Option<Vec<NetworkPolicyConfig>>,
    pub rbac: Option<RBACConfig>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PodSecurityStandards {
    pub level: String, // privileged, baseline, restricted
    pub version: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NetworkPolicyConfig {
    pub name: String,
    pub pod_selector: Option<LabelSelector>,
    pub ingress: Option<Vec<NetworkPolicyIngressRule>>,
    pub egress: Option<Vec<NetworkPolicyEgressRule>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NetworkPolicyIngressRule {
    pub ports: Option<Vec<NetworkPolicyPort>>,
    pub from: Option<Vec<NetworkPolicyPeer>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NetworkPolicyEgressRule {
    pub ports: Option<Vec<NetworkPolicyPort>>,
    pub to: Option<Vec<NetworkPolicyPeer>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NetworkPolicyPort {
    pub protocol: Option<String>,
    pub port: Option<IntOrString>,
    pub end_port: Option<i32>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NetworkPolicyPeer {
    pub pod_selector: Option<LabelSelector>,
    pub namespace_selector: Option<LabelSelector>,
    pub ip_block: Option<IPBlock>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IPBlock {
    pub cidr: String,
    pub except: Option<Vec<String>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RBACConfig {
    pub create_service_account: Option<bool>,
    pub service_account_name: Option<String>,
    pub roles: Option<Vec<Role>>,
    pub role_bindings: Option<Vec<RoleBinding>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct MonitoringConfig {
    pub enabled: bool,
    pub prometheus: Option<PrometheusConfig>,
    pub grafana: Option<GrafanaConfig>,
    pub alertmanager: Option<AlertmanagerConfig>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PrometheusConfig {
    pub enabled: bool,
    pub retention: Option<String>,
    pub storage: Option<StorageConfig>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GrafanaConfig {
    pub enabled: bool,
    pub admin_password: Option<String>,
    pub dashboards: Option<Vec<String>>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct AlertmanagerConfig {
    pub enabled: bool,
    pub config: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct StorageConfig {
    pub type_: String, // persistent, empty_dir
    pub size: Option<String>,
    pub storage_class: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BackupConfig {
    pub enabled: bool,
    pub schedule: Option<String>,
    pub retention: Option<String>,
    pub storage: Option<BackupStorageConfig>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BackupStorageConfig {
    pub type_: String, // s3, gcs, azure
    pub bucket: Option<String>,
    pub prefix: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DebugConfig {
    pub enabled: bool,
    pub log_level: Option<String>,
    pub debug_endpoints: Option<bool>,
    pub profiling: Option<bool>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct AppCondition {
    pub type_: String,
    pub status: String,
    pub last_transition_time: Option<String>,
    pub reason: Option<String>,
    pub message: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CloudProviderStatus {
    pub connected: bool,
    pub services: Vec<String>,
    pub last_check: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ServiceMeshStatus {
    pub enabled: bool,
    pub provider: String,
    pub virtual_services: Vec<String>,
    pub destination_rules: Vec<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ObservabilityStatus {
    pub tracing_enabled: bool,
    pub metrics_enabled: bool,
    pub logging_enabled: bool,
    pub endpoints: HashMap<String, String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GitOpsStatus {
    pub enabled: bool,
    pub provider: String,
    pub repository: String,
    pub last_sync: Option<String>,
    pub sync_status: String,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HelmStatus {
    pub enabled: bool,
    pub chart: String,
    pub version: String,
    pub status: String,
    pub last_updated: Option<String>,
}