cloudflare/endpoints/workers/
create_secret.rs1use surf::http::Method;
2
3use super::WorkersSecret;
4use crate::framework::endpoint::Endpoint;
5
6#[derive(Debug)]
9pub struct CreateSecret<'a> {
10 pub account_identifier: &'a str,
12 pub script_name: &'a str,
14 pub params: CreateSecretParams,
16}
17
18impl<'a> Endpoint<WorkersSecret, (), CreateSecretParams> for CreateSecret<'a> {
19 fn method(&self) -> Method {
20 Method::Put
21 }
22 fn path(&self) -> String {
23 format!(
24 "accounts/{}/workers/scripts/{}/secrets",
25 self.account_identifier, self.script_name
26 )
27 }
28 fn body(&self) -> Option<CreateSecretParams> {
29 Some(self.params.clone())
30 }
31}
32
33#[derive(Serialize, Clone, Debug)]
34pub struct CreateSecretParams {
35 pub name: String,
37 pub text: String,
39 #[serde(rename = "type")]
41 pub secret_type: String,
42}