devops_armory/cloud/gcp/gke/healthcheck/
models.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Serialize, Deserialize)]
4pub struct HealthCheckPolicy {
5 pub apiVersion: String,
6 pub kind: String,
7 pub metadata: Metadata,
8 pub spec: HealthCheckPolicySpec,
9}
10
11#[derive(Debug, Serialize, Deserialize)]
12pub struct Metadata {
13 pub name: String,
14 pub namespace: String,
15}
16
17#[derive(Debug, Serialize, Deserialize)]
18pub struct HealthCheckPolicySpec {
19 pub default: DefaultPolicy,
20 pub targetRef: TargetRef,
21}
22
23#[derive(Debug, Serialize, Deserialize)]
24pub struct LogConfig {
25 pub enabled: bool,
26}
27
28#[derive(Debug, Serialize, Deserialize)]
29pub struct HealthCheckConfig {
30 #[serde(rename = "type")]
31 pub kind: Option<ProtocolType>,
32 pub http_health_check: Option<HttpHealthCheck>,
33 pub https_health_check: Option<HttpsHealthCheck>,
34 pub grpc_health_check: Option<GrpcHealthCheck>,
35 pub http2_health_check: Option<Http2HealthCheck>,
36 pub tcp_health_check: Option<TcpHealthCheck>,
37}
38
39#[derive(Debug, Serialize, Deserialize)]
40pub struct TargetRef {
41 pub group: String,
42 pub kind: String,
43 pub name: String,
44}
45
46#[derive(Debug, Serialize, Deserialize)]
47pub struct DefaultPolicy {
48 pub check_interval_sec: Option<u32>,
49 pub timeout_sec: Option<u32>,
50 pub healthy_threshold: Option<u32>,
51 pub unhealthy_threshold: Option<u32>,
52 pub log_config: Option<LogConfig>,
53 pub config: Option<HealthCheckConfig>,
54}
55
56#[derive(Debug, Serialize, Deserialize)]
57pub enum ProtocolType {
58 HTTP,
59 HTTPS,
60 GRPC,
61 HTTP2,
62 TCP,
63 #[serde(other)]
64 Unknown,
65}
66
67#[derive(Debug, Serialize, Deserialize)]
68pub enum PortSpecification {
69 USE_FIXED_PORT,
70 USE_NAMED_PORT,
71 USE_SERVING_PORT,
72 #[serde(other)]
73 Unknown,
74}
75
76#[derive(Debug, Serialize, Deserialize)]
77pub enum ProxyHeader {
78 NONE,
79 PROXY_V1,
80 #[serde(other)]
81 Unknown,
82}
83
84#[derive(Debug, Serialize, Deserialize)]
85pub struct HttpHealthCheck {
86 pub port_specification: Option<PortSpecification>,
87 pub port: Option<u32>,
88 pub host: Option<String>,
89 pub request_path: Option<String>,
90 pub response: Option<String>,
91 pub proxy_header: Option<ProxyHeader>,
92}
93
94#[derive(Debug, Serialize, Deserialize)]
95pub struct HttpsHealthCheck {
96 pub port_specification: Option<PortSpecification>,
97 pub port: Option<u32>,
98 pub host: Option<String>,
99 pub request_path: Option<String>,
100 pub response: Option<String>,
101 pub proxy_header: Option<ProxyHeader>,
102}
103
104#[derive(Debug, Serialize, Deserialize)]
105pub struct GrpcHealthCheck {
106 pub grpc_service_name: Option<String>,
107 pub port_specification: Option<PortSpecification>,
108 pub port: Option<u32>,
109}
110
111#[derive(Debug, Serialize, Deserialize)]
112pub struct Http2HealthCheck {
113 pub port_specification: Option<PortSpecification>,
114 pub port: Option<u32>,
115 pub host: Option<String>,
116 pub request_path: Option<String>,
117 pub response: Option<String>,
118 pub proxy_header: Option<ProxyHeader>,
119}
120
121#[derive(Debug, Serialize, Deserialize)]
122pub struct TcpHealthCheck {
123 pub port_specification: Option<PortSpecification>,
124 pub port: Option<u32>,
125 pub port_name: Option<String>,
126 pub request: Option<String>,
127 pub response: Option<String>,
128 pub proxy_header: Option<ProxyHeader>,
129}