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