google_cloud_pubsub/generated/gapic_dataplane/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21
22mod debug;
23mod deserialize;
24mod serialize;
25
26/// A message that is published by publishers and consumed by subscribers. The
27/// message must contain either a non-empty data field or at least one attribute.
28/// Note that client libraries represent this object differently
29/// depending on the language. See the corresponding [client library
30/// documentation](https://cloud.google.com/pubsub/docs/reference/libraries) for
31/// more information. See [quotas and limits]
32/// (<https://cloud.google.com/pubsub/quotas>) for more information about message
33/// limits.
34#[derive(Clone, Default, PartialEq)]
35#[non_exhaustive]
36pub struct PubsubMessage {
37 /// Optional. The message data field. If this field is empty, the message must
38 /// contain at least one attribute.
39 pub data: ::bytes::Bytes,
40
41 /// Optional. Attributes for this message. If this field is empty, the message
42 /// must contain non-empty data. This can be used to filter messages on the
43 /// subscription.
44 pub attributes: std::collections::HashMap<std::string::String, std::string::String>,
45
46 /// ID of this message, assigned by the server when the message is published.
47 /// Guaranteed to be unique within the topic. This value may be read by a
48 /// subscriber that receives a `PubsubMessage` via a `Pull` call or a push
49 /// delivery. It must not be populated by the publisher in a `Publish` call.
50 pub message_id: std::string::String,
51
52 /// The time at which the message was published, populated by the server when
53 /// it receives the `Publish` call. It must not be populated by the
54 /// publisher in a `Publish` call.
55 pub publish_time: std::option::Option<wkt::Timestamp>,
56
57 /// Optional. If non-empty, identifies related messages for which publish order
58 /// should be respected. If a `Subscription` has `enable_message_ordering` set
59 /// to `true`, messages published with the same non-empty `ordering_key` value
60 /// will be delivered to subscribers in the order in which they are received by
61 /// the Pub/Sub system. All `PubsubMessage`s published in a given
62 /// `PublishRequest` must specify the same `ordering_key` value. For more
63 /// information, see [ordering
64 /// messages](https://cloud.google.com/pubsub/docs/ordering).
65 pub ordering_key: std::string::String,
66
67 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
68}
69
70impl PubsubMessage {
71 /// Creates a new default instance.
72 pub fn new() -> Self {
73 std::default::Default::default()
74 }
75
76 /// Sets the value of [data][crate::model::PubsubMessage::data].
77 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
78 self.data = v.into();
79 self
80 }
81
82 /// Sets the value of [attributes][crate::model::PubsubMessage::attributes].
83 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
84 where
85 T: std::iter::IntoIterator<Item = (K, V)>,
86 K: std::convert::Into<std::string::String>,
87 V: std::convert::Into<std::string::String>,
88 {
89 use std::iter::Iterator;
90 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
91 self
92 }
93
94 /// Sets the value of [message_id][crate::model::PubsubMessage::message_id].
95 pub fn set_message_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
96 self.message_id = v.into();
97 self
98 }
99
100 /// Sets the value of [publish_time][crate::model::PubsubMessage::publish_time].
101 pub fn set_publish_time<T>(mut self, v: T) -> Self
102 where
103 T: std::convert::Into<wkt::Timestamp>,
104 {
105 self.publish_time = std::option::Option::Some(v.into());
106 self
107 }
108
109 /// Sets or clears the value of [publish_time][crate::model::PubsubMessage::publish_time].
110 pub fn set_or_clear_publish_time<T>(mut self, v: std::option::Option<T>) -> Self
111 where
112 T: std::convert::Into<wkt::Timestamp>,
113 {
114 self.publish_time = v.map(|x| x.into());
115 self
116 }
117
118 /// Sets the value of [ordering_key][crate::model::PubsubMessage::ordering_key].
119 pub fn set_ordering_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
120 self.ordering_key = v.into();
121 self
122 }
123}
124
125impl wkt::message::Message for PubsubMessage {
126 fn typename() -> &'static str {
127 "type.googleapis.com/google.pubsub.v1.PubsubMessage"
128 }
129}
130
131/// Request for the Publish method.
132#[derive(Clone, Default, PartialEq)]
133#[non_exhaustive]
134pub struct PublishRequest {
135 /// Required. The messages in the request will be published on this topic.
136 /// Format is `projects/{project}/topics/{topic}`.
137 pub topic: std::string::String,
138
139 /// Required. The messages to publish.
140 pub messages: std::vec::Vec<crate::model::PubsubMessage>,
141
142 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
143}
144
145impl PublishRequest {
146 /// Creates a new default instance.
147 pub fn new() -> Self {
148 std::default::Default::default()
149 }
150
151 /// Sets the value of [topic][crate::model::PublishRequest::topic].
152 pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
153 self.topic = v.into();
154 self
155 }
156
157 /// Sets the value of [messages][crate::model::PublishRequest::messages].
158 pub fn set_messages<T, V>(mut self, v: T) -> Self
159 where
160 T: std::iter::IntoIterator<Item = V>,
161 V: std::convert::Into<crate::model::PubsubMessage>,
162 {
163 use std::iter::Iterator;
164 self.messages = v.into_iter().map(|i| i.into()).collect();
165 self
166 }
167}
168
169impl wkt::message::Message for PublishRequest {
170 fn typename() -> &'static str {
171 "type.googleapis.com/google.pubsub.v1.PublishRequest"
172 }
173}
174
175/// Response for the `Publish` method.
176#[derive(Clone, Default, PartialEq)]
177#[non_exhaustive]
178pub struct PublishResponse {
179 /// Optional. The server-assigned ID of each published message, in the same
180 /// order as the messages in the request. IDs are guaranteed to be unique
181 /// within the topic.
182 pub message_ids: std::vec::Vec<std::string::String>,
183
184 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
185}
186
187impl PublishResponse {
188 /// Creates a new default instance.
189 pub fn new() -> Self {
190 std::default::Default::default()
191 }
192
193 /// Sets the value of [message_ids][crate::model::PublishResponse::message_ids].
194 pub fn set_message_ids<T, V>(mut self, v: T) -> Self
195 where
196 T: std::iter::IntoIterator<Item = V>,
197 V: std::convert::Into<std::string::String>,
198 {
199 use std::iter::Iterator;
200 self.message_ids = v.into_iter().map(|i| i.into()).collect();
201 self
202 }
203}
204
205impl wkt::message::Message for PublishResponse {
206 fn typename() -> &'static str {
207 "type.googleapis.com/google.pubsub.v1.PublishResponse"
208 }
209}
210
211/// A message and its corresponding acknowledgment ID.
212#[derive(Clone, Default, PartialEq)]
213#[non_exhaustive]
214pub struct ReceivedMessage {
215 /// Optional. This ID can be used to acknowledge the received message.
216 pub ack_id: std::string::String,
217
218 /// Optional. The message.
219 pub message: std::option::Option<crate::model::PubsubMessage>,
220
221 /// Optional. The approximate number of times that Pub/Sub has attempted to
222 /// deliver the associated message to a subscriber.
223 ///
224 /// More precisely, this is 1 + (number of NACKs) +
225 /// (number of ack_deadline exceeds) for this message.
226 ///
227 /// A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline
228 /// exceeds event is whenever a message is not acknowledged within
229 /// ack_deadline. Note that ack_deadline is initially
230 /// Subscription.ackDeadlineSeconds, but may get extended automatically by
231 /// the client library.
232 ///
233 /// Upon the first delivery of a given message, `delivery_attempt` will have a
234 /// value of 1. The value is calculated at best effort and is approximate.
235 ///
236 /// If a DeadLetterPolicy is not set on the subscription, this will be 0.
237 pub delivery_attempt: i32,
238
239 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
240}
241
242impl ReceivedMessage {
243 /// Creates a new default instance.
244 pub fn new() -> Self {
245 std::default::Default::default()
246 }
247
248 /// Sets the value of [ack_id][crate::model::ReceivedMessage::ack_id].
249 pub fn set_ack_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
250 self.ack_id = v.into();
251 self
252 }
253
254 /// Sets the value of [message][crate::model::ReceivedMessage::message].
255 pub fn set_message<T>(mut self, v: T) -> Self
256 where
257 T: std::convert::Into<crate::model::PubsubMessage>,
258 {
259 self.message = std::option::Option::Some(v.into());
260 self
261 }
262
263 /// Sets or clears the value of [message][crate::model::ReceivedMessage::message].
264 pub fn set_or_clear_message<T>(mut self, v: std::option::Option<T>) -> Self
265 where
266 T: std::convert::Into<crate::model::PubsubMessage>,
267 {
268 self.message = v.map(|x| x.into());
269 self
270 }
271
272 /// Sets the value of [delivery_attempt][crate::model::ReceivedMessage::delivery_attempt].
273 pub fn set_delivery_attempt<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
274 self.delivery_attempt = v.into();
275 self
276 }
277}
278
279impl wkt::message::Message for ReceivedMessage {
280 fn typename() -> &'static str {
281 "type.googleapis.com/google.pubsub.v1.ReceivedMessage"
282 }
283}
284
285/// Request for the ModifyAckDeadline method.
286#[derive(Clone, Default, PartialEq)]
287#[non_exhaustive]
288pub struct ModifyAckDeadlineRequest {
289 /// Required. The name of the subscription.
290 /// Format is `projects/{project}/subscriptions/{sub}`.
291 pub subscription: std::string::String,
292
293 /// Required. List of acknowledgment IDs.
294 pub ack_ids: std::vec::Vec<std::string::String>,
295
296 /// Required. The new ack deadline with respect to the time this request was
297 /// sent to the Pub/Sub system. For example, if the value is 10, the new ack
298 /// deadline will expire 10 seconds after the `ModifyAckDeadline` call was
299 /// made. Specifying zero might immediately make the message available for
300 /// delivery to another subscriber client. This typically results in an
301 /// increase in the rate of message redeliveries (that is, duplicates).
302 /// The minimum deadline you can specify is 0 seconds.
303 /// The maximum deadline you can specify in a single request is 600 seconds
304 /// (10 minutes).
305 pub ack_deadline_seconds: i32,
306
307 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
308}
309
310impl ModifyAckDeadlineRequest {
311 /// Creates a new default instance.
312 pub fn new() -> Self {
313 std::default::Default::default()
314 }
315
316 /// Sets the value of [subscription][crate::model::ModifyAckDeadlineRequest::subscription].
317 pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
318 self.subscription = v.into();
319 self
320 }
321
322 /// Sets the value of [ack_ids][crate::model::ModifyAckDeadlineRequest::ack_ids].
323 pub fn set_ack_ids<T, V>(mut self, v: T) -> Self
324 where
325 T: std::iter::IntoIterator<Item = V>,
326 V: std::convert::Into<std::string::String>,
327 {
328 use std::iter::Iterator;
329 self.ack_ids = v.into_iter().map(|i| i.into()).collect();
330 self
331 }
332
333 /// Sets the value of [ack_deadline_seconds][crate::model::ModifyAckDeadlineRequest::ack_deadline_seconds].
334 pub fn set_ack_deadline_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
335 self.ack_deadline_seconds = v.into();
336 self
337 }
338}
339
340impl wkt::message::Message for ModifyAckDeadlineRequest {
341 fn typename() -> &'static str {
342 "type.googleapis.com/google.pubsub.v1.ModifyAckDeadlineRequest"
343 }
344}
345
346/// Request for the Acknowledge method.
347#[derive(Clone, Default, PartialEq)]
348#[non_exhaustive]
349pub struct AcknowledgeRequest {
350 /// Required. The subscription whose message is being acknowledged.
351 /// Format is `projects/{project}/subscriptions/{sub}`.
352 pub subscription: std::string::String,
353
354 /// Required. The acknowledgment ID for the messages being acknowledged that
355 /// was returned by the Pub/Sub system in the `Pull` response. Must not be
356 /// empty.
357 pub ack_ids: std::vec::Vec<std::string::String>,
358
359 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
360}
361
362impl AcknowledgeRequest {
363 /// Creates a new default instance.
364 pub fn new() -> Self {
365 std::default::Default::default()
366 }
367
368 /// Sets the value of [subscription][crate::model::AcknowledgeRequest::subscription].
369 pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
370 self.subscription = v.into();
371 self
372 }
373
374 /// Sets the value of [ack_ids][crate::model::AcknowledgeRequest::ack_ids].
375 pub fn set_ack_ids<T, V>(mut self, v: T) -> Self
376 where
377 T: std::iter::IntoIterator<Item = V>,
378 V: std::convert::Into<std::string::String>,
379 {
380 use std::iter::Iterator;
381 self.ack_ids = v.into_iter().map(|i| i.into()).collect();
382 self
383 }
384}
385
386impl wkt::message::Message for AcknowledgeRequest {
387 fn typename() -> &'static str {
388 "type.googleapis.com/google.pubsub.v1.AcknowledgeRequest"
389 }
390}
391
392/// Request for the `StreamingPull` streaming RPC method. This request is used to
393/// establish the initial stream as well as to stream acknowledgments and ack
394/// deadline modifications from the client to the server.
395#[derive(Clone, Default, PartialEq)]
396#[non_exhaustive]
397pub struct StreamingPullRequest {
398 /// Required. The subscription for which to initialize the new stream. This
399 /// must be provided in the first request on the stream, and must not be set in
400 /// subsequent requests from client to server.
401 /// Format is `projects/{project}/subscriptions/{sub}`.
402 pub subscription: std::string::String,
403
404 /// Optional. List of acknowledgment IDs for acknowledging previously received
405 /// messages (received on this stream or a different stream). If an ack ID has
406 /// expired, the corresponding message may be redelivered later. Acknowledging
407 /// a message more than once will not result in an error. If the acknowledgment
408 /// ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
409 pub ack_ids: std::vec::Vec<std::string::String>,
410
411 /// Optional. The list of new ack deadlines for the IDs listed in
412 /// `modify_deadline_ack_ids`. The size of this list must be the same as the
413 /// size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
414 /// with `INVALID_ARGUMENT`. Each element in this list is applied to the
415 /// element in the same position in `modify_deadline_ack_ids`. The new ack
416 /// deadline is with respect to the time this request was sent to the Pub/Sub
417 /// system. Must be >= 0. For example, if the value is 10, the new ack deadline
418 /// will expire 10 seconds after this request is received. If the value is 0,
419 /// the message is immediately made available for another streaming or
420 /// non-streaming pull request. If the value is < 0 (an error), the stream will
421 /// be aborted with status `INVALID_ARGUMENT`.
422 pub modify_deadline_seconds: std::vec::Vec<i32>,
423
424 /// Optional. List of acknowledgment IDs whose deadline will be modified based
425 /// on the corresponding element in `modify_deadline_seconds`. This field can
426 /// be used to indicate that more time is needed to process a message by the
427 /// subscriber, or to make the message available for redelivery if the
428 /// processing was interrupted.
429 pub modify_deadline_ack_ids: std::vec::Vec<std::string::String>,
430
431 /// Required. The ack deadline to use for the stream. This must be provided in
432 /// the first request on the stream, but it can also be updated on subsequent
433 /// requests from client to server. The minimum deadline you can specify is 10
434 /// seconds. The maximum deadline you can specify is 600 seconds (10 minutes).
435 pub stream_ack_deadline_seconds: i32,
436
437 /// Optional. A unique identifier that is used to distinguish client instances
438 /// from each other. Only needs to be provided on the initial request. When a
439 /// stream disconnects and reconnects for the same stream, the client_id should
440 /// be set to the same value so that state associated with the old stream can
441 /// be transferred to the new stream. The same client_id should not be used for
442 /// different client instances.
443 pub client_id: std::string::String,
444
445 /// Optional. Flow control settings for the maximum number of outstanding
446 /// messages. When there are `max_outstanding_messages` currently sent to the
447 /// streaming pull client that have not yet been acked or nacked, the server
448 /// stops sending more messages. The sending of messages resumes once the
449 /// number of outstanding messages is less than this value. If the value is
450 /// <= 0, there is no limit to the number of outstanding messages. This
451 /// property can only be set on the initial StreamingPullRequest. If it is set
452 /// on a subsequent request, the stream will be aborted with status
453 /// `INVALID_ARGUMENT`.
454 pub max_outstanding_messages: i64,
455
456 /// Optional. Flow control settings for the maximum number of outstanding
457 /// bytes. When there are `max_outstanding_bytes` or more worth of messages
458 /// currently sent to the streaming pull client that have not yet been acked or
459 /// nacked, the server will stop sending more messages. The sending of messages
460 /// resumes once the number of outstanding bytes is less than this value. If
461 /// the value is <= 0, there is no limit to the number of outstanding bytes.
462 /// This property can only be set on the initial StreamingPullRequest. If it is
463 /// set on a subsequent request, the stream will be aborted with status
464 /// `INVALID_ARGUMENT`.
465 pub max_outstanding_bytes: i64,
466
467 /// Optional. The protocol version used by the client. This property can only
468 /// be set on the initial StreamingPullRequest. If it is set on a subsequent
469 /// request, the stream will be aborted with status `INVALID_ARGUMENT`.
470 pub protocol_version: i64,
471
472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
473}
474
475impl StreamingPullRequest {
476 /// Creates a new default instance.
477 pub fn new() -> Self {
478 std::default::Default::default()
479 }
480
481 /// Sets the value of [subscription][crate::model::StreamingPullRequest::subscription].
482 pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
483 self.subscription = v.into();
484 self
485 }
486
487 /// Sets the value of [ack_ids][crate::model::StreamingPullRequest::ack_ids].
488 pub fn set_ack_ids<T, V>(mut self, v: T) -> Self
489 where
490 T: std::iter::IntoIterator<Item = V>,
491 V: std::convert::Into<std::string::String>,
492 {
493 use std::iter::Iterator;
494 self.ack_ids = v.into_iter().map(|i| i.into()).collect();
495 self
496 }
497
498 /// Sets the value of [modify_deadline_seconds][crate::model::StreamingPullRequest::modify_deadline_seconds].
499 pub fn set_modify_deadline_seconds<T, V>(mut self, v: T) -> Self
500 where
501 T: std::iter::IntoIterator<Item = V>,
502 V: std::convert::Into<i32>,
503 {
504 use std::iter::Iterator;
505 self.modify_deadline_seconds = v.into_iter().map(|i| i.into()).collect();
506 self
507 }
508
509 /// Sets the value of [modify_deadline_ack_ids][crate::model::StreamingPullRequest::modify_deadline_ack_ids].
510 pub fn set_modify_deadline_ack_ids<T, V>(mut self, v: T) -> Self
511 where
512 T: std::iter::IntoIterator<Item = V>,
513 V: std::convert::Into<std::string::String>,
514 {
515 use std::iter::Iterator;
516 self.modify_deadline_ack_ids = v.into_iter().map(|i| i.into()).collect();
517 self
518 }
519
520 /// Sets the value of [stream_ack_deadline_seconds][crate::model::StreamingPullRequest::stream_ack_deadline_seconds].
521 pub fn set_stream_ack_deadline_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
522 self.stream_ack_deadline_seconds = v.into();
523 self
524 }
525
526 /// Sets the value of [client_id][crate::model::StreamingPullRequest::client_id].
527 pub fn set_client_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
528 self.client_id = v.into();
529 self
530 }
531
532 /// Sets the value of [max_outstanding_messages][crate::model::StreamingPullRequest::max_outstanding_messages].
533 pub fn set_max_outstanding_messages<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
534 self.max_outstanding_messages = v.into();
535 self
536 }
537
538 /// Sets the value of [max_outstanding_bytes][crate::model::StreamingPullRequest::max_outstanding_bytes].
539 pub fn set_max_outstanding_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
540 self.max_outstanding_bytes = v.into();
541 self
542 }
543
544 /// Sets the value of [protocol_version][crate::model::StreamingPullRequest::protocol_version].
545 pub fn set_protocol_version<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
546 self.protocol_version = v.into();
547 self
548 }
549}
550
551impl wkt::message::Message for StreamingPullRequest {
552 fn typename() -> &'static str {
553 "type.googleapis.com/google.pubsub.v1.StreamingPullRequest"
554 }
555}
556
557/// Response for the `StreamingPull` method. This response is used to stream
558/// messages from the server to the client.
559#[derive(Clone, Default, PartialEq)]
560#[non_exhaustive]
561pub struct StreamingPullResponse {
562 /// Optional. Received Pub/Sub messages.
563 pub received_messages: std::vec::Vec<crate::model::ReceivedMessage>,
564
565 /// Optional. This field will only be set if `enable_exactly_once_delivery` is
566 /// set to `true` and is not guaranteed to be populated.
567 pub acknowledge_confirmation:
568 std::option::Option<crate::model::streaming_pull_response::AcknowledgeConfirmation>,
569
570 /// Optional. This field will only be set if `enable_exactly_once_delivery` is
571 /// set to `true` and is not guaranteed to be populated.
572 pub modify_ack_deadline_confirmation:
573 std::option::Option<crate::model::streaming_pull_response::ModifyAckDeadlineConfirmation>,
574
575 /// Optional. Properties associated with this subscription.
576 pub subscription_properties:
577 std::option::Option<crate::model::streaming_pull_response::SubscriptionProperties>,
578
579 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
580}
581
582impl StreamingPullResponse {
583 /// Creates a new default instance.
584 pub fn new() -> Self {
585 std::default::Default::default()
586 }
587
588 /// Sets the value of [received_messages][crate::model::StreamingPullResponse::received_messages].
589 pub fn set_received_messages<T, V>(mut self, v: T) -> Self
590 where
591 T: std::iter::IntoIterator<Item = V>,
592 V: std::convert::Into<crate::model::ReceivedMessage>,
593 {
594 use std::iter::Iterator;
595 self.received_messages = v.into_iter().map(|i| i.into()).collect();
596 self
597 }
598
599 /// Sets the value of [acknowledge_confirmation][crate::model::StreamingPullResponse::acknowledge_confirmation].
600 pub fn set_acknowledge_confirmation<T>(mut self, v: T) -> Self
601 where
602 T: std::convert::Into<crate::model::streaming_pull_response::AcknowledgeConfirmation>,
603 {
604 self.acknowledge_confirmation = std::option::Option::Some(v.into());
605 self
606 }
607
608 /// Sets or clears the value of [acknowledge_confirmation][crate::model::StreamingPullResponse::acknowledge_confirmation].
609 pub fn set_or_clear_acknowledge_confirmation<T>(mut self, v: std::option::Option<T>) -> Self
610 where
611 T: std::convert::Into<crate::model::streaming_pull_response::AcknowledgeConfirmation>,
612 {
613 self.acknowledge_confirmation = v.map(|x| x.into());
614 self
615 }
616
617 /// Sets the value of [modify_ack_deadline_confirmation][crate::model::StreamingPullResponse::modify_ack_deadline_confirmation].
618 pub fn set_modify_ack_deadline_confirmation<T>(mut self, v: T) -> Self
619 where
620 T: std::convert::Into<crate::model::streaming_pull_response::ModifyAckDeadlineConfirmation>,
621 {
622 self.modify_ack_deadline_confirmation = std::option::Option::Some(v.into());
623 self
624 }
625
626 /// Sets or clears the value of [modify_ack_deadline_confirmation][crate::model::StreamingPullResponse::modify_ack_deadline_confirmation].
627 pub fn set_or_clear_modify_ack_deadline_confirmation<T>(
628 mut self,
629 v: std::option::Option<T>,
630 ) -> Self
631 where
632 T: std::convert::Into<crate::model::streaming_pull_response::ModifyAckDeadlineConfirmation>,
633 {
634 self.modify_ack_deadline_confirmation = v.map(|x| x.into());
635 self
636 }
637
638 /// Sets the value of [subscription_properties][crate::model::StreamingPullResponse::subscription_properties].
639 pub fn set_subscription_properties<T>(mut self, v: T) -> Self
640 where
641 T: std::convert::Into<crate::model::streaming_pull_response::SubscriptionProperties>,
642 {
643 self.subscription_properties = std::option::Option::Some(v.into());
644 self
645 }
646
647 /// Sets or clears the value of [subscription_properties][crate::model::StreamingPullResponse::subscription_properties].
648 pub fn set_or_clear_subscription_properties<T>(mut self, v: std::option::Option<T>) -> Self
649 where
650 T: std::convert::Into<crate::model::streaming_pull_response::SubscriptionProperties>,
651 {
652 self.subscription_properties = v.map(|x| x.into());
653 self
654 }
655}
656
657impl wkt::message::Message for StreamingPullResponse {
658 fn typename() -> &'static str {
659 "type.googleapis.com/google.pubsub.v1.StreamingPullResponse"
660 }
661}
662
663/// Defines additional types related to [StreamingPullResponse].
664pub mod streaming_pull_response {
665 #[allow(unused_imports)]
666 use super::*;
667
668 /// Acknowledgment IDs sent in one or more previous requests to acknowledge a
669 /// previously received message.
670 #[derive(Clone, Default, PartialEq)]
671 #[non_exhaustive]
672 pub struct AcknowledgeConfirmation {
673 /// Optional. Successfully processed acknowledgment IDs.
674 pub ack_ids: std::vec::Vec<std::string::String>,
675
676 /// Optional. List of acknowledgment IDs that were malformed or whose
677 /// acknowledgment deadline has expired.
678 pub invalid_ack_ids: std::vec::Vec<std::string::String>,
679
680 /// Optional. List of acknowledgment IDs that were out of order.
681 pub unordered_ack_ids: std::vec::Vec<std::string::String>,
682
683 /// Optional. List of acknowledgment IDs that failed processing with
684 /// temporary issues.
685 pub temporary_failed_ack_ids: std::vec::Vec<std::string::String>,
686
687 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
688 }
689
690 impl AcknowledgeConfirmation {
691 /// Creates a new default instance.
692 pub fn new() -> Self {
693 std::default::Default::default()
694 }
695
696 /// Sets the value of [ack_ids][crate::model::streaming_pull_response::AcknowledgeConfirmation::ack_ids].
697 pub fn set_ack_ids<T, V>(mut self, v: T) -> Self
698 where
699 T: std::iter::IntoIterator<Item = V>,
700 V: std::convert::Into<std::string::String>,
701 {
702 use std::iter::Iterator;
703 self.ack_ids = v.into_iter().map(|i| i.into()).collect();
704 self
705 }
706
707 /// Sets the value of [invalid_ack_ids][crate::model::streaming_pull_response::AcknowledgeConfirmation::invalid_ack_ids].
708 pub fn set_invalid_ack_ids<T, V>(mut self, v: T) -> Self
709 where
710 T: std::iter::IntoIterator<Item = V>,
711 V: std::convert::Into<std::string::String>,
712 {
713 use std::iter::Iterator;
714 self.invalid_ack_ids = v.into_iter().map(|i| i.into()).collect();
715 self
716 }
717
718 /// Sets the value of [unordered_ack_ids][crate::model::streaming_pull_response::AcknowledgeConfirmation::unordered_ack_ids].
719 pub fn set_unordered_ack_ids<T, V>(mut self, v: T) -> Self
720 where
721 T: std::iter::IntoIterator<Item = V>,
722 V: std::convert::Into<std::string::String>,
723 {
724 use std::iter::Iterator;
725 self.unordered_ack_ids = v.into_iter().map(|i| i.into()).collect();
726 self
727 }
728
729 /// Sets the value of [temporary_failed_ack_ids][crate::model::streaming_pull_response::AcknowledgeConfirmation::temporary_failed_ack_ids].
730 pub fn set_temporary_failed_ack_ids<T, V>(mut self, v: T) -> Self
731 where
732 T: std::iter::IntoIterator<Item = V>,
733 V: std::convert::Into<std::string::String>,
734 {
735 use std::iter::Iterator;
736 self.temporary_failed_ack_ids = v.into_iter().map(|i| i.into()).collect();
737 self
738 }
739 }
740
741 impl wkt::message::Message for AcknowledgeConfirmation {
742 fn typename() -> &'static str {
743 "type.googleapis.com/google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation"
744 }
745 }
746
747 /// Acknowledgment IDs sent in one or more previous requests to modify the
748 /// deadline for a specific message.
749 #[derive(Clone, Default, PartialEq)]
750 #[non_exhaustive]
751 pub struct ModifyAckDeadlineConfirmation {
752 /// Optional. Successfully processed acknowledgment IDs.
753 pub ack_ids: std::vec::Vec<std::string::String>,
754
755 /// Optional. List of acknowledgment IDs that were malformed or whose
756 /// acknowledgment deadline has expired.
757 pub invalid_ack_ids: std::vec::Vec<std::string::String>,
758
759 /// Optional. List of acknowledgment IDs that failed processing with
760 /// temporary issues.
761 pub temporary_failed_ack_ids: std::vec::Vec<std::string::String>,
762
763 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
764 }
765
766 impl ModifyAckDeadlineConfirmation {
767 /// Creates a new default instance.
768 pub fn new() -> Self {
769 std::default::Default::default()
770 }
771
772 /// Sets the value of [ack_ids][crate::model::streaming_pull_response::ModifyAckDeadlineConfirmation::ack_ids].
773 pub fn set_ack_ids<T, V>(mut self, v: T) -> Self
774 where
775 T: std::iter::IntoIterator<Item = V>,
776 V: std::convert::Into<std::string::String>,
777 {
778 use std::iter::Iterator;
779 self.ack_ids = v.into_iter().map(|i| i.into()).collect();
780 self
781 }
782
783 /// Sets the value of [invalid_ack_ids][crate::model::streaming_pull_response::ModifyAckDeadlineConfirmation::invalid_ack_ids].
784 pub fn set_invalid_ack_ids<T, V>(mut self, v: T) -> Self
785 where
786 T: std::iter::IntoIterator<Item = V>,
787 V: std::convert::Into<std::string::String>,
788 {
789 use std::iter::Iterator;
790 self.invalid_ack_ids = v.into_iter().map(|i| i.into()).collect();
791 self
792 }
793
794 /// Sets the value of [temporary_failed_ack_ids][crate::model::streaming_pull_response::ModifyAckDeadlineConfirmation::temporary_failed_ack_ids].
795 pub fn set_temporary_failed_ack_ids<T, V>(mut self, v: T) -> Self
796 where
797 T: std::iter::IntoIterator<Item = V>,
798 V: std::convert::Into<std::string::String>,
799 {
800 use std::iter::Iterator;
801 self.temporary_failed_ack_ids = v.into_iter().map(|i| i.into()).collect();
802 self
803 }
804 }
805
806 impl wkt::message::Message for ModifyAckDeadlineConfirmation {
807 fn typename() -> &'static str {
808 "type.googleapis.com/google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation"
809 }
810 }
811
812 /// Subscription properties sent as part of the response.
813 #[derive(Clone, Default, PartialEq)]
814 #[non_exhaustive]
815 pub struct SubscriptionProperties {
816 /// Optional. True iff exactly once delivery is enabled for this
817 /// subscription.
818 pub exactly_once_delivery_enabled: bool,
819
820 /// Optional. True iff message ordering is enabled for this subscription.
821 pub message_ordering_enabled: bool,
822
823 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
824 }
825
826 impl SubscriptionProperties {
827 /// Creates a new default instance.
828 pub fn new() -> Self {
829 std::default::Default::default()
830 }
831
832 /// Sets the value of [exactly_once_delivery_enabled][crate::model::streaming_pull_response::SubscriptionProperties::exactly_once_delivery_enabled].
833 pub fn set_exactly_once_delivery_enabled<T: std::convert::Into<bool>>(
834 mut self,
835 v: T,
836 ) -> Self {
837 self.exactly_once_delivery_enabled = v.into();
838 self
839 }
840
841 /// Sets the value of [message_ordering_enabled][crate::model::streaming_pull_response::SubscriptionProperties::message_ordering_enabled].
842 pub fn set_message_ordering_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
843 self.message_ordering_enabled = v.into();
844 self
845 }
846 }
847
848 impl wkt::message::Message for SubscriptionProperties {
849 fn typename() -> &'static str {
850 "type.googleapis.com/google.pubsub.v1.StreamingPullResponse.SubscriptionProperties"
851 }
852 }
853}