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