cloudflare/endpoints/workers/
create_tail.rs1use surf::http::Method;
2
3use super::WorkersTail;
4use crate::framework::endpoint::Endpoint;
5
6#[derive(Debug)]
9pub struct CreateTail<'a> {
10 pub account_identifier: &'a str,
12 pub script_name: &'a str,
14 pub params: CreateTailParams,
20}
21
22impl<'a> Endpoint<WorkersTail, (), CreateTailParams> for CreateTail<'a> {
23 fn method(&self) -> Method {
24 Method::Post
25 }
26 fn path(&self) -> String {
27 format!(
28 "accounts/{}/workers/scripts/{}/tails",
29 self.account_identifier, self.script_name
30 )
31 }
32 fn body(&self) -> Option<CreateTailParams> {
33 if self.params.url.is_some() {
34 Some(self.params.clone())
35 } else {
36 None
37 }
38 }
39}
40
41#[derive(Serialize, Clone, Debug, Default)]
42pub struct CreateTailParams {
43 pub url: Option<String>,
45}