1use crate::datadog;
5use async_stream::try_stream;
6use flate2::{
7 write::{GzEncoder, ZlibEncoder},
8 Compression,
9};
10use futures_core::stream::Stream;
11use reqwest::header::{HeaderMap, HeaderValue};
12use serde::{Deserialize, Serialize};
13use std::io::Write;
14
15#[non_exhaustive]
17#[derive(Clone, Default, Debug)]
18pub struct GetPublicDashboardInvitationsOptionalParams {
19 pub page_size: Option<i64>,
21 pub page_number: Option<i64>,
23}
24
25impl GetPublicDashboardInvitationsOptionalParams {
26 pub fn page_size(mut self, value: i64) -> Self {
28 self.page_size = Some(value);
29 self
30 }
31 pub fn page_number(mut self, value: i64) -> Self {
33 self.page_number = Some(value);
34 self
35 }
36}
37
38#[non_exhaustive]
40#[derive(Clone, Default, Debug)]
41pub struct ListDashboardsOptionalParams {
42 pub filter_shared: Option<bool>,
45 pub filter_deleted: Option<bool>,
48 pub count: Option<i64>,
50 pub start: Option<i64>,
52}
53
54impl ListDashboardsOptionalParams {
55 pub fn filter_shared(mut self, value: bool) -> Self {
58 self.filter_shared = Some(value);
59 self
60 }
61 pub fn filter_deleted(mut self, value: bool) -> Self {
64 self.filter_deleted = Some(value);
65 self
66 }
67 pub fn count(mut self, value: i64) -> Self {
69 self.count = Some(value);
70 self
71 }
72 pub fn start(mut self, value: i64) -> Self {
74 self.start = Some(value);
75 self
76 }
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum CreateDashboardError {
83 APIErrorResponse(crate::datadogV1::model::APIErrorResponse),
84 UnknownValue(serde_json::Value),
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum CreatePublicDashboardError {
91 APIErrorResponse(crate::datadogV1::model::APIErrorResponse),
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum DeleteDashboardError {
99 APIErrorResponse(crate::datadogV1::model::APIErrorResponse),
100 UnknownValue(serde_json::Value),
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize)]
105#[serde(untagged)]
106pub enum DeleteDashboardsError {
107 APIErrorResponse(crate::datadogV1::model::APIErrorResponse),
108 UnknownValue(serde_json::Value),
109}
110
111#[derive(Debug, Clone, Serialize, Deserialize)]
113#[serde(untagged)]
114pub enum DeletePublicDashboardError {
115 APIErrorResponse(crate::datadogV1::model::APIErrorResponse),
116 UnknownValue(serde_json::Value),
117}
118
119#[derive(Debug, Clone, Serialize, Deserialize)]
121#[serde(untagged)]
122pub enum DeletePublicDashboardInvitationError {
123 APIErrorResponse(crate::datadogV1::model::APIErrorResponse),
124 UnknownValue(serde_json::Value),
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize)]
129#[serde(untagged)]
130pub enum GetDashboardError {
131 APIErrorResponse(crate::datadogV1::model::APIErrorResponse),
132 UnknownValue(serde_json::Value),
133}
134
135#[derive(Debug, Clone, Serialize, Deserialize)]
137#[serde(untagged)]
138pub enum GetPublicDashboardError {
139 APIErrorResponse(crate::datadogV1::model::APIErrorResponse),
140 UnknownValue(serde_json::Value),
141}
142
143#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum GetPublicDashboardInvitationsError {
147 APIErrorResponse(crate::datadogV1::model::APIErrorResponse),
148 UnknownValue(serde_json::Value),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum ListDashboardsError {
155 APIErrorResponse(crate::datadogV1::model::APIErrorResponse),
156 UnknownValue(serde_json::Value),
157}
158
159#[derive(Debug, Clone, Serialize, Deserialize)]
161#[serde(untagged)]
162pub enum RestoreDashboardsError {
163 APIErrorResponse(crate::datadogV1::model::APIErrorResponse),
164 UnknownValue(serde_json::Value),
165}
166
167#[derive(Debug, Clone, Serialize, Deserialize)]
169#[serde(untagged)]
170pub enum SendPublicDashboardInvitationError {
171 APIErrorResponse(crate::datadogV1::model::APIErrorResponse),
172 UnknownValue(serde_json::Value),
173}
174
175#[derive(Debug, Clone, Serialize, Deserialize)]
177#[serde(untagged)]
178pub enum UpdateDashboardError {
179 APIErrorResponse(crate::datadogV1::model::APIErrorResponse),
180 UnknownValue(serde_json::Value),
181}
182
183#[derive(Debug, Clone, Serialize, Deserialize)]
185#[serde(untagged)]
186pub enum UpdatePublicDashboardError {
187 APIErrorResponse(crate::datadogV1::model::APIErrorResponse),
188 UnknownValue(serde_json::Value),
189}
190
191#[derive(Debug, Clone)]
193pub struct DashboardsAPI {
194 config: datadog::Configuration,
195 client: reqwest_middleware::ClientWithMiddleware,
196}
197
198impl Default for DashboardsAPI {
199 fn default() -> Self {
200 Self::with_config(datadog::Configuration::default())
201 }
202}
203
204impl DashboardsAPI {
205 pub fn new() -> Self {
206 Self::default()
207 }
208 pub fn with_config(config: datadog::Configuration) -> Self {
209 let mut reqwest_client_builder = reqwest::Client::builder();
210
211 if let Some(proxy_url) = &config.proxy_url {
212 let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL");
213 reqwest_client_builder = reqwest_client_builder.proxy(proxy);
214 }
215
216 let mut middleware_client_builder =
217 reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap());
218
219 if config.enable_retry {
220 struct RetryableStatus;
221 impl reqwest_retry::RetryableStrategy for RetryableStatus {
222 fn handle(
223 &self,
224 res: &Result<reqwest::Response, reqwest_middleware::Error>,
225 ) -> Option<reqwest_retry::Retryable> {
226 match res {
227 Ok(success) => reqwest_retry::default_on_request_success(success),
228 Err(_) => None,
229 }
230 }
231 }
232 let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder()
233 .build_with_max_retries(config.max_retries);
234
235 let retry_middleware =
236 reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy(
237 backoff_policy,
238 RetryableStatus,
239 );
240
241 middleware_client_builder = middleware_client_builder.with(retry_middleware);
242 }
243
244 let client = middleware_client_builder.build();
245
246 Self { config, client }
247 }
248
249 pub fn with_client_and_config(
250 config: datadog::Configuration,
251 client: reqwest_middleware::ClientWithMiddleware,
252 ) -> Self {
253 Self { config, client }
254 }
255
256 pub async fn create_dashboard(
259 &self,
260 body: crate::datadogV1::model::Dashboard,
261 ) -> Result<crate::datadogV1::model::Dashboard, datadog::Error<CreateDashboardError>> {
262 match self.create_dashboard_with_http_info(body).await {
263 Ok(response_content) => {
264 if let Some(e) = response_content.entity {
265 Ok(e)
266 } else {
267 Err(datadog::Error::Serde(serde::de::Error::custom(
268 "response content was None",
269 )))
270 }
271 }
272 Err(err) => Err(err),
273 }
274 }
275
276 pub async fn create_dashboard_with_http_info(
279 &self,
280 body: crate::datadogV1::model::Dashboard,
281 ) -> Result<
282 datadog::ResponseContent<crate::datadogV1::model::Dashboard>,
283 datadog::Error<CreateDashboardError>,
284 > {
285 let local_configuration = &self.config;
286 let operation_id = "v1.create_dashboard";
287
288 let local_client = &self.client;
289
290 let local_uri_str = format!(
291 "{}/api/v1/dashboard",
292 local_configuration.get_operation_host(operation_id)
293 );
294 let mut local_req_builder =
295 local_client.request(reqwest::Method::POST, local_uri_str.as_str());
296
297 let mut headers = HeaderMap::new();
299 headers.insert("Content-Type", HeaderValue::from_static("application/json"));
300 headers.insert("Accept", HeaderValue::from_static("application/json"));
301
302 match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
304 Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
305 Err(e) => {
306 log::warn!("Failed to parse user agent header: {e}, falling back to default");
307 headers.insert(
308 reqwest::header::USER_AGENT,
309 HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
310 )
311 }
312 };
313
314 if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
316 headers.insert(
317 "DD-API-KEY",
318 HeaderValue::from_str(local_key.key.as_str())
319 .expect("failed to parse DD-API-KEY header"),
320 );
321 };
322 if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
323 headers.insert(
324 "DD-APPLICATION-KEY",
325 HeaderValue::from_str(local_key.key.as_str())
326 .expect("failed to parse DD-APPLICATION-KEY header"),
327 );
328 };
329
330 let output = Vec::new();
332 let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
333 if body.serialize(&mut ser).is_ok() {
334 if let Some(content_encoding) = headers.get("Content-Encoding") {
335 match content_encoding.to_str().unwrap_or_default() {
336 "gzip" => {
337 let mut enc = GzEncoder::new(Vec::new(), Compression::default());
338 let _ = enc.write_all(ser.into_inner().as_slice());
339 match enc.finish() {
340 Ok(buf) => {
341 local_req_builder = local_req_builder.body(buf);
342 }
343 Err(e) => return Err(datadog::Error::Io(e)),
344 }
345 }
346 "deflate" => {
347 let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
348 let _ = enc.write_all(ser.into_inner().as_slice());
349 match enc.finish() {
350 Ok(buf) => {
351 local_req_builder = local_req_builder.body(buf);
352 }
353 Err(e) => return Err(datadog::Error::Io(e)),
354 }
355 }
356 "zstd1" => {
357 let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
358 let _ = enc.write_all(ser.into_inner().as_slice());
359 match enc.finish() {
360 Ok(buf) => {
361 local_req_builder = local_req_builder.body(buf);
362 }
363 Err(e) => return Err(datadog::Error::Io(e)),
364 }
365 }
366 _ => {
367 local_req_builder = local_req_builder.body(ser.into_inner());
368 }
369 }
370 } else {
371 local_req_builder = local_req_builder.body(ser.into_inner());
372 }
373 }
374
375 local_req_builder = local_req_builder.headers(headers);
376 let local_req = local_req_builder.build()?;
377 log::debug!("request content: {:?}", local_req.body());
378 let local_resp = local_client.execute(local_req).await?;
379
380 let local_status = local_resp.status();
381 let local_content = local_resp.text().await?;
382 log::debug!("response content: {}", local_content);
383
384 if !local_status.is_client_error() && !local_status.is_server_error() {
385 match serde_json::from_str::<crate::datadogV1::model::Dashboard>(&local_content) {
386 Ok(e) => {
387 return Ok(datadog::ResponseContent {
388 status: local_status,
389 content: local_content,
390 entity: Some(e),
391 })
392 }
393 Err(e) => return Err(datadog::Error::Serde(e)),
394 };
395 } else {
396 let local_entity: Option<CreateDashboardError> =
397 serde_json::from_str(&local_content).ok();
398 let local_error = datadog::ResponseContent {
399 status: local_status,
400 content: local_content,
401 entity: local_entity,
402 };
403 Err(datadog::Error::ResponseError(local_error))
404 }
405 }
406
407 pub async fn create_public_dashboard(
409 &self,
410 body: crate::datadogV1::model::SharedDashboard,
411 ) -> Result<crate::datadogV1::model::SharedDashboard, datadog::Error<CreatePublicDashboardError>>
412 {
413 match self.create_public_dashboard_with_http_info(body).await {
414 Ok(response_content) => {
415 if let Some(e) = response_content.entity {
416 Ok(e)
417 } else {
418 Err(datadog::Error::Serde(serde::de::Error::custom(
419 "response content was None",
420 )))
421 }
422 }
423 Err(err) => Err(err),
424 }
425 }
426
427 pub async fn create_public_dashboard_with_http_info(
429 &self,
430 body: crate::datadogV1::model::SharedDashboard,
431 ) -> Result<
432 datadog::ResponseContent<crate::datadogV1::model::SharedDashboard>,
433 datadog::Error<CreatePublicDashboardError>,
434 > {
435 let local_configuration = &self.config;
436 let operation_id = "v1.create_public_dashboard";
437
438 let local_client = &self.client;
439
440 let local_uri_str = format!(
441 "{}/api/v1/dashboard/public",
442 local_configuration.get_operation_host(operation_id)
443 );
444 let mut local_req_builder =
445 local_client.request(reqwest::Method::POST, local_uri_str.as_str());
446
447 let mut headers = HeaderMap::new();
449 headers.insert("Content-Type", HeaderValue::from_static("application/json"));
450 headers.insert("Accept", HeaderValue::from_static("application/json"));
451
452 match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
454 Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
455 Err(e) => {
456 log::warn!("Failed to parse user agent header: {e}, falling back to default");
457 headers.insert(
458 reqwest::header::USER_AGENT,
459 HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
460 )
461 }
462 };
463
464 if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
466 headers.insert(
467 "DD-API-KEY",
468 HeaderValue::from_str(local_key.key.as_str())
469 .expect("failed to parse DD-API-KEY header"),
470 );
471 };
472 if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
473 headers.insert(
474 "DD-APPLICATION-KEY",
475 HeaderValue::from_str(local_key.key.as_str())
476 .expect("failed to parse DD-APPLICATION-KEY header"),
477 );
478 };
479
480 let output = Vec::new();
482 let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
483 if body.serialize(&mut ser).is_ok() {
484 if let Some(content_encoding) = headers.get("Content-Encoding") {
485 match content_encoding.to_str().unwrap_or_default() {
486 "gzip" => {
487 let mut enc = GzEncoder::new(Vec::new(), Compression::default());
488 let _ = enc.write_all(ser.into_inner().as_slice());
489 match enc.finish() {
490 Ok(buf) => {
491 local_req_builder = local_req_builder.body(buf);
492 }
493 Err(e) => return Err(datadog::Error::Io(e)),
494 }
495 }
496 "deflate" => {
497 let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
498 let _ = enc.write_all(ser.into_inner().as_slice());
499 match enc.finish() {
500 Ok(buf) => {
501 local_req_builder = local_req_builder.body(buf);
502 }
503 Err(e) => return Err(datadog::Error::Io(e)),
504 }
505 }
506 "zstd1" => {
507 let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
508 let _ = enc.write_all(ser.into_inner().as_slice());
509 match enc.finish() {
510 Ok(buf) => {
511 local_req_builder = local_req_builder.body(buf);
512 }
513 Err(e) => return Err(datadog::Error::Io(e)),
514 }
515 }
516 _ => {
517 local_req_builder = local_req_builder.body(ser.into_inner());
518 }
519 }
520 } else {
521 local_req_builder = local_req_builder.body(ser.into_inner());
522 }
523 }
524
525 local_req_builder = local_req_builder.headers(headers);
526 let local_req = local_req_builder.build()?;
527 log::debug!("request content: {:?}", local_req.body());
528 let local_resp = local_client.execute(local_req).await?;
529
530 let local_status = local_resp.status();
531 let local_content = local_resp.text().await?;
532 log::debug!("response content: {}", local_content);
533
534 if !local_status.is_client_error() && !local_status.is_server_error() {
535 match serde_json::from_str::<crate::datadogV1::model::SharedDashboard>(&local_content) {
536 Ok(e) => {
537 return Ok(datadog::ResponseContent {
538 status: local_status,
539 content: local_content,
540 entity: Some(e),
541 })
542 }
543 Err(e) => return Err(datadog::Error::Serde(e)),
544 };
545 } else {
546 let local_entity: Option<CreatePublicDashboardError> =
547 serde_json::from_str(&local_content).ok();
548 let local_error = datadog::ResponseContent {
549 status: local_status,
550 content: local_content,
551 entity: local_entity,
552 };
553 Err(datadog::Error::ResponseError(local_error))
554 }
555 }
556
557 pub async fn delete_dashboard(
559 &self,
560 dashboard_id: String,
561 ) -> Result<
562 crate::datadogV1::model::DashboardDeleteResponse,
563 datadog::Error<DeleteDashboardError>,
564 > {
565 match self.delete_dashboard_with_http_info(dashboard_id).await {
566 Ok(response_content) => {
567 if let Some(e) = response_content.entity {
568 Ok(e)
569 } else {
570 Err(datadog::Error::Serde(serde::de::Error::custom(
571 "response content was None",
572 )))
573 }
574 }
575 Err(err) => Err(err),
576 }
577 }
578
579 pub async fn delete_dashboard_with_http_info(
581 &self,
582 dashboard_id: String,
583 ) -> Result<
584 datadog::ResponseContent<crate::datadogV1::model::DashboardDeleteResponse>,
585 datadog::Error<DeleteDashboardError>,
586 > {
587 let local_configuration = &self.config;
588 let operation_id = "v1.delete_dashboard";
589
590 let local_client = &self.client;
591
592 let local_uri_str = format!(
593 "{}/api/v1/dashboard/{dashboard_id}",
594 local_configuration.get_operation_host(operation_id),
595 dashboard_id = datadog::urlencode(dashboard_id)
596 );
597 let mut local_req_builder =
598 local_client.request(reqwest::Method::DELETE, local_uri_str.as_str());
599
600 let mut headers = HeaderMap::new();
602 headers.insert("Accept", HeaderValue::from_static("application/json"));
603
604 match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
606 Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
607 Err(e) => {
608 log::warn!("Failed to parse user agent header: {e}, falling back to default");
609 headers.insert(
610 reqwest::header::USER_AGENT,
611 HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
612 )
613 }
614 };
615
616 if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
618 headers.insert(
619 "DD-API-KEY",
620 HeaderValue::from_str(local_key.key.as_str())
621 .expect("failed to parse DD-API-KEY header"),
622 );
623 };
624 if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
625 headers.insert(
626 "DD-APPLICATION-KEY",
627 HeaderValue::from_str(local_key.key.as_str())
628 .expect("failed to parse DD-APPLICATION-KEY header"),
629 );
630 };
631
632 local_req_builder = local_req_builder.headers(headers);
633 let local_req = local_req_builder.build()?;
634 log::debug!("request content: {:?}", local_req.body());
635 let local_resp = local_client.execute(local_req).await?;
636
637 let local_status = local_resp.status();
638 let local_content = local_resp.text().await?;
639 log::debug!("response content: {}", local_content);
640
641 if !local_status.is_client_error() && !local_status.is_server_error() {
642 match serde_json::from_str::<crate::datadogV1::model::DashboardDeleteResponse>(
643 &local_content,
644 ) {
645 Ok(e) => {
646 return Ok(datadog::ResponseContent {
647 status: local_status,
648 content: local_content,
649 entity: Some(e),
650 })
651 }
652 Err(e) => return Err(datadog::Error::Serde(e)),
653 };
654 } else {
655 let local_entity: Option<DeleteDashboardError> =
656 serde_json::from_str(&local_content).ok();
657 let local_error = datadog::ResponseContent {
658 status: local_status,
659 content: local_content,
660 entity: local_entity,
661 };
662 Err(datadog::Error::ResponseError(local_error))
663 }
664 }
665
666 pub async fn delete_dashboards(
668 &self,
669 body: crate::datadogV1::model::DashboardBulkDeleteRequest,
670 ) -> Result<(), datadog::Error<DeleteDashboardsError>> {
671 match self.delete_dashboards_with_http_info(body).await {
672 Ok(_) => Ok(()),
673 Err(err) => Err(err),
674 }
675 }
676
677 pub async fn delete_dashboards_with_http_info(
679 &self,
680 body: crate::datadogV1::model::DashboardBulkDeleteRequest,
681 ) -> Result<datadog::ResponseContent<()>, datadog::Error<DeleteDashboardsError>> {
682 let local_configuration = &self.config;
683 let operation_id = "v1.delete_dashboards";
684
685 let local_client = &self.client;
686
687 let local_uri_str = format!(
688 "{}/api/v1/dashboard",
689 local_configuration.get_operation_host(operation_id)
690 );
691 let mut local_req_builder =
692 local_client.request(reqwest::Method::DELETE, local_uri_str.as_str());
693
694 let mut headers = HeaderMap::new();
696 headers.insert("Content-Type", HeaderValue::from_static("application/json"));
697 headers.insert("Accept", HeaderValue::from_static("*/*"));
698
699 match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
701 Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
702 Err(e) => {
703 log::warn!("Failed to parse user agent header: {e}, falling back to default");
704 headers.insert(
705 reqwest::header::USER_AGENT,
706 HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
707 )
708 }
709 };
710
711 if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
713 headers.insert(
714 "DD-API-KEY",
715 HeaderValue::from_str(local_key.key.as_str())
716 .expect("failed to parse DD-API-KEY header"),
717 );
718 };
719 if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
720 headers.insert(
721 "DD-APPLICATION-KEY",
722 HeaderValue::from_str(local_key.key.as_str())
723 .expect("failed to parse DD-APPLICATION-KEY header"),
724 );
725 };
726
727 let output = Vec::new();
729 let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
730 if body.serialize(&mut ser).is_ok() {
731 if let Some(content_encoding) = headers.get("Content-Encoding") {
732 match content_encoding.to_str().unwrap_or_default() {
733 "gzip" => {
734 let mut enc = GzEncoder::new(Vec::new(), Compression::default());
735 let _ = enc.write_all(ser.into_inner().as_slice());
736 match enc.finish() {
737 Ok(buf) => {
738 local_req_builder = local_req_builder.body(buf);
739 }
740 Err(e) => return Err(datadog::Error::Io(e)),
741 }
742 }
743 "deflate" => {
744 let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
745 let _ = enc.write_all(ser.into_inner().as_slice());
746 match enc.finish() {
747 Ok(buf) => {
748 local_req_builder = local_req_builder.body(buf);
749 }
750 Err(e) => return Err(datadog::Error::Io(e)),
751 }
752 }
753 "zstd1" => {
754 let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
755 let _ = enc.write_all(ser.into_inner().as_slice());
756 match enc.finish() {
757 Ok(buf) => {
758 local_req_builder = local_req_builder.body(buf);
759 }
760 Err(e) => return Err(datadog::Error::Io(e)),
761 }
762 }
763 _ => {
764 local_req_builder = local_req_builder.body(ser.into_inner());
765 }
766 }
767 } else {
768 local_req_builder = local_req_builder.body(ser.into_inner());
769 }
770 }
771
772 local_req_builder = local_req_builder.headers(headers);
773 let local_req = local_req_builder.build()?;
774 log::debug!("request content: {:?}", local_req.body());
775 let local_resp = local_client.execute(local_req).await?;
776
777 let local_status = local_resp.status();
778 let local_content = local_resp.text().await?;
779 log::debug!("response content: {}", local_content);
780
781 if !local_status.is_client_error() && !local_status.is_server_error() {
782 Ok(datadog::ResponseContent {
783 status: local_status,
784 content: local_content,
785 entity: None,
786 })
787 } else {
788 let local_entity: Option<DeleteDashboardsError> =
789 serde_json::from_str(&local_content).ok();
790 let local_error = datadog::ResponseContent {
791 status: local_status,
792 content: local_content,
793 entity: local_entity,
794 };
795 Err(datadog::Error::ResponseError(local_error))
796 }
797 }
798
799 pub async fn delete_public_dashboard(
801 &self,
802 token: String,
803 ) -> Result<
804 crate::datadogV1::model::DeleteSharedDashboardResponse,
805 datadog::Error<DeletePublicDashboardError>,
806 > {
807 match self.delete_public_dashboard_with_http_info(token).await {
808 Ok(response_content) => {
809 if let Some(e) = response_content.entity {
810 Ok(e)
811 } else {
812 Err(datadog::Error::Serde(serde::de::Error::custom(
813 "response content was None",
814 )))
815 }
816 }
817 Err(err) => Err(err),
818 }
819 }
820
821 pub async fn delete_public_dashboard_with_http_info(
823 &self,
824 token: String,
825 ) -> Result<
826 datadog::ResponseContent<crate::datadogV1::model::DeleteSharedDashboardResponse>,
827 datadog::Error<DeletePublicDashboardError>,
828 > {
829 let local_configuration = &self.config;
830 let operation_id = "v1.delete_public_dashboard";
831
832 let local_client = &self.client;
833
834 let local_uri_str = format!(
835 "{}/api/v1/dashboard/public/{token}",
836 local_configuration.get_operation_host(operation_id),
837 token = datadog::urlencode(token)
838 );
839 let mut local_req_builder =
840 local_client.request(reqwest::Method::DELETE, local_uri_str.as_str());
841
842 let mut headers = HeaderMap::new();
844 headers.insert("Accept", HeaderValue::from_static("application/json"));
845
846 match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
848 Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
849 Err(e) => {
850 log::warn!("Failed to parse user agent header: {e}, falling back to default");
851 headers.insert(
852 reqwest::header::USER_AGENT,
853 HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
854 )
855 }
856 };
857
858 if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
860 headers.insert(
861 "DD-API-KEY",
862 HeaderValue::from_str(local_key.key.as_str())
863 .expect("failed to parse DD-API-KEY header"),
864 );
865 };
866 if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
867 headers.insert(
868 "DD-APPLICATION-KEY",
869 HeaderValue::from_str(local_key.key.as_str())
870 .expect("failed to parse DD-APPLICATION-KEY header"),
871 );
872 };
873
874 local_req_builder = local_req_builder.headers(headers);
875 let local_req = local_req_builder.build()?;
876 log::debug!("request content: {:?}", local_req.body());
877 let local_resp = local_client.execute(local_req).await?;
878
879 let local_status = local_resp.status();
880 let local_content = local_resp.text().await?;
881 log::debug!("response content: {}", local_content);
882
883 if !local_status.is_client_error() && !local_status.is_server_error() {
884 match serde_json::from_str::<crate::datadogV1::model::DeleteSharedDashboardResponse>(
885 &local_content,
886 ) {
887 Ok(e) => {
888 return Ok(datadog::ResponseContent {
889 status: local_status,
890 content: local_content,
891 entity: Some(e),
892 })
893 }
894 Err(e) => return Err(datadog::Error::Serde(e)),
895 };
896 } else {
897 let local_entity: Option<DeletePublicDashboardError> =
898 serde_json::from_str(&local_content).ok();
899 let local_error = datadog::ResponseContent {
900 status: local_status,
901 content: local_content,
902 entity: local_entity,
903 };
904 Err(datadog::Error::ResponseError(local_error))
905 }
906 }
907
908 pub async fn delete_public_dashboard_invitation(
910 &self,
911 token: String,
912 body: crate::datadogV1::model::SharedDashboardInvites,
913 ) -> Result<(), datadog::Error<DeletePublicDashboardInvitationError>> {
914 match self
915 .delete_public_dashboard_invitation_with_http_info(token, body)
916 .await
917 {
918 Ok(_) => Ok(()),
919 Err(err) => Err(err),
920 }
921 }
922
923 pub async fn delete_public_dashboard_invitation_with_http_info(
925 &self,
926 token: String,
927 body: crate::datadogV1::model::SharedDashboardInvites,
928 ) -> Result<datadog::ResponseContent<()>, datadog::Error<DeletePublicDashboardInvitationError>>
929 {
930 let local_configuration = &self.config;
931 let operation_id = "v1.delete_public_dashboard_invitation";
932
933 let local_client = &self.client;
934
935 let local_uri_str = format!(
936 "{}/api/v1/dashboard/public/{token}/invitation",
937 local_configuration.get_operation_host(operation_id),
938 token = datadog::urlencode(token)
939 );
940 let mut local_req_builder =
941 local_client.request(reqwest::Method::DELETE, local_uri_str.as_str());
942
943 let mut headers = HeaderMap::new();
945 headers.insert("Content-Type", HeaderValue::from_static("application/json"));
946 headers.insert("Accept", HeaderValue::from_static("*/*"));
947
948 match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
950 Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
951 Err(e) => {
952 log::warn!("Failed to parse user agent header: {e}, falling back to default");
953 headers.insert(
954 reqwest::header::USER_AGENT,
955 HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
956 )
957 }
958 };
959
960 if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
962 headers.insert(
963 "DD-API-KEY",
964 HeaderValue::from_str(local_key.key.as_str())
965 .expect("failed to parse DD-API-KEY header"),
966 );
967 };
968 if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
969 headers.insert(
970 "DD-APPLICATION-KEY",
971 HeaderValue::from_str(local_key.key.as_str())
972 .expect("failed to parse DD-APPLICATION-KEY header"),
973 );
974 };
975
976 let output = Vec::new();
978 let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
979 if body.serialize(&mut ser).is_ok() {
980 if let Some(content_encoding) = headers.get("Content-Encoding") {
981 match content_encoding.to_str().unwrap_or_default() {
982 "gzip" => {
983 let mut enc = GzEncoder::new(Vec::new(), Compression::default());
984 let _ = enc.write_all(ser.into_inner().as_slice());
985 match enc.finish() {
986 Ok(buf) => {
987 local_req_builder = local_req_builder.body(buf);
988 }
989 Err(e) => return Err(datadog::Error::Io(e)),
990 }
991 }
992 "deflate" => {
993 let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
994 let _ = enc.write_all(ser.into_inner().as_slice());
995 match enc.finish() {
996 Ok(buf) => {
997 local_req_builder = local_req_builder.body(buf);
998 }
999 Err(e) => return Err(datadog::Error::Io(e)),
1000 }
1001 }
1002 "zstd1" => {
1003 let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
1004 let _ = enc.write_all(ser.into_inner().as_slice());
1005 match enc.finish() {
1006 Ok(buf) => {
1007 local_req_builder = local_req_builder.body(buf);
1008 }
1009 Err(e) => return Err(datadog::Error::Io(e)),
1010 }
1011 }
1012 _ => {
1013 local_req_builder = local_req_builder.body(ser.into_inner());
1014 }
1015 }
1016 } else {
1017 local_req_builder = local_req_builder.body(ser.into_inner());
1018 }
1019 }
1020
1021 local_req_builder = local_req_builder.headers(headers);
1022 let local_req = local_req_builder.build()?;
1023 log::debug!("request content: {:?}", local_req.body());
1024 let local_resp = local_client.execute(local_req).await?;
1025
1026 let local_status = local_resp.status();
1027 let local_content = local_resp.text().await?;
1028 log::debug!("response content: {}", local_content);
1029
1030 if !local_status.is_client_error() && !local_status.is_server_error() {
1031 Ok(datadog::ResponseContent {
1032 status: local_status,
1033 content: local_content,
1034 entity: None,
1035 })
1036 } else {
1037 let local_entity: Option<DeletePublicDashboardInvitationError> =
1038 serde_json::from_str(&local_content).ok();
1039 let local_error = datadog::ResponseContent {
1040 status: local_status,
1041 content: local_content,
1042 entity: local_entity,
1043 };
1044 Err(datadog::Error::ResponseError(local_error))
1045 }
1046 }
1047
1048 pub async fn get_dashboard(
1050 &self,
1051 dashboard_id: String,
1052 ) -> Result<crate::datadogV1::model::Dashboard, datadog::Error<GetDashboardError>> {
1053 match self.get_dashboard_with_http_info(dashboard_id).await {
1054 Ok(response_content) => {
1055 if let Some(e) = response_content.entity {
1056 Ok(e)
1057 } else {
1058 Err(datadog::Error::Serde(serde::de::Error::custom(
1059 "response content was None",
1060 )))
1061 }
1062 }
1063 Err(err) => Err(err),
1064 }
1065 }
1066
1067 pub async fn get_dashboard_with_http_info(
1069 &self,
1070 dashboard_id: String,
1071 ) -> Result<
1072 datadog::ResponseContent<crate::datadogV1::model::Dashboard>,
1073 datadog::Error<GetDashboardError>,
1074 > {
1075 let local_configuration = &self.config;
1076 let operation_id = "v1.get_dashboard";
1077
1078 let local_client = &self.client;
1079
1080 let local_uri_str = format!(
1081 "{}/api/v1/dashboard/{dashboard_id}",
1082 local_configuration.get_operation_host(operation_id),
1083 dashboard_id = datadog::urlencode(dashboard_id)
1084 );
1085 let mut local_req_builder =
1086 local_client.request(reqwest::Method::GET, local_uri_str.as_str());
1087
1088 let mut headers = HeaderMap::new();
1090 headers.insert("Accept", HeaderValue::from_static("application/json"));
1091
1092 match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
1094 Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
1095 Err(e) => {
1096 log::warn!("Failed to parse user agent header: {e}, falling back to default");
1097 headers.insert(
1098 reqwest::header::USER_AGENT,
1099 HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
1100 )
1101 }
1102 };
1103
1104 if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
1106 headers.insert(
1107 "DD-API-KEY",
1108 HeaderValue::from_str(local_key.key.as_str())
1109 .expect("failed to parse DD-API-KEY header"),
1110 );
1111 };
1112 if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
1113 headers.insert(
1114 "DD-APPLICATION-KEY",
1115 HeaderValue::from_str(local_key.key.as_str())
1116 .expect("failed to parse DD-APPLICATION-KEY header"),
1117 );
1118 };
1119
1120 local_req_builder = local_req_builder.headers(headers);
1121 let local_req = local_req_builder.build()?;
1122 log::debug!("request content: {:?}", local_req.body());
1123 let local_resp = local_client.execute(local_req).await?;
1124
1125 let local_status = local_resp.status();
1126 let local_content = local_resp.text().await?;
1127 log::debug!("response content: {}", local_content);
1128
1129 if !local_status.is_client_error() && !local_status.is_server_error() {
1130 match serde_json::from_str::<crate::datadogV1::model::Dashboard>(&local_content) {
1131 Ok(e) => {
1132 return Ok(datadog::ResponseContent {
1133 status: local_status,
1134 content: local_content,
1135 entity: Some(e),
1136 })
1137 }
1138 Err(e) => return Err(datadog::Error::Serde(e)),
1139 };
1140 } else {
1141 let local_entity: Option<GetDashboardError> = serde_json::from_str(&local_content).ok();
1142 let local_error = datadog::ResponseContent {
1143 status: local_status,
1144 content: local_content,
1145 entity: local_entity,
1146 };
1147 Err(datadog::Error::ResponseError(local_error))
1148 }
1149 }
1150
1151 pub async fn get_public_dashboard(
1153 &self,
1154 token: String,
1155 ) -> Result<crate::datadogV1::model::SharedDashboard, datadog::Error<GetPublicDashboardError>>
1156 {
1157 match self.get_public_dashboard_with_http_info(token).await {
1158 Ok(response_content) => {
1159 if let Some(e) = response_content.entity {
1160 Ok(e)
1161 } else {
1162 Err(datadog::Error::Serde(serde::de::Error::custom(
1163 "response content was None",
1164 )))
1165 }
1166 }
1167 Err(err) => Err(err),
1168 }
1169 }
1170
1171 pub async fn get_public_dashboard_with_http_info(
1173 &self,
1174 token: String,
1175 ) -> Result<
1176 datadog::ResponseContent<crate::datadogV1::model::SharedDashboard>,
1177 datadog::Error<GetPublicDashboardError>,
1178 > {
1179 let local_configuration = &self.config;
1180 let operation_id = "v1.get_public_dashboard";
1181
1182 let local_client = &self.client;
1183
1184 let local_uri_str = format!(
1185 "{}/api/v1/dashboard/public/{token}",
1186 local_configuration.get_operation_host(operation_id),
1187 token = datadog::urlencode(token)
1188 );
1189 let mut local_req_builder =
1190 local_client.request(reqwest::Method::GET, local_uri_str.as_str());
1191
1192 let mut headers = HeaderMap::new();
1194 headers.insert("Accept", HeaderValue::from_static("application/json"));
1195
1196 match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
1198 Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
1199 Err(e) => {
1200 log::warn!("Failed to parse user agent header: {e}, falling back to default");
1201 headers.insert(
1202 reqwest::header::USER_AGENT,
1203 HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
1204 )
1205 }
1206 };
1207
1208 if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
1210 headers.insert(
1211 "DD-API-KEY",
1212 HeaderValue::from_str(local_key.key.as_str())
1213 .expect("failed to parse DD-API-KEY header"),
1214 );
1215 };
1216 if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
1217 headers.insert(
1218 "DD-APPLICATION-KEY",
1219 HeaderValue::from_str(local_key.key.as_str())
1220 .expect("failed to parse DD-APPLICATION-KEY header"),
1221 );
1222 };
1223
1224 local_req_builder = local_req_builder.headers(headers);
1225 let local_req = local_req_builder.build()?;
1226 log::debug!("request content: {:?}", local_req.body());
1227 let local_resp = local_client.execute(local_req).await?;
1228
1229 let local_status = local_resp.status();
1230 let local_content = local_resp.text().await?;
1231 log::debug!("response content: {}", local_content);
1232
1233 if !local_status.is_client_error() && !local_status.is_server_error() {
1234 match serde_json::from_str::<crate::datadogV1::model::SharedDashboard>(&local_content) {
1235 Ok(e) => {
1236 return Ok(datadog::ResponseContent {
1237 status: local_status,
1238 content: local_content,
1239 entity: Some(e),
1240 })
1241 }
1242 Err(e) => return Err(datadog::Error::Serde(e)),
1243 };
1244 } else {
1245 let local_entity: Option<GetPublicDashboardError> =
1246 serde_json::from_str(&local_content).ok();
1247 let local_error = datadog::ResponseContent {
1248 status: local_status,
1249 content: local_content,
1250 entity: local_entity,
1251 };
1252 Err(datadog::Error::ResponseError(local_error))
1253 }
1254 }
1255
1256 pub async fn get_public_dashboard_invitations(
1258 &self,
1259 token: String,
1260 params: GetPublicDashboardInvitationsOptionalParams,
1261 ) -> Result<
1262 crate::datadogV1::model::SharedDashboardInvites,
1263 datadog::Error<GetPublicDashboardInvitationsError>,
1264 > {
1265 match self
1266 .get_public_dashboard_invitations_with_http_info(token, params)
1267 .await
1268 {
1269 Ok(response_content) => {
1270 if let Some(e) = response_content.entity {
1271 Ok(e)
1272 } else {
1273 Err(datadog::Error::Serde(serde::de::Error::custom(
1274 "response content was None",
1275 )))
1276 }
1277 }
1278 Err(err) => Err(err),
1279 }
1280 }
1281
1282 pub async fn get_public_dashboard_invitations_with_http_info(
1284 &self,
1285 token: String,
1286 params: GetPublicDashboardInvitationsOptionalParams,
1287 ) -> Result<
1288 datadog::ResponseContent<crate::datadogV1::model::SharedDashboardInvites>,
1289 datadog::Error<GetPublicDashboardInvitationsError>,
1290 > {
1291 let local_configuration = &self.config;
1292 let operation_id = "v1.get_public_dashboard_invitations";
1293
1294 let page_size = params.page_size;
1296 let page_number = params.page_number;
1297
1298 let local_client = &self.client;
1299
1300 let local_uri_str = format!(
1301 "{}/api/v1/dashboard/public/{token}/invitation",
1302 local_configuration.get_operation_host(operation_id),
1303 token = datadog::urlencode(token)
1304 );
1305 let mut local_req_builder =
1306 local_client.request(reqwest::Method::GET, local_uri_str.as_str());
1307
1308 if let Some(ref local_query_param) = page_size {
1309 local_req_builder =
1310 local_req_builder.query(&[("page_size", &local_query_param.to_string())]);
1311 };
1312 if let Some(ref local_query_param) = page_number {
1313 local_req_builder =
1314 local_req_builder.query(&[("page_number", &local_query_param.to_string())]);
1315 };
1316
1317 let mut headers = HeaderMap::new();
1319 headers.insert("Accept", HeaderValue::from_static("application/json"));
1320
1321 match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
1323 Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
1324 Err(e) => {
1325 log::warn!("Failed to parse user agent header: {e}, falling back to default");
1326 headers.insert(
1327 reqwest::header::USER_AGENT,
1328 HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
1329 )
1330 }
1331 };
1332
1333 if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
1335 headers.insert(
1336 "DD-API-KEY",
1337 HeaderValue::from_str(local_key.key.as_str())
1338 .expect("failed to parse DD-API-KEY header"),
1339 );
1340 };
1341 if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
1342 headers.insert(
1343 "DD-APPLICATION-KEY",
1344 HeaderValue::from_str(local_key.key.as_str())
1345 .expect("failed to parse DD-APPLICATION-KEY header"),
1346 );
1347 };
1348
1349 local_req_builder = local_req_builder.headers(headers);
1350 let local_req = local_req_builder.build()?;
1351 log::debug!("request content: {:?}", local_req.body());
1352 let local_resp = local_client.execute(local_req).await?;
1353
1354 let local_status = local_resp.status();
1355 let local_content = local_resp.text().await?;
1356 log::debug!("response content: {}", local_content);
1357
1358 if !local_status.is_client_error() && !local_status.is_server_error() {
1359 match serde_json::from_str::<crate::datadogV1::model::SharedDashboardInvites>(
1360 &local_content,
1361 ) {
1362 Ok(e) => {
1363 return Ok(datadog::ResponseContent {
1364 status: local_status,
1365 content: local_content,
1366 entity: Some(e),
1367 })
1368 }
1369 Err(e) => return Err(datadog::Error::Serde(e)),
1370 };
1371 } else {
1372 let local_entity: Option<GetPublicDashboardInvitationsError> =
1373 serde_json::from_str(&local_content).ok();
1374 let local_error = datadog::ResponseContent {
1375 status: local_status,
1376 content: local_content,
1377 entity: local_entity,
1378 };
1379 Err(datadog::Error::ResponseError(local_error))
1380 }
1381 }
1382
1383 pub async fn list_dashboards(
1388 &self,
1389 params: ListDashboardsOptionalParams,
1390 ) -> Result<crate::datadogV1::model::DashboardSummary, datadog::Error<ListDashboardsError>>
1391 {
1392 match self.list_dashboards_with_http_info(params).await {
1393 Ok(response_content) => {
1394 if let Some(e) = response_content.entity {
1395 Ok(e)
1396 } else {
1397 Err(datadog::Error::Serde(serde::de::Error::custom(
1398 "response content was None",
1399 )))
1400 }
1401 }
1402 Err(err) => Err(err),
1403 }
1404 }
1405
1406 pub fn list_dashboards_with_pagination(
1407 &self,
1408 mut params: ListDashboardsOptionalParams,
1409 ) -> impl Stream<
1410 Item = Result<
1411 crate::datadogV1::model::DashboardSummaryDefinition,
1412 datadog::Error<ListDashboardsError>,
1413 >,
1414 > + '_ {
1415 try_stream! {
1416 let mut page_size: i64 = 100;
1417 if params.count.is_none() {
1418 params.count = Some(page_size);
1419 } else {
1420 page_size = params.count.unwrap().clone();
1421 }
1422 loop {
1423 let resp = self.list_dashboards(params.clone()).await?;
1424 let Some(dashboards) = resp.dashboards else { break };
1425
1426 let r = dashboards;
1427 let count = r.len();
1428 for team in r {
1429 yield team;
1430 }
1431
1432 if count < page_size as usize {
1433 break;
1434 }
1435 if params.start.is_none() {
1436 params.start = Some(page_size.clone());
1437 } else {
1438 params.start = Some(params.start.unwrap() + page_size.clone());
1439 }
1440 }
1441 }
1442 }
1443
1444 pub async fn list_dashboards_with_http_info(
1449 &self,
1450 params: ListDashboardsOptionalParams,
1451 ) -> Result<
1452 datadog::ResponseContent<crate::datadogV1::model::DashboardSummary>,
1453 datadog::Error<ListDashboardsError>,
1454 > {
1455 let local_configuration = &self.config;
1456 let operation_id = "v1.list_dashboards";
1457
1458 let filter_shared = params.filter_shared;
1460 let filter_deleted = params.filter_deleted;
1461 let count = params.count;
1462 let start = params.start;
1463
1464 let local_client = &self.client;
1465
1466 let local_uri_str = format!(
1467 "{}/api/v1/dashboard",
1468 local_configuration.get_operation_host(operation_id)
1469 );
1470 let mut local_req_builder =
1471 local_client.request(reqwest::Method::GET, local_uri_str.as_str());
1472
1473 if let Some(ref local_query_param) = filter_shared {
1474 local_req_builder =
1475 local_req_builder.query(&[("filter[shared]", &local_query_param.to_string())]);
1476 };
1477 if let Some(ref local_query_param) = filter_deleted {
1478 local_req_builder =
1479 local_req_builder.query(&[("filter[deleted]", &local_query_param.to_string())]);
1480 };
1481 if let Some(ref local_query_param) = count {
1482 local_req_builder =
1483 local_req_builder.query(&[("count", &local_query_param.to_string())]);
1484 };
1485 if let Some(ref local_query_param) = start {
1486 local_req_builder =
1487 local_req_builder.query(&[("start", &local_query_param.to_string())]);
1488 };
1489
1490 let mut headers = HeaderMap::new();
1492 headers.insert("Accept", HeaderValue::from_static("application/json"));
1493
1494 match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
1496 Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
1497 Err(e) => {
1498 log::warn!("Failed to parse user agent header: {e}, falling back to default");
1499 headers.insert(
1500 reqwest::header::USER_AGENT,
1501 HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
1502 )
1503 }
1504 };
1505
1506 if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
1508 headers.insert(
1509 "DD-API-KEY",
1510 HeaderValue::from_str(local_key.key.as_str())
1511 .expect("failed to parse DD-API-KEY header"),
1512 );
1513 };
1514 if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
1515 headers.insert(
1516 "DD-APPLICATION-KEY",
1517 HeaderValue::from_str(local_key.key.as_str())
1518 .expect("failed to parse DD-APPLICATION-KEY header"),
1519 );
1520 };
1521
1522 local_req_builder = local_req_builder.headers(headers);
1523 let local_req = local_req_builder.build()?;
1524 log::debug!("request content: {:?}", local_req.body());
1525 let local_resp = local_client.execute(local_req).await?;
1526
1527 let local_status = local_resp.status();
1528 let local_content = local_resp.text().await?;
1529 log::debug!("response content: {}", local_content);
1530
1531 if !local_status.is_client_error() && !local_status.is_server_error() {
1532 match serde_json::from_str::<crate::datadogV1::model::DashboardSummary>(&local_content)
1533 {
1534 Ok(e) => {
1535 return Ok(datadog::ResponseContent {
1536 status: local_status,
1537 content: local_content,
1538 entity: Some(e),
1539 })
1540 }
1541 Err(e) => return Err(datadog::Error::Serde(e)),
1542 };
1543 } else {
1544 let local_entity: Option<ListDashboardsError> =
1545 serde_json::from_str(&local_content).ok();
1546 let local_error = datadog::ResponseContent {
1547 status: local_status,
1548 content: local_content,
1549 entity: local_entity,
1550 };
1551 Err(datadog::Error::ResponseError(local_error))
1552 }
1553 }
1554
1555 pub async fn restore_dashboards(
1557 &self,
1558 body: crate::datadogV1::model::DashboardRestoreRequest,
1559 ) -> Result<(), datadog::Error<RestoreDashboardsError>> {
1560 match self.restore_dashboards_with_http_info(body).await {
1561 Ok(_) => Ok(()),
1562 Err(err) => Err(err),
1563 }
1564 }
1565
1566 pub async fn restore_dashboards_with_http_info(
1568 &self,
1569 body: crate::datadogV1::model::DashboardRestoreRequest,
1570 ) -> Result<datadog::ResponseContent<()>, datadog::Error<RestoreDashboardsError>> {
1571 let local_configuration = &self.config;
1572 let operation_id = "v1.restore_dashboards";
1573
1574 let local_client = &self.client;
1575
1576 let local_uri_str = format!(
1577 "{}/api/v1/dashboard",
1578 local_configuration.get_operation_host(operation_id)
1579 );
1580 let mut local_req_builder =
1581 local_client.request(reqwest::Method::PATCH, local_uri_str.as_str());
1582
1583 let mut headers = HeaderMap::new();
1585 headers.insert("Content-Type", HeaderValue::from_static("application/json"));
1586 headers.insert("Accept", HeaderValue::from_static("*/*"));
1587
1588 match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
1590 Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
1591 Err(e) => {
1592 log::warn!("Failed to parse user agent header: {e}, falling back to default");
1593 headers.insert(
1594 reqwest::header::USER_AGENT,
1595 HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
1596 )
1597 }
1598 };
1599
1600 if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
1602 headers.insert(
1603 "DD-API-KEY",
1604 HeaderValue::from_str(local_key.key.as_str())
1605 .expect("failed to parse DD-API-KEY header"),
1606 );
1607 };
1608 if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
1609 headers.insert(
1610 "DD-APPLICATION-KEY",
1611 HeaderValue::from_str(local_key.key.as_str())
1612 .expect("failed to parse DD-APPLICATION-KEY header"),
1613 );
1614 };
1615
1616 let output = Vec::new();
1618 let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
1619 if body.serialize(&mut ser).is_ok() {
1620 if let Some(content_encoding) = headers.get("Content-Encoding") {
1621 match content_encoding.to_str().unwrap_or_default() {
1622 "gzip" => {
1623 let mut enc = GzEncoder::new(Vec::new(), Compression::default());
1624 let _ = enc.write_all(ser.into_inner().as_slice());
1625 match enc.finish() {
1626 Ok(buf) => {
1627 local_req_builder = local_req_builder.body(buf);
1628 }
1629 Err(e) => return Err(datadog::Error::Io(e)),
1630 }
1631 }
1632 "deflate" => {
1633 let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
1634 let _ = enc.write_all(ser.into_inner().as_slice());
1635 match enc.finish() {
1636 Ok(buf) => {
1637 local_req_builder = local_req_builder.body(buf);
1638 }
1639 Err(e) => return Err(datadog::Error::Io(e)),
1640 }
1641 }
1642 "zstd1" => {
1643 let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
1644 let _ = enc.write_all(ser.into_inner().as_slice());
1645 match enc.finish() {
1646 Ok(buf) => {
1647 local_req_builder = local_req_builder.body(buf);
1648 }
1649 Err(e) => return Err(datadog::Error::Io(e)),
1650 }
1651 }
1652 _ => {
1653 local_req_builder = local_req_builder.body(ser.into_inner());
1654 }
1655 }
1656 } else {
1657 local_req_builder = local_req_builder.body(ser.into_inner());
1658 }
1659 }
1660
1661 local_req_builder = local_req_builder.headers(headers);
1662 let local_req = local_req_builder.build()?;
1663 log::debug!("request content: {:?}", local_req.body());
1664 let local_resp = local_client.execute(local_req).await?;
1665
1666 let local_status = local_resp.status();
1667 let local_content = local_resp.text().await?;
1668 log::debug!("response content: {}", local_content);
1669
1670 if !local_status.is_client_error() && !local_status.is_server_error() {
1671 Ok(datadog::ResponseContent {
1672 status: local_status,
1673 content: local_content,
1674 entity: None,
1675 })
1676 } else {
1677 let local_entity: Option<RestoreDashboardsError> =
1678 serde_json::from_str(&local_content).ok();
1679 let local_error = datadog::ResponseContent {
1680 status: local_status,
1681 content: local_content,
1682 entity: local_entity,
1683 };
1684 Err(datadog::Error::ResponseError(local_error))
1685 }
1686 }
1687
1688 pub async fn send_public_dashboard_invitation(
1690 &self,
1691 token: String,
1692 body: crate::datadogV1::model::SharedDashboardInvites,
1693 ) -> Result<
1694 crate::datadogV1::model::SharedDashboardInvites,
1695 datadog::Error<SendPublicDashboardInvitationError>,
1696 > {
1697 match self
1698 .send_public_dashboard_invitation_with_http_info(token, body)
1699 .await
1700 {
1701 Ok(response_content) => {
1702 if let Some(e) = response_content.entity {
1703 Ok(e)
1704 } else {
1705 Err(datadog::Error::Serde(serde::de::Error::custom(
1706 "response content was None",
1707 )))
1708 }
1709 }
1710 Err(err) => Err(err),
1711 }
1712 }
1713
1714 pub async fn send_public_dashboard_invitation_with_http_info(
1716 &self,
1717 token: String,
1718 body: crate::datadogV1::model::SharedDashboardInvites,
1719 ) -> Result<
1720 datadog::ResponseContent<crate::datadogV1::model::SharedDashboardInvites>,
1721 datadog::Error<SendPublicDashboardInvitationError>,
1722 > {
1723 let local_configuration = &self.config;
1724 let operation_id = "v1.send_public_dashboard_invitation";
1725
1726 let local_client = &self.client;
1727
1728 let local_uri_str = format!(
1729 "{}/api/v1/dashboard/public/{token}/invitation",
1730 local_configuration.get_operation_host(operation_id),
1731 token = datadog::urlencode(token)
1732 );
1733 let mut local_req_builder =
1734 local_client.request(reqwest::Method::POST, local_uri_str.as_str());
1735
1736 let mut headers = HeaderMap::new();
1738 headers.insert("Content-Type", HeaderValue::from_static("application/json"));
1739 headers.insert("Accept", HeaderValue::from_static("application/json"));
1740
1741 match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
1743 Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
1744 Err(e) => {
1745 log::warn!("Failed to parse user agent header: {e}, falling back to default");
1746 headers.insert(
1747 reqwest::header::USER_AGENT,
1748 HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
1749 )
1750 }
1751 };
1752
1753 if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
1755 headers.insert(
1756 "DD-API-KEY",
1757 HeaderValue::from_str(local_key.key.as_str())
1758 .expect("failed to parse DD-API-KEY header"),
1759 );
1760 };
1761 if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
1762 headers.insert(
1763 "DD-APPLICATION-KEY",
1764 HeaderValue::from_str(local_key.key.as_str())
1765 .expect("failed to parse DD-APPLICATION-KEY header"),
1766 );
1767 };
1768
1769 let output = Vec::new();
1771 let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
1772 if body.serialize(&mut ser).is_ok() {
1773 if let Some(content_encoding) = headers.get("Content-Encoding") {
1774 match content_encoding.to_str().unwrap_or_default() {
1775 "gzip" => {
1776 let mut enc = GzEncoder::new(Vec::new(), Compression::default());
1777 let _ = enc.write_all(ser.into_inner().as_slice());
1778 match enc.finish() {
1779 Ok(buf) => {
1780 local_req_builder = local_req_builder.body(buf);
1781 }
1782 Err(e) => return Err(datadog::Error::Io(e)),
1783 }
1784 }
1785 "deflate" => {
1786 let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
1787 let _ = enc.write_all(ser.into_inner().as_slice());
1788 match enc.finish() {
1789 Ok(buf) => {
1790 local_req_builder = local_req_builder.body(buf);
1791 }
1792 Err(e) => return Err(datadog::Error::Io(e)),
1793 }
1794 }
1795 "zstd1" => {
1796 let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
1797 let _ = enc.write_all(ser.into_inner().as_slice());
1798 match enc.finish() {
1799 Ok(buf) => {
1800 local_req_builder = local_req_builder.body(buf);
1801 }
1802 Err(e) => return Err(datadog::Error::Io(e)),
1803 }
1804 }
1805 _ => {
1806 local_req_builder = local_req_builder.body(ser.into_inner());
1807 }
1808 }
1809 } else {
1810 local_req_builder = local_req_builder.body(ser.into_inner());
1811 }
1812 }
1813
1814 local_req_builder = local_req_builder.headers(headers);
1815 let local_req = local_req_builder.build()?;
1816 log::debug!("request content: {:?}", local_req.body());
1817 let local_resp = local_client.execute(local_req).await?;
1818
1819 let local_status = local_resp.status();
1820 let local_content = local_resp.text().await?;
1821 log::debug!("response content: {}", local_content);
1822
1823 if !local_status.is_client_error() && !local_status.is_server_error() {
1824 match serde_json::from_str::<crate::datadogV1::model::SharedDashboardInvites>(
1825 &local_content,
1826 ) {
1827 Ok(e) => {
1828 return Ok(datadog::ResponseContent {
1829 status: local_status,
1830 content: local_content,
1831 entity: Some(e),
1832 })
1833 }
1834 Err(e) => return Err(datadog::Error::Serde(e)),
1835 };
1836 } else {
1837 let local_entity: Option<SendPublicDashboardInvitationError> =
1838 serde_json::from_str(&local_content).ok();
1839 let local_error = datadog::ResponseContent {
1840 status: local_status,
1841 content: local_content,
1842 entity: local_entity,
1843 };
1844 Err(datadog::Error::ResponseError(local_error))
1845 }
1846 }
1847
1848 pub async fn update_dashboard(
1850 &self,
1851 dashboard_id: String,
1852 body: crate::datadogV1::model::Dashboard,
1853 ) -> Result<crate::datadogV1::model::Dashboard, datadog::Error<UpdateDashboardError>> {
1854 match self
1855 .update_dashboard_with_http_info(dashboard_id, body)
1856 .await
1857 {
1858 Ok(response_content) => {
1859 if let Some(e) = response_content.entity {
1860 Ok(e)
1861 } else {
1862 Err(datadog::Error::Serde(serde::de::Error::custom(
1863 "response content was None",
1864 )))
1865 }
1866 }
1867 Err(err) => Err(err),
1868 }
1869 }
1870
1871 pub async fn update_dashboard_with_http_info(
1873 &self,
1874 dashboard_id: String,
1875 body: crate::datadogV1::model::Dashboard,
1876 ) -> Result<
1877 datadog::ResponseContent<crate::datadogV1::model::Dashboard>,
1878 datadog::Error<UpdateDashboardError>,
1879 > {
1880 let local_configuration = &self.config;
1881 let operation_id = "v1.update_dashboard";
1882
1883 let local_client = &self.client;
1884
1885 let local_uri_str = format!(
1886 "{}/api/v1/dashboard/{dashboard_id}",
1887 local_configuration.get_operation_host(operation_id),
1888 dashboard_id = datadog::urlencode(dashboard_id)
1889 );
1890 let mut local_req_builder =
1891 local_client.request(reqwest::Method::PUT, local_uri_str.as_str());
1892
1893 let mut headers = HeaderMap::new();
1895 headers.insert("Content-Type", HeaderValue::from_static("application/json"));
1896 headers.insert("Accept", HeaderValue::from_static("application/json"));
1897
1898 match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
1900 Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
1901 Err(e) => {
1902 log::warn!("Failed to parse user agent header: {e}, falling back to default");
1903 headers.insert(
1904 reqwest::header::USER_AGENT,
1905 HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
1906 )
1907 }
1908 };
1909
1910 if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
1912 headers.insert(
1913 "DD-API-KEY",
1914 HeaderValue::from_str(local_key.key.as_str())
1915 .expect("failed to parse DD-API-KEY header"),
1916 );
1917 };
1918 if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
1919 headers.insert(
1920 "DD-APPLICATION-KEY",
1921 HeaderValue::from_str(local_key.key.as_str())
1922 .expect("failed to parse DD-APPLICATION-KEY header"),
1923 );
1924 };
1925
1926 let output = Vec::new();
1928 let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
1929 if body.serialize(&mut ser).is_ok() {
1930 if let Some(content_encoding) = headers.get("Content-Encoding") {
1931 match content_encoding.to_str().unwrap_or_default() {
1932 "gzip" => {
1933 let mut enc = GzEncoder::new(Vec::new(), Compression::default());
1934 let _ = enc.write_all(ser.into_inner().as_slice());
1935 match enc.finish() {
1936 Ok(buf) => {
1937 local_req_builder = local_req_builder.body(buf);
1938 }
1939 Err(e) => return Err(datadog::Error::Io(e)),
1940 }
1941 }
1942 "deflate" => {
1943 let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
1944 let _ = enc.write_all(ser.into_inner().as_slice());
1945 match enc.finish() {
1946 Ok(buf) => {
1947 local_req_builder = local_req_builder.body(buf);
1948 }
1949 Err(e) => return Err(datadog::Error::Io(e)),
1950 }
1951 }
1952 "zstd1" => {
1953 let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
1954 let _ = enc.write_all(ser.into_inner().as_slice());
1955 match enc.finish() {
1956 Ok(buf) => {
1957 local_req_builder = local_req_builder.body(buf);
1958 }
1959 Err(e) => return Err(datadog::Error::Io(e)),
1960 }
1961 }
1962 _ => {
1963 local_req_builder = local_req_builder.body(ser.into_inner());
1964 }
1965 }
1966 } else {
1967 local_req_builder = local_req_builder.body(ser.into_inner());
1968 }
1969 }
1970
1971 local_req_builder = local_req_builder.headers(headers);
1972 let local_req = local_req_builder.build()?;
1973 log::debug!("request content: {:?}", local_req.body());
1974 let local_resp = local_client.execute(local_req).await?;
1975
1976 let local_status = local_resp.status();
1977 let local_content = local_resp.text().await?;
1978 log::debug!("response content: {}", local_content);
1979
1980 if !local_status.is_client_error() && !local_status.is_server_error() {
1981 match serde_json::from_str::<crate::datadogV1::model::Dashboard>(&local_content) {
1982 Ok(e) => {
1983 return Ok(datadog::ResponseContent {
1984 status: local_status,
1985 content: local_content,
1986 entity: Some(e),
1987 })
1988 }
1989 Err(e) => return Err(datadog::Error::Serde(e)),
1990 };
1991 } else {
1992 let local_entity: Option<UpdateDashboardError> =
1993 serde_json::from_str(&local_content).ok();
1994 let local_error = datadog::ResponseContent {
1995 status: local_status,
1996 content: local_content,
1997 entity: local_entity,
1998 };
1999 Err(datadog::Error::ResponseError(local_error))
2000 }
2001 }
2002
2003 pub async fn update_public_dashboard(
2005 &self,
2006 token: String,
2007 body: crate::datadogV1::model::SharedDashboardUpdateRequest,
2008 ) -> Result<crate::datadogV1::model::SharedDashboard, datadog::Error<UpdatePublicDashboardError>>
2009 {
2010 match self
2011 .update_public_dashboard_with_http_info(token, body)
2012 .await
2013 {
2014 Ok(response_content) => {
2015 if let Some(e) = response_content.entity {
2016 Ok(e)
2017 } else {
2018 Err(datadog::Error::Serde(serde::de::Error::custom(
2019 "response content was None",
2020 )))
2021 }
2022 }
2023 Err(err) => Err(err),
2024 }
2025 }
2026
2027 pub async fn update_public_dashboard_with_http_info(
2029 &self,
2030 token: String,
2031 body: crate::datadogV1::model::SharedDashboardUpdateRequest,
2032 ) -> Result<
2033 datadog::ResponseContent<crate::datadogV1::model::SharedDashboard>,
2034 datadog::Error<UpdatePublicDashboardError>,
2035 > {
2036 let local_configuration = &self.config;
2037 let operation_id = "v1.update_public_dashboard";
2038
2039 let local_client = &self.client;
2040
2041 let local_uri_str = format!(
2042 "{}/api/v1/dashboard/public/{token}",
2043 local_configuration.get_operation_host(operation_id),
2044 token = datadog::urlencode(token)
2045 );
2046 let mut local_req_builder =
2047 local_client.request(reqwest::Method::PUT, local_uri_str.as_str());
2048
2049 let mut headers = HeaderMap::new();
2051 headers.insert("Content-Type", HeaderValue::from_static("application/json"));
2052 headers.insert("Accept", HeaderValue::from_static("application/json"));
2053
2054 match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
2056 Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
2057 Err(e) => {
2058 log::warn!("Failed to parse user agent header: {e}, falling back to default");
2059 headers.insert(
2060 reqwest::header::USER_AGENT,
2061 HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
2062 )
2063 }
2064 };
2065
2066 if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
2068 headers.insert(
2069 "DD-API-KEY",
2070 HeaderValue::from_str(local_key.key.as_str())
2071 .expect("failed to parse DD-API-KEY header"),
2072 );
2073 };
2074 if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
2075 headers.insert(
2076 "DD-APPLICATION-KEY",
2077 HeaderValue::from_str(local_key.key.as_str())
2078 .expect("failed to parse DD-APPLICATION-KEY header"),
2079 );
2080 };
2081
2082 let output = Vec::new();
2084 let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
2085 if body.serialize(&mut ser).is_ok() {
2086 if let Some(content_encoding) = headers.get("Content-Encoding") {
2087 match content_encoding.to_str().unwrap_or_default() {
2088 "gzip" => {
2089 let mut enc = GzEncoder::new(Vec::new(), Compression::default());
2090 let _ = enc.write_all(ser.into_inner().as_slice());
2091 match enc.finish() {
2092 Ok(buf) => {
2093 local_req_builder = local_req_builder.body(buf);
2094 }
2095 Err(e) => return Err(datadog::Error::Io(e)),
2096 }
2097 }
2098 "deflate" => {
2099 let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
2100 let _ = enc.write_all(ser.into_inner().as_slice());
2101 match enc.finish() {
2102 Ok(buf) => {
2103 local_req_builder = local_req_builder.body(buf);
2104 }
2105 Err(e) => return Err(datadog::Error::Io(e)),
2106 }
2107 }
2108 "zstd1" => {
2109 let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
2110 let _ = enc.write_all(ser.into_inner().as_slice());
2111 match enc.finish() {
2112 Ok(buf) => {
2113 local_req_builder = local_req_builder.body(buf);
2114 }
2115 Err(e) => return Err(datadog::Error::Io(e)),
2116 }
2117 }
2118 _ => {
2119 local_req_builder = local_req_builder.body(ser.into_inner());
2120 }
2121 }
2122 } else {
2123 local_req_builder = local_req_builder.body(ser.into_inner());
2124 }
2125 }
2126
2127 local_req_builder = local_req_builder.headers(headers);
2128 let local_req = local_req_builder.build()?;
2129 log::debug!("request content: {:?}", local_req.body());
2130 let local_resp = local_client.execute(local_req).await?;
2131
2132 let local_status = local_resp.status();
2133 let local_content = local_resp.text().await?;
2134 log::debug!("response content: {}", local_content);
2135
2136 if !local_status.is_client_error() && !local_status.is_server_error() {
2137 match serde_json::from_str::<crate::datadogV1::model::SharedDashboard>(&local_content) {
2138 Ok(e) => {
2139 return Ok(datadog::ResponseContent {
2140 status: local_status,
2141 content: local_content,
2142 entity: Some(e),
2143 })
2144 }
2145 Err(e) => return Err(datadog::Error::Serde(e)),
2146 };
2147 } else {
2148 let local_entity: Option<UpdatePublicDashboardError> =
2149 serde_json::from_str(&local_content).ok();
2150 let local_error = datadog::ResponseContent {
2151 status: local_status,
2152 content: local_content,
2153 entity: local_entity,
2154 };
2155 Err(datadog::Error::ResponseError(local_error))
2156 }
2157 }
2158}