Skip to main content

basaltic/services/
telemetry.rs

1//! Generated API methods; do not edit.
2#![allow(unused_imports)]
3use crate::models::telemetry as m;
4use crate::transport::{Core, Operation, Payload, QueryEncoding};
5use crate::{BinaryRequest, Client, EmptyRequest, PagedRequest, Request, WebSocketRequest};
6const ENDPOINT: &str = "https://telemetry.{region}.basaltic.sh";
7static OP_0: Operation = Operation {
8    id: "createAlert",
9    method: "POST",
10    path: "/v1/alerts",
11    authenticated: true,
12    required_query: &[],
13    required_headers: &[],
14    content_type: "application/json",
15    accept: "application/json",
16    query_encoding: &[],
17};
18static OP_1: Operation = Operation {
19    id: "createLogGroup",
20    method: "POST",
21    path: "/v1/log-groups",
22    authenticated: true,
23    required_query: &[],
24    required_headers: &[],
25    content_type: "application/json",
26    accept: "application/json",
27    query_encoding: &[],
28};
29static OP_2: Operation = Operation {
30    id: "deleteAlert",
31    method: "DELETE",
32    path: "/v1/alerts/{id}",
33    authenticated: true,
34    required_query: &[],
35    required_headers: &[],
36    content_type: "",
37    accept: "application/json",
38    query_encoding: &[],
39};
40static OP_3: Operation = Operation {
41    id: "deleteLogGroup",
42    method: "DELETE",
43    path: "/v1/log-groups/{id}",
44    authenticated: true,
45    required_query: &[],
46    required_headers: &[],
47    content_type: "",
48    accept: "application/json",
49    query_encoding: &[],
50};
51static OP_4: Operation = Operation {
52    id: "deleteTraceSettings",
53    method: "DELETE",
54    path: "/v1/trace-settings",
55    authenticated: true,
56    required_query: &[],
57    required_headers: &[],
58    content_type: "",
59    accept: "application/json",
60    query_encoding: &[],
61};
62static OP_5: Operation = Operation {
63    id: "getAlert",
64    method: "GET",
65    path: "/v1/alerts/{id}",
66    authenticated: true,
67    required_query: &[],
68    required_headers: &[],
69    content_type: "",
70    accept: "application/json",
71    query_encoding: &[],
72};
73static OP_6: Operation = Operation {
74    id: "getLog",
75    method: "GET",
76    path: "/v1/logs/{log_id}",
77    authenticated: true,
78    required_query: &[],
79    required_headers: &[],
80    content_type: "",
81    accept: "application/json",
82    query_encoding: &[],
83};
84static OP_7: Operation = Operation {
85    id: "getLogGroup",
86    method: "GET",
87    path: "/v1/log-groups/{id}",
88    authenticated: true,
89    required_query: &[],
90    required_headers: &[],
91    content_type: "",
92    accept: "application/json",
93    query_encoding: &[],
94};
95static OP_8: Operation = Operation {
96    id: "getRetainedTelemetryPresence",
97    method: "GET",
98    path: "/v1/retained-data",
99    authenticated: true,
100    required_query: &[],
101    required_headers: &[],
102    content_type: "",
103    accept: "application/json",
104    query_encoding: &[],
105};
106static OP_9: Operation = Operation {
107    id: "getTrace",
108    method: "GET",
109    path: "/v1/traces/{trace_id}",
110    authenticated: true,
111    required_query: &[],
112    required_headers: &[],
113    content_type: "",
114    accept: "application/json",
115    query_encoding: &[],
116};
117static OP_10: Operation = Operation {
118    id: "getTraceSettings",
119    method: "GET",
120    path: "/v1/trace-settings",
121    authenticated: true,
122    required_query: &[],
123    required_headers: &[],
124    content_type: "",
125    accept: "application/json",
126    query_encoding: &[],
127};
128static OP_11: Operation = Operation {
129    id: "ingestLogs",
130    method: "POST",
131    path: "/v1/logs",
132    authenticated: true,
133    required_query: &[],
134    required_headers: &[],
135    content_type: "application/json",
136    accept: "application/json",
137    query_encoding: &[],
138};
139static OP_12: Operation = Operation {
140    id: "ingestSpans",
141    method: "POST",
142    path: "/v1/spans",
143    authenticated: true,
144    required_query: &[],
145    required_headers: &[],
146    content_type: "application/json",
147    accept: "application/json",
148    query_encoding: &[],
149};
150static OP_13: Operation = Operation {
151    id: "listAlerts",
152    method: "GET",
153    path: "/v1/alerts",
154    authenticated: true,
155    required_query: &[],
156    required_headers: &[],
157    content_type: "",
158    accept: "application/json",
159    query_encoding: &[
160        QueryEncoding {
161            name: "name",
162            style: "form",
163            explode: true,
164        },
165        QueryEncoding {
166            name: "crn",
167            style: "form",
168            explode: true,
169        },
170        QueryEncoding {
171            name: "state",
172            style: "form",
173            explode: true,
174        },
175        QueryEncoding {
176            name: "limit",
177            style: "form",
178            explode: true,
179        },
180        QueryEncoding {
181            name: "marker",
182            style: "form",
183            explode: true,
184        },
185    ],
186};
187static OP_14: Operation = Operation {
188    id: "listLogGroups",
189    method: "GET",
190    path: "/v1/log-groups",
191    authenticated: true,
192    required_query: &[],
193    required_headers: &[],
194    content_type: "",
195    accept: "application/json",
196    query_encoding: &[
197        QueryEncoding {
198            name: "name",
199            style: "form",
200            explode: true,
201        },
202        QueryEncoding {
203            name: "crn",
204            style: "form",
205            explode: true,
206        },
207        QueryEncoding {
208            name: "limit",
209            style: "form",
210            explode: true,
211        },
212        QueryEncoding {
213            name: "marker",
214            style: "form",
215            explode: true,
216        },
217    ],
218};
219static OP_15: Operation = Operation {
220    id: "listMetricNames",
221    method: "GET",
222    path: "/v1/metrics/names",
223    authenticated: true,
224    required_query: &["start", "end"],
225    required_headers: &[],
226    content_type: "",
227    accept: "application/json",
228    query_encoding: &[
229        QueryEncoding {
230            name: "start",
231            style: "form",
232            explode: true,
233        },
234        QueryEncoding {
235            name: "end",
236            style: "form",
237            explode: true,
238        },
239        QueryEncoding {
240            name: "limit",
241            style: "form",
242            explode: true,
243        },
244        QueryEncoding {
245            name: "marker",
246            style: "form",
247            explode: true,
248        },
249    ],
250};
251static OP_16: Operation = Operation {
252    id: "listMetricNamesPost",
253    method: "POST",
254    path: "/v1/metrics/names",
255    authenticated: true,
256    required_query: &[],
257    required_headers: &[],
258    content_type: "application/json",
259    accept: "application/json",
260    query_encoding: &[],
261};
262static OP_17: Operation = Operation {
263    id: "listMetricSeries",
264    method: "GET",
265    path: "/v1/metrics/series",
266    authenticated: true,
267    required_query: &["metric", "start", "end"],
268    required_headers: &[],
269    content_type: "",
270    accept: "application/json",
271    query_encoding: &[
272        QueryEncoding {
273            name: "metric",
274            style: "form",
275            explode: true,
276        },
277        QueryEncoding {
278            name: "start",
279            style: "form",
280            explode: true,
281        },
282        QueryEncoding {
283            name: "end",
284            style: "form",
285            explode: true,
286        },
287        QueryEncoding {
288            name: "limit",
289            style: "form",
290            explode: true,
291        },
292        QueryEncoding {
293            name: "marker",
294            style: "form",
295            explode: true,
296        },
297    ],
298};
299static OP_18: Operation = Operation {
300    id: "listMetricSeriesPost",
301    method: "POST",
302    path: "/v1/metrics/series",
303    authenticated: true,
304    required_query: &[],
305    required_headers: &[],
306    content_type: "application/json",
307    accept: "application/json",
308    query_encoding: &[],
309};
310static OP_19: Operation = Operation {
311    id: "listTraceSpans",
312    method: "GET",
313    path: "/v1/traces/{trace_id}/spans",
314    authenticated: true,
315    required_query: &[],
316    required_headers: &[],
317    content_type: "",
318    accept: "application/json",
319    query_encoding: &[
320        QueryEncoding {
321            name: "limit",
322            style: "form",
323            explode: true,
324        },
325        QueryEncoding {
326            name: "marker",
327            style: "form",
328            explode: true,
329        },
330    ],
331};
332static OP_20: Operation = Operation {
333    id: "queryMetricsInstant",
334    method: "GET",
335    path: "/v1/metrics/query",
336    authenticated: true,
337    required_query: &["metric"],
338    required_headers: &[],
339    content_type: "",
340    accept: "application/json",
341    query_encoding: &[
342        QueryEncoding {
343            name: "metric",
344            style: "form",
345            explode: true,
346        },
347        QueryEncoding {
348            name: "agg",
349            style: "form",
350            explode: true,
351        },
352        QueryEncoding {
353            name: "match[]",
354            style: "form",
355            explode: true,
356        },
357        QueryEncoding {
358            name: "by[]",
359            style: "form",
360            explode: true,
361        },
362        QueryEncoding {
363            name: "step",
364            style: "form",
365            explode: true,
366        },
367        QueryEncoding {
368            name: "time",
369            style: "form",
370            explode: true,
371        },
372    ],
373};
374static OP_21: Operation = Operation {
375    id: "queryMetricsInstantPost",
376    method: "POST",
377    path: "/v1/metrics/query",
378    authenticated: true,
379    required_query: &[],
380    required_headers: &[],
381    content_type: "application/json",
382    accept: "application/json",
383    query_encoding: &[],
384};
385static OP_22: Operation = Operation {
386    id: "queryMetricsRange",
387    method: "GET",
388    path: "/v1/metrics/query-range",
389    authenticated: true,
390    required_query: &["metric", "start", "end"],
391    required_headers: &[],
392    content_type: "",
393    accept: "application/json",
394    query_encoding: &[
395        QueryEncoding {
396            name: "metric",
397            style: "form",
398            explode: true,
399        },
400        QueryEncoding {
401            name: "agg",
402            style: "form",
403            explode: true,
404        },
405        QueryEncoding {
406            name: "match[]",
407            style: "form",
408            explode: true,
409        },
410        QueryEncoding {
411            name: "by[]",
412            style: "form",
413            explode: true,
414        },
415        QueryEncoding {
416            name: "start",
417            style: "form",
418            explode: true,
419        },
420        QueryEncoding {
421            name: "end",
422            style: "form",
423            explode: true,
424        },
425        QueryEncoding {
426            name: "step",
427            style: "form",
428            explode: true,
429        },
430    ],
431};
432static OP_23: Operation = Operation {
433    id: "queryMetricsRangePost",
434    method: "POST",
435    path: "/v1/metrics/query-range",
436    authenticated: true,
437    required_query: &[],
438    required_headers: &[],
439    content_type: "application/json",
440    accept: "application/json",
441    query_encoding: &[],
442};
443static OP_24: Operation = Operation {
444    id: "searchLogs",
445    method: "GET",
446    path: "/v1/logs",
447    authenticated: true,
448    required_query: &["from", "to"],
449    required_headers: &[],
450    content_type: "",
451    accept: "application/json",
452    query_encoding: &[
453        QueryEncoding {
454            name: "from",
455            style: "form",
456            explode: true,
457        },
458        QueryEncoding {
459            name: "to",
460            style: "form",
461            explode: true,
462        },
463        QueryEncoding {
464            name: "log_group",
465            style: "form",
466            explode: true,
467        },
468        QueryEncoding {
469            name: "log_stream",
470            style: "form",
471            explode: true,
472        },
473        QueryEncoding {
474            name: "min_severity",
475            style: "form",
476            explode: true,
477        },
478        QueryEncoding {
479            name: "region",
480            style: "form",
481            explode: true,
482        },
483        QueryEncoding {
484            name: "q",
485            style: "form",
486            explode: true,
487        },
488        QueryEncoding {
489            name: "trace_id",
490            style: "form",
491            explode: true,
492        },
493        QueryEncoding {
494            name: "limit",
495            style: "form",
496            explode: true,
497        },
498        QueryEncoding {
499            name: "marker",
500            style: "form",
501            explode: true,
502        },
503    ],
504};
505static OP_25: Operation = Operation {
506    id: "searchTraces",
507    method: "GET",
508    path: "/v1/traces",
509    authenticated: true,
510    required_query: &["from", "to"],
511    required_headers: &[],
512    content_type: "",
513    accept: "application/json",
514    query_encoding: &[
515        QueryEncoding {
516            name: "from",
517            style: "form",
518            explode: true,
519        },
520        QueryEncoding {
521            name: "to",
522            style: "form",
523            explode: true,
524        },
525        QueryEncoding {
526            name: "service",
527            style: "form",
528            explode: true,
529        },
530        QueryEncoding {
531            name: "operation",
532            style: "form",
533            explode: true,
534        },
535        QueryEncoding {
536            name: "status_code",
537            style: "form",
538            explode: true,
539        },
540        QueryEncoding {
541            name: "min_duration_ms",
542            style: "form",
543            explode: true,
544        },
545        QueryEncoding {
546            name: "limit",
547            style: "form",
548            explode: true,
549        },
550        QueryEncoding {
551            name: "marker",
552            style: "form",
553            explode: true,
554        },
555    ],
556};
557static OP_26: Operation = Operation {
558    id: "updateAlert",
559    method: "PATCH",
560    path: "/v1/alerts/{id}",
561    authenticated: true,
562    required_query: &[],
563    required_headers: &[],
564    content_type: "application/json",
565    accept: "application/json",
566    query_encoding: &[],
567};
568static OP_27: Operation = Operation {
569    id: "updateLogGroup",
570    method: "PATCH",
571    path: "/v1/log-groups/{id}",
572    authenticated: true,
573    required_query: &[],
574    required_headers: &[],
575    content_type: "application/json",
576    accept: "application/json",
577    query_encoding: &[],
578};
579static OP_28: Operation = Operation {
580    id: "updateTraceSettings",
581    method: "PATCH",
582    path: "/v1/trace-settings",
583    authenticated: true,
584    required_query: &[],
585    required_headers: &[],
586    content_type: "application/json",
587    accept: "application/json",
588    query_encoding: &[],
589};
590static OP_29: Operation = Operation {
591    id: "writeMetrics",
592    method: "POST",
593    path: "/v1/metrics/write",
594    authenticated: true,
595    required_query: &[],
596    required_headers: &[],
597    content_type: "application/x-protobuf",
598    accept: "application/json",
599    query_encoding: &[],
600};
601#[derive(Clone, Debug)]
602pub struct TelemetryService {
603    pub(crate) client: Client,
604}
605impl TelemetryService {
606    /// Create a metric alert
607    pub fn create_alert(&self, body: &m::CreateAlertBody) -> Request<m::CreateAlertResponse> {
608        Request::new(Core::new(
609            self.client.clone(),
610            "telemetry",
611            ENDPOINT,
612            &OP_0,
613            &[],
614            Payload::json(body),
615            Ok(serde_json::json!({})),
616        ))
617    }
618    /// Create a log group
619    pub fn create_log_group(
620        &self,
621        body: &m::CreateLogGroupBody,
622    ) -> Request<m::CreateLogGroupResponse> {
623        Request::new(Core::new(
624            self.client.clone(),
625            "telemetry",
626            ENDPOINT,
627            &OP_1,
628            &[],
629            Payload::json(body),
630            Ok(serde_json::json!({})),
631        ))
632    }
633    /// Delete a metric alert
634    pub fn delete_alert(&self, id: &str) -> EmptyRequest {
635        EmptyRequest::new(Core::new(
636            self.client.clone(),
637            "telemetry",
638            ENDPOINT,
639            &OP_2,
640            &[("id", id)],
641            Ok(Payload::Empty),
642            Ok(serde_json::json!({})),
643        ))
644    }
645    /// Delete a log group
646    pub fn delete_log_group(&self, id: &str) -> EmptyRequest {
647        EmptyRequest::new(Core::new(
648            self.client.clone(),
649            "telemetry",
650            ENDPOINT,
651            &OP_3,
652            &[("id", id)],
653            Ok(Payload::Empty),
654            Ok(serde_json::json!({})),
655        ))
656    }
657    /// Delete trace settings
658    pub fn delete_trace_settings(&self) -> EmptyRequest {
659        EmptyRequest::new(Core::new(
660            self.client.clone(),
661            "telemetry",
662            ENDPOINT,
663            &OP_4,
664            &[],
665            Ok(Payload::Empty),
666            Ok(serde_json::json!({})),
667        ))
668    }
669    /// Get a metric alert
670    pub fn get_alert(&self, id: &str) -> Request<m::GetAlertResponse> {
671        Request::new(Core::new(
672            self.client.clone(),
673            "telemetry",
674            ENDPOINT,
675            &OP_5,
676            &[("id", id)],
677            Ok(Payload::Empty),
678            Ok(serde_json::json!({})),
679        ))
680    }
681    /// Resolve one resource by UUID, CRN, or an unambiguous name.
682    pub fn get_alert_by_reference(
683        &self,
684        reference: &str,
685        scope: &m::GetAlertScope,
686    ) -> Request<m::GetAlertResource> {
687        let (core, extract) = crate::request::reference_core(
688            Core::new(
689                self.client.clone(),
690                "telemetry",
691                ENDPOINT,
692                &OP_5,
693                &[("id", reference)],
694                Ok(Payload::Empty),
695                Ok(serde_json::json!({})),
696            ),
697            Core::new(
698                self.client.clone(),
699                "telemetry",
700                ENDPOINT,
701                &OP_13,
702                &[],
703                Ok(Payload::Empty),
704                serde_json::to_value(scope).map_err(crate::Error::from),
705            ),
706            reference,
707            true,
708            Some("alert"),
709            "alerts",
710        );
711        Request::reference(core, extract)
712    }
713    /// Get a single log record by id
714    pub fn get_log(&self, log_id: &str) -> Request<m::GetLogResponse> {
715        Request::new(Core::new(
716            self.client.clone(),
717            "telemetry",
718            ENDPOINT,
719            &OP_6,
720            &[("log_id", log_id)],
721            Ok(Payload::Empty),
722            Ok(serde_json::json!({})),
723        ))
724    }
725    /// Get a log group by id
726    pub fn get_log_group(&self, id: &str) -> Request<m::GetLogGroupResponse> {
727        Request::new(Core::new(
728            self.client.clone(),
729            "telemetry",
730            ENDPOINT,
731            &OP_7,
732            &[("id", id)],
733            Ok(Payload::Empty),
734            Ok(serde_json::json!({})),
735        ))
736    }
737    /// Resolve one resource by UUID, CRN, or an unambiguous name.
738    pub fn get_log_group_by_reference(
739        &self,
740        reference: &str,
741        scope: &m::GetLogGroupScope,
742    ) -> Request<m::GetLogGroupResource> {
743        let (core, extract) = crate::request::reference_core(
744            Core::new(
745                self.client.clone(),
746                "telemetry",
747                ENDPOINT,
748                &OP_7,
749                &[("id", reference)],
750                Ok(Payload::Empty),
751                Ok(serde_json::json!({})),
752            ),
753            Core::new(
754                self.client.clone(),
755                "telemetry",
756                ENDPOINT,
757                &OP_14,
758                &[],
759                Ok(Payload::Empty),
760                serde_json::to_value(scope).map_err(crate::Error::from),
761            ),
762            reference,
763            true,
764            Some("log_group"),
765            "log_groups",
766        );
767        Request::reference(core, extract)
768    }
769    /// Check retained telemetry presence
770    pub fn get_retained_telemetry_presence(
771        &self,
772    ) -> Request<m::GetRetainedTelemetryPresenceResponse> {
773        Request::new(Core::new(
774            self.client.clone(),
775            "telemetry",
776            ENDPOINT,
777            &OP_8,
778            &[],
779            Ok(Payload::Empty),
780            Ok(serde_json::json!({})),
781        ))
782    }
783    /// Get a trace
784    pub fn get_trace(&self, trace_id: &str) -> Request<m::GetTraceResponse> {
785        Request::new(Core::new(
786            self.client.clone(),
787            "telemetry",
788            ENDPOINT,
789            &OP_9,
790            &[("trace_id", trace_id)],
791            Ok(Payload::Empty),
792            Ok(serde_json::json!({})),
793        ))
794    }
795    /// Get the caller account's trace settings
796    pub fn get_trace_settings(&self) -> Request<m::GetTraceSettingsResponse> {
797        Request::new(Core::new(
798            self.client.clone(),
799            "telemetry",
800            ENDPOINT,
801            &OP_10,
802            &[],
803            Ok(Payload::Empty),
804            Ok(serde_json::json!({})),
805        ))
806    }
807    /// Ingest a batch of log records
808    pub fn ingest_logs(&self, body: &m::IngestLogsBody) -> Request<m::IngestLogsResponse> {
809        Request::new(Core::new(
810            self.client.clone(),
811            "telemetry",
812            ENDPOINT,
813            &OP_11,
814            &[],
815            Payload::json(body),
816            Ok(serde_json::json!({})),
817        ))
818    }
819    /// Ingest a batch of trace spans
820    pub fn ingest_spans(&self, body: &m::IngestSpansBody) -> Request<m::IngestSpansResponse> {
821        Request::new(Core::new(
822            self.client.clone(),
823            "telemetry",
824            ENDPOINT,
825            &OP_12,
826            &[],
827            Payload::json(body),
828            Ok(serde_json::json!({})),
829        ))
830    }
831    /// List metric alerts
832    pub fn list_alerts(
833        &self,
834        query: &m::ListAlertsQuery,
835    ) -> PagedRequest<m::ListAlertsResponse, m::ListAlertsItem> {
836        PagedRequest::new(
837            Core::new(
838                self.client.clone(),
839                "telemetry",
840                ENDPOINT,
841                &OP_13,
842                &[],
843                Ok(Payload::Empty),
844                serde_json::to_value(query).map_err(crate::Error::from),
845            ),
846            "alerts",
847        )
848    }
849    /// List log groups (or look up one by name)
850    pub fn list_log_groups(
851        &self,
852        query: &m::ListLogGroupsQuery,
853    ) -> PagedRequest<m::ListLogGroupsResponse, m::ListLogGroupsItem> {
854        PagedRequest::new(
855            Core::new(
856                self.client.clone(),
857                "telemetry",
858                ENDPOINT,
859                &OP_14,
860                &[],
861                Ok(Payload::Empty),
862                serde_json::to_value(query).map_err(crate::Error::from),
863            ),
864            "log_groups",
865        )
866    }
867    /// List metric names
868    pub fn list_metric_names(
869        &self,
870        query: &m::ListMetricNamesQuery,
871    ) -> PagedRequest<m::ListMetricNamesResponse, m::ListMetricNamesItem> {
872        PagedRequest::new(
873            Core::new(
874                self.client.clone(),
875                "telemetry",
876                ENDPOINT,
877                &OP_15,
878                &[],
879                Ok(Payload::Empty),
880                serde_json::to_value(query).map_err(crate::Error::from),
881            ),
882            "metric_names",
883        )
884    }
885    /// List metric names (JSON)
886    pub fn list_metric_names_post(
887        &self,
888        body: &m::ListMetricNamesPostBody,
889    ) -> Request<m::ListMetricNamesPostResponse> {
890        Request::new(Core::new(
891            self.client.clone(),
892            "telemetry",
893            ENDPOINT,
894            &OP_16,
895            &[],
896            Payload::json(body),
897            Ok(serde_json::json!({})),
898        ))
899    }
900    /// List metric series
901    pub fn list_metric_series(
902        &self,
903        query: &m::ListMetricSeriesQuery,
904    ) -> PagedRequest<m::ListMetricSeriesResponse, m::ListMetricSeriesItem> {
905        PagedRequest::new(
906            Core::new(
907                self.client.clone(),
908                "telemetry",
909                ENDPOINT,
910                &OP_17,
911                &[],
912                Ok(Payload::Empty),
913                serde_json::to_value(query).map_err(crate::Error::from),
914            ),
915            "series",
916        )
917    }
918    /// List metric series (JSON)
919    pub fn list_metric_series_post(
920        &self,
921        body: &m::ListMetricSeriesPostBody,
922    ) -> Request<m::ListMetricSeriesPostResponse> {
923        Request::new(Core::new(
924            self.client.clone(),
925            "telemetry",
926            ENDPOINT,
927            &OP_18,
928            &[],
929            Payload::json(body),
930            Ok(serde_json::json!({})),
931        ))
932    }
933    /// List spans in a trace
934    pub fn list_trace_spans(
935        &self,
936        trace_id: &str,
937        query: &m::ListTraceSpansQuery,
938    ) -> PagedRequest<m::ListTraceSpansResponse, m::ListTraceSpansItem> {
939        PagedRequest::new(
940            Core::new(
941                self.client.clone(),
942                "telemetry",
943                ENDPOINT,
944                &OP_19,
945                &[("trace_id", trace_id)],
946                Ok(Payload::Empty),
947                serde_json::to_value(query).map_err(crate::Error::from),
948            ),
949            "spans",
950        )
951    }
952    /// Run an instant metric query
953    pub fn query_metrics_instant(
954        &self,
955        query: &m::QueryMetricsInstantQuery,
956    ) -> Request<m::QueryMetricsInstantResponse> {
957        Request::new(Core::new(
958            self.client.clone(),
959            "telemetry",
960            ENDPOINT,
961            &OP_20,
962            &[],
963            Ok(Payload::Empty),
964            serde_json::to_value(query).map_err(crate::Error::from),
965        ))
966    }
967    /// Run an instant metric query (JSON)
968    pub fn query_metrics_instant_post(
969        &self,
970        body: &m::QueryMetricsInstantPostBody,
971    ) -> Request<m::QueryMetricsInstantPostResponse> {
972        Request::new(Core::new(
973            self.client.clone(),
974            "telemetry",
975            ENDPOINT,
976            &OP_21,
977            &[],
978            Payload::json(body),
979            Ok(serde_json::json!({})),
980        ))
981    }
982    /// Run a range metric query
983    pub fn query_metrics_range(
984        &self,
985        query: &m::QueryMetricsRangeQuery,
986    ) -> Request<m::QueryMetricsRangeResponse> {
987        Request::new(Core::new(
988            self.client.clone(),
989            "telemetry",
990            ENDPOINT,
991            &OP_22,
992            &[],
993            Ok(Payload::Empty),
994            serde_json::to_value(query).map_err(crate::Error::from),
995        ))
996    }
997    /// Run a range metric query (JSON)
998    pub fn query_metrics_range_post(
999        &self,
1000        body: &m::QueryMetricsRangePostBody,
1001    ) -> Request<m::QueryMetricsRangePostResponse> {
1002        Request::new(Core::new(
1003            self.client.clone(),
1004            "telemetry",
1005            ENDPOINT,
1006            &OP_23,
1007            &[],
1008            Payload::json(body),
1009            Ok(serde_json::json!({})),
1010        ))
1011    }
1012    /// Search log records
1013    pub fn search_logs(&self, query: &m::SearchLogsQuery) -> Request<m::SearchLogsResponse> {
1014        Request::new(Core::new(
1015            self.client.clone(),
1016            "telemetry",
1017            ENDPOINT,
1018            &OP_24,
1019            &[],
1020            Ok(Payload::Empty),
1021            serde_json::to_value(query).map_err(crate::Error::from),
1022        ))
1023    }
1024    /// List traces
1025    pub fn search_traces(&self, query: &m::SearchTracesQuery) -> Request<m::SearchTracesResponse> {
1026        Request::new(Core::new(
1027            self.client.clone(),
1028            "telemetry",
1029            ENDPOINT,
1030            &OP_25,
1031            &[],
1032            Ok(Payload::Empty),
1033            serde_json::to_value(query).map_err(crate::Error::from),
1034        ))
1035    }
1036    /// Update a metric alert
1037    pub fn update_alert(
1038        &self,
1039        id: &str,
1040        body: &m::UpdateAlertBody,
1041    ) -> Request<m::UpdateAlertResponse> {
1042        Request::new(Core::new(
1043            self.client.clone(),
1044            "telemetry",
1045            ENDPOINT,
1046            &OP_26,
1047            &[("id", id)],
1048            Payload::json(body),
1049            Ok(serde_json::json!({})),
1050        ))
1051    }
1052    /// Update a log group
1053    pub fn update_log_group(
1054        &self,
1055        id: &str,
1056        body: &m::UpdateLogGroupBody,
1057    ) -> Request<m::UpdateLogGroupResponse> {
1058        Request::new(Core::new(
1059            self.client.clone(),
1060            "telemetry",
1061            ENDPOINT,
1062            &OP_27,
1063            &[("id", id)],
1064            Payload::json(body),
1065            Ok(serde_json::json!({})),
1066        ))
1067    }
1068    /// Update the caller account's trace settings
1069    pub fn update_trace_settings(
1070        &self,
1071        body: &m::UpdateTraceSettingsBody,
1072    ) -> Request<m::UpdateTraceSettingsResponse> {
1073        Request::new(Core::new(
1074            self.client.clone(),
1075            "telemetry",
1076            ENDPOINT,
1077            &OP_28,
1078            &[],
1079            Payload::json(body),
1080            Ok(serde_json::json!({})),
1081        ))
1082    }
1083    /// Prometheus remote_write ingest
1084    pub fn write_metrics(&self, body: reqwest::Body) -> EmptyRequest {
1085        EmptyRequest::new(Core::new(
1086            self.client.clone(),
1087            "telemetry",
1088            ENDPOINT,
1089            &OP_29,
1090            &[],
1091            Ok(Payload::binary(body)),
1092            Ok(serde_json::json!({})),
1093        ))
1094    }
1095}