1use std::collections::HashMap;
2use serde::{Serialize, Deserialize};
3
4#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
5#[serde(rename_all = "camelCase")]
6pub struct RequestContextSimple {
7 pub account_id: String,
8 pub api_id: String,
9 pub domain_name: String,
10 pub http: Http,
11 pub stage: String,
12 pub time_epoch: u64,
13}
14
15#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
16#[serde(rename_all = "camelCase")]
17pub struct RequestContext {
18 pub account_id: String,
19 pub api_id: String,
20 pub authentication: Option<Authentication>,
21 pub authorizer: Option<Authorizer>,
22 pub domain_name: String,
23 pub domain_prefix: String,
24 pub http: Http,
25 pub request_id: String,
26 pub route_key: String,
27 pub stage: String,
28 pub time: String,
29 pub time_epoch: u64,
30}
31
32#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
33#[serde(rename_all = "camelCase")]
34pub struct Authentication {
35 pub client_cert: ClientCert,
36}
37
38#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
39#[serde(rename_all = "camelCase")]
40pub struct ClientCert {
41 pub client_cert_pem: String,
42 #[serde(rename = "subjectDN")]
43 pub subject_dn: String,
44 #[serde(rename = "issuerDN")]
45 pub issuer_dn: String,
46 pub serial_number: String,
47 pub validity: Validity,
48}
49
50#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
51#[serde(rename_all = "camelCase")]
52pub struct Authorizer {
53 pub lambda: Option<HashMap<String, String>>,
54 pub jwt: Option<HashMap<String,String>>,
55}
56
57#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
58#[serde(rename_all = "camelCase")]
59pub struct Validity {
60 pub not_before: String,
61 pub not_after: String,
62}
63
64#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
65#[serde(rename_all = "camelCase")]
66pub struct Http {
67 pub method: String,
68 pub path: String,
69 pub protocol: String,
70 pub source_ip: String,
71 pub user_agent: String,
72}