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}
16
17#[derive(Debug, Serialize, Deserialize)]
18pub struct HTTPRouteSpec {
19    pub parentRefs: Vec<ParentRef>,
20    pub hostnames: Vec<String>,  
21    pub rules: Vec<Rule>,
22}
23
24#[derive(Debug, Serialize, Deserialize)]
25pub struct ParentRef {
26    pub kind: String,
27    pub name: String,
28}
29
30#[derive(Debug, Serialize, Deserialize)]
31pub struct Rule {
32    pub matches: Vec<MatchCriteria>,
33    pub filters: Option<Vec<Filter>>,
34    pub backendRefs: Vec<BackendRef>,
35}
36
37#[derive(Debug, Serialize, Deserialize)]
38pub struct MatchCriteria {
39    pub path: Path,
40}
41
42#[derive(Debug, Serialize, Deserialize)]
43pub struct Path {
44    pub r#type: String, 
45    pub value: String,
46}
47
48#[derive(Debug, Serialize, Deserialize)]
49pub struct Filter {
50    pub r#type: String,
51    pub urlRewrite: URLRewrite,
52}
53
54#[derive(Debug, Serialize, Deserialize)]
55pub struct URLRewrite {
56    pub hostname: String,
57    pub path: PathRewrite,
58}
59
60#[derive(Debug, Serialize, Deserialize)]
61pub struct PathRewrite {
62    pub r#type: String,
63    pub replacePrefixMatch: String,
64}
65
66#[derive(Debug, Serialize, Deserialize)]
67pub struct BackendRef {
68    pub name: String,
69    pub port: u16,
70}
71