MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / add_record

Method add_record

certbot/src/dns01_client/cloudflare.rs:166–188  ·  view source on GitHub ↗
(&self, record: &impl Serialize)

Source from the content-addressed store, hash-verified

164 }
165
166 async fn add_record(&self, record: &impl Serialize) -> Result<Response> {
167 let client = Client::new();
168 let url = format!("{}/zones/{}/dns_records", self.api_url, self.zone_id);
169 let response = client
170 .post(&url)
171 .header("Authorization", format!("Bearer {}", self.api_token))
172 .header("Content-Type", "application/json")
173 .json(record)
174 .send()
175 .await
176 .context("failed to send add_record request")?;
177
178 let status = response.status();
179 let body = response
180 .text()
181 .await
182 .context("failed to read add_record response body")?;
183 if !status.is_success() {
184 anyhow::bail!("failed to add record: {body}");
185 }
186 let response = serde_json::from_str(&body).context("failed to parse response")?;
187 Ok(response)
188 }
189
190 async fn remove_record_inner(&self, record_id: &str) -> Result<()> {
191 let client = Client::new();

Callers 2

add_txt_recordMethod · 0.80
add_caa_recordMethod · 0.80

Calls 2

sendMethod · 0.80
statusMethod · 0.45

Tested by

no test coverage detected