Skip to main content

devops_armory/cloud/gcp/gke/route/
models.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Serialize, Deserialize)]
4pub struct HTTPRoute {
5    pub kind: String,
6    pub apiVersion: String,
7    pub metadata: Metadata,
8    pub spec: HTTPRouteSpec,
9}
10
11#[derive(Debug, Serialize, Deserialize)]
12pub struct Metadata {
13    pub name: String,
14    pub namespace: String,
15    pub resourceVersion: Option<String>
16}
17
18#[derive(Debug, Serialize, Deserialize)]
19pub struct HTTPRouteSpec {
20    pub parentRefs: Vec<ParentRef>,
21    pub hostnames: Vec<String>,  
22    pub rules: Vec<Rule>,
23}
24
25#[derive(Debug, Serialize, Deserialize)]
26pub struct ParentRef {
27    pub kind: String,
28    pub name: String,
29}
30
31#[derive(Debug, Serialize, Deserialize)]
32pub struct Rule {
33    pub matches: Vec<MatchCriteria>,
34    pub filters: Option<Vec<Filter>>,
35    pub backendRefs: Vec<BackendRef>,
36}
37
38#[derive(Debug, Serialize, Deserialize)]
39pub struct MatchCriteria {
40    pub path: Path,
41}
42
43#[derive(Debug, Serialize, Deserialize)]
44pub struct Path {
45    pub r#type: String, 
46    pub value: String,
47}
48
49#[derive(Debug, Serialize, Deserialize)]
50pub struct Filter {
51    pub r#type: String,
52    pub urlRewrite: URLRewrite,
53}
54
55#[derive(Debug, Serialize, Deserialize)]
56pub struct URLRewrite {
57    pub hostname: String,
58    pub path: PathRewrite,
59}
60
61#[derive(Debug, Serialize, Deserialize)]
62pub struct PathRewrite {
63    pub r#type: String,
64    pub replacePrefixMatch: String,
65}
66
67#[derive(Debug, Serialize, Deserialize)]
68pub struct BackendRef {
69    pub name: String,
70    pub port: u16,
71}
72
73// Get resource version models
74
75#[derive(Debug, Serialize, Deserialize, Default)]
76pub struct HTTPRouteGetParent {
77    pub items: Vec<MetadataGet>,
78}
79
80#[derive(Debug, Serialize, Deserialize, Default)]
81pub struct HTTPRouteGet {
82    pub metadata: MetadataGet,
83}
84
85#[derive(Debug, Serialize, Deserialize, Default)]
86pub struct MetadataGet {
87    pub resourceVersion: String
88}