Skip to main content

basaltic/models/
queue.rs

1//! Generated typed wire models. Unknown string enum values are retained.
2#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3pub struct ChangeVisibilityRequestInput {
4    #[serde(rename = "receipt_handle")]
5    pub receipt_handle: String,
6    /// Measured from now, not from the original lease. 0 releases the message immediately.
7    #[serde(rename = "visibility_timeout_seconds")]
8    pub visibility_timeout_seconds: i64,
9}
10impl ChangeVisibilityRequestInput {
11    /// Set the required fields; optional fields start omitted.
12    #[allow(clippy::too_many_arguments)]
13    pub fn new(receipt_handle: String, visibility_timeout_seconds: i64) -> Self {
14        Self {
15            receipt_handle,
16            visibility_timeout_seconds,
17        }
18    }
19}
20
21pub type ChangeMessageVisibilityBody = ChangeVisibilityRequestInput;
22
23#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
24pub struct ChangeVisibilityBatchRequestInput {
25    #[serde(rename = "entries")]
26    pub entries: Vec<ChangeVisibilityBatchRequestInputEntriesItem>,
27}
28impl ChangeVisibilityBatchRequestInput {
29    /// Set the required fields; optional fields start omitted.
30    #[allow(clippy::too_many_arguments)]
31    pub fn new(entries: Vec<ChangeVisibilityBatchRequestInputEntriesItem>) -> Self {
32        Self { entries }
33    }
34}
35
36#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
37pub struct ChangeVisibilityBatchRequestInputEntriesItem {
38    #[serde(rename = "id")]
39    pub id: String,
40
41    #[serde(rename = "receipt_handle")]
42    pub receipt_handle: String,
43
44    #[serde(rename = "visibility_timeout_seconds")]
45    pub visibility_timeout_seconds: i64,
46}
47impl ChangeVisibilityBatchRequestInputEntriesItem {
48    /// Set the required fields; optional fields start omitted.
49    #[allow(clippy::too_many_arguments)]
50    pub fn new(id: String, receipt_handle: String, visibility_timeout_seconds: i64) -> Self {
51        Self {
52            id,
53            receipt_handle,
54            visibility_timeout_seconds,
55        }
56    }
57}
58
59pub type ChangeMessageVisibilityBatchBody = ChangeVisibilityBatchRequestInput;
60
61#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
62pub struct BatchResponse {
63    #[serde(rename = "results")]
64    pub results: Vec<BatchResult>,
65}
66
67#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
68pub struct BatchResult {
69    /// The entry id from the request.
70    #[serde(rename = "id")]
71    pub id: String,
72
73    #[serde(
74        rename = "message_id",
75        default,
76        skip_serializing_if = "Option::is_none"
77    )]
78    pub message_id: Option<String>,
79
80    #[serde(rename = "duplicate", default, skip_serializing_if = "Option::is_none")]
81    pub duplicate: Option<bool>,
82    /// Machine-readable code when this entry failed.
83    #[serde(rename = "error", default, skip_serializing_if = "Option::is_none")]
84    pub error: Option<String>,
85    /// Human-readable reason accompanying error.
86    #[serde(rename = "message", default, skip_serializing_if = "Option::is_none")]
87    pub message: Option<String>,
88}
89
90pub type ChangeMessageVisibilityBatchResponse = BatchResponse;
91
92#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
93pub struct CreateQueueRequestInput {
94    /// Letters, digits, dot, dash, or underscore, starting with a letter or digit. A name ending in `.fifo` creates a FIFO queue. Resource names must not start with the literal crn: prefix or be UUIDs (canonical, compact, braced, or urn:uuid: forms, in either case).
95    #[serde(rename = "name")]
96    pub name: String,
97
98    #[serde(
99        rename = "visibility_timeout_seconds",
100        default,
101        skip_serializing_if = "Option::is_none"
102    )]
103    pub visibility_timeout_seconds: Option<i64>,
104
105    #[serde(
106        rename = "message_retention_seconds",
107        default,
108        skip_serializing_if = "Option::is_none"
109    )]
110    pub message_retention_seconds: Option<i64>,
111
112    #[serde(
113        rename = "max_message_bytes",
114        default,
115        skip_serializing_if = "Option::is_none"
116    )]
117    pub max_message_bytes: Option<i64>,
118
119    #[serde(
120        rename = "delay_seconds",
121        default,
122        skip_serializing_if = "Option::is_none"
123    )]
124    pub delay_seconds: Option<i64>,
125
126    #[serde(
127        rename = "receive_wait_time_seconds",
128        default,
129        skip_serializing_if = "Option::is_none"
130    )]
131    pub receive_wait_time_seconds: Option<i64>,
132
133    #[serde(
134        rename = "kms_data_key_reuse_period_seconds",
135        default,
136        skip_serializing_if = "Option::is_none"
137    )]
138    pub kms_data_key_reuse_period_seconds: Option<i64>,
139    /// FIFO queues only.
140    #[serde(
141        rename = "content_based_deduplication",
142        default,
143        skip_serializing_if = "Option::is_none"
144    )]
145    pub content_based_deduplication: Option<bool>,
146    /// KMS key UUID, CRN or account-scoped name. Omit to use the platform key.
147    #[serde(rename = "kms_key", default, skip_serializing_if = "Option::is_none")]
148    pub kms_key: Option<String>,
149
150    #[serde(
151        rename = "redrive_policy",
152        default,
153        skip_serializing_if = "Option::is_none"
154    )]
155    pub redrive_policy: Option<RedrivePolicyInputInput>,
156
157    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
158    pub tags: Option<TagsInput>,
159}
160impl CreateQueueRequestInput {
161    /// Set the required fields; optional fields start omitted.
162    #[allow(clippy::too_many_arguments)]
163    pub fn new(name: String) -> Self {
164        Self {
165            name,
166            visibility_timeout_seconds: None,
167            message_retention_seconds: None,
168            max_message_bytes: None,
169            delay_seconds: None,
170            receive_wait_time_seconds: None,
171            kms_data_key_reuse_period_seconds: None,
172            content_based_deduplication: None,
173            kms_key: None,
174            redrive_policy: None,
175            tags: None,
176        }
177    }
178}
179
180#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
181pub struct RedrivePolicyInputInput {
182    #[serde(rename = "dead_letter_queue")]
183    pub dead_letter_queue: String,
184
185    #[serde(rename = "max_receive_count")]
186    pub max_receive_count: i64,
187}
188impl RedrivePolicyInputInput {
189    /// Set the required fields; optional fields start omitted.
190    #[allow(clippy::too_many_arguments)]
191    pub fn new(dead_letter_queue: String, max_receive_count: i64) -> Self {
192        Self {
193            dead_letter_queue,
194            max_receive_count,
195        }
196    }
197}
198
199pub type TagsInput = std::collections::BTreeMap<String, String>;
200
201pub type CreateQueueBody = CreateQueueRequestInput;
202
203#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
204pub struct QueueResponse {
205    #[serde(rename = "queue")]
206    pub queue: Queue,
207}
208
209#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
210pub struct Queue {
211    #[serde(rename = "id")]
212    pub id: String,
213
214    #[serde(rename = "crn")]
215    pub crn: String,
216    /// Unique within the calling account. Immutable. Resource names must not start with the literal crn: prefix or be UUIDs (canonical, compact, braced, or urn:uuid: forms, in either case).
217    #[serde(rename = "name")]
218    pub name: String,
219    /// Derived from the name and immutable.
220    #[serde(rename = "kind")]
221    pub kind: QueueKind,
222
223    #[serde(rename = "attributes")]
224    pub attributes: QueueAttributes,
225
226    #[serde(
227        rename = "redrive_policy",
228        default,
229        skip_serializing_if = "Option::is_none"
230    )]
231    pub redrive_policy: Option<RedrivePolicy>,
232    /// FIFO only. Derives a deduplication id from a hash of the body when the sender supplies none.
233    #[serde(
234        rename = "content_based_deduplication",
235        default,
236        skip_serializing_if = "Option::is_none"
237    )]
238    pub content_based_deduplication: Option<bool>,
239    /// Customer-managed key wrapping the queue data key. Omitted for platform encryption. If key metadata is unavailable, the reference retains its stored ID and CRN without a name.
240    #[serde(rename = "kms_key", default, skip_serializing_if = "Option::is_none")]
241    pub kms_key: Option<ResourceRef>,
242
243    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
244    pub tags: Option<Tags>,
245
246    #[serde(rename = "depth", default, skip_serializing_if = "Option::is_none")]
247    pub depth: Option<QueueDepth>,
248
249    #[serde(rename = "created_at")]
250    pub created_at: String,
251
252    #[serde(rename = "updated_at")]
253    pub updated_at: String,
254}
255
256#[derive(Clone, Debug, PartialEq, Eq)]
257pub enum QueueKind {
258    Standard,
259    Fifo,
260    Unknown(String),
261}
262impl QueueKind {
263    pub fn as_str(&self) -> &str {
264        match self {
265            Self::Standard => "standard",
266            Self::Fifo => "fifo",
267            Self::Unknown(value) => value,
268        }
269    }
270}
271impl serde::Serialize for QueueKind {
272    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
273        serializer.serialize_str(self.as_str())
274    }
275}
276impl<'de> serde::Deserialize<'de> for QueueKind {
277    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
278        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
279        Ok(match value.as_str() {
280            "standard" => Self::Standard,
281            "fifo" => Self::Fifo,
282            _ => Self::Unknown(value),
283        })
284    }
285}
286
287#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
288pub struct QueueAttributes {
289    /// How long a received message stays invisible before redelivery. 0 redelivers immediately.
290    #[serde(
291        rename = "visibility_timeout_seconds",
292        default,
293        skip_serializing_if = "Option::is_none"
294    )]
295    pub visibility_timeout_seconds: Option<i64>,
296    /// How long an undeleted message survives before it is discarded.
297    #[serde(
298        rename = "message_retention_seconds",
299        default,
300        skip_serializing_if = "Option::is_none"
301    )]
302    pub message_retention_seconds: Option<i64>,
303    /// Largest accepted message. Attributes count against this alongside the body.
304    #[serde(
305        rename = "max_message_bytes",
306        default,
307        skip_serializing_if = "Option::is_none"
308    )]
309    pub max_message_bytes: Option<i64>,
310    /// Default delay applied to every send that does not override it. Not supported on FIFO queues.
311    #[serde(
312        rename = "delay_seconds",
313        default,
314        skip_serializing_if = "Option::is_none"
315    )]
316    pub delay_seconds: Option<i64>,
317    /// Default long-poll window for a receive that does not override it.
318    #[serde(
319        rename = "receive_wait_time_seconds",
320        default,
321        skip_serializing_if = "Option::is_none"
322    )]
323    pub receive_wait_time_seconds: Option<i64>,
324    /// How long an unwrapped data key is cached. Sends and receives keep working for up to this long after the wrapping key is disabled; lower it to tighten that window at the cost of more KMS round-trips.
325    #[serde(
326        rename = "kms_data_key_reuse_period_seconds",
327        default,
328        skip_serializing_if = "Option::is_none"
329    )]
330    pub kms_data_key_reuse_period_seconds: Option<i64>,
331}
332
333#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
334pub struct RedrivePolicy {
335    #[serde(rename = "dead_letter_queue")]
336    pub dead_letter_queue: ResourceRef,
337
338    #[serde(rename = "max_receive_count")]
339    pub max_receive_count: i64,
340}
341
342#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
343pub struct ResourceRef {
344    #[serde(rename = "id")]
345    pub id: String,
346
347    #[serde(rename = "crn")]
348    pub crn: String,
349    /// 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.
350    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
351    pub name: Option<String>,
352}
353
354pub type Tags = std::collections::BTreeMap<String, String>;
355
356#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
357pub struct QueueDepth {
358    #[serde(
359        rename = "approximate_available",
360        default,
361        skip_serializing_if = "Option::is_none"
362    )]
363    pub approximate_available: Option<i64>,
364
365    #[serde(
366        rename = "approximate_in_flight",
367        default,
368        skip_serializing_if = "Option::is_none"
369    )]
370    pub approximate_in_flight: Option<i64>,
371
372    #[serde(
373        rename = "approximate_delayed",
374        default,
375        skip_serializing_if = "Option::is_none"
376    )]
377    pub approximate_delayed: Option<i64>,
378
379    #[serde(
380        rename = "counts_capped",
381        default,
382        skip_serializing_if = "Option::is_none"
383    )]
384    pub counts_capped: Option<bool>,
385}
386
387pub type CreateQueueResponse = QueueResponse;
388
389#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
390pub struct DeleteMessageParameters {
391    #[serde(rename = "receipt_handle")]
392    pub receipt_handle: String,
393}
394impl DeleteMessageParameters {
395    /// Set the required fields; optional fields start omitted.
396    #[allow(clippy::too_many_arguments)]
397    pub fn new(receipt_handle: String) -> Self {
398        Self { receipt_handle }
399    }
400}
401
402pub type DeleteMessageQuery = DeleteMessageParameters;
403
404#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
405pub struct DeleteMessageBatchRequestInput {
406    #[serde(rename = "entries")]
407    pub entries: Vec<DeleteMessageBatchRequestInputEntriesItem>,
408}
409impl DeleteMessageBatchRequestInput {
410    /// Set the required fields; optional fields start omitted.
411    #[allow(clippy::too_many_arguments)]
412    pub fn new(entries: Vec<DeleteMessageBatchRequestInputEntriesItem>) -> Self {
413        Self { entries }
414    }
415}
416
417#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
418pub struct DeleteMessageBatchRequestInputEntriesItem {
419    #[serde(rename = "id")]
420    pub id: String,
421
422    #[serde(rename = "receipt_handle")]
423    pub receipt_handle: String,
424}
425impl DeleteMessageBatchRequestInputEntriesItem {
426    /// Set the required fields; optional fields start omitted.
427    #[allow(clippy::too_many_arguments)]
428    pub fn new(id: String, receipt_handle: String) -> Self {
429        Self { id, receipt_handle }
430    }
431}
432
433pub type DeleteMessageBatchBody = DeleteMessageBatchRequestInput;
434
435pub type DeleteMessageBatchResponse = BatchResponse;
436
437pub type DescribeQueueResponse = QueueResponse;
438
439#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
440pub struct ListQueuesParameters {
441    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
442    pub name: Option<String>,
443
444    #[serde(rename = "crn", default, skip_serializing_if = "Option::is_none")]
445    pub crn: Option<String>,
446
447    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
448    pub marker: Option<String>,
449
450    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
451    pub limit: Option<i64>,
452}
453
454pub type ListQueuesQuery = ListQueuesParameters;
455
456#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
457pub struct QueueListResponse {
458    #[serde(rename = "queues")]
459    pub queues: Vec<Queue>,
460
461    #[serde(rename = "meta", default, skip_serializing_if = "Option::is_none")]
462    pub meta: Option<PaginationMeta>,
463}
464
465#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
466pub struct PaginationMeta {
467    /// Total number of items
468    #[serde(rename = "total", default, skip_serializing_if = "Option::is_none")]
469    pub total: Option<i64>,
470    /// Number of items per page
471    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
472    pub limit: Option<i64>,
473    /// Opaque cursor for the next page. Pass it back as the `marker` query parameter; treat it as a token, not a value to parse.
474    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
475    pub marker: Option<String>,
476    /// Whether there are more items
477    #[serde(rename = "has_more", default, skip_serializing_if = "Option::is_none")]
478    pub has_more: Option<bool>,
479}
480
481pub type ListQueuesResponse = QueueListResponse;
482
483pub type ListQueuesItem = Queue;
484
485#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
486pub struct PeekMessagesParameters {
487    #[serde(rename = "crn", default, skip_serializing_if = "Option::is_none")]
488    pub crn: Option<String>,
489
490    #[serde(
491        rename = "visibility",
492        default,
493        skip_serializing_if = "Option::is_none"
494    )]
495    pub visibility: Option<PeekMessagesParametersVisibility>,
496
497    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
498    pub marker: Option<String>,
499
500    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
501    pub limit: Option<i64>,
502}
503
504#[derive(Clone, Debug, PartialEq, Eq)]
505pub enum PeekMessagesParametersVisibility {
506    Available,
507    InFlight,
508    Delayed,
509    Unknown(String),
510}
511impl PeekMessagesParametersVisibility {
512    pub fn as_str(&self) -> &str {
513        match self {
514            Self::Available => "available",
515            Self::InFlight => "in_flight",
516            Self::Delayed => "delayed",
517            Self::Unknown(value) => value,
518        }
519    }
520}
521impl serde::Serialize for PeekMessagesParametersVisibility {
522    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
523        serializer.serialize_str(self.as_str())
524    }
525}
526impl<'de> serde::Deserialize<'de> for PeekMessagesParametersVisibility {
527    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
528        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
529        Ok(match value.as_str() {
530            "available" => Self::Available,
531            "in_flight" => Self::InFlight,
532            "delayed" => Self::Delayed,
533            _ => Self::Unknown(value),
534        })
535    }
536}
537
538pub type PeekMessagesQuery = PeekMessagesParameters;
539
540#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
541pub struct PeekResponse {
542    #[serde(rename = "messages")]
543    pub messages: Vec<Message>,
544
545    #[serde(rename = "meta", default, skip_serializing_if = "Option::is_none")]
546    pub meta: Option<PaginationMeta>,
547}
548
549#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
550pub struct Message {
551    #[serde(rename = "id")]
552    pub id: String,
553
554    #[serde(rename = "crn")]
555    pub crn: String,
556
557    #[serde(rename = "queue_id")]
558    pub queue_id: String,
559    /// Absent when the body could not be decrypted — the rest of the row is still reported.
560    #[serde(rename = "body", default, skip_serializing_if = "Option::is_none")]
561    pub body: Option<String>,
562
563    #[serde(
564        rename = "attributes",
565        default,
566        skip_serializing_if = "Option::is_none"
567    )]
568    pub attributes: Option<MessageAttributes>,
569
570    #[serde(rename = "visibility")]
571    pub visibility: MessageVisibility,
572
573    #[serde(rename = "receive_count")]
574    pub receive_count: i64,
575    /// Plaintext size, counted against the queue's max_message_bytes.
576    #[serde(
577        rename = "body_bytes",
578        default,
579        skip_serializing_if = "Option::is_none"
580    )]
581    pub body_bytes: Option<i64>,
582
583    #[serde(
584        rename = "message_group_id",
585        default,
586        skip_serializing_if = "Option::is_none"
587    )]
588    pub message_group_id: Option<String>,
589
590    #[serde(rename = "enqueued_at")]
591    pub enqueued_at: String,
592
593    #[serde(rename = "visible_at")]
594    pub visible_at: String,
595    /// When retention discards this message.
596    #[serde(rename = "expires_at")]
597    pub expires_at: String,
598
599    #[serde(
600        rename = "first_received_at",
601        default,
602        skip_serializing_if = "Option::is_none",
603        deserialize_with = "crate::response::present_nullable"
604    )]
605    pub first_received_at: Option<crate::Nullable<String>>,
606}
607
608pub type MessageAttributes = std::collections::BTreeMap<String, MessageAttributesValue>;
609
610#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
611pub struct MessageAttributesValue {
612    #[serde(rename = "type")]
613    pub type_: MessageAttributesValueType,
614
615    #[serde(rename = "value")]
616    pub value: String,
617}
618
619#[derive(Clone, Debug, PartialEq, Eq)]
620pub enum MessageAttributesValueType {
621    String,
622    Number,
623    Binary,
624    Unknown(String),
625}
626impl MessageAttributesValueType {
627    pub fn as_str(&self) -> &str {
628        match self {
629            Self::String => "String",
630            Self::Number => "Number",
631            Self::Binary => "Binary",
632            Self::Unknown(value) => value,
633        }
634    }
635}
636impl serde::Serialize for MessageAttributesValueType {
637    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
638        serializer.serialize_str(self.as_str())
639    }
640}
641impl<'de> serde::Deserialize<'de> for MessageAttributesValueType {
642    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
643        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
644        Ok(match value.as_str() {
645            "String" => Self::String,
646            "Number" => Self::Number,
647            "Binary" => Self::Binary,
648            _ => Self::Unknown(value),
649        })
650    }
651}
652
653#[derive(Clone, Debug, PartialEq, Eq)]
654pub enum MessageVisibility {
655    Available,
656    InFlight,
657    Delayed,
658    Unknown(String),
659}
660impl MessageVisibility {
661    pub fn as_str(&self) -> &str {
662        match self {
663            Self::Available => "available",
664            Self::InFlight => "in_flight",
665            Self::Delayed => "delayed",
666            Self::Unknown(value) => value,
667        }
668    }
669}
670impl serde::Serialize for MessageVisibility {
671    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
672        serializer.serialize_str(self.as_str())
673    }
674}
675impl<'de> serde::Deserialize<'de> for MessageVisibility {
676    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
677        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
678        Ok(match value.as_str() {
679            "available" => Self::Available,
680            "in_flight" => Self::InFlight,
681            "delayed" => Self::Delayed,
682            _ => Self::Unknown(value),
683        })
684    }
685}
686
687pub type PeekMessagesResponse = PeekResponse;
688
689#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
690pub struct PurgeQueueResponse2 {
691    #[serde(rename = "messages_deleted")]
692    pub messages_deleted: i64,
693}
694
695pub type PurgeQueueResponse = PurgeQueueResponse2;
696
697#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
698pub struct ReceiveRequestInput {
699    /// How many messages to lease. Fewer may be returned even when more are available.
700    #[serde(
701        rename = "max_messages",
702        default,
703        skip_serializing_if = "Option::is_none"
704    )]
705    pub max_messages: Option<i64>,
706    /// Overrides the queue's default for this lease only.
707    #[serde(
708        rename = "visibility_timeout_seconds",
709        default,
710        skip_serializing_if = "Option::is_none"
711    )]
712    pub visibility_timeout_seconds: Option<i64>,
713    /// Block up to this long for a message rather than returning empty. Defaults to the queue's receive_wait_time_seconds.
714    #[serde(
715        rename = "wait_time_seconds",
716        default,
717        skip_serializing_if = "Option::is_none"
718    )]
719    pub wait_time_seconds: Option<i64>,
720}
721
722pub type ReceiveMessagesBody = ReceiveRequestInput;
723
724#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
725pub struct ReceiveResponse {
726    #[serde(rename = "messages")]
727    pub messages: Vec<ReceivedMessage>,
728}
729
730#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
731pub struct ReceivedMessage {
732    #[serde(rename = "id")]
733    pub id: String,
734    /// The credential for this lease. Required to delete the message or extend its lease, and valid only until the lease lapses.
735    #[serde(rename = "receipt_handle")]
736    pub receipt_handle: String,
737
738    #[serde(rename = "body")]
739    pub body: String,
740
741    #[serde(
742        rename = "attributes",
743        default,
744        skip_serializing_if = "Option::is_none"
745    )]
746    pub attributes: Option<MessageAttributes>,
747    /// How many times this message has been leased, including now. Compare against the redrive policy to spot a poison message.
748    #[serde(rename = "receive_count")]
749    pub receive_count: i64,
750
751    #[serde(
752        rename = "message_group_id",
753        default,
754        skip_serializing_if = "Option::is_none"
755    )]
756    pub message_group_id: Option<String>,
757
758    #[serde(rename = "enqueued_at")]
759    pub enqueued_at: String,
760    /// When this lease lapses and the message is redelivered.
761    #[serde(rename = "visible_at")]
762    pub visible_at: String,
763}
764
765pub type ReceiveMessagesResponse = ReceiveResponse;
766
767#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
768pub struct SendMessageRequestInput {
769    /// The payload. Counted against the queue's max_message_bytes together with the attributes.
770    #[serde(rename = "body")]
771    pub body: String,
772
773    #[serde(
774        rename = "attributes",
775        default,
776        skip_serializing_if = "Option::is_none"
777    )]
778    pub attributes: Option<MessageAttributesInput>,
779    /// Overrides the queue's default for this message. Rejected on FIFO queues, where it would let a later message become visible before an earlier one in the same group.
780    #[serde(
781        rename = "delay_seconds",
782        default,
783        skip_serializing_if = "Option::is_none"
784    )]
785    pub delay_seconds: Option<i64>,
786    /// Required on FIFO queues, rejected on standard ones. Messages sharing a group are delivered in order, and a group's next message is withheld while an earlier one is in flight.
787    #[serde(
788        rename = "message_group_id",
789        default,
790        skip_serializing_if = "Option::is_none"
791    )]
792    pub message_group_id: Option<String>,
793    /// FIFO only. A repeat within five minutes is suppressed and the original message's id is returned. Omit on a queue with `content_based_deduplication` to derive it from the body.
794    #[serde(
795        rename = "message_deduplication_id",
796        default,
797        skip_serializing_if = "Option::is_none"
798    )]
799    pub message_deduplication_id: Option<String>,
800}
801impl SendMessageRequestInput {
802    /// Set the required fields; optional fields start omitted.
803    #[allow(clippy::too_many_arguments)]
804    pub fn new(body: String) -> Self {
805        Self {
806            body,
807            attributes: None,
808            delay_seconds: None,
809            message_group_id: None,
810            message_deduplication_id: None,
811        }
812    }
813}
814
815pub type MessageAttributesInput = std::collections::BTreeMap<String, MessageAttributesInputValue>;
816
817#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
818pub struct MessageAttributesInputValue {
819    #[serde(rename = "type")]
820    pub type_: MessageAttributesInputValueType,
821
822    #[serde(rename = "value")]
823    pub value: String,
824}
825impl MessageAttributesInputValue {
826    /// Set the required fields; optional fields start omitted.
827    #[allow(clippy::too_many_arguments)]
828    pub fn new(type_: MessageAttributesInputValueType, value: String) -> Self {
829        Self { type_, value }
830    }
831}
832
833#[derive(Clone, Debug, PartialEq, Eq)]
834pub enum MessageAttributesInputValueType {
835    String,
836    Number,
837    Binary,
838    Unknown(String),
839}
840impl MessageAttributesInputValueType {
841    pub fn as_str(&self) -> &str {
842        match self {
843            Self::String => "String",
844            Self::Number => "Number",
845            Self::Binary => "Binary",
846            Self::Unknown(value) => value,
847        }
848    }
849}
850impl serde::Serialize for MessageAttributesInputValueType {
851    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
852        serializer.serialize_str(self.as_str())
853    }
854}
855impl<'de> serde::Deserialize<'de> for MessageAttributesInputValueType {
856    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
857        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
858        Ok(match value.as_str() {
859            "String" => Self::String,
860            "Number" => Self::Number,
861            "Binary" => Self::Binary,
862            _ => Self::Unknown(value),
863        })
864    }
865}
866
867pub type SendMessageBody = SendMessageRequestInput;
868
869#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
870pub struct SendMessageResponse2 {
871    #[serde(rename = "result")]
872    pub result: SendResult,
873}
874
875#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
876pub struct SendResult {
877    #[serde(rename = "message_id")]
878    pub message_id: String,
879    /// A live deduplication entry suppressed this send; message_id names the message the original produced.
880    #[serde(rename = "duplicate", default, skip_serializing_if = "Option::is_none")]
881    pub duplicate: Option<bool>,
882}
883
884pub type SendMessageResponse = SendMessageResponse2;
885
886#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
887pub struct SendMessageBatchRequestInput {
888    #[serde(rename = "entries")]
889    pub entries: Vec<SendMessageBatchRequestInputEntriesItem>,
890}
891impl SendMessageBatchRequestInput {
892    /// Set the required fields; optional fields start omitted.
893    #[allow(clippy::too_many_arguments)]
894    pub fn new(entries: Vec<SendMessageBatchRequestInputEntriesItem>) -> Self {
895        Self { entries }
896    }
897}
898
899#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
900pub struct SendMessageBatchRequestInputEntriesItem {
901    /// Your own identifier for this entry, echoed back in the result. Must be unique within the request.
902    #[serde(rename = "id")]
903    pub id: String,
904    /// The payload. Counted against the queue's max_message_bytes together with the attributes.
905    #[serde(rename = "body")]
906    pub body: String,
907
908    #[serde(
909        rename = "attributes",
910        default,
911        skip_serializing_if = "Option::is_none"
912    )]
913    pub attributes: Option<MessageAttributesInput>,
914    /// Overrides the queue's default for this message. Rejected on FIFO queues, where it would let a later message become visible before an earlier one in the same group.
915    #[serde(
916        rename = "delay_seconds",
917        default,
918        skip_serializing_if = "Option::is_none"
919    )]
920    pub delay_seconds: Option<i64>,
921    /// Required on FIFO queues, rejected on standard ones. Messages sharing a group are delivered in order, and a group's next message is withheld while an earlier one is in flight.
922    #[serde(
923        rename = "message_group_id",
924        default,
925        skip_serializing_if = "Option::is_none"
926    )]
927    pub message_group_id: Option<String>,
928    /// FIFO only. A repeat within five minutes is suppressed and the original message's id is returned. Omit on a queue with `content_based_deduplication` to derive it from the body.
929    #[serde(
930        rename = "message_deduplication_id",
931        default,
932        skip_serializing_if = "Option::is_none"
933    )]
934    pub message_deduplication_id: Option<String>,
935}
936impl SendMessageBatchRequestInputEntriesItem {
937    /// Set the required fields; optional fields start omitted.
938    #[allow(clippy::too_many_arguments)]
939    pub fn new(id: String, body: String) -> Self {
940        Self {
941            id,
942            body,
943            attributes: None,
944            delay_seconds: None,
945            message_group_id: None,
946            message_deduplication_id: None,
947        }
948    }
949}
950
951pub type SendMessageBatchBody = SendMessageBatchRequestInput;
952
953pub type SendMessageBatchResponse = BatchResponse;
954
955#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
956pub struct UpdateQueueRequestInput {
957    #[serde(
958        rename = "visibility_timeout_seconds",
959        default,
960        skip_serializing_if = "Option::is_none"
961    )]
962    pub visibility_timeout_seconds: Option<i64>,
963
964    #[serde(
965        rename = "message_retention_seconds",
966        default,
967        skip_serializing_if = "Option::is_none"
968    )]
969    pub message_retention_seconds: Option<i64>,
970
971    #[serde(
972        rename = "max_message_bytes",
973        default,
974        skip_serializing_if = "Option::is_none"
975    )]
976    pub max_message_bytes: Option<i64>,
977
978    #[serde(
979        rename = "delay_seconds",
980        default,
981        skip_serializing_if = "Option::is_none"
982    )]
983    pub delay_seconds: Option<i64>,
984
985    #[serde(
986        rename = "receive_wait_time_seconds",
987        default,
988        skip_serializing_if = "Option::is_none"
989    )]
990    pub receive_wait_time_seconds: Option<i64>,
991
992    #[serde(
993        rename = "kms_data_key_reuse_period_seconds",
994        default,
995        skip_serializing_if = "Option::is_none"
996    )]
997    pub kms_data_key_reuse_period_seconds: Option<i64>,
998    /// Omit to keep the current policy; null removes it. An object replaces the policy.
999    #[serde(
1000        rename = "redrive_policy",
1001        default,
1002        skip_serializing_if = "Option::is_none",
1003        deserialize_with = "crate::response::present_nullable"
1004    )]
1005    pub redrive_policy: Option<crate::Nullable<UpdateQueueRequestInputRedrivePolicyValue>>,
1006    /// KMS key UUID, CRN or account-scoped name. Omit to keep the current key; null restores the platform key. Existing messages keep the key that sealed them.
1007    #[serde(
1008        rename = "kms_key",
1009        default,
1010        skip_serializing_if = "Option::is_none",
1011        deserialize_with = "crate::response::present_nullable"
1012    )]
1013    pub kms_key: Option<crate::Nullable<String>>,
1014
1015    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
1016    pub tags: Option<TagsInput>,
1017}
1018
1019#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1020pub struct UpdateQueueRequestInputRedrivePolicyValue {
1021    /// Queue UUID, CRN or account-scoped name.
1022    #[serde(rename = "dead_letter_queue")]
1023    pub dead_letter_queue: String,
1024
1025    #[serde(rename = "max_receive_count")]
1026    pub max_receive_count: i64,
1027}
1028impl UpdateQueueRequestInputRedrivePolicyValue {
1029    /// Set the required fields; optional fields start omitted.
1030    #[allow(clippy::too_many_arguments)]
1031    pub fn new(dead_letter_queue: String, max_receive_count: i64) -> Self {
1032        Self {
1033            dead_letter_queue,
1034            max_receive_count,
1035        }
1036    }
1037}
1038
1039pub type UpdateQueueBody = UpdateQueueRequestInput;
1040
1041pub type UpdateQueueResponse = QueueResponse;