1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use super::WorkersRouteIdOnly;
use crate::framework::endpoint::{Endpoint, Method};
pub struct CreateRoute<'a> {
pub zone_identifier: &'a str,
pub params: CreateRouteParams,
}
impl<'a> Endpoint<WorkersRouteIdOnly, (), CreateRouteParams> for CreateRoute<'a> {
fn method(&self) -> Method {
Method::Post
}
fn path(&self) -> String {
format!("zones/{}/workers/routes", self.zone_identifier)
}
fn body(&self) -> Option<CreateRouteParams> {
Some(self.params.clone())
}
}
#[derive(Serialize, Clone, Debug)]
pub struct CreateRouteParams {
pub pattern: String,
pub script: Option<String>,
}