Skip to main content

basaltic/models/
telemetry.rs

1//! Generated typed wire models. Unknown string enum values are retained.
2#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3pub struct CreateAlertRequestInput {
4    /// Immutable account-unique name. UUID names and the crn: prefix are reserved.
5    #[serde(rename = "name")]
6    pub name: String,
7    /// Required same-account, same-region notification topic reference: UUID, canonical CRN or exact name, classified by syntax. Multiple alerts may share a topic. Binding requires notifications:Publish and respects explicit topic-policy denies.
8    #[serde(rename = "topic")]
9    pub topic: String,
10
11    #[serde(rename = "expression")]
12    pub expression: AlertExpressionInput,
13
14    #[serde(rename = "operator")]
15    pub operator: CreateAlertRequestInputOperator,
16
17    #[serde(rename = "threshold")]
18    pub threshold: f64,
19    /// Whole-minute window. Evaluated every minute against the last complete UTC-aligned window.
20    #[serde(rename = "window_seconds")]
21    pub window_seconds: i64,
22    /// Continuous breach duration before firing; 0 fires immediately. Missing data, query failures and scheduling gaps reset a pending duration.
23    #[serde(rename = "for_seconds")]
24    pub for_seconds: i64,
25
26    #[serde(rename = "enabled", default, skip_serializing_if = "Option::is_none")]
27    pub enabled: Option<bool>,
28    /// Mute notifications until this instant (at most 30 days ahead). Evaluation continues; null removes silence. An active alert notifies on the next evaluation after silence expires.
29    #[serde(
30        rename = "silenced_until",
31        default,
32        skip_serializing_if = "Option::is_none",
33        deserialize_with = "crate::response::present_nullable"
34    )]
35    pub silenced_until: Option<crate::Nullable<String>>,
36}
37impl CreateAlertRequestInput {
38    /// Set the required fields; optional fields start omitted.
39    #[allow(clippy::too_many_arguments)]
40    pub fn new(
41        name: String,
42        topic: String,
43        expression: AlertExpressionInput,
44        operator: CreateAlertRequestInputOperator,
45        threshold: f64,
46        window_seconds: i64,
47        for_seconds: i64,
48    ) -> Self {
49        Self {
50            name,
51            topic,
52            expression,
53            operator,
54            threshold,
55            window_seconds,
56            for_seconds,
57            enabled: None,
58            silenced_until: None,
59        }
60    }
61}
62
63#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
64pub struct AlertExpressionInput {
65    #[serde(rename = "metric")]
66    pub metric: String,
67
68    #[serde(rename = "agg")]
69    pub agg: AlertExpressionInputAgg,
70    /// Label matchers (label=value, label!=value, label=~regex, label!~regex). Tenant scope is always applied independently.
71    #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
72    pub match_: Option<Vec<String>>,
73    /// Grouping labels; the resulting series are summed to match the console metric card.
74    #[serde(rename = "by", default, skip_serializing_if = "Option::is_none")]
75    pub by: Option<Vec<String>>,
76
77    #[serde(
78        rename = "denominator",
79        default,
80        skip_serializing_if = "Option::is_none"
81    )]
82    pub denominator: Option<AlertQueryInput>,
83    /// Multiplier after optional division, e.g. 100 for a percentage or 1/1048576 for MiB/s.
84    #[serde(rename = "scale")]
85    pub scale: f64,
86    /// Display unit for the scaled threshold and value.
87    #[serde(rename = "unit", default, skip_serializing_if = "Option::is_none")]
88    pub unit: Option<String>,
89}
90impl AlertExpressionInput {
91    /// Set the required fields; optional fields start omitted.
92    #[allow(clippy::too_many_arguments)]
93    pub fn new(metric: String, agg: AlertExpressionInputAgg, scale: f64) -> Self {
94        Self {
95            metric,
96            agg,
97            match_: None,
98            by: None,
99            denominator: None,
100            scale,
101            unit: None,
102        }
103    }
104}
105
106#[derive(Clone, Debug, PartialEq, Eq)]
107pub enum AlertExpressionInputAgg {
108    Avg,
109    Min,
110    Max,
111    Sum,
112    Last,
113    Count,
114    Rate,
115    Increase,
116    Unknown(String),
117}
118impl AlertExpressionInputAgg {
119    pub fn as_str(&self) -> &str {
120        match self {
121            Self::Avg => "avg",
122            Self::Min => "min",
123            Self::Max => "max",
124            Self::Sum => "sum",
125            Self::Last => "last",
126            Self::Count => "count",
127            Self::Rate => "rate",
128            Self::Increase => "increase",
129            Self::Unknown(value) => value,
130        }
131    }
132}
133impl serde::Serialize for AlertExpressionInputAgg {
134    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
135        serializer.serialize_str(self.as_str())
136    }
137}
138impl<'de> serde::Deserialize<'de> for AlertExpressionInputAgg {
139    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
140        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
141        Ok(match value.as_str() {
142            "avg" => Self::Avg,
143            "min" => Self::Min,
144            "max" => Self::Max,
145            "sum" => Self::Sum,
146            "last" => Self::Last,
147            "count" => Self::Count,
148            "rate" => Self::Rate,
149            "increase" => Self::Increase,
150            _ => Self::Unknown(value),
151        })
152    }
153}
154
155#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
156pub struct AlertQueryInput {
157    #[serde(rename = "metric")]
158    pub metric: String,
159
160    #[serde(rename = "agg")]
161    pub agg: AlertQueryInputAgg,
162    /// Label matchers (label=value, label!=value, label=~regex, label!~regex). Tenant scope is always applied independently.
163    #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
164    pub match_: Option<Vec<String>>,
165    /// Grouping labels; the resulting series are summed to match the console metric card.
166    #[serde(rename = "by", default, skip_serializing_if = "Option::is_none")]
167    pub by: Option<Vec<String>>,
168}
169impl AlertQueryInput {
170    /// Set the required fields; optional fields start omitted.
171    #[allow(clippy::too_many_arguments)]
172    pub fn new(metric: String, agg: AlertQueryInputAgg) -> Self {
173        Self {
174            metric,
175            agg,
176            match_: None,
177            by: None,
178        }
179    }
180}
181
182#[derive(Clone, Debug, PartialEq, Eq)]
183pub enum AlertQueryInputAgg {
184    Avg,
185    Min,
186    Max,
187    Sum,
188    Last,
189    Count,
190    Rate,
191    Increase,
192    Unknown(String),
193}
194impl AlertQueryInputAgg {
195    pub fn as_str(&self) -> &str {
196        match self {
197            Self::Avg => "avg",
198            Self::Min => "min",
199            Self::Max => "max",
200            Self::Sum => "sum",
201            Self::Last => "last",
202            Self::Count => "count",
203            Self::Rate => "rate",
204            Self::Increase => "increase",
205            Self::Unknown(value) => value,
206        }
207    }
208}
209impl serde::Serialize for AlertQueryInputAgg {
210    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
211        serializer.serialize_str(self.as_str())
212    }
213}
214impl<'de> serde::Deserialize<'de> for AlertQueryInputAgg {
215    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
216        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
217        Ok(match value.as_str() {
218            "avg" => Self::Avg,
219            "min" => Self::Min,
220            "max" => Self::Max,
221            "sum" => Self::Sum,
222            "last" => Self::Last,
223            "count" => Self::Count,
224            "rate" => Self::Rate,
225            "increase" => Self::Increase,
226            _ => Self::Unknown(value),
227        })
228    }
229}
230
231#[derive(Clone, Debug, PartialEq, Eq)]
232pub enum CreateAlertRequestInputOperator {
233    Gt,
234    Gte,
235    Lt,
236    Lte,
237    Unknown(String),
238}
239impl CreateAlertRequestInputOperator {
240    pub fn as_str(&self) -> &str {
241        match self {
242            Self::Gt => "gt",
243            Self::Gte => "gte",
244            Self::Lt => "lt",
245            Self::Lte => "lte",
246            Self::Unknown(value) => value,
247        }
248    }
249}
250impl serde::Serialize for CreateAlertRequestInputOperator {
251    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
252        serializer.serialize_str(self.as_str())
253    }
254}
255impl<'de> serde::Deserialize<'de> for CreateAlertRequestInputOperator {
256    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
257        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
258        Ok(match value.as_str() {
259            "gt" => Self::Gt,
260            "gte" => Self::Gte,
261            "lt" => Self::Lt,
262            "lte" => Self::Lte,
263            _ => Self::Unknown(value),
264        })
265    }
266}
267
268pub type CreateAlertBody = CreateAlertRequestInput;
269
270#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
271pub struct AlertResponse {
272    #[serde(rename = "alert")]
273    pub alert: Alert,
274}
275
276#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
277pub struct Alert {
278    #[serde(rename = "expression")]
279    pub expression: AlertExpression,
280
281    #[serde(rename = "operator")]
282    pub operator: AlertOperator,
283
284    #[serde(rename = "threshold")]
285    pub threshold: f64,
286    /// Whole-minute window. Evaluated every minute against the last complete UTC-aligned window.
287    #[serde(rename = "window_seconds")]
288    pub window_seconds: i64,
289    /// Continuous breach duration before firing; 0 fires immediately. Missing data, query failures and scheduling gaps reset a pending duration.
290    #[serde(rename = "for_seconds")]
291    pub for_seconds: i64,
292
293    #[serde(rename = "enabled")]
294    pub enabled: bool,
295    /// Mute notifications until this instant (at most 30 days ahead). Evaluation continues; null removes silence. An active alert notifies on the next evaluation after silence expires.
296    #[serde(rename = "silenced_until")]
297    pub silenced_until: crate::Nullable<String>,
298
299    #[serde(rename = "id")]
300    pub id: String,
301
302    #[serde(rename = "crn")]
303    pub crn: String,
304
305    #[serde(rename = "name")]
306    pub name: String,
307
308    #[serde(rename = "topic")]
309    pub topic: ResourceRef,
310    /// Evaluation state, independent of enabled and silenced_until. Missing data/errors do not resolve an open incident.
311    #[serde(rename = "state")]
312    pub state: AlertState,
313
314    #[serde(rename = "last_value")]
315    pub last_value: crate::Nullable<f64>,
316
317    #[serde(
318        rename = "evaluated_at",
319        default,
320        skip_serializing_if = "Option::is_none"
321    )]
322    pub evaluated_at: Option<String>,
323
324    #[serde(
325        rename = "state_changed_at",
326        default,
327        skip_serializing_if = "Option::is_none"
328    )]
329    pub state_changed_at: Option<String>,
330
331    #[serde(
332        rename = "pending_since",
333        default,
334        skip_serializing_if = "Option::is_none"
335    )]
336    pub pending_since: Option<String>,
337
338    #[serde(
339        rename = "evaluation_error",
340        default,
341        skip_serializing_if = "Option::is_none"
342    )]
343    pub evaluation_error: Option<String>,
344    /// Notification remains queued for retry; metric evaluation continues.
345    #[serde(
346        rename = "delivery_error",
347        default,
348        skip_serializing_if = "Option::is_none"
349    )]
350    pub delivery_error: Option<String>,
351
352    #[serde(rename = "created_at")]
353    pub created_at: String,
354
355    #[serde(rename = "updated_at")]
356    pub updated_at: String,
357}
358
359#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
360pub struct AlertExpression {
361    #[serde(rename = "metric")]
362    pub metric: String,
363
364    #[serde(rename = "agg")]
365    pub agg: AlertExpressionAgg,
366    /// Label matchers (label=value, label!=value, label=~regex, label!~regex). Tenant scope is always applied independently.
367    #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
368    pub match_: Option<Vec<String>>,
369    /// Grouping labels; the resulting series are summed to match the console metric card.
370    #[serde(rename = "by", default, skip_serializing_if = "Option::is_none")]
371    pub by: Option<Vec<String>>,
372
373    #[serde(
374        rename = "denominator",
375        default,
376        skip_serializing_if = "Option::is_none"
377    )]
378    pub denominator: Option<AlertQuery>,
379    /// Multiplier after optional division, e.g. 100 for a percentage or 1/1048576 for MiB/s.
380    #[serde(rename = "scale")]
381    pub scale: f64,
382    /// Display unit for the scaled threshold and value.
383    #[serde(rename = "unit", default, skip_serializing_if = "Option::is_none")]
384    pub unit: Option<String>,
385}
386
387#[derive(Clone, Debug, PartialEq, Eq)]
388pub enum AlertExpressionAgg {
389    Avg,
390    Min,
391    Max,
392    Sum,
393    Last,
394    Count,
395    Rate,
396    Increase,
397    Unknown(String),
398}
399impl AlertExpressionAgg {
400    pub fn as_str(&self) -> &str {
401        match self {
402            Self::Avg => "avg",
403            Self::Min => "min",
404            Self::Max => "max",
405            Self::Sum => "sum",
406            Self::Last => "last",
407            Self::Count => "count",
408            Self::Rate => "rate",
409            Self::Increase => "increase",
410            Self::Unknown(value) => value,
411        }
412    }
413}
414impl serde::Serialize for AlertExpressionAgg {
415    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
416        serializer.serialize_str(self.as_str())
417    }
418}
419impl<'de> serde::Deserialize<'de> for AlertExpressionAgg {
420    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
421        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
422        Ok(match value.as_str() {
423            "avg" => Self::Avg,
424            "min" => Self::Min,
425            "max" => Self::Max,
426            "sum" => Self::Sum,
427            "last" => Self::Last,
428            "count" => Self::Count,
429            "rate" => Self::Rate,
430            "increase" => Self::Increase,
431            _ => Self::Unknown(value),
432        })
433    }
434}
435
436#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
437pub struct AlertQuery {
438    #[serde(rename = "metric")]
439    pub metric: String,
440
441    #[serde(rename = "agg")]
442    pub agg: AlertQueryAgg,
443    /// Label matchers (label=value, label!=value, label=~regex, label!~regex). Tenant scope is always applied independently.
444    #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
445    pub match_: Option<Vec<String>>,
446    /// Grouping labels; the resulting series are summed to match the console metric card.
447    #[serde(rename = "by", default, skip_serializing_if = "Option::is_none")]
448    pub by: Option<Vec<String>>,
449}
450
451#[derive(Clone, Debug, PartialEq, Eq)]
452pub enum AlertQueryAgg {
453    Avg,
454    Min,
455    Max,
456    Sum,
457    Last,
458    Count,
459    Rate,
460    Increase,
461    Unknown(String),
462}
463impl AlertQueryAgg {
464    pub fn as_str(&self) -> &str {
465        match self {
466            Self::Avg => "avg",
467            Self::Min => "min",
468            Self::Max => "max",
469            Self::Sum => "sum",
470            Self::Last => "last",
471            Self::Count => "count",
472            Self::Rate => "rate",
473            Self::Increase => "increase",
474            Self::Unknown(value) => value,
475        }
476    }
477}
478impl serde::Serialize for AlertQueryAgg {
479    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
480        serializer.serialize_str(self.as_str())
481    }
482}
483impl<'de> serde::Deserialize<'de> for AlertQueryAgg {
484    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
485        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
486        Ok(match value.as_str() {
487            "avg" => Self::Avg,
488            "min" => Self::Min,
489            "max" => Self::Max,
490            "sum" => Self::Sum,
491            "last" => Self::Last,
492            "count" => Self::Count,
493            "rate" => Self::Rate,
494            "increase" => Self::Increase,
495            _ => Self::Unknown(value),
496        })
497    }
498}
499
500#[derive(Clone, Debug, PartialEq, Eq)]
501pub enum AlertOperator {
502    Gt,
503    Gte,
504    Lt,
505    Lte,
506    Unknown(String),
507}
508impl AlertOperator {
509    pub fn as_str(&self) -> &str {
510        match self {
511            Self::Gt => "gt",
512            Self::Gte => "gte",
513            Self::Lt => "lt",
514            Self::Lte => "lte",
515            Self::Unknown(value) => value,
516        }
517    }
518}
519impl serde::Serialize for AlertOperator {
520    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
521        serializer.serialize_str(self.as_str())
522    }
523}
524impl<'de> serde::Deserialize<'de> for AlertOperator {
525    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
526        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
527        Ok(match value.as_str() {
528            "gt" => Self::Gt,
529            "gte" => Self::Gte,
530            "lt" => Self::Lt,
531            "lte" => Self::Lte,
532            _ => Self::Unknown(value),
533        })
534    }
535}
536
537#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
538pub struct ResourceRef {
539    #[serde(rename = "id")]
540    pub id: String,
541
542    #[serde(rename = "crn")]
543    pub crn: String,
544    /// Display label at response time — the resource's name where it has one, otherwise its human label (an invoice number, an account display name). Absent when the target is gone. Not a lookup key.
545    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
546    pub name: Option<String>,
547}
548
549#[derive(Clone, Debug, PartialEq, Eq)]
550pub enum AlertState {
551    Ok,
552    Pending,
553    Firing,
554    NoData,
555    Error,
556    Unknown(String),
557}
558impl AlertState {
559    pub fn as_str(&self) -> &str {
560        match self {
561            Self::Ok => "ok",
562            Self::Pending => "pending",
563            Self::Firing => "firing",
564            Self::NoData => "no_data",
565            Self::Error => "error",
566            Self::Unknown(value) => value,
567        }
568    }
569}
570impl serde::Serialize for AlertState {
571    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
572        serializer.serialize_str(self.as_str())
573    }
574}
575impl<'de> serde::Deserialize<'de> for AlertState {
576    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
577        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
578        Ok(match value.as_str() {
579            "ok" => Self::Ok,
580            "pending" => Self::Pending,
581            "firing" => Self::Firing,
582            "no_data" => Self::NoData,
583            "error" => Self::Error,
584            _ => Self::Unknown(value),
585        })
586    }
587}
588
589pub type CreateAlertResponse = AlertResponse;
590
591#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
592pub struct CreateLogGroupRequestInput {
593    /// Resource names must not start with the literal crn: prefix or be UUIDs (canonical, compact, braced, or urn:uuid: forms, in either case).
594    #[serde(rename = "name")]
595    pub name: String,
596
597    #[serde(
598        rename = "description",
599        default,
600        skip_serializing_if = "Option::is_none"
601    )]
602    pub description: Option<String>,
603    /// Retention in days. Omit or use null for no expiry.
604    #[serde(
605        rename = "retention_days",
606        default,
607        skip_serializing_if = "Option::is_none",
608        deserialize_with = "crate::response::present_nullable"
609    )]
610    pub retention_days: Option<crate::Nullable<i64>>,
611    /// KMS key UUID, CRN or exact name in the authenticated account and serving region. The resolved UUID is pinned; deleting a key and reusing its name never retargets existing data. An empty string selects plaintext.
612    #[serde(rename = "kms_key", default, skip_serializing_if = "Option::is_none")]
613    pub kms_key: Option<String>,
614
615    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
616    pub tags: Option<std::collections::BTreeMap<String, String>>,
617}
618impl CreateLogGroupRequestInput {
619    /// Set the required fields; optional fields start omitted.
620    #[allow(clippy::too_many_arguments)]
621    pub fn new(name: String) -> Self {
622        Self {
623            name,
624            description: None,
625            retention_days: None,
626            kms_key: None,
627            tags: None,
628        }
629    }
630}
631
632pub type CreateLogGroupBody = CreateLogGroupRequestInput;
633
634#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
635pub struct LogGroupResponse {
636    #[serde(rename = "log_group")]
637    pub log_group: LogGroup,
638}
639
640#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
641pub struct LogGroup {
642    #[serde(rename = "kms_key", default, skip_serializing_if = "Option::is_none")]
643    pub kms_key: Option<ResourceRef>,
644
645    #[serde(rename = "id")]
646    pub id: String,
647    /// CRN of the log group (used as the IAM resource ARN)
648    #[serde(rename = "crn")]
649    pub crn: String,
650    /// 1..512 chars, \[A-Za-z0-9_./#-\]. Leading "/" not allowed. Resource names must not start with the literal crn: prefix or be UUIDs (canonical, compact, braced, or urn:uuid: forms, in either case).
651    #[serde(rename = "name")]
652    pub name: String,
653
654    #[serde(
655        rename = "description",
656        default,
657        skip_serializing_if = "Option::is_none"
658    )]
659    pub description: Option<String>,
660    /// Retention in days, or null for no expiry.
661    #[serde(rename = "retention_days")]
662    pub retention_days: crate::Nullable<i64>,
663
664    #[serde(rename = "tags")]
665    pub tags: std::collections::BTreeMap<String, String>,
666
667    #[serde(rename = "created_at")]
668    pub created_at: String,
669
670    #[serde(rename = "updated_at")]
671    pub updated_at: String,
672}
673
674pub type CreateLogGroupResponse = LogGroupResponse;
675
676pub type GetAlertResponse = AlertResponse;
677
678pub type GetAlertResource = Alert;
679
680#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
681pub struct GetAlertScope {
682    #[serde(rename = "state", default, skip_serializing_if = "Option::is_none")]
683    pub state: Option<GetAlertScopeState>,
684
685    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
686    pub limit: Option<i64>,
687}
688
689#[derive(Clone, Debug, PartialEq, Eq)]
690pub enum GetAlertScopeState {
691    Ok,
692    Pending,
693    Firing,
694    NoData,
695    Error,
696    Silenced,
697    Disabled,
698    Unknown(String),
699}
700impl GetAlertScopeState {
701    pub fn as_str(&self) -> &str {
702        match self {
703            Self::Ok => "ok",
704            Self::Pending => "pending",
705            Self::Firing => "firing",
706            Self::NoData => "no_data",
707            Self::Error => "error",
708            Self::Silenced => "silenced",
709            Self::Disabled => "disabled",
710            Self::Unknown(value) => value,
711        }
712    }
713}
714impl serde::Serialize for GetAlertScopeState {
715    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
716        serializer.serialize_str(self.as_str())
717    }
718}
719impl<'de> serde::Deserialize<'de> for GetAlertScopeState {
720    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
721        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
722        Ok(match value.as_str() {
723            "ok" => Self::Ok,
724            "pending" => Self::Pending,
725            "firing" => Self::Firing,
726            "no_data" => Self::NoData,
727            "error" => Self::Error,
728            "silenced" => Self::Silenced,
729            "disabled" => Self::Disabled,
730            _ => Self::Unknown(value),
731        })
732    }
733}
734
735#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
736pub struct LogResponse {
737    #[serde(rename = "log")]
738    pub log: LogRecord,
739}
740
741#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
742pub struct LogRecord {
743    #[serde(rename = "id")]
744    pub id: String,
745    /// Producer-stamped event time
746    #[serde(rename = "timestamp")]
747    pub timestamp: String,
748
749    #[serde(rename = "log_group")]
750    pub log_group: ResourceRef,
751    /// Within-group stream name (typically the producer host)
752    #[serde(rename = "log_stream")]
753    pub log_stream: String,
754
755    #[serde(rename = "severity")]
756    pub severity: LogRecordSeverity,
757    /// OTel numeric severity band (1..24)
758    #[serde(rename = "severity_number")]
759    pub severity_number: i64,
760
761    #[serde(rename = "body")]
762    pub body: String,
763
764    #[serde(
765        rename = "attributes",
766        default,
767        skip_serializing_if = "Option::is_none"
768    )]
769    pub attributes: Option<std::collections::BTreeMap<String, String>>,
770
771    #[serde(rename = "resource", default, skip_serializing_if = "Option::is_none")]
772    pub resource: Option<std::collections::BTreeMap<String, String>>,
773
774    #[serde(rename = "trace_id", default, skip_serializing_if = "Option::is_none")]
775    pub trace_id: Option<String>,
776
777    #[serde(rename = "span_id", default, skip_serializing_if = "Option::is_none")]
778    pub span_id: Option<String>,
779}
780
781#[derive(Clone, Debug, PartialEq, Eq)]
782pub enum LogRecordSeverity {
783    TRACE,
784    DEBUG,
785    INFO,
786    WARN,
787    ERROR,
788    FATAL,
789    Unknown(String),
790}
791impl LogRecordSeverity {
792    pub fn as_str(&self) -> &str {
793        match self {
794            Self::TRACE => "TRACE",
795            Self::DEBUG => "DEBUG",
796            Self::INFO => "INFO",
797            Self::WARN => "WARN",
798            Self::ERROR => "ERROR",
799            Self::FATAL => "FATAL",
800            Self::Unknown(value) => value,
801        }
802    }
803}
804impl serde::Serialize for LogRecordSeverity {
805    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
806        serializer.serialize_str(self.as_str())
807    }
808}
809impl<'de> serde::Deserialize<'de> for LogRecordSeverity {
810    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
811        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
812        Ok(match value.as_str() {
813            "TRACE" => Self::TRACE,
814            "DEBUG" => Self::DEBUG,
815            "INFO" => Self::INFO,
816            "WARN" => Self::WARN,
817            "ERROR" => Self::ERROR,
818            "FATAL" => Self::FATAL,
819            _ => Self::Unknown(value),
820        })
821    }
822}
823
824pub type GetLogResponse = LogResponse;
825
826pub type GetLogGroupResponse = LogGroupResponse;
827
828pub type GetLogGroupResource = LogGroup;
829
830#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
831pub struct GetLogGroupScope {
832    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
833    pub limit: Option<i64>,
834}
835
836#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
837pub struct RetainedDataResponse {
838    #[serde(rename = "retained_data")]
839    pub retained_data: RetainedDataResponseRetainedData,
840}
841
842#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
843pub struct RetainedDataResponseRetainedData {
844    #[serde(rename = "has_data")]
845    pub has_data: bool,
846    /// True when retained logs, spans or their storage rollups still block account deletion. Metric samples alone do not block account soft-deletion and expire through normal retention. Clients talking to older servers that omit this field must fall back to has_data.
847    #[serde(
848        rename = "blocks_deletion",
849        default,
850        skip_serializing_if = "Option::is_none"
851    )]
852    pub blocks_deletion: Option<bool>,
853}
854
855pub type GetRetainedTelemetryPresenceResponse = RetainedDataResponse;
856
857#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
858pub struct TraceResponse {
859    #[serde(rename = "trace")]
860    pub trace: TraceSummary,
861}
862
863#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
864pub struct TraceSummary {
865    #[serde(rename = "trace_id")]
866    pub trace_id: String,
867
868    #[serde(rename = "root_span_id")]
869    pub root_span_id: String,
870
871    #[serde(rename = "root_name")]
872    pub root_name: String,
873
874    #[serde(rename = "root_service")]
875    pub root_service: String,
876
877    #[serde(rename = "start_time")]
878    pub start_time: String,
879
880    #[serde(rename = "duration_ms")]
881    pub duration_ms: f64,
882
883    #[serde(rename = "span_count")]
884    pub span_count: i64,
885
886    #[serde(rename = "error_count")]
887    pub error_count: i64,
888
889    #[serde(rename = "service_count")]
890    pub service_count: i64,
891}
892
893pub type GetTraceResponse = TraceResponse;
894
895#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
896pub struct TraceSettingsResponse {
897    #[serde(rename = "trace_settings")]
898    pub trace_settings: TraceSettings,
899}
900
901#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
902pub struct TraceSettings {
903    /// Effective retention in days. Defaults to 30; traces always expire.
904    #[serde(rename = "retention_days")]
905    pub retention_days: i64,
906
907    #[serde(
908        rename = "created_at",
909        default,
910        skip_serializing_if = "Option::is_none"
911    )]
912    pub created_at: Option<String>,
913
914    #[serde(
915        rename = "updated_at",
916        default,
917        skip_serializing_if = "Option::is_none"
918    )]
919    pub updated_at: Option<String>,
920
921    #[serde(rename = "kms_key", default, skip_serializing_if = "Option::is_none")]
922    pub kms_key: Option<ResourceRef>,
923}
924
925pub type GetTraceSettingsResponse = TraceSettingsResponse;
926
927#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
928pub struct IngestRequestInput {
929    #[serde(rename = "logs")]
930    pub logs: Vec<IngestRecordInput>,
931}
932impl IngestRequestInput {
933    /// Set the required fields; optional fields start omitted.
934    #[allow(clippy::too_many_arguments)]
935    pub fn new(logs: Vec<IngestRecordInput>) -> Self {
936        Self { logs }
937    }
938}
939
940#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
941pub struct IngestRecordInput {
942    /// Optional — defaults to ingest time
943    #[serde(rename = "timestamp", default, skip_serializing_if = "Option::is_none")]
944    pub timestamp: Option<String>,
945    /// Reference to an existing log group by UUID, CRN or exact name in the authenticated account. CRNs must identify telemetry/log-group in the serving region and account handle. Classification is by syntax with no lookup fallback; slash-bearing names are preserved.
946    #[serde(rename = "log_group")]
947    pub log_group: String,
948    /// Within-group stream name (free-form, customer choice)
949    #[serde(rename = "log_stream")]
950    pub log_stream: String,
951    /// One of TRACE/DEBUG/INFO/WARN/ERROR/FATAL (defaults to INFO)
952    #[serde(rename = "severity", default, skip_serializing_if = "Option::is_none")]
953    pub severity: Option<String>,
954
955    #[serde(rename = "body")]
956    pub body: String,
957
958    #[serde(
959        rename = "attributes",
960        default,
961        skip_serializing_if = "Option::is_none"
962    )]
963    pub attributes: Option<std::collections::BTreeMap<String, String>>,
964
965    #[serde(rename = "resource", default, skip_serializing_if = "Option::is_none")]
966    pub resource: Option<std::collections::BTreeMap<String, String>>,
967
968    #[serde(rename = "trace_id", default, skip_serializing_if = "Option::is_none")]
969    pub trace_id: Option<String>,
970
971    #[serde(rename = "span_id", default, skip_serializing_if = "Option::is_none")]
972    pub span_id: Option<String>,
973}
974impl IngestRecordInput {
975    /// Set the required fields; optional fields start omitted.
976    #[allow(clippy::too_many_arguments)]
977    pub fn new(log_group: String, log_stream: String, body: String) -> Self {
978        Self {
979            timestamp: None,
980            log_group,
981            log_stream,
982            severity: None,
983            body,
984            attributes: None,
985            resource: None,
986            trace_id: None,
987            span_id: None,
988        }
989    }
990}
991
992pub type IngestLogsBody = IngestRequestInput;
993
994#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
995pub struct IngestResponse {
996    #[serde(rename = "ingestion")]
997    pub ingestion: IngestResult,
998}
999
1000#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1001pub struct IngestResult {
1002    #[serde(rename = "accepted")]
1003    pub accepted: i64,
1004
1005    #[serde(rename = "rejected")]
1006    pub rejected: i64,
1007
1008    #[serde(rename = "errors", default, skip_serializing_if = "Option::is_none")]
1009    pub errors: Option<Vec<IngestError>>,
1010}
1011
1012#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1013pub struct IngestError {
1014    /// Zero-based input record index.
1015    #[serde(rename = "index")]
1016    pub index: i64,
1017
1018    #[serde(rename = "code")]
1019    pub code: String,
1020
1021    #[serde(rename = "message")]
1022    pub message: String,
1023}
1024
1025pub type IngestLogsResponse = IngestResponse;
1026
1027#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1028pub struct IngestSpansRequestInput {
1029    #[serde(rename = "spans")]
1030    pub spans: Vec<SpanIngestRecordInput>,
1031}
1032impl IngestSpansRequestInput {
1033    /// Set the required fields; optional fields start omitted.
1034    #[allow(clippy::too_many_arguments)]
1035    pub fn new(spans: Vec<SpanIngestRecordInput>) -> Self {
1036        Self { spans }
1037    }
1038}
1039
1040#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1041pub struct SpanIngestRecordInput {
1042    /// 32 lower-hex chars (OTel TraceId)
1043    #[serde(rename = "trace_id")]
1044    pub trace_id: String,
1045    /// 16 lower-hex chars (OTel SpanId)
1046    #[serde(rename = "span_id")]
1047    pub span_id: String,
1048    /// 16 lower-hex chars or empty for root
1049    #[serde(
1050        rename = "parent_span_id",
1051        default,
1052        skip_serializing_if = "Option::is_none"
1053    )]
1054    pub parent_span_id: Option<String>,
1055    /// Operation name (e.g. "GET /api/users")
1056    #[serde(rename = "name")]
1057    pub name: String,
1058    /// Defaults to INTERNAL
1059    #[serde(rename = "kind", default, skip_serializing_if = "Option::is_none")]
1060    pub kind: Option<SpanIngestRecordInputKind>,
1061    /// Defaults to resource\[service.name\]
1062    #[serde(
1063        rename = "service_name",
1064        default,
1065        skip_serializing_if = "Option::is_none"
1066    )]
1067    pub service_name: Option<String>,
1068
1069    #[serde(rename = "start_time")]
1070    pub start_time: String,
1071
1072    #[serde(rename = "end_time")]
1073    pub end_time: String,
1074
1075    #[serde(
1076        rename = "status_code",
1077        default,
1078        skip_serializing_if = "Option::is_none"
1079    )]
1080    pub status_code: Option<SpanIngestRecordInputStatusCode>,
1081
1082    #[serde(
1083        rename = "status_message",
1084        default,
1085        skip_serializing_if = "Option::is_none"
1086    )]
1087    pub status_message: Option<String>,
1088
1089    #[serde(
1090        rename = "attributes",
1091        default,
1092        skip_serializing_if = "Option::is_none"
1093    )]
1094    pub attributes: Option<std::collections::BTreeMap<String, String>>,
1095
1096    #[serde(rename = "resource", default, skip_serializing_if = "Option::is_none")]
1097    pub resource: Option<std::collections::BTreeMap<String, String>>,
1098
1099    #[serde(rename = "events", default, skip_serializing_if = "Option::is_none")]
1100    pub events: Option<Vec<SpanEventInput>>,
1101
1102    #[serde(rename = "links", default, skip_serializing_if = "Option::is_none")]
1103    pub links: Option<Vec<SpanLinkInput>>,
1104}
1105impl SpanIngestRecordInput {
1106    /// Set the required fields; optional fields start omitted.
1107    #[allow(clippy::too_many_arguments)]
1108    pub fn new(
1109        trace_id: String,
1110        span_id: String,
1111        name: String,
1112        start_time: String,
1113        end_time: String,
1114    ) -> Self {
1115        Self {
1116            trace_id,
1117            span_id,
1118            parent_span_id: None,
1119            name,
1120            kind: None,
1121            service_name: None,
1122            start_time,
1123            end_time,
1124            status_code: None,
1125            status_message: None,
1126            attributes: None,
1127            resource: None,
1128            events: None,
1129            links: None,
1130        }
1131    }
1132}
1133
1134#[derive(Clone, Debug, PartialEq, Eq)]
1135pub enum SpanIngestRecordInputKind {
1136    INTERNAL,
1137    SERVER,
1138    CLIENT,
1139    PRODUCER,
1140    CONSUMER,
1141    Unknown(String),
1142}
1143impl SpanIngestRecordInputKind {
1144    pub fn as_str(&self) -> &str {
1145        match self {
1146            Self::INTERNAL => "INTERNAL",
1147            Self::SERVER => "SERVER",
1148            Self::CLIENT => "CLIENT",
1149            Self::PRODUCER => "PRODUCER",
1150            Self::CONSUMER => "CONSUMER",
1151            Self::Unknown(value) => value,
1152        }
1153    }
1154}
1155impl serde::Serialize for SpanIngestRecordInputKind {
1156    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1157        serializer.serialize_str(self.as_str())
1158    }
1159}
1160impl<'de> serde::Deserialize<'de> for SpanIngestRecordInputKind {
1161    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1162        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1163        Ok(match value.as_str() {
1164            "INTERNAL" => Self::INTERNAL,
1165            "SERVER" => Self::SERVER,
1166            "CLIENT" => Self::CLIENT,
1167            "PRODUCER" => Self::PRODUCER,
1168            "CONSUMER" => Self::CONSUMER,
1169            _ => Self::Unknown(value),
1170        })
1171    }
1172}
1173
1174#[derive(Clone, Debug, PartialEq, Eq)]
1175pub enum SpanIngestRecordInputStatusCode {
1176    UNSET,
1177    OK,
1178    ERROR,
1179    Unknown(String),
1180}
1181impl SpanIngestRecordInputStatusCode {
1182    pub fn as_str(&self) -> &str {
1183        match self {
1184            Self::UNSET => "UNSET",
1185            Self::OK => "OK",
1186            Self::ERROR => "ERROR",
1187            Self::Unknown(value) => value,
1188        }
1189    }
1190}
1191impl serde::Serialize for SpanIngestRecordInputStatusCode {
1192    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1193        serializer.serialize_str(self.as_str())
1194    }
1195}
1196impl<'de> serde::Deserialize<'de> for SpanIngestRecordInputStatusCode {
1197    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1198        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1199        Ok(match value.as_str() {
1200            "UNSET" => Self::UNSET,
1201            "OK" => Self::OK,
1202            "ERROR" => Self::ERROR,
1203            _ => Self::Unknown(value),
1204        })
1205    }
1206}
1207
1208#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1209pub struct SpanEventInput {
1210    #[serde(rename = "timestamp", default, skip_serializing_if = "Option::is_none")]
1211    pub timestamp: Option<String>,
1212
1213    #[serde(rename = "name")]
1214    pub name: String,
1215
1216    #[serde(
1217        rename = "attributes",
1218        default,
1219        skip_serializing_if = "Option::is_none"
1220    )]
1221    pub attributes: Option<std::collections::BTreeMap<String, String>>,
1222}
1223impl SpanEventInput {
1224    /// Set the required fields; optional fields start omitted.
1225    #[allow(clippy::too_many_arguments)]
1226    pub fn new(name: String) -> Self {
1227        Self {
1228            timestamp: None,
1229            name,
1230            attributes: None,
1231        }
1232    }
1233}
1234
1235#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1236pub struct SpanLinkInput {
1237    #[serde(rename = "trace_id")]
1238    pub trace_id: String,
1239
1240    #[serde(rename = "span_id")]
1241    pub span_id: String,
1242}
1243impl SpanLinkInput {
1244    /// Set the required fields; optional fields start omitted.
1245    #[allow(clippy::too_many_arguments)]
1246    pub fn new(trace_id: String, span_id: String) -> Self {
1247        Self { trace_id, span_id }
1248    }
1249}
1250
1251pub type IngestSpansBody = IngestSpansRequestInput;
1252
1253pub type IngestSpansResponse = IngestResponse;
1254
1255#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
1256pub struct ListAlertsParameters {
1257    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
1258    pub name: Option<String>,
1259
1260    #[serde(rename = "crn", default, skip_serializing_if = "Option::is_none")]
1261    pub crn: Option<String>,
1262
1263    #[serde(rename = "state", default, skip_serializing_if = "Option::is_none")]
1264    pub state: Option<ListAlertsParametersState>,
1265
1266    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
1267    pub limit: Option<i64>,
1268
1269    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
1270    pub marker: Option<String>,
1271}
1272
1273#[derive(Clone, Debug, PartialEq, Eq)]
1274pub enum ListAlertsParametersState {
1275    Ok,
1276    Pending,
1277    Firing,
1278    NoData,
1279    Error,
1280    Silenced,
1281    Disabled,
1282    Unknown(String),
1283}
1284impl ListAlertsParametersState {
1285    pub fn as_str(&self) -> &str {
1286        match self {
1287            Self::Ok => "ok",
1288            Self::Pending => "pending",
1289            Self::Firing => "firing",
1290            Self::NoData => "no_data",
1291            Self::Error => "error",
1292            Self::Silenced => "silenced",
1293            Self::Disabled => "disabled",
1294            Self::Unknown(value) => value,
1295        }
1296    }
1297}
1298impl serde::Serialize for ListAlertsParametersState {
1299    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1300        serializer.serialize_str(self.as_str())
1301    }
1302}
1303impl<'de> serde::Deserialize<'de> for ListAlertsParametersState {
1304    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1305        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1306        Ok(match value.as_str() {
1307            "ok" => Self::Ok,
1308            "pending" => Self::Pending,
1309            "firing" => Self::Firing,
1310            "no_data" => Self::NoData,
1311            "error" => Self::Error,
1312            "silenced" => Self::Silenced,
1313            "disabled" => Self::Disabled,
1314            _ => Self::Unknown(value),
1315        })
1316    }
1317}
1318
1319pub type ListAlertsQuery = ListAlertsParameters;
1320
1321#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1322pub struct AlertListResponse {
1323    #[serde(rename = "alerts")]
1324    pub alerts: Vec<Alert>,
1325
1326    #[serde(rename = "meta")]
1327    pub meta: PaginationMeta,
1328}
1329
1330#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
1331pub struct PaginationMeta {
1332    /// Total number of items
1333    #[serde(rename = "total", default, skip_serializing_if = "Option::is_none")]
1334    pub total: Option<i64>,
1335    /// Number of items per page
1336    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
1337    pub limit: Option<i64>,
1338    /// Opaque cursor for the next page. Pass it back as the `marker` query parameter; treat it as a token, not a value to parse.
1339    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
1340    pub marker: Option<String>,
1341    /// Whether there are more items
1342    #[serde(rename = "has_more", default, skip_serializing_if = "Option::is_none")]
1343    pub has_more: Option<bool>,
1344}
1345
1346pub type ListAlertsResponse = AlertListResponse;
1347
1348pub type ListAlertsItem = Alert;
1349
1350#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
1351pub struct ListLogGroupsParameters {
1352    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
1353    pub name: Option<String>,
1354
1355    #[serde(rename = "crn", default, skip_serializing_if = "Option::is_none")]
1356    pub crn: Option<String>,
1357
1358    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
1359    pub limit: Option<i64>,
1360
1361    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
1362    pub marker: Option<String>,
1363}
1364
1365pub type ListLogGroupsQuery = ListLogGroupsParameters;
1366
1367#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1368pub struct LogGroupListResponse {
1369    #[serde(rename = "log_groups")]
1370    pub log_groups: Vec<LogGroup>,
1371
1372    #[serde(rename = "meta")]
1373    pub meta: PaginationMeta,
1374}
1375
1376pub type ListLogGroupsResponse = LogGroupListResponse;
1377
1378pub type ListLogGroupsItem = LogGroup;
1379
1380#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1381pub struct ListMetricNamesParameters {
1382    #[serde(rename = "start")]
1383    pub start: String,
1384
1385    #[serde(rename = "end")]
1386    pub end: String,
1387
1388    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
1389    pub limit: Option<i64>,
1390
1391    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
1392    pub marker: Option<String>,
1393}
1394impl ListMetricNamesParameters {
1395    /// Set the required fields; optional fields start omitted.
1396    #[allow(clippy::too_many_arguments)]
1397    pub fn new(start: String, end: String) -> Self {
1398        Self {
1399            start,
1400            end,
1401            limit: None,
1402            marker: None,
1403        }
1404    }
1405}
1406
1407pub type ListMetricNamesQuery = ListMetricNamesParameters;
1408
1409#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1410pub struct MetricNamesResponse {
1411    #[serde(rename = "metric_names")]
1412    pub metric_names: Vec<String>,
1413
1414    #[serde(rename = "meta")]
1415    pub meta: PaginationMeta,
1416}
1417
1418pub type ListMetricNamesResponse = MetricNamesResponse;
1419
1420pub type ListMetricNamesItem = String;
1421
1422#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1423pub struct ListMetricNamesPostRequest {
1424    #[serde(rename = "start")]
1425    pub start: String,
1426
1427    #[serde(rename = "end")]
1428    pub end: String,
1429
1430    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
1431    pub limit: Option<i64>,
1432
1433    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
1434    pub marker: Option<String>,
1435}
1436impl ListMetricNamesPostRequest {
1437    /// Set the required fields; optional fields start omitted.
1438    #[allow(clippy::too_many_arguments)]
1439    pub fn new(start: String, end: String) -> Self {
1440        Self {
1441            start,
1442            end,
1443            limit: None,
1444            marker: None,
1445        }
1446    }
1447}
1448
1449pub type ListMetricNamesPostBody = ListMetricNamesPostRequest;
1450
1451pub type ListMetricNamesPostResponse = MetricNamesResponse;
1452
1453#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1454pub struct ListMetricSeriesParameters {
1455    #[serde(rename = "metric")]
1456    pub metric: String,
1457
1458    #[serde(rename = "start")]
1459    pub start: String,
1460
1461    #[serde(rename = "end")]
1462    pub end: String,
1463
1464    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
1465    pub limit: Option<i64>,
1466
1467    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
1468    pub marker: Option<String>,
1469}
1470impl ListMetricSeriesParameters {
1471    /// Set the required fields; optional fields start omitted.
1472    #[allow(clippy::too_many_arguments)]
1473    pub fn new(metric: String, start: String, end: String) -> Self {
1474        Self {
1475            metric,
1476            start,
1477            end,
1478            limit: None,
1479            marker: None,
1480        }
1481    }
1482}
1483
1484pub type ListMetricSeriesQuery = ListMetricSeriesParameters;
1485
1486#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1487pub struct MetricSeriesResponse {
1488    #[serde(rename = "series")]
1489    pub series: Vec<std::collections::BTreeMap<String, String>>,
1490
1491    #[serde(rename = "meta")]
1492    pub meta: PaginationMeta,
1493}
1494
1495pub type ListMetricSeriesResponse = MetricSeriesResponse;
1496
1497pub type ListMetricSeriesItem = std::collections::BTreeMap<String, String>;
1498
1499#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1500pub struct ListMetricSeriesPostRequest {
1501    #[serde(rename = "metric")]
1502    pub metric: String,
1503
1504    #[serde(rename = "start")]
1505    pub start: String,
1506
1507    #[serde(rename = "end")]
1508    pub end: String,
1509
1510    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
1511    pub limit: Option<i64>,
1512
1513    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
1514    pub marker: Option<String>,
1515}
1516impl ListMetricSeriesPostRequest {
1517    /// Set the required fields; optional fields start omitted.
1518    #[allow(clippy::too_many_arguments)]
1519    pub fn new(metric: String, start: String, end: String) -> Self {
1520        Self {
1521            metric,
1522            start,
1523            end,
1524            limit: None,
1525            marker: None,
1526        }
1527    }
1528}
1529
1530pub type ListMetricSeriesPostBody = ListMetricSeriesPostRequest;
1531
1532pub type ListMetricSeriesPostResponse = MetricSeriesResponse;
1533
1534#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
1535pub struct ListTraceSpansParameters {
1536    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
1537    pub limit: Option<i64>,
1538
1539    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
1540    pub marker: Option<String>,
1541}
1542
1543pub type ListTraceSpansQuery = ListTraceSpansParameters;
1544
1545#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1546pub struct SpanListResponse {
1547    #[serde(rename = "spans")]
1548    pub spans: Vec<Span>,
1549
1550    #[serde(rename = "meta")]
1551    pub meta: PaginationMeta,
1552}
1553
1554#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1555pub struct Span {
1556    #[serde(rename = "trace_id")]
1557    pub trace_id: String,
1558
1559    #[serde(rename = "span_id")]
1560    pub span_id: String,
1561
1562    #[serde(
1563        rename = "parent_span_id",
1564        default,
1565        skip_serializing_if = "Option::is_none"
1566    )]
1567    pub parent_span_id: Option<String>,
1568
1569    #[serde(rename = "name")]
1570    pub name: String,
1571
1572    #[serde(rename = "kind")]
1573    pub kind: SpanKind,
1574
1575    #[serde(rename = "service_name")]
1576    pub service_name: String,
1577
1578    #[serde(rename = "start_time")]
1579    pub start_time: String,
1580
1581    #[serde(rename = "end_time")]
1582    pub end_time: String,
1583
1584    #[serde(rename = "duration_ms")]
1585    pub duration_ms: f64,
1586
1587    #[serde(rename = "status_code")]
1588    pub status_code: SpanStatusCode,
1589
1590    #[serde(
1591        rename = "status_message",
1592        default,
1593        skip_serializing_if = "Option::is_none"
1594    )]
1595    pub status_message: Option<String>,
1596
1597    #[serde(
1598        rename = "attributes",
1599        default,
1600        skip_serializing_if = "Option::is_none"
1601    )]
1602    pub attributes: Option<std::collections::BTreeMap<String, String>>,
1603
1604    #[serde(rename = "resource", default, skip_serializing_if = "Option::is_none")]
1605    pub resource: Option<std::collections::BTreeMap<String, String>>,
1606
1607    #[serde(rename = "events", default, skip_serializing_if = "Option::is_none")]
1608    pub events: Option<Vec<SpanEvent>>,
1609
1610    #[serde(rename = "links", default, skip_serializing_if = "Option::is_none")]
1611    pub links: Option<Vec<SpanLink>>,
1612}
1613
1614#[derive(Clone, Debug, PartialEq, Eq)]
1615pub enum SpanKind {
1616    INTERNAL,
1617    SERVER,
1618    CLIENT,
1619    PRODUCER,
1620    CONSUMER,
1621    Unknown(String),
1622}
1623impl SpanKind {
1624    pub fn as_str(&self) -> &str {
1625        match self {
1626            Self::INTERNAL => "INTERNAL",
1627            Self::SERVER => "SERVER",
1628            Self::CLIENT => "CLIENT",
1629            Self::PRODUCER => "PRODUCER",
1630            Self::CONSUMER => "CONSUMER",
1631            Self::Unknown(value) => value,
1632        }
1633    }
1634}
1635impl serde::Serialize for SpanKind {
1636    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1637        serializer.serialize_str(self.as_str())
1638    }
1639}
1640impl<'de> serde::Deserialize<'de> for SpanKind {
1641    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1642        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1643        Ok(match value.as_str() {
1644            "INTERNAL" => Self::INTERNAL,
1645            "SERVER" => Self::SERVER,
1646            "CLIENT" => Self::CLIENT,
1647            "PRODUCER" => Self::PRODUCER,
1648            "CONSUMER" => Self::CONSUMER,
1649            _ => Self::Unknown(value),
1650        })
1651    }
1652}
1653
1654#[derive(Clone, Debug, PartialEq, Eq)]
1655pub enum SpanStatusCode {
1656    UNSET,
1657    OK,
1658    ERROR,
1659    Unknown(String),
1660}
1661impl SpanStatusCode {
1662    pub fn as_str(&self) -> &str {
1663        match self {
1664            Self::UNSET => "UNSET",
1665            Self::OK => "OK",
1666            Self::ERROR => "ERROR",
1667            Self::Unknown(value) => value,
1668        }
1669    }
1670}
1671impl serde::Serialize for SpanStatusCode {
1672    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1673        serializer.serialize_str(self.as_str())
1674    }
1675}
1676impl<'de> serde::Deserialize<'de> for SpanStatusCode {
1677    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1678        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1679        Ok(match value.as_str() {
1680            "UNSET" => Self::UNSET,
1681            "OK" => Self::OK,
1682            "ERROR" => Self::ERROR,
1683            _ => Self::Unknown(value),
1684        })
1685    }
1686}
1687
1688#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1689pub struct SpanEvent {
1690    #[serde(rename = "timestamp", default, skip_serializing_if = "Option::is_none")]
1691    pub timestamp: Option<String>,
1692
1693    #[serde(rename = "name")]
1694    pub name: String,
1695
1696    #[serde(
1697        rename = "attributes",
1698        default,
1699        skip_serializing_if = "Option::is_none"
1700    )]
1701    pub attributes: Option<std::collections::BTreeMap<String, String>>,
1702}
1703
1704#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1705pub struct SpanLink {
1706    #[serde(rename = "trace_id")]
1707    pub trace_id: String,
1708
1709    #[serde(rename = "span_id")]
1710    pub span_id: String,
1711}
1712
1713pub type ListTraceSpansResponse = SpanListResponse;
1714
1715pub type ListTraceSpansItem = Span;
1716
1717#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1718pub struct QueryMetricsInstantParameters {
1719    #[serde(rename = "metric")]
1720    pub metric: String,
1721
1722    #[serde(rename = "agg", default, skip_serializing_if = "Option::is_none")]
1723    pub agg: Option<QueryMetricsInstantParametersAgg>,
1724
1725    #[serde(rename = "match[]", default, skip_serializing_if = "Option::is_none")]
1726    pub match__: Option<Vec<String>>,
1727
1728    #[serde(rename = "by[]", default, skip_serializing_if = "Option::is_none")]
1729    pub by__: Option<Vec<String>>,
1730
1731    #[serde(rename = "step", default, skip_serializing_if = "Option::is_none")]
1732    pub step: Option<String>,
1733
1734    #[serde(rename = "time", default, skip_serializing_if = "Option::is_none")]
1735    pub time: Option<String>,
1736}
1737impl QueryMetricsInstantParameters {
1738    /// Set the required fields; optional fields start omitted.
1739    #[allow(clippy::too_many_arguments)]
1740    pub fn new(metric: String) -> Self {
1741        Self {
1742            metric,
1743            agg: None,
1744            match__: None,
1745            by__: None,
1746            step: None,
1747            time: None,
1748        }
1749    }
1750}
1751
1752#[derive(Clone, Debug, PartialEq, Eq)]
1753pub enum QueryMetricsInstantParametersAgg {
1754    Avg,
1755    Sum,
1756    Min,
1757    Max,
1758    Count,
1759    Last,
1760    Rate,
1761    Increase,
1762    Unknown(String),
1763}
1764impl QueryMetricsInstantParametersAgg {
1765    pub fn as_str(&self) -> &str {
1766        match self {
1767            Self::Avg => "avg",
1768            Self::Sum => "sum",
1769            Self::Min => "min",
1770            Self::Max => "max",
1771            Self::Count => "count",
1772            Self::Last => "last",
1773            Self::Rate => "rate",
1774            Self::Increase => "increase",
1775            Self::Unknown(value) => value,
1776        }
1777    }
1778}
1779impl serde::Serialize for QueryMetricsInstantParametersAgg {
1780    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1781        serializer.serialize_str(self.as_str())
1782    }
1783}
1784impl<'de> serde::Deserialize<'de> for QueryMetricsInstantParametersAgg {
1785    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1786        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1787        Ok(match value.as_str() {
1788            "avg" => Self::Avg,
1789            "sum" => Self::Sum,
1790            "min" => Self::Min,
1791            "max" => Self::Max,
1792            "count" => Self::Count,
1793            "last" => Self::Last,
1794            "rate" => Self::Rate,
1795            "increase" => Self::Increase,
1796            _ => Self::Unknown(value),
1797        })
1798    }
1799}
1800
1801pub type QueryMetricsInstantQuery = QueryMetricsInstantParameters;
1802
1803#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1804pub struct MetricQueryResponse {
1805    #[serde(rename = "query_result")]
1806    pub query_result: MetricQueryResult,
1807}
1808
1809#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1810pub struct MetricQueryResult {
1811    #[serde(rename = "metric")]
1812    pub metric: String,
1813
1814    #[serde(rename = "series")]
1815    pub series: Vec<MetricQuerySeries>,
1816}
1817
1818#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1819pub struct MetricQuerySeries {
1820    #[serde(rename = "labels")]
1821    pub labels: std::collections::BTreeMap<String, String>,
1822
1823    #[serde(rename = "points")]
1824    pub points: Vec<MetricPoint>,
1825}
1826
1827#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1828pub struct MetricPoint {
1829    /// Unix timestamp in seconds, including fractional seconds.
1830    #[serde(rename = "timestamp")]
1831    pub timestamp: f64,
1832    /// Float value as text, including NaN and infinities.
1833    #[serde(rename = "value")]
1834    pub value: String,
1835}
1836
1837pub type QueryMetricsInstantResponse = MetricQueryResponse;
1838
1839#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1840pub struct QueryMetricsInstantPostRequest {
1841    #[serde(rename = "metric")]
1842    pub metric: String,
1843
1844    #[serde(rename = "agg", default, skip_serializing_if = "Option::is_none")]
1845    pub agg: Option<QueryMetricsInstantPostRequestAgg>,
1846
1847    #[serde(rename = "step", default, skip_serializing_if = "Option::is_none")]
1848    pub step: Option<String>,
1849
1850    #[serde(rename = "time", default, skip_serializing_if = "Option::is_none")]
1851    pub time: Option<String>,
1852
1853    #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
1854    pub match_: Option<Vec<String>>,
1855
1856    #[serde(rename = "by", default, skip_serializing_if = "Option::is_none")]
1857    pub by: Option<Vec<String>>,
1858}
1859impl QueryMetricsInstantPostRequest {
1860    /// Set the required fields; optional fields start omitted.
1861    #[allow(clippy::too_many_arguments)]
1862    pub fn new(metric: String) -> Self {
1863        Self {
1864            metric,
1865            agg: None,
1866            step: None,
1867            time: None,
1868            match_: None,
1869            by: None,
1870        }
1871    }
1872}
1873
1874#[derive(Clone, Debug, PartialEq, Eq)]
1875pub enum QueryMetricsInstantPostRequestAgg {
1876    Avg,
1877    Sum,
1878    Min,
1879    Max,
1880    Count,
1881    Last,
1882    Rate,
1883    Increase,
1884    Unknown(String),
1885}
1886impl QueryMetricsInstantPostRequestAgg {
1887    pub fn as_str(&self) -> &str {
1888        match self {
1889            Self::Avg => "avg",
1890            Self::Sum => "sum",
1891            Self::Min => "min",
1892            Self::Max => "max",
1893            Self::Count => "count",
1894            Self::Last => "last",
1895            Self::Rate => "rate",
1896            Self::Increase => "increase",
1897            Self::Unknown(value) => value,
1898        }
1899    }
1900}
1901impl serde::Serialize for QueryMetricsInstantPostRequestAgg {
1902    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1903        serializer.serialize_str(self.as_str())
1904    }
1905}
1906impl<'de> serde::Deserialize<'de> for QueryMetricsInstantPostRequestAgg {
1907    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1908        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1909        Ok(match value.as_str() {
1910            "avg" => Self::Avg,
1911            "sum" => Self::Sum,
1912            "min" => Self::Min,
1913            "max" => Self::Max,
1914            "count" => Self::Count,
1915            "last" => Self::Last,
1916            "rate" => Self::Rate,
1917            "increase" => Self::Increase,
1918            _ => Self::Unknown(value),
1919        })
1920    }
1921}
1922
1923pub type QueryMetricsInstantPostBody = QueryMetricsInstantPostRequest;
1924
1925pub type QueryMetricsInstantPostResponse = MetricQueryResponse;
1926
1927#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1928pub struct QueryMetricsRangeParameters {
1929    #[serde(rename = "metric")]
1930    pub metric: String,
1931
1932    #[serde(rename = "agg", default, skip_serializing_if = "Option::is_none")]
1933    pub agg: Option<QueryMetricsRangeParametersAgg>,
1934
1935    #[serde(rename = "match[]", default, skip_serializing_if = "Option::is_none")]
1936    pub match__: Option<Vec<String>>,
1937
1938    #[serde(rename = "by[]", default, skip_serializing_if = "Option::is_none")]
1939    pub by__: Option<Vec<String>>,
1940
1941    #[serde(rename = "start")]
1942    pub start: String,
1943
1944    #[serde(rename = "end")]
1945    pub end: String,
1946
1947    #[serde(rename = "step", default, skip_serializing_if = "Option::is_none")]
1948    pub step: Option<String>,
1949}
1950impl QueryMetricsRangeParameters {
1951    /// Set the required fields; optional fields start omitted.
1952    #[allow(clippy::too_many_arguments)]
1953    pub fn new(metric: String, start: String, end: String) -> Self {
1954        Self {
1955            metric,
1956            agg: None,
1957            match__: None,
1958            by__: None,
1959            start,
1960            end,
1961            step: None,
1962        }
1963    }
1964}
1965
1966#[derive(Clone, Debug, PartialEq, Eq)]
1967pub enum QueryMetricsRangeParametersAgg {
1968    Avg,
1969    Sum,
1970    Min,
1971    Max,
1972    Count,
1973    Last,
1974    Rate,
1975    Increase,
1976    Unknown(String),
1977}
1978impl QueryMetricsRangeParametersAgg {
1979    pub fn as_str(&self) -> &str {
1980        match self {
1981            Self::Avg => "avg",
1982            Self::Sum => "sum",
1983            Self::Min => "min",
1984            Self::Max => "max",
1985            Self::Count => "count",
1986            Self::Last => "last",
1987            Self::Rate => "rate",
1988            Self::Increase => "increase",
1989            Self::Unknown(value) => value,
1990        }
1991    }
1992}
1993impl serde::Serialize for QueryMetricsRangeParametersAgg {
1994    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1995        serializer.serialize_str(self.as_str())
1996    }
1997}
1998impl<'de> serde::Deserialize<'de> for QueryMetricsRangeParametersAgg {
1999    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2000        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2001        Ok(match value.as_str() {
2002            "avg" => Self::Avg,
2003            "sum" => Self::Sum,
2004            "min" => Self::Min,
2005            "max" => Self::Max,
2006            "count" => Self::Count,
2007            "last" => Self::Last,
2008            "rate" => Self::Rate,
2009            "increase" => Self::Increase,
2010            _ => Self::Unknown(value),
2011        })
2012    }
2013}
2014
2015pub type QueryMetricsRangeQuery = QueryMetricsRangeParameters;
2016
2017pub type QueryMetricsRangeResponse = MetricQueryResponse;
2018
2019#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2020pub struct QueryMetricsRangePostRequest {
2021    #[serde(rename = "metric")]
2022    pub metric: String,
2023
2024    #[serde(rename = "agg", default, skip_serializing_if = "Option::is_none")]
2025    pub agg: Option<QueryMetricsRangePostRequestAgg>,
2026
2027    #[serde(rename = "start")]
2028    pub start: String,
2029
2030    #[serde(rename = "end")]
2031    pub end: String,
2032
2033    #[serde(rename = "step", default, skip_serializing_if = "Option::is_none")]
2034    pub step: Option<String>,
2035
2036    #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
2037    pub match_: Option<Vec<String>>,
2038
2039    #[serde(rename = "by", default, skip_serializing_if = "Option::is_none")]
2040    pub by: Option<Vec<String>>,
2041}
2042impl QueryMetricsRangePostRequest {
2043    /// Set the required fields; optional fields start omitted.
2044    #[allow(clippy::too_many_arguments)]
2045    pub fn new(metric: String, start: String, end: String) -> Self {
2046        Self {
2047            metric,
2048            agg: None,
2049            start,
2050            end,
2051            step: None,
2052            match_: None,
2053            by: None,
2054        }
2055    }
2056}
2057
2058#[derive(Clone, Debug, PartialEq, Eq)]
2059pub enum QueryMetricsRangePostRequestAgg {
2060    Avg,
2061    Sum,
2062    Min,
2063    Max,
2064    Count,
2065    Last,
2066    Rate,
2067    Increase,
2068    Unknown(String),
2069}
2070impl QueryMetricsRangePostRequestAgg {
2071    pub fn as_str(&self) -> &str {
2072        match self {
2073            Self::Avg => "avg",
2074            Self::Sum => "sum",
2075            Self::Min => "min",
2076            Self::Max => "max",
2077            Self::Count => "count",
2078            Self::Last => "last",
2079            Self::Rate => "rate",
2080            Self::Increase => "increase",
2081            Self::Unknown(value) => value,
2082        }
2083    }
2084}
2085impl serde::Serialize for QueryMetricsRangePostRequestAgg {
2086    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2087        serializer.serialize_str(self.as_str())
2088    }
2089}
2090impl<'de> serde::Deserialize<'de> for QueryMetricsRangePostRequestAgg {
2091    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2092        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2093        Ok(match value.as_str() {
2094            "avg" => Self::Avg,
2095            "sum" => Self::Sum,
2096            "min" => Self::Min,
2097            "max" => Self::Max,
2098            "count" => Self::Count,
2099            "last" => Self::Last,
2100            "rate" => Self::Rate,
2101            "increase" => Self::Increase,
2102            _ => Self::Unknown(value),
2103        })
2104    }
2105}
2106
2107pub type QueryMetricsRangePostBody = QueryMetricsRangePostRequest;
2108
2109pub type QueryMetricsRangePostResponse = MetricQueryResponse;
2110
2111#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2112pub struct SearchLogsParameters {
2113    #[serde(rename = "from")]
2114    pub from: String,
2115
2116    #[serde(rename = "to")]
2117    pub to: String,
2118
2119    #[serde(rename = "log_group", default, skip_serializing_if = "Option::is_none")]
2120    pub log_group: Option<String>,
2121
2122    #[serde(
2123        rename = "log_stream",
2124        default,
2125        skip_serializing_if = "Option::is_none"
2126    )]
2127    pub log_stream: Option<String>,
2128
2129    #[serde(
2130        rename = "min_severity",
2131        default,
2132        skip_serializing_if = "Option::is_none"
2133    )]
2134    pub min_severity: Option<SearchLogsParametersMinSeverity>,
2135
2136    #[serde(rename = "region", default, skip_serializing_if = "Option::is_none")]
2137    pub region: Option<String>,
2138
2139    #[serde(rename = "q", default, skip_serializing_if = "Option::is_none")]
2140    pub q: Option<String>,
2141
2142    #[serde(rename = "trace_id", default, skip_serializing_if = "Option::is_none")]
2143    pub trace_id: Option<String>,
2144
2145    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
2146    pub limit: Option<i64>,
2147
2148    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
2149    pub marker: Option<String>,
2150}
2151impl SearchLogsParameters {
2152    /// Set the required fields; optional fields start omitted.
2153    #[allow(clippy::too_many_arguments)]
2154    pub fn new(from: String, to: String) -> Self {
2155        Self {
2156            from,
2157            to,
2158            log_group: None,
2159            log_stream: None,
2160            min_severity: None,
2161            region: None,
2162            q: None,
2163            trace_id: None,
2164            limit: None,
2165            marker: None,
2166        }
2167    }
2168}
2169
2170#[derive(Clone, Debug, PartialEq, Eq)]
2171pub enum SearchLogsParametersMinSeverity {
2172    TRACE,
2173    DEBUG,
2174    INFO,
2175    WARN,
2176    ERROR,
2177    FATAL,
2178    Unknown(String),
2179}
2180impl SearchLogsParametersMinSeverity {
2181    pub fn as_str(&self) -> &str {
2182        match self {
2183            Self::TRACE => "TRACE",
2184            Self::DEBUG => "DEBUG",
2185            Self::INFO => "INFO",
2186            Self::WARN => "WARN",
2187            Self::ERROR => "ERROR",
2188            Self::FATAL => "FATAL",
2189            Self::Unknown(value) => value,
2190        }
2191    }
2192}
2193impl serde::Serialize for SearchLogsParametersMinSeverity {
2194    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2195        serializer.serialize_str(self.as_str())
2196    }
2197}
2198impl<'de> serde::Deserialize<'de> for SearchLogsParametersMinSeverity {
2199    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2200        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2201        Ok(match value.as_str() {
2202            "TRACE" => Self::TRACE,
2203            "DEBUG" => Self::DEBUG,
2204            "INFO" => Self::INFO,
2205            "WARN" => Self::WARN,
2206            "ERROR" => Self::ERROR,
2207            "FATAL" => Self::FATAL,
2208            _ => Self::Unknown(value),
2209        })
2210    }
2211}
2212
2213pub type SearchLogsQuery = SearchLogsParameters;
2214
2215#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2216pub struct LogListResponse {
2217    #[serde(rename = "logs")]
2218    pub logs: Vec<LogRecord>,
2219
2220    #[serde(rename = "meta")]
2221    pub meta: PaginationMeta,
2222}
2223
2224pub type SearchLogsResponse = LogListResponse;
2225
2226#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2227pub struct SearchTracesParameters {
2228    #[serde(rename = "from")]
2229    pub from: String,
2230
2231    #[serde(rename = "to")]
2232    pub to: String,
2233
2234    #[serde(rename = "service", default, skip_serializing_if = "Option::is_none")]
2235    pub service: Option<String>,
2236
2237    #[serde(rename = "operation", default, skip_serializing_if = "Option::is_none")]
2238    pub operation: Option<String>,
2239
2240    #[serde(
2241        rename = "status_code",
2242        default,
2243        skip_serializing_if = "Option::is_none"
2244    )]
2245    pub status_code: Option<SearchTracesParametersStatusCode>,
2246
2247    #[serde(
2248        rename = "min_duration_ms",
2249        default,
2250        skip_serializing_if = "Option::is_none"
2251    )]
2252    pub min_duration_ms: Option<f64>,
2253
2254    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
2255    pub limit: Option<i64>,
2256
2257    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
2258    pub marker: Option<String>,
2259}
2260impl SearchTracesParameters {
2261    /// Set the required fields; optional fields start omitted.
2262    #[allow(clippy::too_many_arguments)]
2263    pub fn new(from: String, to: String) -> Self {
2264        Self {
2265            from,
2266            to,
2267            service: None,
2268            operation: None,
2269            status_code: None,
2270            min_duration_ms: None,
2271            limit: None,
2272            marker: None,
2273        }
2274    }
2275}
2276
2277#[derive(Clone, Debug, PartialEq, Eq)]
2278pub enum SearchTracesParametersStatusCode {
2279    UNSET,
2280    OK,
2281    ERROR,
2282    Unknown(String),
2283}
2284impl SearchTracesParametersStatusCode {
2285    pub fn as_str(&self) -> &str {
2286        match self {
2287            Self::UNSET => "UNSET",
2288            Self::OK => "OK",
2289            Self::ERROR => "ERROR",
2290            Self::Unknown(value) => value,
2291        }
2292    }
2293}
2294impl serde::Serialize for SearchTracesParametersStatusCode {
2295    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2296        serializer.serialize_str(self.as_str())
2297    }
2298}
2299impl<'de> serde::Deserialize<'de> for SearchTracesParametersStatusCode {
2300    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2301        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2302        Ok(match value.as_str() {
2303            "UNSET" => Self::UNSET,
2304            "OK" => Self::OK,
2305            "ERROR" => Self::ERROR,
2306            _ => Self::Unknown(value),
2307        })
2308    }
2309}
2310
2311pub type SearchTracesQuery = SearchTracesParameters;
2312
2313#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2314pub struct TraceListResponse {
2315    #[serde(rename = "traces")]
2316    pub traces: Vec<TraceSummary>,
2317
2318    #[serde(rename = "meta")]
2319    pub meta: PaginationMeta,
2320}
2321
2322pub type SearchTracesResponse = TraceListResponse;
2323
2324#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
2325pub struct UpdateAlertRequestInput {
2326    /// Required same-account, same-region notification topic reference: UUID, canonical CRN or exact name, classified by syntax. Multiple alerts may share a topic. Binding requires notifications:Publish and respects explicit topic-policy denies.
2327    #[serde(rename = "topic", default, skip_serializing_if = "Option::is_none")]
2328    pub topic: Option<String>,
2329
2330    #[serde(
2331        rename = "expression",
2332        default,
2333        skip_serializing_if = "Option::is_none"
2334    )]
2335    pub expression: Option<AlertExpressionInput>,
2336
2337    #[serde(rename = "operator", default, skip_serializing_if = "Option::is_none")]
2338    pub operator: Option<UpdateAlertRequestInputOperator>,
2339
2340    #[serde(rename = "threshold", default, skip_serializing_if = "Option::is_none")]
2341    pub threshold: Option<f64>,
2342    /// Whole-minute window. Evaluated every minute against the last complete UTC-aligned window.
2343    #[serde(
2344        rename = "window_seconds",
2345        default,
2346        skip_serializing_if = "Option::is_none"
2347    )]
2348    pub window_seconds: Option<i64>,
2349    /// Continuous breach duration before firing; 0 fires immediately. Missing data, query failures and scheduling gaps reset a pending duration.
2350    #[serde(
2351        rename = "for_seconds",
2352        default,
2353        skip_serializing_if = "Option::is_none"
2354    )]
2355    pub for_seconds: Option<i64>,
2356
2357    #[serde(rename = "enabled", default, skip_serializing_if = "Option::is_none")]
2358    pub enabled: Option<bool>,
2359    /// Mute notifications until this instant (at most 30 days ahead). Evaluation continues; null removes silence. An active alert notifies on the next evaluation after silence expires.
2360    #[serde(
2361        rename = "silenced_until",
2362        default,
2363        skip_serializing_if = "Option::is_none",
2364        deserialize_with = "crate::response::present_nullable"
2365    )]
2366    pub silenced_until: Option<crate::Nullable<String>>,
2367}
2368
2369#[derive(Clone, Debug, PartialEq, Eq)]
2370pub enum UpdateAlertRequestInputOperator {
2371    Gt,
2372    Gte,
2373    Lt,
2374    Lte,
2375    Unknown(String),
2376}
2377impl UpdateAlertRequestInputOperator {
2378    pub fn as_str(&self) -> &str {
2379        match self {
2380            Self::Gt => "gt",
2381            Self::Gte => "gte",
2382            Self::Lt => "lt",
2383            Self::Lte => "lte",
2384            Self::Unknown(value) => value,
2385        }
2386    }
2387}
2388impl serde::Serialize for UpdateAlertRequestInputOperator {
2389    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2390        serializer.serialize_str(self.as_str())
2391    }
2392}
2393impl<'de> serde::Deserialize<'de> for UpdateAlertRequestInputOperator {
2394    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2395        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2396        Ok(match value.as_str() {
2397            "gt" => Self::Gt,
2398            "gte" => Self::Gte,
2399            "lt" => Self::Lt,
2400            "lte" => Self::Lte,
2401            _ => Self::Unknown(value),
2402        })
2403    }
2404}
2405
2406pub type UpdateAlertBody = UpdateAlertRequestInput;
2407
2408pub type UpdateAlertResponse = AlertResponse;
2409
2410#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
2411pub struct UpdateLogGroupRequestInput {
2412    #[serde(
2413        rename = "description",
2414        default,
2415        skip_serializing_if = "Option::is_none",
2416        deserialize_with = "crate::response::present_nullable"
2417    )]
2418    pub description: Option<crate::Nullable<String>>,
2419    /// Omit to preserve retention. Null selects no expiry.
2420    #[serde(
2421        rename = "retention_days",
2422        default,
2423        skip_serializing_if = "Option::is_none",
2424        deserialize_with = "crate::response::present_nullable"
2425    )]
2426    pub retention_days: Option<crate::Nullable<i64>>,
2427    /// KMS key UUID, CRN or exact name in this account and region. Omit to preserve the binding; null clears encryption for future records.
2428    #[serde(
2429        rename = "kms_key",
2430        default,
2431        skip_serializing_if = "Option::is_none",
2432        deserialize_with = "crate::response::present_nullable"
2433    )]
2434    pub kms_key: Option<crate::Nullable<String>>,
2435
2436    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
2437    pub tags: Option<std::collections::BTreeMap<String, String>>,
2438}
2439
2440pub type UpdateLogGroupBody = UpdateLogGroupRequestInput;
2441
2442pub type UpdateLogGroupResponse = LogGroupResponse;
2443
2444#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
2445pub struct UpdateTraceSettingsRequestInput {
2446    /// Omit to preserve retention. Null restores the default 30 days; traces always expire.
2447    #[serde(
2448        rename = "retention_days",
2449        default,
2450        skip_serializing_if = "Option::is_none",
2451        deserialize_with = "crate::response::present_nullable"
2452    )]
2453    pub retention_days: Option<crate::Nullable<i64>>,
2454    /// KMS key UUID, CRN or exact name in this account and region. Omit to preserve the binding; null clears encryption for future records.
2455    #[serde(
2456        rename = "kms_key",
2457        default,
2458        skip_serializing_if = "Option::is_none",
2459        deserialize_with = "crate::response::present_nullable"
2460    )]
2461    pub kms_key: Option<crate::Nullable<String>>,
2462}
2463
2464pub type UpdateTraceSettingsBody = UpdateTraceSettingsRequestInput;
2465
2466pub type UpdateTraceSettingsResponse = TraceSettingsResponse;