1# -*- coding: utf-8 -*-
2# Copyright 2024 Google LLC
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16from __future__ import annotations
17
18from typing import MutableMapping, MutableSequence
19
20import proto # type: ignore
21
22from google.protobuf import duration_pb2 # type: ignore
23from google.protobuf import field_mask_pb2 # type: ignore
24from google.protobuf import timestamp_pb2 # type: ignore
25from google.pubsub_v1.types import schema as gp_schema
26
27
28__protobuf__ = proto.module(
29 package="google.pubsub.v1",
30 manifest={
31 "MessageStoragePolicy",
32 "SchemaSettings",
33 "IngestionDataSourceSettings",
34 "PlatformLogsSettings",
35 "IngestionFailureEvent",
36 "JavaScriptUDF",
37 "MessageTransform",
38 "Topic",
39 "PubsubMessage",
40 "GetTopicRequest",
41 "UpdateTopicRequest",
42 "PublishRequest",
43 "PublishResponse",
44 "ListTopicsRequest",
45 "ListTopicsResponse",
46 "ListTopicSubscriptionsRequest",
47 "ListTopicSubscriptionsResponse",
48 "ListTopicSnapshotsRequest",
49 "ListTopicSnapshotsResponse",
50 "DeleteTopicRequest",
51 "DetachSubscriptionRequest",
52 "DetachSubscriptionResponse",
53 "Subscription",
54 "RetryPolicy",
55 "DeadLetterPolicy",
56 "ExpirationPolicy",
57 "PushConfig",
58 "BigQueryConfig",
59 "CloudStorageConfig",
60 "ReceivedMessage",
61 "GetSubscriptionRequest",
62 "UpdateSubscriptionRequest",
63 "ListSubscriptionsRequest",
64 "ListSubscriptionsResponse",
65 "DeleteSubscriptionRequest",
66 "ModifyPushConfigRequest",
67 "PullRequest",
68 "PullResponse",
69 "ModifyAckDeadlineRequest",
70 "AcknowledgeRequest",
71 "StreamingPullRequest",
72 "StreamingPullResponse",
73 "CreateSnapshotRequest",
74 "UpdateSnapshotRequest",
75 "Snapshot",
76 "GetSnapshotRequest",
77 "ListSnapshotsRequest",
78 "ListSnapshotsResponse",
79 "DeleteSnapshotRequest",
80 "SeekRequest",
81 "SeekResponse",
82 },
83)
84
85
86class MessageStoragePolicy(proto.Message):
87 r"""A policy constraining the storage of messages published to
88 the topic.
89
90 Attributes:
91 allowed_persistence_regions (MutableSequence[str]):
92 Optional. A list of IDs of Google Cloud
93 regions where messages that are published to the
94 topic may be persisted in storage. Messages
95 published by publishers running in non-allowed
96 Google Cloud regions (or running outside of
97 Google Cloud altogether) are routed for storage
98 in one of the allowed regions. An empty list
99 means that no regions are allowed, and is not a
100 valid configuration.
101 enforce_in_transit (bool):
102 Optional. If true, ``allowed_persistence_regions`` is also
103 used to enforce in-transit guarantees for messages. That is,
104 Pub/Sub will fail Publish operations on this topic and
105 subscribe operations on any subscription attached to this
106 topic in any region that is not in
107 ``allowed_persistence_regions``.
108 """
109
110 allowed_persistence_regions: MutableSequence[str] = proto.RepeatedField(
111 proto.STRING,
112 number=1,
113 )
114 enforce_in_transit: bool = proto.Field(
115 proto.BOOL,
116 number=2,
117 )
118
119
120class SchemaSettings(proto.Message):
121 r"""Settings for validating messages published against a schema.
122
123 Attributes:
124 schema (str):
125 Required. The name of the schema that messages published
126 should be validated against. Format is
127 ``projects/{project}/schemas/{schema}``. The value of this
128 field will be ``_deleted-schema_`` if the schema has been
129 deleted.
130 encoding (google.pubsub_v1.types.Encoding):
131 Optional. The encoding of messages validated against
132 ``schema``.
133 first_revision_id (str):
134 Optional. The minimum (inclusive) revision allowed for
135 validating messages. If empty or not present, allow any
136 revision to be validated against last_revision or any
137 revision created before.
138 last_revision_id (str):
139 Optional. The maximum (inclusive) revision allowed for
140 validating messages. If empty or not present, allow any
141 revision to be validated against first_revision or any
142 revision created after.
143 """
144
145 schema: str = proto.Field(
146 proto.STRING,
147 number=1,
148 )
149 encoding: gp_schema.Encoding = proto.Field(
150 proto.ENUM,
151 number=2,
152 enum=gp_schema.Encoding,
153 )
154 first_revision_id: str = proto.Field(
155 proto.STRING,
156 number=3,
157 )
158 last_revision_id: str = proto.Field(
159 proto.STRING,
160 number=4,
161 )
162
163
164class IngestionDataSourceSettings(proto.Message):
165 r"""Settings for an ingestion data source on a topic.
166
167 This message has `oneof`_ fields (mutually exclusive fields).
168 For each oneof, at most one member field can be set at the same time.
169 Setting any member of the oneof automatically clears all other
170 members.
171
172 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
173
174 Attributes:
175 aws_kinesis (google.pubsub_v1.types.IngestionDataSourceSettings.AwsKinesis):
176 Optional. Amazon Kinesis Data Streams.
177
178 This field is a member of `oneof`_ ``source``.
179 cloud_storage (google.pubsub_v1.types.IngestionDataSourceSettings.CloudStorage):
180 Optional. Cloud Storage.
181
182 This field is a member of `oneof`_ ``source``.
183 azure_event_hubs (google.pubsub_v1.types.IngestionDataSourceSettings.AzureEventHubs):
184 Optional. Azure Event Hubs.
185
186 This field is a member of `oneof`_ ``source``.
187 aws_msk (google.pubsub_v1.types.IngestionDataSourceSettings.AwsMsk):
188 Optional. Amazon MSK.
189
190 This field is a member of `oneof`_ ``source``.
191 confluent_cloud (google.pubsub_v1.types.IngestionDataSourceSettings.ConfluentCloud):
192 Optional. Confluent Cloud.
193
194 This field is a member of `oneof`_ ``source``.
195 platform_logs_settings (google.pubsub_v1.types.PlatformLogsSettings):
196 Optional. Platform Logs settings. If unset,
197 no Platform Logs will be generated.
198 """
199
200 class AwsKinesis(proto.Message):
201 r"""Ingestion settings for Amazon Kinesis Data Streams.
202
203 Attributes:
204 state (google.pubsub_v1.types.IngestionDataSourceSettings.AwsKinesis.State):
205 Output only. An output-only field that
206 indicates the state of the Kinesis ingestion
207 source.
208 stream_arn (str):
209 Required. The Kinesis stream ARN to ingest
210 data from.
211 consumer_arn (str):
212 Required. The Kinesis consumer ARN to used
213 for ingestion in Enhanced Fan-Out mode. The
214 consumer must be already created and ready to be
215 used.
216 aws_role_arn (str):
217 Required. AWS role ARN to be used for
218 Federated Identity authentication with Kinesis.
219 Check the Pub/Sub docs for how to set up this
220 role and the required permissions that need to
221 be attached to it.
222 gcp_service_account (str):
223 Required. The GCP service account to be used for Federated
224 Identity authentication with Kinesis (via a
225 ``AssumeRoleWithWebIdentity`` call for the provided role).
226 The ``aws_role_arn`` must be set up with
227 ``accounts.google.com:sub`` equals to this service account
228 number.
229 """
230
231 class State(proto.Enum):
232 r"""Possible states for ingestion from Amazon Kinesis Data
233 Streams.
234
235 Values:
236 STATE_UNSPECIFIED (0):
237 Default value. This value is unused.
238 ACTIVE (1):
239 Ingestion is active.
240 KINESIS_PERMISSION_DENIED (2):
241 Permission denied encountered while consuming data from
242 Kinesis. This can happen if:
243
244 - The provided ``aws_role_arn`` does not exist or does not
245 have the appropriate permissions attached.
246 - The provided ``aws_role_arn`` is not set up properly for
247 Identity Federation using ``gcp_service_account``.
248 - The Pub/Sub SA is not granted the
249 ``iam.serviceAccounts.getOpenIdToken`` permission on
250 ``gcp_service_account``.
251 PUBLISH_PERMISSION_DENIED (3):
252 Permission denied encountered while publishing to the topic.
253 This can happen if the Pub/Sub SA has not been granted the
254 `appropriate publish
255 permissions <https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher>`__
256 STREAM_NOT_FOUND (4):
257 The Kinesis stream does not exist.
258 CONSUMER_NOT_FOUND (5):
259 The Kinesis consumer does not exist.
260 """
261 STATE_UNSPECIFIED = 0
262 ACTIVE = 1
263 KINESIS_PERMISSION_DENIED = 2
264 PUBLISH_PERMISSION_DENIED = 3
265 STREAM_NOT_FOUND = 4
266 CONSUMER_NOT_FOUND = 5
267
268 state: "IngestionDataSourceSettings.AwsKinesis.State" = proto.Field(
269 proto.ENUM,
270 number=1,
271 enum="IngestionDataSourceSettings.AwsKinesis.State",
272 )
273 stream_arn: str = proto.Field(
274 proto.STRING,
275 number=2,
276 )
277 consumer_arn: str = proto.Field(
278 proto.STRING,
279 number=3,
280 )
281 aws_role_arn: str = proto.Field(
282 proto.STRING,
283 number=4,
284 )
285 gcp_service_account: str = proto.Field(
286 proto.STRING,
287 number=5,
288 )
289
290 class CloudStorage(proto.Message):
291 r"""Ingestion settings for Cloud Storage.
292
293 This message has `oneof`_ fields (mutually exclusive fields).
294 For each oneof, at most one member field can be set at the same time.
295 Setting any member of the oneof automatically clears all other
296 members.
297
298 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
299
300 Attributes:
301 state (google.pubsub_v1.types.IngestionDataSourceSettings.CloudStorage.State):
302 Output only. An output-only field that
303 indicates the state of the Cloud Storage
304 ingestion source.
305 bucket (str):
306 Optional. Cloud Storage bucket. The bucket name must be
307 without any prefix like "gs://". See the [bucket naming
308 requirements]
309 (https://cloud.google.com/storage/docs/buckets#naming).
310 text_format (google.pubsub_v1.types.IngestionDataSourceSettings.CloudStorage.TextFormat):
311 Optional. Data from Cloud Storage will be
312 interpreted as text.
313
314 This field is a member of `oneof`_ ``input_format``.
315 avro_format (google.pubsub_v1.types.IngestionDataSourceSettings.CloudStorage.AvroFormat):
316 Optional. Data from Cloud Storage will be
317 interpreted in Avro format.
318
319 This field is a member of `oneof`_ ``input_format``.
320 pubsub_avro_format (google.pubsub_v1.types.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat):
321 Optional. It will be assumed data from Cloud Storage was
322 written via `Cloud Storage
323 subscriptions <https://cloud.google.com/pubsub/docs/cloudstorage>`__.
324
325 This field is a member of `oneof`_ ``input_format``.
326 minimum_object_create_time (google.protobuf.timestamp_pb2.Timestamp):
327 Optional. Only objects with a larger or equal
328 creation timestamp will be ingested.
329 match_glob (str):
330 Optional. Glob pattern used to match objects that will be
331 ingested. If unset, all objects will be ingested. See the
332 `supported
333 patterns <https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob>`__.
334 """
335
336 class State(proto.Enum):
337 r"""Possible states for ingestion from Cloud Storage.
338
339 Values:
340 STATE_UNSPECIFIED (0):
341 Default value. This value is unused.
342 ACTIVE (1):
343 Ingestion is active.
344 CLOUD_STORAGE_PERMISSION_DENIED (2):
345 Permission denied encountered while calling the Cloud
346 Storage API. This can happen if the Pub/Sub SA has not been
347 granted the `appropriate
348 permissions <https://cloud.google.com/storage/docs/access-control/iam-permissions>`__:
349
350 - storage.objects.list: to list the objects in a bucket.
351 - storage.objects.get: to read the objects in a bucket.
352 - storage.buckets.get: to verify the bucket exists.
353 PUBLISH_PERMISSION_DENIED (3):
354 Permission denied encountered while publishing to the topic.
355 This can happen if the Pub/Sub SA has not been granted the
356 `appropriate publish
357 permissions <https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher>`__
358 BUCKET_NOT_FOUND (4):
359 The provided Cloud Storage bucket doesn't
360 exist.
361 TOO_MANY_OBJECTS (5):
362 The Cloud Storage bucket has too many
363 objects, ingestion will be paused.
364 """
365 STATE_UNSPECIFIED = 0
366 ACTIVE = 1
367 CLOUD_STORAGE_PERMISSION_DENIED = 2
368 PUBLISH_PERMISSION_DENIED = 3
369 BUCKET_NOT_FOUND = 4
370 TOO_MANY_OBJECTS = 5
371
372 class TextFormat(proto.Message):
373 r"""Configuration for reading Cloud Storage data in text format. Each
374 line of text as specified by the delimiter will be set to the
375 ``data`` field of a Pub/Sub message.
376
377
378 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
379
380 Attributes:
381 delimiter (str):
382 Optional. When unset, '\n' is used.
383
384 This field is a member of `oneof`_ ``_delimiter``.
385 """
386
387 delimiter: str = proto.Field(
388 proto.STRING,
389 number=1,
390 optional=True,
391 )
392
393 class AvroFormat(proto.Message):
394 r"""Configuration for reading Cloud Storage data in Avro binary format.
395 The bytes of each object will be set to the ``data`` field of a
396 Pub/Sub message.
397
398 """
399
400 class PubSubAvroFormat(proto.Message):
401 r"""Configuration for reading Cloud Storage data written via `Cloud
402 Storage
403 subscriptions <https://cloud.google.com/pubsub/docs/cloudstorage>`__.
404 The data and attributes fields of the originally exported Pub/Sub
405 message will be restored when publishing.
406
407 """
408
409 state: "IngestionDataSourceSettings.CloudStorage.State" = proto.Field(
410 proto.ENUM,
411 number=1,
412 enum="IngestionDataSourceSettings.CloudStorage.State",
413 )
414 bucket: str = proto.Field(
415 proto.STRING,
416 number=2,
417 )
418 text_format: "IngestionDataSourceSettings.CloudStorage.TextFormat" = (
419 proto.Field(
420 proto.MESSAGE,
421 number=3,
422 oneof="input_format",
423 message="IngestionDataSourceSettings.CloudStorage.TextFormat",
424 )
425 )
426 avro_format: "IngestionDataSourceSettings.CloudStorage.AvroFormat" = (
427 proto.Field(
428 proto.MESSAGE,
429 number=4,
430 oneof="input_format",
431 message="IngestionDataSourceSettings.CloudStorage.AvroFormat",
432 )
433 )
434 pubsub_avro_format: "IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat" = proto.Field(
435 proto.MESSAGE,
436 number=5,
437 oneof="input_format",
438 message="IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat",
439 )
440 minimum_object_create_time: timestamp_pb2.Timestamp = proto.Field(
441 proto.MESSAGE,
442 number=6,
443 message=timestamp_pb2.Timestamp,
444 )
445 match_glob: str = proto.Field(
446 proto.STRING,
447 number=9,
448 )
449
450 class AzureEventHubs(proto.Message):
451 r"""Ingestion settings for Azure Event Hubs.
452
453 Attributes:
454 state (google.pubsub_v1.types.IngestionDataSourceSettings.AzureEventHubs.State):
455 Output only. An output-only field that
456 indicates the state of the Event Hubs ingestion
457 source.
458 resource_group (str):
459 Optional. Name of the resource group within
460 the azure subscription.
461 namespace (str):
462 Optional. The name of the Event Hubs
463 namespace.
464 event_hub (str):
465 Optional. The name of the Event Hub.
466 client_id (str):
467 Optional. The client id of the Azure
468 application that is being used to authenticate
469 Pub/Sub.
470 tenant_id (str):
471 Optional. The tenant id of the Azure
472 application that is being used to authenticate
473 Pub/Sub.
474 subscription_id (str):
475 Optional. The Azure subscription id.
476 gcp_service_account (str):
477 Optional. The GCP service account to be used
478 for Federated Identity authentication.
479 """
480
481 class State(proto.Enum):
482 r"""Possible states for managed ingestion from Event Hubs.
483
484 Values:
485 STATE_UNSPECIFIED (0):
486 Default value. This value is unused.
487 ACTIVE (1):
488 Ingestion is active.
489 EVENT_HUBS_PERMISSION_DENIED (2):
490 Permission denied encountered while consuming data from
491 Event Hubs. This can happen when ``client_id``, or
492 ``tenant_id`` are invalid. Or the right permissions haven't
493 been granted.
494 PUBLISH_PERMISSION_DENIED (3):
495 Permission denied encountered while
496 publishing to the topic.
497 NAMESPACE_NOT_FOUND (4):
498 The provided Event Hubs namespace couldn't be
499 found.
500 EVENT_HUB_NOT_FOUND (5):
501 The provided Event Hub couldn't be found.
502 SUBSCRIPTION_NOT_FOUND (6):
503 The provided Event Hubs subscription couldn't
504 be found.
505 RESOURCE_GROUP_NOT_FOUND (7):
506 The provided Event Hubs resource group
507 couldn't be found.
508 """
509 STATE_UNSPECIFIED = 0
510 ACTIVE = 1
511 EVENT_HUBS_PERMISSION_DENIED = 2
512 PUBLISH_PERMISSION_DENIED = 3
513 NAMESPACE_NOT_FOUND = 4
514 EVENT_HUB_NOT_FOUND = 5
515 SUBSCRIPTION_NOT_FOUND = 6
516 RESOURCE_GROUP_NOT_FOUND = 7
517
518 state: "IngestionDataSourceSettings.AzureEventHubs.State" = proto.Field(
519 proto.ENUM,
520 number=1,
521 enum="IngestionDataSourceSettings.AzureEventHubs.State",
522 )
523 resource_group: str = proto.Field(
524 proto.STRING,
525 number=2,
526 )
527 namespace: str = proto.Field(
528 proto.STRING,
529 number=3,
530 )
531 event_hub: str = proto.Field(
532 proto.STRING,
533 number=4,
534 )
535 client_id: str = proto.Field(
536 proto.STRING,
537 number=5,
538 )
539 tenant_id: str = proto.Field(
540 proto.STRING,
541 number=6,
542 )
543 subscription_id: str = proto.Field(
544 proto.STRING,
545 number=7,
546 )
547 gcp_service_account: str = proto.Field(
548 proto.STRING,
549 number=8,
550 )
551
552 class AwsMsk(proto.Message):
553 r"""Ingestion settings for Amazon MSK.
554
555 Attributes:
556 state (google.pubsub_v1.types.IngestionDataSourceSettings.AwsMsk.State):
557 Output only. An output-only field that
558 indicates the state of the Amazon MSK ingestion
559 source.
560 cluster_arn (str):
561 Required. The Amazon Resource Name (ARN) that
562 uniquely identifies the cluster.
563 topic (str):
564 Required. The name of the topic in the Amazon
565 MSK cluster that Pub/Sub will import from.
566 aws_role_arn (str):
567 Required. AWS role ARN to be used for
568 Federated Identity authentication with Amazon
569 MSK. Check the Pub/Sub docs for how to set up
570 this role and the required permissions that need
571 to be attached to it.
572 gcp_service_account (str):
573 Required. The GCP service account to be used for Federated
574 Identity authentication with Amazon MSK (via a
575 ``AssumeRoleWithWebIdentity`` call for the provided role).
576 The ``aws_role_arn`` must be set up with
577 ``accounts.google.com:sub`` equals to this service account
578 number.
579 """
580
581 class State(proto.Enum):
582 r"""Possible states for managed ingestion from Amazon MSK.
583
584 Values:
585 STATE_UNSPECIFIED (0):
586 Default value. This value is unused.
587 ACTIVE (1):
588 Ingestion is active.
589 MSK_PERMISSION_DENIED (2):
590 Permission denied encountered while consuming
591 data from Amazon MSK.
592 PUBLISH_PERMISSION_DENIED (3):
593 Permission denied encountered while
594 publishing to the topic.
595 CLUSTER_NOT_FOUND (4):
596 The provided MSK cluster wasn't found.
597 TOPIC_NOT_FOUND (5):
598 The provided topic wasn't found.
599 """
600 STATE_UNSPECIFIED = 0
601 ACTIVE = 1
602 MSK_PERMISSION_DENIED = 2
603 PUBLISH_PERMISSION_DENIED = 3
604 CLUSTER_NOT_FOUND = 4
605 TOPIC_NOT_FOUND = 5
606
607 state: "IngestionDataSourceSettings.AwsMsk.State" = proto.Field(
608 proto.ENUM,
609 number=1,
610 enum="IngestionDataSourceSettings.AwsMsk.State",
611 )
612 cluster_arn: str = proto.Field(
613 proto.STRING,
614 number=2,
615 )
616 topic: str = proto.Field(
617 proto.STRING,
618 number=3,
619 )
620 aws_role_arn: str = proto.Field(
621 proto.STRING,
622 number=4,
623 )
624 gcp_service_account: str = proto.Field(
625 proto.STRING,
626 number=5,
627 )
628
629 class ConfluentCloud(proto.Message):
630 r"""Ingestion settings for Confluent Cloud.
631
632 Attributes:
633 state (google.pubsub_v1.types.IngestionDataSourceSettings.ConfluentCloud.State):
634 Output only. An output-only field that
635 indicates the state of the Confluent Cloud
636 ingestion source.
637 bootstrap_server (str):
638 Required. The address of the bootstrap
639 server. The format is url:port.
640 cluster_id (str):
641 Required. The id of the cluster.
642 topic (str):
643 Required. The name of the topic in the
644 Confluent Cloud cluster that Pub/Sub will import
645 from.
646 identity_pool_id (str):
647 Required. The id of the identity pool to be
648 used for Federated Identity authentication with
649 Confluent Cloud. See
650 https://docs.confluent.io/cloud/current/security/authenticate/workload-identities/identity-providers/oauth/identity-pools.html#add-oauth-identity-pools.
651 gcp_service_account (str):
652 Required. The GCP service account to be used for Federated
653 Identity authentication with ``identity_pool_id``.
654 """
655
656 class State(proto.Enum):
657 r"""Possible states for managed ingestion from Confluent Cloud.
658
659 Values:
660 STATE_UNSPECIFIED (0):
661 Default value. This value is unused.
662 ACTIVE (1):
663 Ingestion is active.
664 CONFLUENT_CLOUD_PERMISSION_DENIED (2):
665 Permission denied encountered while consuming
666 data from Confluent Cloud.
667 PUBLISH_PERMISSION_DENIED (3):
668 Permission denied encountered while
669 publishing to the topic.
670 UNREACHABLE_BOOTSTRAP_SERVER (4):
671 The provided bootstrap server address is
672 unreachable.
673 CLUSTER_NOT_FOUND (5):
674 The provided cluster wasn't found.
675 TOPIC_NOT_FOUND (6):
676 The provided topic wasn't found.
677 """
678 STATE_UNSPECIFIED = 0
679 ACTIVE = 1
680 CONFLUENT_CLOUD_PERMISSION_DENIED = 2
681 PUBLISH_PERMISSION_DENIED = 3
682 UNREACHABLE_BOOTSTRAP_SERVER = 4
683 CLUSTER_NOT_FOUND = 5
684 TOPIC_NOT_FOUND = 6
685
686 state: "IngestionDataSourceSettings.ConfluentCloud.State" = proto.Field(
687 proto.ENUM,
688 number=1,
689 enum="IngestionDataSourceSettings.ConfluentCloud.State",
690 )
691 bootstrap_server: str = proto.Field(
692 proto.STRING,
693 number=2,
694 )
695 cluster_id: str = proto.Field(
696 proto.STRING,
697 number=3,
698 )
699 topic: str = proto.Field(
700 proto.STRING,
701 number=4,
702 )
703 identity_pool_id: str = proto.Field(
704 proto.STRING,
705 number=5,
706 )
707 gcp_service_account: str = proto.Field(
708 proto.STRING,
709 number=6,
710 )
711
712 aws_kinesis: AwsKinesis = proto.Field(
713 proto.MESSAGE,
714 number=1,
715 oneof="source",
716 message=AwsKinesis,
717 )
718 cloud_storage: CloudStorage = proto.Field(
719 proto.MESSAGE,
720 number=2,
721 oneof="source",
722 message=CloudStorage,
723 )
724 azure_event_hubs: AzureEventHubs = proto.Field(
725 proto.MESSAGE,
726 number=3,
727 oneof="source",
728 message=AzureEventHubs,
729 )
730 aws_msk: AwsMsk = proto.Field(
731 proto.MESSAGE,
732 number=5,
733 oneof="source",
734 message=AwsMsk,
735 )
736 confluent_cloud: ConfluentCloud = proto.Field(
737 proto.MESSAGE,
738 number=6,
739 oneof="source",
740 message=ConfluentCloud,
741 )
742 platform_logs_settings: "PlatformLogsSettings" = proto.Field(
743 proto.MESSAGE,
744 number=4,
745 message="PlatformLogsSettings",
746 )
747
748
749class PlatformLogsSettings(proto.Message):
750 r"""Settings for Platform Logs produced by Pub/Sub.
751
752 Attributes:
753 severity (google.pubsub_v1.types.PlatformLogsSettings.Severity):
754 Optional. The minimum severity level of
755 Platform Logs that will be written.
756 """
757
758 class Severity(proto.Enum):
759 r"""Severity levels of Platform Logs.
760
761 Values:
762 SEVERITY_UNSPECIFIED (0):
763 Default value. Logs level is unspecified.
764 Logs will be disabled.
765 DISABLED (1):
766 Logs will be disabled.
767 DEBUG (2):
768 Debug logs and higher-severity logs will be
769 written.
770 INFO (3):
771 Info logs and higher-severity logs will be
772 written.
773 WARNING (4):
774 Warning logs and higher-severity logs will be
775 written.
776 ERROR (5):
777 Only error logs will be written.
778 """
779 SEVERITY_UNSPECIFIED = 0
780 DISABLED = 1
781 DEBUG = 2
782 INFO = 3
783 WARNING = 4
784 ERROR = 5
785
786 severity: Severity = proto.Field(
787 proto.ENUM,
788 number=1,
789 enum=Severity,
790 )
791
792
793class IngestionFailureEvent(proto.Message):
794 r"""Payload of the Platform Log entry sent when a failure is
795 encountered while ingesting.
796
797 This message has `oneof`_ fields (mutually exclusive fields).
798 For each oneof, at most one member field can be set at the same time.
799 Setting any member of the oneof automatically clears all other
800 members.
801
802 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
803
804 Attributes:
805 topic (str):
806 Required. Name of the import topic. Format is:
807 projects/{project_name}/topics/{topic_name}.
808 error_message (str):
809 Required. Error details explaining why
810 ingestion to Pub/Sub has failed.
811 cloud_storage_failure (google.pubsub_v1.types.IngestionFailureEvent.CloudStorageFailure):
812 Optional. Failure when ingesting from Cloud
813 Storage.
814
815 This field is a member of `oneof`_ ``failure``.
816 aws_msk_failure (google.pubsub_v1.types.IngestionFailureEvent.AwsMskFailureReason):
817 Optional. Failure when ingesting from Amazon
818 MSK.
819
820 This field is a member of `oneof`_ ``failure``.
821 azure_event_hubs_failure (google.pubsub_v1.types.IngestionFailureEvent.AzureEventHubsFailureReason):
822 Optional. Failure when ingesting from Azure
823 Event Hubs.
824
825 This field is a member of `oneof`_ ``failure``.
826 confluent_cloud_failure (google.pubsub_v1.types.IngestionFailureEvent.ConfluentCloudFailureReason):
827 Optional. Failure when ingesting from
828 Confluent Cloud.
829
830 This field is a member of `oneof`_ ``failure``.
831 """
832
833 class ApiViolationReason(proto.Message):
834 r"""Specifies the reason why some data may have been left out of the
835 desired Pub/Sub message due to the API message limits
836 (https://cloud.google.com/pubsub/quotas#resource_limits). For
837 example, when the number of attributes is larger than 100, the
838 number of attributes is truncated to 100 to respect the limit on the
839 attribute count. Other attribute limits are treated similarly. When
840 the size of the desired message would've been larger than 10MB, the
841 message won't be published at all, and ingestion of the subsequent
842 messages will proceed as normal.
843
844 """
845
846 class AvroFailureReason(proto.Message):
847 r"""Set when an Avro file is unsupported or its format is not
848 valid. When this occurs, one or more Avro objects won't be
849 ingested.
850
851 """
852
853 class CloudStorageFailure(proto.Message):
854 r"""Failure when ingesting from a Cloud Storage source.
855
856 This message has `oneof`_ fields (mutually exclusive fields).
857 For each oneof, at most one member field can be set at the same time.
858 Setting any member of the oneof automatically clears all other
859 members.
860
861 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
862
863 Attributes:
864 bucket (str):
865 Optional. Name of the Cloud Storage bucket
866 used for ingestion.
867 object_name (str):
868 Optional. Name of the Cloud Storage object
869 which contained the section that couldn't be
870 ingested.
871 object_generation (int):
872 Optional. Generation of the Cloud Storage
873 object which contained the section that couldn't
874 be ingested.
875 avro_failure_reason (google.pubsub_v1.types.IngestionFailureEvent.AvroFailureReason):
876 Optional. Failure encountered when parsing an
877 Avro file.
878
879 This field is a member of `oneof`_ ``reason``.
880 api_violation_reason (google.pubsub_v1.types.IngestionFailureEvent.ApiViolationReason):
881 Optional. The Pub/Sub API limits prevented
882 the desired message from being published.
883
884 This field is a member of `oneof`_ ``reason``.
885 """
886
887 bucket: str = proto.Field(
888 proto.STRING,
889 number=1,
890 )
891 object_name: str = proto.Field(
892 proto.STRING,
893 number=2,
894 )
895 object_generation: int = proto.Field(
896 proto.INT64,
897 number=3,
898 )
899 avro_failure_reason: "IngestionFailureEvent.AvroFailureReason" = proto.Field(
900 proto.MESSAGE,
901 number=5,
902 oneof="reason",
903 message="IngestionFailureEvent.AvroFailureReason",
904 )
905 api_violation_reason: "IngestionFailureEvent.ApiViolationReason" = proto.Field(
906 proto.MESSAGE,
907 number=6,
908 oneof="reason",
909 message="IngestionFailureEvent.ApiViolationReason",
910 )
911
912 class AwsMskFailureReason(proto.Message):
913 r"""Failure when ingesting from an Amazon MSK source.
914
915 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
916
917 Attributes:
918 cluster_arn (str):
919 Optional. The ARN of the cluster of the topic
920 being ingested from.
921 kafka_topic (str):
922 Optional. The name of the Kafka topic being
923 ingested from.
924 partition_id (int):
925 Optional. The partition ID of the message
926 that failed to be ingested.
927 offset (int):
928 Optional. The offset within the partition of
929 the message that failed to be ingested.
930 api_violation_reason (google.pubsub_v1.types.IngestionFailureEvent.ApiViolationReason):
931 Optional. The Pub/Sub API limits prevented
932 the desired message from being published.
933
934 This field is a member of `oneof`_ ``reason``.
935 """
936
937 cluster_arn: str = proto.Field(
938 proto.STRING,
939 number=1,
940 )
941 kafka_topic: str = proto.Field(
942 proto.STRING,
943 number=2,
944 )
945 partition_id: int = proto.Field(
946 proto.INT64,
947 number=3,
948 )
949 offset: int = proto.Field(
950 proto.INT64,
951 number=4,
952 )
953 api_violation_reason: "IngestionFailureEvent.ApiViolationReason" = proto.Field(
954 proto.MESSAGE,
955 number=5,
956 oneof="reason",
957 message="IngestionFailureEvent.ApiViolationReason",
958 )
959
960 class AzureEventHubsFailureReason(proto.Message):
961 r"""Failure when ingesting from an Azure Event Hubs source.
962
963 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
964
965 Attributes:
966 namespace (str):
967 Optional. The namespace containing the event
968 hub being ingested from.
969 event_hub (str):
970 Optional. The name of the event hub being
971 ingested from.
972 partition_id (int):
973 Optional. The partition ID of the message
974 that failed to be ingested.
975 offset (int):
976 Optional. The offset within the partition of
977 the message that failed to be ingested.
978 api_violation_reason (google.pubsub_v1.types.IngestionFailureEvent.ApiViolationReason):
979 Optional. The Pub/Sub API limits prevented
980 the desired message from being published.
981
982 This field is a member of `oneof`_ ``reason``.
983 """
984
985 namespace: str = proto.Field(
986 proto.STRING,
987 number=1,
988 )
989 event_hub: str = proto.Field(
990 proto.STRING,
991 number=2,
992 )
993 partition_id: int = proto.Field(
994 proto.INT64,
995 number=3,
996 )
997 offset: int = proto.Field(
998 proto.INT64,
999 number=4,
1000 )
1001 api_violation_reason: "IngestionFailureEvent.ApiViolationReason" = proto.Field(
1002 proto.MESSAGE,
1003 number=5,
1004 oneof="reason",
1005 message="IngestionFailureEvent.ApiViolationReason",
1006 )
1007
1008 class ConfluentCloudFailureReason(proto.Message):
1009 r"""Failure when ingesting from a Confluent Cloud source.
1010
1011 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1012
1013 Attributes:
1014 cluster_id (str):
1015 Optional. The cluster ID containing the topic
1016 being ingested from.
1017 kafka_topic (str):
1018 Optional. The name of the Kafka topic being
1019 ingested from.
1020 partition_id (int):
1021 Optional. The partition ID of the message
1022 that failed to be ingested.
1023 offset (int):
1024 Optional. The offset within the partition of
1025 the message that failed to be ingested.
1026 api_violation_reason (google.pubsub_v1.types.IngestionFailureEvent.ApiViolationReason):
1027 Optional. The Pub/Sub API limits prevented
1028 the desired message from being published.
1029
1030 This field is a member of `oneof`_ ``reason``.
1031 """
1032
1033 cluster_id: str = proto.Field(
1034 proto.STRING,
1035 number=1,
1036 )
1037 kafka_topic: str = proto.Field(
1038 proto.STRING,
1039 number=2,
1040 )
1041 partition_id: int = proto.Field(
1042 proto.INT64,
1043 number=3,
1044 )
1045 offset: int = proto.Field(
1046 proto.INT64,
1047 number=4,
1048 )
1049 api_violation_reason: "IngestionFailureEvent.ApiViolationReason" = proto.Field(
1050 proto.MESSAGE,
1051 number=5,
1052 oneof="reason",
1053 message="IngestionFailureEvent.ApiViolationReason",
1054 )
1055
1056 topic: str = proto.Field(
1057 proto.STRING,
1058 number=1,
1059 )
1060 error_message: str = proto.Field(
1061 proto.STRING,
1062 number=2,
1063 )
1064 cloud_storage_failure: CloudStorageFailure = proto.Field(
1065 proto.MESSAGE,
1066 number=3,
1067 oneof="failure",
1068 message=CloudStorageFailure,
1069 )
1070 aws_msk_failure: AwsMskFailureReason = proto.Field(
1071 proto.MESSAGE,
1072 number=4,
1073 oneof="failure",
1074 message=AwsMskFailureReason,
1075 )
1076 azure_event_hubs_failure: AzureEventHubsFailureReason = proto.Field(
1077 proto.MESSAGE,
1078 number=5,
1079 oneof="failure",
1080 message=AzureEventHubsFailureReason,
1081 )
1082 confluent_cloud_failure: ConfluentCloudFailureReason = proto.Field(
1083 proto.MESSAGE,
1084 number=6,
1085 oneof="failure",
1086 message=ConfluentCloudFailureReason,
1087 )
1088
1089
1090class JavaScriptUDF(proto.Message):
1091 r"""User-defined JavaScript function that can transform or filter
1092 a Pub/Sub message.
1093
1094 Attributes:
1095 function_name (str):
1096 Required. Name of the JavasScript function
1097 that should applied to Pub/Sub messages.
1098 code (str):
1099 Required. JavaScript code that contains a function
1100 ``function_name`` with the below signature:
1101
1102 ::
1103
1104 /**
1105 * Transforms a Pub/Sub message.
1106
1107 * @return {(Object<string, (string | Object<string, string>)>|null)} - To
1108 * filter a message, return `null`. To transform a message return a map
1109 * with the following keys:
1110 * - (required) 'data' : {string}
1111 * - (optional) 'attributes' : {Object<string, string>}
1112 * Returning empty `attributes` will remove all attributes from the
1113 * message.
1114 *
1115 * @param {(Object<string, (string | Object<string, string>)>} Pub/Sub
1116 * message. Keys:
1117 * - (required) 'data' : {string}
1118 * - (required) 'attributes' : {Object<string, string>}
1119 *
1120 * @param {Object<string, any>} metadata - Pub/Sub message metadata.
1121 * Keys:
1122 * - (required) 'message_id' : {string}
1123 * - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
1124 * - (optional) 'ordering_key': {string}
1125 */
1126
1127 function <function_name>(message, metadata) {
1128 }
1129 """
1130
1131 function_name: str = proto.Field(
1132 proto.STRING,
1133 number=1,
1134 )
1135 code: str = proto.Field(
1136 proto.STRING,
1137 number=2,
1138 )
1139
1140
1141class MessageTransform(proto.Message):
1142 r"""All supported message transforms types.
1143
1144 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1145
1146 Attributes:
1147 javascript_udf (google.pubsub_v1.types.JavaScriptUDF):
1148 Optional. JavaScript User Defined Function. If multiple
1149 JavaScriptUDF's are specified on a resource, each must have
1150 a unique ``function_name``.
1151
1152 This field is a member of `oneof`_ ``transform``.
1153 enabled (bool):
1154 Optional. This field is deprecated, use the ``disabled``
1155 field to disable transforms.
1156 disabled (bool):
1157 Optional. If true, the transform is disabled and will not be
1158 applied to messages. Defaults to ``false``.
1159 """
1160
1161 javascript_udf: "JavaScriptUDF" = proto.Field(
1162 proto.MESSAGE,
1163 number=2,
1164 oneof="transform",
1165 message="JavaScriptUDF",
1166 )
1167 enabled: bool = proto.Field(
1168 proto.BOOL,
1169 number=3,
1170 )
1171 disabled: bool = proto.Field(
1172 proto.BOOL,
1173 number=4,
1174 )
1175
1176
1177class Topic(proto.Message):
1178 r"""A topic resource.
1179
1180 Attributes:
1181 name (str):
1182 Required. The name of the topic. It must have the format
1183 ``"projects/{project}/topics/{topic}"``. ``{topic}`` must
1184 start with a letter, and contain only letters
1185 (``[A-Za-z]``), numbers (``[0-9]``), dashes (``-``),
1186 underscores (``_``), periods (``.``), tildes (``~``), plus
1187 (``+``) or percent signs (``%``). It must be between 3 and
1188 255 characters in length, and it must not start with
1189 ``"goog"``.
1190 labels (MutableMapping[str, str]):
1191 Optional. See [Creating and managing labels]
1192 (https://cloud.google.com/pubsub/docs/labels).
1193 message_storage_policy (google.pubsub_v1.types.MessageStoragePolicy):
1194 Optional. Policy constraining the set of
1195 Google Cloud Platform regions where messages
1196 published to the topic may be stored. If not
1197 present, then no constraints are in effect.
1198 kms_key_name (str):
1199 Optional. The resource name of the Cloud KMS CryptoKey to be
1200 used to protect access to messages published on this topic.
1201
1202 The expected format is
1203 ``projects/*/locations/*/keyRings/*/cryptoKeys/*``.
1204 schema_settings (google.pubsub_v1.types.SchemaSettings):
1205 Optional. Settings for validating messages
1206 published against a schema.
1207 satisfies_pzs (bool):
1208 Optional. Reserved for future use. This field
1209 is set only in responses from the server; it is
1210 ignored if it is set in any requests.
1211 message_retention_duration (google.protobuf.duration_pb2.Duration):
1212 Optional. Indicates the minimum duration to retain a message
1213 after it is published to the topic. If this field is set,
1214 messages published to the topic in the last
1215 ``message_retention_duration`` are always available to
1216 subscribers. For instance, it allows any attached
1217 subscription to `seek to a
1218 timestamp <https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time>`__
1219 that is up to ``message_retention_duration`` in the past. If
1220 this field is not set, message retention is controlled by
1221 settings on individual subscriptions. Cannot be more than 31
1222 days or less than 10 minutes.
1223 state (google.pubsub_v1.types.Topic.State):
1224 Output only. An output-only field indicating
1225 the state of the topic.
1226 ingestion_data_source_settings (google.pubsub_v1.types.IngestionDataSourceSettings):
1227 Optional. Settings for ingestion from a data
1228 source into this topic.
1229 message_transforms (MutableSequence[google.pubsub_v1.types.MessageTransform]):
1230 Optional. Transforms to be applied to
1231 messages published to the topic. Transforms are
1232 applied in the order specified.
1233 """
1234
1235 class State(proto.Enum):
1236 r"""The state of the topic.
1237
1238 Values:
1239 STATE_UNSPECIFIED (0):
1240 Default value. This value is unused.
1241 ACTIVE (1):
1242 The topic does not have any persistent
1243 errors.
1244 INGESTION_RESOURCE_ERROR (2):
1245 Ingestion from the data source has
1246 encountered a permanent error. See the more
1247 detailed error state in the corresponding
1248 ingestion source configuration.
1249 """
1250 STATE_UNSPECIFIED = 0
1251 ACTIVE = 1
1252 INGESTION_RESOURCE_ERROR = 2
1253
1254 name: str = proto.Field(
1255 proto.STRING,
1256 number=1,
1257 )
1258 labels: MutableMapping[str, str] = proto.MapField(
1259 proto.STRING,
1260 proto.STRING,
1261 number=2,
1262 )
1263 message_storage_policy: "MessageStoragePolicy" = proto.Field(
1264 proto.MESSAGE,
1265 number=3,
1266 message="MessageStoragePolicy",
1267 )
1268 kms_key_name: str = proto.Field(
1269 proto.STRING,
1270 number=5,
1271 )
1272 schema_settings: "SchemaSettings" = proto.Field(
1273 proto.MESSAGE,
1274 number=6,
1275 message="SchemaSettings",
1276 )
1277 satisfies_pzs: bool = proto.Field(
1278 proto.BOOL,
1279 number=7,
1280 )
1281 message_retention_duration: duration_pb2.Duration = proto.Field(
1282 proto.MESSAGE,
1283 number=8,
1284 message=duration_pb2.Duration,
1285 )
1286 state: State = proto.Field(
1287 proto.ENUM,
1288 number=9,
1289 enum=State,
1290 )
1291 ingestion_data_source_settings: "IngestionDataSourceSettings" = proto.Field(
1292 proto.MESSAGE,
1293 number=10,
1294 message="IngestionDataSourceSettings",
1295 )
1296 message_transforms: MutableSequence["MessageTransform"] = proto.RepeatedField(
1297 proto.MESSAGE,
1298 number=13,
1299 message="MessageTransform",
1300 )
1301
1302
1303class PubsubMessage(proto.Message):
1304 r"""A message that is published by publishers and consumed by
1305 subscribers. The message must contain either a non-empty data field
1306 or at least one attribute. Note that client libraries represent this
1307 object differently depending on the language. See the corresponding
1308 `client library
1309 documentation <https://cloud.google.com/pubsub/docs/reference/libraries>`__
1310 for more information. See [quotas and limits]
1311 (https://cloud.google.com/pubsub/quotas) for more information about
1312 message limits.
1313
1314 Attributes:
1315 data (bytes):
1316 Optional. The message data field. If this
1317 field is empty, the message must contain at
1318 least one attribute.
1319 attributes (MutableMapping[str, str]):
1320 Optional. Attributes for this message. If
1321 this field is empty, the message must contain
1322 non-empty data. This can be used to filter
1323 messages on the subscription.
1324 message_id (str):
1325 ID of this message, assigned by the server when the message
1326 is published. Guaranteed to be unique within the topic. This
1327 value may be read by a subscriber that receives a
1328 ``PubsubMessage`` via a ``Pull`` call or a push delivery. It
1329 must not be populated by the publisher in a ``Publish``
1330 call.
1331 publish_time (google.protobuf.timestamp_pb2.Timestamp):
1332 The time at which the message was published, populated by
1333 the server when it receives the ``Publish`` call. It must
1334 not be populated by the publisher in a ``Publish`` call.
1335 ordering_key (str):
1336 Optional. If non-empty, identifies related messages for
1337 which publish order should be respected. If a
1338 ``Subscription`` has ``enable_message_ordering`` set to
1339 ``true``, messages published with the same non-empty
1340 ``ordering_key`` value will be delivered to subscribers in
1341 the order in which they are received by the Pub/Sub system.
1342 All ``PubsubMessage``\ s published in a given
1343 ``PublishRequest`` must specify the same ``ordering_key``
1344 value. For more information, see `ordering
1345 messages <https://cloud.google.com/pubsub/docs/ordering>`__.
1346 """
1347
1348 data: bytes = proto.Field(
1349 proto.BYTES,
1350 number=1,
1351 )
1352 attributes: MutableMapping[str, str] = proto.MapField(
1353 proto.STRING,
1354 proto.STRING,
1355 number=2,
1356 )
1357 message_id: str = proto.Field(
1358 proto.STRING,
1359 number=3,
1360 )
1361 publish_time: timestamp_pb2.Timestamp = proto.Field(
1362 proto.MESSAGE,
1363 number=4,
1364 message=timestamp_pb2.Timestamp,
1365 )
1366 ordering_key: str = proto.Field(
1367 proto.STRING,
1368 number=5,
1369 )
1370
1371
1372class GetTopicRequest(proto.Message):
1373 r"""Request for the GetTopic method.
1374
1375 Attributes:
1376 topic (str):
1377 Required. The name of the topic to get. Format is
1378 ``projects/{project}/topics/{topic}``.
1379 """
1380
1381 topic: str = proto.Field(
1382 proto.STRING,
1383 number=1,
1384 )
1385
1386
1387class UpdateTopicRequest(proto.Message):
1388 r"""Request for the UpdateTopic method.
1389
1390 Attributes:
1391 topic (google.pubsub_v1.types.Topic):
1392 Required. The updated topic object.
1393 update_mask (google.protobuf.field_mask_pb2.FieldMask):
1394 Required. Indicates which fields in the provided topic to
1395 update. Must be specified and non-empty. Note that if
1396 ``update_mask`` contains "message_storage_policy" but the
1397 ``message_storage_policy`` is not set in the ``topic``
1398 provided above, then the updated value is determined by the
1399 policy configured at the project or organization level.
1400 """
1401
1402 topic: "Topic" = proto.Field(
1403 proto.MESSAGE,
1404 number=1,
1405 message="Topic",
1406 )
1407 update_mask: field_mask_pb2.FieldMask = proto.Field(
1408 proto.MESSAGE,
1409 number=2,
1410 message=field_mask_pb2.FieldMask,
1411 )
1412
1413
1414class PublishRequest(proto.Message):
1415 r"""Request for the Publish method.
1416
1417 Attributes:
1418 topic (str):
1419 Required. The messages in the request will be published on
1420 this topic. Format is ``projects/{project}/topics/{topic}``.
1421 messages (MutableSequence[google.pubsub_v1.types.PubsubMessage]):
1422 Required. The messages to publish.
1423 """
1424
1425 topic: str = proto.Field(
1426 proto.STRING,
1427 number=1,
1428 )
1429 messages: MutableSequence["PubsubMessage"] = proto.RepeatedField(
1430 proto.MESSAGE,
1431 number=2,
1432 message="PubsubMessage",
1433 )
1434
1435
1436class PublishResponse(proto.Message):
1437 r"""Response for the ``Publish`` method.
1438
1439 Attributes:
1440 message_ids (MutableSequence[str]):
1441 Optional. The server-assigned ID of each
1442 published message, in the same order as the
1443 messages in the request. IDs are guaranteed to
1444 be unique within the topic.
1445 """
1446
1447 message_ids: MutableSequence[str] = proto.RepeatedField(
1448 proto.STRING,
1449 number=1,
1450 )
1451
1452
1453class ListTopicsRequest(proto.Message):
1454 r"""Request for the ``ListTopics`` method.
1455
1456 Attributes:
1457 project (str):
1458 Required. The name of the project in which to list topics.
1459 Format is ``projects/{project-id}``.
1460 page_size (int):
1461 Optional. Maximum number of topics to return.
1462 page_token (str):
1463 Optional. The value returned by the last
1464 ``ListTopicsResponse``; indicates that this is a
1465 continuation of a prior ``ListTopics`` call, and that the
1466 system should return the next page of data.
1467 """
1468
1469 project: str = proto.Field(
1470 proto.STRING,
1471 number=1,
1472 )
1473 page_size: int = proto.Field(
1474 proto.INT32,
1475 number=2,
1476 )
1477 page_token: str = proto.Field(
1478 proto.STRING,
1479 number=3,
1480 )
1481
1482
1483class ListTopicsResponse(proto.Message):
1484 r"""Response for the ``ListTopics`` method.
1485
1486 Attributes:
1487 topics (MutableSequence[google.pubsub_v1.types.Topic]):
1488 Optional. The resulting topics.
1489 next_page_token (str):
1490 Optional. If not empty, indicates that there may be more
1491 topics that match the request; this value should be passed
1492 in a new ``ListTopicsRequest``.
1493 """
1494
1495 @property
1496 def raw_page(self):
1497 return self
1498
1499 topics: MutableSequence["Topic"] = proto.RepeatedField(
1500 proto.MESSAGE,
1501 number=1,
1502 message="Topic",
1503 )
1504 next_page_token: str = proto.Field(
1505 proto.STRING,
1506 number=2,
1507 )
1508
1509
1510class ListTopicSubscriptionsRequest(proto.Message):
1511 r"""Request for the ``ListTopicSubscriptions`` method.
1512
1513 Attributes:
1514 topic (str):
1515 Required. The name of the topic that subscriptions are
1516 attached to. Format is
1517 ``projects/{project}/topics/{topic}``.
1518 page_size (int):
1519 Optional. Maximum number of subscription
1520 names to return.
1521 page_token (str):
1522 Optional. The value returned by the last
1523 ``ListTopicSubscriptionsResponse``; indicates that this is a
1524 continuation of a prior ``ListTopicSubscriptions`` call, and
1525 that the system should return the next page of data.
1526 """
1527
1528 topic: str = proto.Field(
1529 proto.STRING,
1530 number=1,
1531 )
1532 page_size: int = proto.Field(
1533 proto.INT32,
1534 number=2,
1535 )
1536 page_token: str = proto.Field(
1537 proto.STRING,
1538 number=3,
1539 )
1540
1541
1542class ListTopicSubscriptionsResponse(proto.Message):
1543 r"""Response for the ``ListTopicSubscriptions`` method.
1544
1545 Attributes:
1546 subscriptions (MutableSequence[str]):
1547 Optional. The names of subscriptions attached
1548 to the topic specified in the request.
1549 next_page_token (str):
1550 Optional. If not empty, indicates that there may be more
1551 subscriptions that match the request; this value should be
1552 passed in a new ``ListTopicSubscriptionsRequest`` to get
1553 more subscriptions.
1554 """
1555
1556 @property
1557 def raw_page(self):
1558 return self
1559
1560 subscriptions: MutableSequence[str] = proto.RepeatedField(
1561 proto.STRING,
1562 number=1,
1563 )
1564 next_page_token: str = proto.Field(
1565 proto.STRING,
1566 number=2,
1567 )
1568
1569
1570class ListTopicSnapshotsRequest(proto.Message):
1571 r"""Request for the ``ListTopicSnapshots`` method.
1572
1573 Attributes:
1574 topic (str):
1575 Required. The name of the topic that snapshots are attached
1576 to. Format is ``projects/{project}/topics/{topic}``.
1577 page_size (int):
1578 Optional. Maximum number of snapshot names to
1579 return.
1580 page_token (str):
1581 Optional. The value returned by the last
1582 ``ListTopicSnapshotsResponse``; indicates that this is a
1583 continuation of a prior ``ListTopicSnapshots`` call, and
1584 that the system should return the next page of data.
1585 """
1586
1587 topic: str = proto.Field(
1588 proto.STRING,
1589 number=1,
1590 )
1591 page_size: int = proto.Field(
1592 proto.INT32,
1593 number=2,
1594 )
1595 page_token: str = proto.Field(
1596 proto.STRING,
1597 number=3,
1598 )
1599
1600
1601class ListTopicSnapshotsResponse(proto.Message):
1602 r"""Response for the ``ListTopicSnapshots`` method.
1603
1604 Attributes:
1605 snapshots (MutableSequence[str]):
1606 Optional. The names of the snapshots that
1607 match the request.
1608 next_page_token (str):
1609 Optional. If not empty, indicates that there may be more
1610 snapshots that match the request; this value should be
1611 passed in a new ``ListTopicSnapshotsRequest`` to get more
1612 snapshots.
1613 """
1614
1615 @property
1616 def raw_page(self):
1617 return self
1618
1619 snapshots: MutableSequence[str] = proto.RepeatedField(
1620 proto.STRING,
1621 number=1,
1622 )
1623 next_page_token: str = proto.Field(
1624 proto.STRING,
1625 number=2,
1626 )
1627
1628
1629class DeleteTopicRequest(proto.Message):
1630 r"""Request for the ``DeleteTopic`` method.
1631
1632 Attributes:
1633 topic (str):
1634 Required. Name of the topic to delete. Format is
1635 ``projects/{project}/topics/{topic}``.
1636 """
1637
1638 topic: str = proto.Field(
1639 proto.STRING,
1640 number=1,
1641 )
1642
1643
1644class DetachSubscriptionRequest(proto.Message):
1645 r"""Request for the DetachSubscription method.
1646
1647 Attributes:
1648 subscription (str):
1649 Required. The subscription to detach. Format is
1650 ``projects/{project}/subscriptions/{subscription}``.
1651 """
1652
1653 subscription: str = proto.Field(
1654 proto.STRING,
1655 number=1,
1656 )
1657
1658
1659class DetachSubscriptionResponse(proto.Message):
1660 r"""Response for the DetachSubscription method.
1661 Reserved for future use.
1662
1663 """
1664
1665
1666class Subscription(proto.Message):
1667 r"""A subscription resource. If none of ``push_config``,
1668 ``bigquery_config``, or ``cloud_storage_config`` is set, then the
1669 subscriber will pull and ack messages using API methods. At most one
1670 of these fields may be set.
1671
1672 Attributes:
1673 name (str):
1674 Required. The name of the subscription. It must have the
1675 format
1676 ``"projects/{project}/subscriptions/{subscription}"``.
1677 ``{subscription}`` must start with a letter, and contain
1678 only letters (``[A-Za-z]``), numbers (``[0-9]``), dashes
1679 (``-``), underscores (``_``), periods (``.``), tildes
1680 (``~``), plus (``+``) or percent signs (``%``). It must be
1681 between 3 and 255 characters in length, and it must not
1682 start with ``"goog"``.
1683 topic (str):
1684 Required. The name of the topic from which this subscription
1685 is receiving messages. Format is
1686 ``projects/{project}/topics/{topic}``. The value of this
1687 field will be ``_deleted-topic_`` if the topic has been
1688 deleted.
1689 push_config (google.pubsub_v1.types.PushConfig):
1690 Optional. If push delivery is used with this
1691 subscription, this field is used to configure
1692 it.
1693 bigquery_config (google.pubsub_v1.types.BigQueryConfig):
1694 Optional. If delivery to BigQuery is used
1695 with this subscription, this field is used to
1696 configure it.
1697 cloud_storage_config (google.pubsub_v1.types.CloudStorageConfig):
1698 Optional. If delivery to Google Cloud Storage
1699 is used with this subscription, this field is
1700 used to configure it.
1701 ack_deadline_seconds (int):
1702 Optional. The approximate amount of time (on a best-effort
1703 basis) Pub/Sub waits for the subscriber to acknowledge
1704 receipt before resending the message. In the interval after
1705 the message is delivered and before it is acknowledged, it
1706 is considered to be *outstanding*. During that time period,
1707 the message will not be redelivered (on a best-effort
1708 basis).
1709
1710 For pull subscriptions, this value is used as the initial
1711 value for the ack deadline. To override this value for a
1712 given message, call ``ModifyAckDeadline`` with the
1713 corresponding ``ack_id`` if using non-streaming pull or send
1714 the ``ack_id`` in a ``StreamingModifyAckDeadlineRequest`` if
1715 using streaming pull. The minimum custom deadline you can
1716 specify is 10 seconds. The maximum custom deadline you can
1717 specify is 600 seconds (10 minutes). If this parameter is 0,
1718 a default value of 10 seconds is used.
1719
1720 For push delivery, this value is also used to set the
1721 request timeout for the call to the push endpoint.
1722
1723 If the subscriber never acknowledges the message, the
1724 Pub/Sub system will eventually redeliver the message.
1725 retain_acked_messages (bool):
1726 Optional. Indicates whether to retain acknowledged messages.
1727 If true, then messages are not expunged from the
1728 subscription's backlog, even if they are acknowledged, until
1729 they fall out of the ``message_retention_duration`` window.
1730 This must be true if you would like to [``Seek`` to a
1731 timestamp]
1732 (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
1733 in the past to replay previously-acknowledged messages.
1734 message_retention_duration (google.protobuf.duration_pb2.Duration):
1735 Optional. How long to retain unacknowledged messages in the
1736 subscription's backlog, from the moment a message is
1737 published. If ``retain_acked_messages`` is true, then this
1738 also configures the retention of acknowledged messages, and
1739 thus configures how far back in time a ``Seek`` can be done.
1740 Defaults to 7 days. Cannot be more than 31 days or less than
1741 10 minutes.
1742 labels (MutableMapping[str, str]):
1743 Optional. See `Creating and managing
1744 labels <https://cloud.google.com/pubsub/docs/labels>`__.
1745 enable_message_ordering (bool):
1746 Optional. If true, messages published with the same
1747 ``ordering_key`` in ``PubsubMessage`` will be delivered to
1748 the subscribers in the order in which they are received by
1749 the Pub/Sub system. Otherwise, they may be delivered in any
1750 order.
1751 expiration_policy (google.pubsub_v1.types.ExpirationPolicy):
1752 Optional. A policy that specifies the conditions for this
1753 subscription's expiration. A subscription is considered
1754 active as long as any connected subscriber is successfully
1755 consuming messages from the subscription or is issuing
1756 operations on the subscription. If ``expiration_policy`` is
1757 not set, a *default policy* with ``ttl`` of 31 days will be
1758 used. The minimum allowed value for
1759 ``expiration_policy.ttl`` is 1 day. If ``expiration_policy``
1760 is set, but ``expiration_policy.ttl`` is not set, the
1761 subscription never expires.
1762 filter (str):
1763 Optional. An expression written in the Pub/Sub `filter
1764 language <https://cloud.google.com/pubsub/docs/filtering>`__.
1765 If non-empty, then only ``PubsubMessage``\ s whose
1766 ``attributes`` field matches the filter are delivered on
1767 this subscription. If empty, then no messages are filtered
1768 out.
1769 dead_letter_policy (google.pubsub_v1.types.DeadLetterPolicy):
1770 Optional. A policy that specifies the conditions for dead
1771 lettering messages in this subscription. If
1772 dead_letter_policy is not set, dead lettering is disabled.
1773
1774 The Pub/Sub service account associated with this
1775 subscriptions's parent project (i.e.,
1776 service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com)
1777 must have permission to Acknowledge() messages on this
1778 subscription.
1779 retry_policy (google.pubsub_v1.types.RetryPolicy):
1780 Optional. A policy that specifies how Pub/Sub
1781 retries message delivery for this subscription.
1782
1783 If not set, the default retry policy is applied.
1784 This generally implies that messages will be
1785 retried as soon as possible for healthy
1786 subscribers. RetryPolicy will be triggered on
1787 NACKs or acknowledgement deadline exceeded
1788 events for a given message.
1789 detached (bool):
1790 Optional. Indicates whether the subscription is detached
1791 from its topic. Detached subscriptions don't receive
1792 messages from their topic and don't retain any backlog.
1793 ``Pull`` and ``StreamingPull`` requests will return
1794 FAILED_PRECONDITION. If the subscription is a push
1795 subscription, pushes to the endpoint will not be made.
1796 enable_exactly_once_delivery (bool):
1797 Optional. If true, Pub/Sub provides the following guarantees
1798 for the delivery of a message with a given value of
1799 ``message_id`` on this subscription:
1800
1801 - The message sent to a subscriber is guaranteed not to be
1802 resent before the message's acknowledgement deadline
1803 expires.
1804 - An acknowledged message will not be resent to a
1805 subscriber.
1806
1807 Note that subscribers may still receive multiple copies of a
1808 message when ``enable_exactly_once_delivery`` is true if the
1809 message was published multiple times by a publisher client.
1810 These copies are considered distinct by Pub/Sub and have
1811 distinct ``message_id`` values.
1812 topic_message_retention_duration (google.protobuf.duration_pb2.Duration):
1813 Output only. Indicates the minimum duration for which a
1814 message is retained after it is published to the
1815 subscription's topic. If this field is set, messages
1816 published to the subscription's topic in the last
1817 ``topic_message_retention_duration`` are always available to
1818 subscribers. See the ``message_retention_duration`` field in
1819 ``Topic``. This field is set only in responses from the
1820 server; it is ignored if it is set in any requests.
1821 state (google.pubsub_v1.types.Subscription.State):
1822 Output only. An output-only field indicating
1823 whether or not the subscription can receive
1824 messages.
1825 analytics_hub_subscription_info (google.pubsub_v1.types.Subscription.AnalyticsHubSubscriptionInfo):
1826 Output only. Information about the associated
1827 Analytics Hub subscription. Only set if the
1828 subscritpion is created by Analytics Hub.
1829 message_transforms (MutableSequence[google.pubsub_v1.types.MessageTransform]):
1830 Optional. Transforms to be applied to
1831 messages before they are delivered to
1832 subscribers. Transforms are applied in the order
1833 specified.
1834 """
1835
1836 class State(proto.Enum):
1837 r"""Possible states for a subscription.
1838
1839 Values:
1840 STATE_UNSPECIFIED (0):
1841 Default value. This value is unused.
1842 ACTIVE (1):
1843 The subscription can actively receive
1844 messages
1845 RESOURCE_ERROR (2):
1846 The subscription cannot receive messages
1847 because of an error with the resource to which
1848 it pushes messages. See the more detailed error
1849 state in the corresponding configuration.
1850 """
1851 STATE_UNSPECIFIED = 0
1852 ACTIVE = 1
1853 RESOURCE_ERROR = 2
1854
1855 class AnalyticsHubSubscriptionInfo(proto.Message):
1856 r"""Information about an associated `Analytics Hub
1857 subscription <https://cloud.google.com/bigquery/docs/analytics-hub-manage-subscriptions>`__.
1858
1859 Attributes:
1860 listing (str):
1861 Optional. The name of the associated Analytics Hub listing
1862 resource. Pattern:
1863 "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}".
1864 subscription (str):
1865 Optional. The name of the associated
1866 Analytics Hub subscription resource. Pattern:
1867
1868 "projects/{project}/locations/{location}/subscriptions/{subscription}".
1869 """
1870
1871 listing: str = proto.Field(
1872 proto.STRING,
1873 number=1,
1874 )
1875 subscription: str = proto.Field(
1876 proto.STRING,
1877 number=2,
1878 )
1879
1880 name: str = proto.Field(
1881 proto.STRING,
1882 number=1,
1883 )
1884 topic: str = proto.Field(
1885 proto.STRING,
1886 number=2,
1887 )
1888 push_config: "PushConfig" = proto.Field(
1889 proto.MESSAGE,
1890 number=4,
1891 message="PushConfig",
1892 )
1893 bigquery_config: "BigQueryConfig" = proto.Field(
1894 proto.MESSAGE,
1895 number=18,
1896 message="BigQueryConfig",
1897 )
1898 cloud_storage_config: "CloudStorageConfig" = proto.Field(
1899 proto.MESSAGE,
1900 number=22,
1901 message="CloudStorageConfig",
1902 )
1903 ack_deadline_seconds: int = proto.Field(
1904 proto.INT32,
1905 number=5,
1906 )
1907 retain_acked_messages: bool = proto.Field(
1908 proto.BOOL,
1909 number=7,
1910 )
1911 message_retention_duration: duration_pb2.Duration = proto.Field(
1912 proto.MESSAGE,
1913 number=8,
1914 message=duration_pb2.Duration,
1915 )
1916 labels: MutableMapping[str, str] = proto.MapField(
1917 proto.STRING,
1918 proto.STRING,
1919 number=9,
1920 )
1921 enable_message_ordering: bool = proto.Field(
1922 proto.BOOL,
1923 number=10,
1924 )
1925 expiration_policy: "ExpirationPolicy" = proto.Field(
1926 proto.MESSAGE,
1927 number=11,
1928 message="ExpirationPolicy",
1929 )
1930 filter: str = proto.Field(
1931 proto.STRING,
1932 number=12,
1933 )
1934 dead_letter_policy: "DeadLetterPolicy" = proto.Field(
1935 proto.MESSAGE,
1936 number=13,
1937 message="DeadLetterPolicy",
1938 )
1939 retry_policy: "RetryPolicy" = proto.Field(
1940 proto.MESSAGE,
1941 number=14,
1942 message="RetryPolicy",
1943 )
1944 detached: bool = proto.Field(
1945 proto.BOOL,
1946 number=15,
1947 )
1948 enable_exactly_once_delivery: bool = proto.Field(
1949 proto.BOOL,
1950 number=16,
1951 )
1952 topic_message_retention_duration: duration_pb2.Duration = proto.Field(
1953 proto.MESSAGE,
1954 number=17,
1955 message=duration_pb2.Duration,
1956 )
1957 state: State = proto.Field(
1958 proto.ENUM,
1959 number=19,
1960 enum=State,
1961 )
1962 analytics_hub_subscription_info: AnalyticsHubSubscriptionInfo = proto.Field(
1963 proto.MESSAGE,
1964 number=23,
1965 message=AnalyticsHubSubscriptionInfo,
1966 )
1967 message_transforms: MutableSequence["MessageTransform"] = proto.RepeatedField(
1968 proto.MESSAGE,
1969 number=25,
1970 message="MessageTransform",
1971 )
1972
1973
1974class RetryPolicy(proto.Message):
1975 r"""A policy that specifies how Pub/Sub retries message delivery.
1976
1977 Retry delay will be exponential based on provided minimum and
1978 maximum backoffs. https://en.wikipedia.org/wiki/Exponential_backoff.
1979
1980 RetryPolicy will be triggered on NACKs or acknowledgement deadline
1981 exceeded events for a given message.
1982
1983 Retry Policy is implemented on a best effort basis. At times, the
1984 delay between consecutive deliveries may not match the
1985 configuration. That is, delay can be more or less than configured
1986 backoff.
1987
1988 Attributes:
1989 minimum_backoff (google.protobuf.duration_pb2.Duration):
1990 Optional. The minimum delay between
1991 consecutive deliveries of a given message. Value
1992 should be between 0 and 600 seconds. Defaults to
1993 10 seconds.
1994 maximum_backoff (google.protobuf.duration_pb2.Duration):
1995 Optional. The maximum delay between
1996 consecutive deliveries of a given message. Value
1997 should be between 0 and 600 seconds. Defaults to
1998 600 seconds.
1999 """
2000
2001 minimum_backoff: duration_pb2.Duration = proto.Field(
2002 proto.MESSAGE,
2003 number=1,
2004 message=duration_pb2.Duration,
2005 )
2006 maximum_backoff: duration_pb2.Duration = proto.Field(
2007 proto.MESSAGE,
2008 number=2,
2009 message=duration_pb2.Duration,
2010 )
2011
2012
2013class DeadLetterPolicy(proto.Message):
2014 r"""Dead lettering is done on a best effort basis. The same
2015 message might be dead lettered multiple times.
2016
2017 If validation on any of the fields fails at subscription
2018 creation/updation, the create/update subscription request will
2019 fail.
2020
2021 Attributes:
2022 dead_letter_topic (str):
2023 Optional. The name of the topic to which dead letter
2024 messages should be published. Format is
2025 ``projects/{project}/topics/{topic}``.The Pub/Sub service
2026 account associated with the enclosing subscription's parent
2027 project (i.e.,
2028 service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com)
2029 must have permission to Publish() to this topic.
2030
2031 The operation will fail if the topic does not exist. Users
2032 should ensure that there is a subscription attached to this
2033 topic since messages published to a topic with no
2034 subscriptions are lost.
2035 max_delivery_attempts (int):
2036 Optional. The maximum number of delivery attempts for any
2037 message. The value must be between 5 and 100.
2038
2039 The number of delivery attempts is defined as 1 + (the sum
2040 of number of NACKs and number of times the acknowledgement
2041 deadline has been exceeded for the message).
2042
2043 A NACK is any call to ModifyAckDeadline with a 0 deadline.
2044 Note that client libraries may automatically extend
2045 ack_deadlines.
2046
2047 This field will be honored on a best effort basis.
2048
2049 If this parameter is 0, a default value of 5 is used.
2050 """
2051
2052 dead_letter_topic: str = proto.Field(
2053 proto.STRING,
2054 number=1,
2055 )
2056 max_delivery_attempts: int = proto.Field(
2057 proto.INT32,
2058 number=2,
2059 )
2060
2061
2062class ExpirationPolicy(proto.Message):
2063 r"""A policy that specifies the conditions for resource
2064 expiration (i.e., automatic resource deletion).
2065
2066 Attributes:
2067 ttl (google.protobuf.duration_pb2.Duration):
2068 Optional. Specifies the "time-to-live" duration for an
2069 associated resource. The resource expires if it is not
2070 active for a period of ``ttl``. The definition of "activity"
2071 depends on the type of the associated resource. The minimum
2072 and maximum allowed values for ``ttl`` depend on the type of
2073 the associated resource, as well. If ``ttl`` is not set, the
2074 associated resource never expires.
2075 """
2076
2077 ttl: duration_pb2.Duration = proto.Field(
2078 proto.MESSAGE,
2079 number=1,
2080 message=duration_pb2.Duration,
2081 )
2082
2083
2084class PushConfig(proto.Message):
2085 r"""Configuration for a push delivery endpoint.
2086
2087 This message has `oneof`_ fields (mutually exclusive fields).
2088 For each oneof, at most one member field can be set at the same time.
2089 Setting any member of the oneof automatically clears all other
2090 members.
2091
2092 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
2093
2094 Attributes:
2095 push_endpoint (str):
2096 Optional. A URL locating the endpoint to which messages
2097 should be pushed. For example, a Webhook endpoint might use
2098 ``https://example.com/push``.
2099 attributes (MutableMapping[str, str]):
2100 Optional. Endpoint configuration attributes that can be used
2101 to control different aspects of the message delivery.
2102
2103 The only currently supported attribute is
2104 ``x-goog-version``, which you can use to change the format
2105 of the pushed message. This attribute indicates the version
2106 of the data expected by the endpoint. This controls the
2107 shape of the pushed message (i.e., its fields and metadata).
2108
2109 If not present during the ``CreateSubscription`` call, it
2110 will default to the version of the Pub/Sub API used to make
2111 such call. If not present in a ``ModifyPushConfig`` call,
2112 its value will not be changed. ``GetSubscription`` calls
2113 will always return a valid version, even if the subscription
2114 was created without this attribute.
2115
2116 The only supported values for the ``x-goog-version``
2117 attribute are:
2118
2119 - ``v1beta1``: uses the push format defined in the v1beta1
2120 Pub/Sub API.
2121 - ``v1`` or ``v1beta2``: uses the push format defined in
2122 the v1 Pub/Sub API.
2123
2124 For example: ``attributes { "x-goog-version": "v1" }``
2125 oidc_token (google.pubsub_v1.types.PushConfig.OidcToken):
2126 Optional. If specified, Pub/Sub will generate and attach an
2127 OIDC JWT token as an ``Authorization`` header in the HTTP
2128 request for every pushed message.
2129
2130 This field is a member of `oneof`_ ``authentication_method``.
2131 pubsub_wrapper (google.pubsub_v1.types.PushConfig.PubsubWrapper):
2132 Optional. When set, the payload to the push
2133 endpoint is in the form of the JSON
2134 representation of a PubsubMessage
2135 (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
2136
2137 This field is a member of `oneof`_ ``wrapper``.
2138 no_wrapper (google.pubsub_v1.types.PushConfig.NoWrapper):
2139 Optional. When set, the payload to the push
2140 endpoint is not wrapped.
2141
2142 This field is a member of `oneof`_ ``wrapper``.
2143 """
2144
2145 class OidcToken(proto.Message):
2146 r"""Contains information needed for generating an `OpenID Connect
2147 token <https://developers.google.com/identity/protocols/OpenIDConnect>`__.
2148
2149 Attributes:
2150 service_account_email (str):
2151 Optional. `Service account
2152 email <https://cloud.google.com/iam/docs/service-accounts>`__
2153 used for generating the OIDC token. For more information on
2154 setting up authentication, see `Push
2155 subscriptions <https://cloud.google.com/pubsub/docs/push>`__.
2156 audience (str):
2157 Optional. Audience to be used when generating
2158 OIDC token. The audience claim identifies the
2159 recipients that the JWT is intended for. The
2160 audience value is a single case-sensitive
2161 string. Having multiple values (array) for the
2162 audience field is not supported. More info about
2163 the OIDC JWT token audience here:
2164
2165 https://tools.ietf.org/html/rfc7519#section-4.1.3
2166 Note: if not specified, the Push endpoint URL
2167 will be used.
2168 """
2169
2170 service_account_email: str = proto.Field(
2171 proto.STRING,
2172 number=1,
2173 )
2174 audience: str = proto.Field(
2175 proto.STRING,
2176 number=2,
2177 )
2178
2179 class PubsubWrapper(proto.Message):
2180 r"""The payload to the push endpoint is in the form of the JSON
2181 representation of a PubsubMessage
2182 (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
2183
2184 """
2185
2186 class NoWrapper(proto.Message):
2187 r"""Sets the ``data`` field as the HTTP body for delivery.
2188
2189 Attributes:
2190 write_metadata (bool):
2191 Optional. When true, writes the Pub/Sub message metadata to
2192 ``x-goog-pubsub-<KEY>:<VAL>`` headers of the HTTP request.
2193 Writes the Pub/Sub message attributes to ``<KEY>:<VAL>``
2194 headers of the HTTP request.
2195 """
2196
2197 write_metadata: bool = proto.Field(
2198 proto.BOOL,
2199 number=1,
2200 )
2201
2202 push_endpoint: str = proto.Field(
2203 proto.STRING,
2204 number=1,
2205 )
2206 attributes: MutableMapping[str, str] = proto.MapField(
2207 proto.STRING,
2208 proto.STRING,
2209 number=2,
2210 )
2211 oidc_token: OidcToken = proto.Field(
2212 proto.MESSAGE,
2213 number=3,
2214 oneof="authentication_method",
2215 message=OidcToken,
2216 )
2217 pubsub_wrapper: PubsubWrapper = proto.Field(
2218 proto.MESSAGE,
2219 number=4,
2220 oneof="wrapper",
2221 message=PubsubWrapper,
2222 )
2223 no_wrapper: NoWrapper = proto.Field(
2224 proto.MESSAGE,
2225 number=5,
2226 oneof="wrapper",
2227 message=NoWrapper,
2228 )
2229
2230
2231class BigQueryConfig(proto.Message):
2232 r"""Configuration for a BigQuery subscription.
2233
2234 Attributes:
2235 table (str):
2236 Optional. The name of the table to which to
2237 write data, of the form
2238 {projectId}.{datasetId}.{tableId}
2239 use_topic_schema (bool):
2240 Optional. When true, use the topic's schema as the columns
2241 to write to in BigQuery, if it exists. ``use_topic_schema``
2242 and ``use_table_schema`` cannot be enabled at the same time.
2243 write_metadata (bool):
2244 Optional. When true, write the subscription name,
2245 message_id, publish_time, attributes, and ordering_key to
2246 additional columns in the table. The subscription name,
2247 message_id, and publish_time fields are put in their own
2248 columns while all other message properties (other than data)
2249 are written to a JSON object in the attributes column.
2250 drop_unknown_fields (bool):
2251 Optional. When true and use_topic_schema is true, any fields
2252 that are a part of the topic schema that are not part of the
2253 BigQuery table schema are dropped when writing to BigQuery.
2254 Otherwise, the schemas must be kept in sync and any messages
2255 with extra fields are not written and remain in the
2256 subscription's backlog.
2257 state (google.pubsub_v1.types.BigQueryConfig.State):
2258 Output only. An output-only field that
2259 indicates whether or not the subscription can
2260 receive messages.
2261 use_table_schema (bool):
2262 Optional. When true, use the BigQuery table's schema as the
2263 columns to write to in BigQuery. ``use_table_schema`` and
2264 ``use_topic_schema`` cannot be enabled at the same time.
2265 service_account_email (str):
2266 Optional. The service account to use to write to BigQuery.
2267 The subscription creator or updater that specifies this
2268 field must have ``iam.serviceAccounts.actAs`` permission on
2269 the service account. If not specified, the Pub/Sub `service
2270 agent <https://cloud.google.com/iam/docs/service-agents>`__,
2271 service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com,
2272 is used.
2273 """
2274
2275 class State(proto.Enum):
2276 r"""Possible states for a BigQuery subscription.
2277
2278 Values:
2279 STATE_UNSPECIFIED (0):
2280 Default value. This value is unused.
2281 ACTIVE (1):
2282 The subscription can actively send messages
2283 to BigQuery
2284 PERMISSION_DENIED (2):
2285 Cannot write to the BigQuery table because of permission
2286 denied errors. This can happen if
2287
2288 - Pub/Sub SA has not been granted the `appropriate BigQuery
2289 IAM
2290 permissions <https://cloud.google.com/pubsub/docs/create-subscription#assign_bigquery_service_account>`__
2291 - bigquery.googleapis.com API is not enabled for the
2292 project
2293 (`instructions <https://cloud.google.com/service-usage/docs/enable-disable>`__)
2294 NOT_FOUND (3):
2295 Cannot write to the BigQuery table because it
2296 does not exist.
2297 SCHEMA_MISMATCH (4):
2298 Cannot write to the BigQuery table due to a
2299 schema mismatch.
2300 IN_TRANSIT_LOCATION_RESTRICTION (5):
2301 Cannot write to the destination because enforce_in_transit
2302 is set to true and the destination locations are not in the
2303 allowed regions.
2304 """
2305 STATE_UNSPECIFIED = 0
2306 ACTIVE = 1
2307 PERMISSION_DENIED = 2
2308 NOT_FOUND = 3
2309 SCHEMA_MISMATCH = 4
2310 IN_TRANSIT_LOCATION_RESTRICTION = 5
2311
2312 table: str = proto.Field(
2313 proto.STRING,
2314 number=1,
2315 )
2316 use_topic_schema: bool = proto.Field(
2317 proto.BOOL,
2318 number=2,
2319 )
2320 write_metadata: bool = proto.Field(
2321 proto.BOOL,
2322 number=3,
2323 )
2324 drop_unknown_fields: bool = proto.Field(
2325 proto.BOOL,
2326 number=4,
2327 )
2328 state: State = proto.Field(
2329 proto.ENUM,
2330 number=5,
2331 enum=State,
2332 )
2333 use_table_schema: bool = proto.Field(
2334 proto.BOOL,
2335 number=6,
2336 )
2337 service_account_email: str = proto.Field(
2338 proto.STRING,
2339 number=7,
2340 )
2341
2342
2343class CloudStorageConfig(proto.Message):
2344 r"""Configuration for a Cloud Storage subscription.
2345
2346 This message has `oneof`_ fields (mutually exclusive fields).
2347 For each oneof, at most one member field can be set at the same time.
2348 Setting any member of the oneof automatically clears all other
2349 members.
2350
2351 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
2352
2353 Attributes:
2354 bucket (str):
2355 Required. User-provided name for the Cloud Storage bucket.
2356 The bucket must be created by the user. The bucket name must
2357 be without any prefix like "gs://". See the [bucket naming
2358 requirements]
2359 (https://cloud.google.com/storage/docs/buckets#naming).
2360 filename_prefix (str):
2361 Optional. User-provided prefix for Cloud Storage filename.
2362 See the `object naming
2363 requirements <https://cloud.google.com/storage/docs/objects#naming>`__.
2364 filename_suffix (str):
2365 Optional. User-provided suffix for Cloud Storage filename.
2366 See the `object naming
2367 requirements <https://cloud.google.com/storage/docs/objects#naming>`__.
2368 Must not end in "/".
2369 filename_datetime_format (str):
2370 Optional. User-provided format string specifying how to
2371 represent datetimes in Cloud Storage filenames. See the
2372 `datetime format
2373 guidance <https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names>`__.
2374 text_config (google.pubsub_v1.types.CloudStorageConfig.TextConfig):
2375 Optional. If set, message data will be
2376 written to Cloud Storage in text format.
2377
2378 This field is a member of `oneof`_ ``output_format``.
2379 avro_config (google.pubsub_v1.types.CloudStorageConfig.AvroConfig):
2380 Optional. If set, message data will be
2381 written to Cloud Storage in Avro format.
2382
2383 This field is a member of `oneof`_ ``output_format``.
2384 max_duration (google.protobuf.duration_pb2.Duration):
2385 Optional. The maximum duration that can
2386 elapse before a new Cloud Storage file is
2387 created. Min 1 minute, max 10 minutes, default 5
2388 minutes. May not exceed the subscription's
2389 acknowledgement deadline.
2390 max_bytes (int):
2391 Optional. The maximum bytes that can be written to a Cloud
2392 Storage file before a new file is created. Min 1 KB, max 10
2393 GiB. The max_bytes limit may be exceeded in cases where
2394 messages are larger than the limit.
2395 max_messages (int):
2396 Optional. The maximum number of messages that
2397 can be written to a Cloud Storage file before a
2398 new file is created. Min 1000 messages.
2399 state (google.pubsub_v1.types.CloudStorageConfig.State):
2400 Output only. An output-only field that
2401 indicates whether or not the subscription can
2402 receive messages.
2403 service_account_email (str):
2404 Optional. The service account to use to write to Cloud
2405 Storage. The subscription creator or updater that specifies
2406 this field must have ``iam.serviceAccounts.actAs``
2407 permission on the service account. If not specified, the
2408 Pub/Sub `service
2409 agent <https://cloud.google.com/iam/docs/service-agents>`__,
2410 service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com,
2411 is used.
2412 """
2413
2414 class State(proto.Enum):
2415 r"""Possible states for a Cloud Storage subscription.
2416
2417 Values:
2418 STATE_UNSPECIFIED (0):
2419 Default value. This value is unused.
2420 ACTIVE (1):
2421 The subscription can actively send messages
2422 to Cloud Storage.
2423 PERMISSION_DENIED (2):
2424 Cannot write to the Cloud Storage bucket
2425 because of permission denied errors.
2426 NOT_FOUND (3):
2427 Cannot write to the Cloud Storage bucket
2428 because it does not exist.
2429 IN_TRANSIT_LOCATION_RESTRICTION (4):
2430 Cannot write to the destination because enforce_in_transit
2431 is set to true and the destination locations are not in the
2432 allowed regions.
2433 SCHEMA_MISMATCH (5):
2434 Cannot write to the Cloud Storage bucket due
2435 to an incompatibility between the topic schema
2436 and subscription settings.
2437 """
2438 STATE_UNSPECIFIED = 0
2439 ACTIVE = 1
2440 PERMISSION_DENIED = 2
2441 NOT_FOUND = 3
2442 IN_TRANSIT_LOCATION_RESTRICTION = 4
2443 SCHEMA_MISMATCH = 5
2444
2445 class TextConfig(proto.Message):
2446 r"""Configuration for writing message data in text format.
2447 Message payloads will be written to files as raw text, separated
2448 by a newline.
2449
2450 """
2451
2452 class AvroConfig(proto.Message):
2453 r"""Configuration for writing message data in Avro format.
2454 Message payloads and metadata will be written to files as an
2455 Avro binary.
2456
2457 Attributes:
2458 write_metadata (bool):
2459 Optional. When true, write the subscription name,
2460 message_id, publish_time, attributes, and ordering_key as
2461 additional fields in the output. The subscription name,
2462 message_id, and publish_time fields are put in their own
2463 fields while all other message properties other than data
2464 (for example, an ordering_key, if present) are added as
2465 entries in the attributes map.
2466 use_topic_schema (bool):
2467 Optional. When true, the output Cloud Storage
2468 file will be serialized using the topic schema,
2469 if it exists.
2470 """
2471
2472 write_metadata: bool = proto.Field(
2473 proto.BOOL,
2474 number=1,
2475 )
2476 use_topic_schema: bool = proto.Field(
2477 proto.BOOL,
2478 number=2,
2479 )
2480
2481 bucket: str = proto.Field(
2482 proto.STRING,
2483 number=1,
2484 )
2485 filename_prefix: str = proto.Field(
2486 proto.STRING,
2487 number=2,
2488 )
2489 filename_suffix: str = proto.Field(
2490 proto.STRING,
2491 number=3,
2492 )
2493 filename_datetime_format: str = proto.Field(
2494 proto.STRING,
2495 number=10,
2496 )
2497 text_config: TextConfig = proto.Field(
2498 proto.MESSAGE,
2499 number=4,
2500 oneof="output_format",
2501 message=TextConfig,
2502 )
2503 avro_config: AvroConfig = proto.Field(
2504 proto.MESSAGE,
2505 number=5,
2506 oneof="output_format",
2507 message=AvroConfig,
2508 )
2509 max_duration: duration_pb2.Duration = proto.Field(
2510 proto.MESSAGE,
2511 number=6,
2512 message=duration_pb2.Duration,
2513 )
2514 max_bytes: int = proto.Field(
2515 proto.INT64,
2516 number=7,
2517 )
2518 max_messages: int = proto.Field(
2519 proto.INT64,
2520 number=8,
2521 )
2522 state: State = proto.Field(
2523 proto.ENUM,
2524 number=9,
2525 enum=State,
2526 )
2527 service_account_email: str = proto.Field(
2528 proto.STRING,
2529 number=11,
2530 )
2531
2532
2533class ReceivedMessage(proto.Message):
2534 r"""A message and its corresponding acknowledgment ID.
2535
2536 Attributes:
2537 ack_id (str):
2538 Optional. This ID can be used to acknowledge
2539 the received message.
2540 message (google.pubsub_v1.types.PubsubMessage):
2541 Optional. The message.
2542 delivery_attempt (int):
2543 Optional. The approximate number of times that Pub/Sub has
2544 attempted to deliver the associated message to a subscriber.
2545
2546 More precisely, this is 1 + (number of NACKs) + (number of
2547 ack_deadline exceeds) for this message.
2548
2549 A NACK is any call to ModifyAckDeadline with a 0 deadline.
2550 An ack_deadline exceeds event is whenever a message is not
2551 acknowledged within ack_deadline. Note that ack_deadline is
2552 initially Subscription.ackDeadlineSeconds, but may get
2553 extended automatically by the client library.
2554
2555 Upon the first delivery of a given message,
2556 ``delivery_attempt`` will have a value of 1. The value is
2557 calculated at best effort and is approximate.
2558
2559 If a DeadLetterPolicy is not set on the subscription, this
2560 will be 0.
2561 """
2562
2563 ack_id: str = proto.Field(
2564 proto.STRING,
2565 number=1,
2566 )
2567 message: "PubsubMessage" = proto.Field(
2568 proto.MESSAGE,
2569 number=2,
2570 message="PubsubMessage",
2571 )
2572 delivery_attempt: int = proto.Field(
2573 proto.INT32,
2574 number=3,
2575 )
2576
2577
2578class GetSubscriptionRequest(proto.Message):
2579 r"""Request for the GetSubscription method.
2580
2581 Attributes:
2582 subscription (str):
2583 Required. The name of the subscription to get. Format is
2584 ``projects/{project}/subscriptions/{sub}``.
2585 """
2586
2587 subscription: str = proto.Field(
2588 proto.STRING,
2589 number=1,
2590 )
2591
2592
2593class UpdateSubscriptionRequest(proto.Message):
2594 r"""Request for the UpdateSubscription method.
2595
2596 Attributes:
2597 subscription (google.pubsub_v1.types.Subscription):
2598 Required. The updated subscription object.
2599 update_mask (google.protobuf.field_mask_pb2.FieldMask):
2600 Required. Indicates which fields in the
2601 provided subscription to update. Must be
2602 specified and non-empty.
2603 """
2604
2605 subscription: "Subscription" = proto.Field(
2606 proto.MESSAGE,
2607 number=1,
2608 message="Subscription",
2609 )
2610 update_mask: field_mask_pb2.FieldMask = proto.Field(
2611 proto.MESSAGE,
2612 number=2,
2613 message=field_mask_pb2.FieldMask,
2614 )
2615
2616
2617class ListSubscriptionsRequest(proto.Message):
2618 r"""Request for the ``ListSubscriptions`` method.
2619
2620 Attributes:
2621 project (str):
2622 Required. The name of the project in which to list
2623 subscriptions. Format is ``projects/{project-id}``.
2624 page_size (int):
2625 Optional. Maximum number of subscriptions to
2626 return.
2627 page_token (str):
2628 Optional. The value returned by the last
2629 ``ListSubscriptionsResponse``; indicates that this is a
2630 continuation of a prior ``ListSubscriptions`` call, and that
2631 the system should return the next page of data.
2632 """
2633
2634 project: str = proto.Field(
2635 proto.STRING,
2636 number=1,
2637 )
2638 page_size: int = proto.Field(
2639 proto.INT32,
2640 number=2,
2641 )
2642 page_token: str = proto.Field(
2643 proto.STRING,
2644 number=3,
2645 )
2646
2647
2648class ListSubscriptionsResponse(proto.Message):
2649 r"""Response for the ``ListSubscriptions`` method.
2650
2651 Attributes:
2652 subscriptions (MutableSequence[google.pubsub_v1.types.Subscription]):
2653 Optional. The subscriptions that match the
2654 request.
2655 next_page_token (str):
2656 Optional. If not empty, indicates that there may be more
2657 subscriptions that match the request; this value should be
2658 passed in a new ``ListSubscriptionsRequest`` to get more
2659 subscriptions.
2660 """
2661
2662 @property
2663 def raw_page(self):
2664 return self
2665
2666 subscriptions: MutableSequence["Subscription"] = proto.RepeatedField(
2667 proto.MESSAGE,
2668 number=1,
2669 message="Subscription",
2670 )
2671 next_page_token: str = proto.Field(
2672 proto.STRING,
2673 number=2,
2674 )
2675
2676
2677class DeleteSubscriptionRequest(proto.Message):
2678 r"""Request for the DeleteSubscription method.
2679
2680 Attributes:
2681 subscription (str):
2682 Required. The subscription to delete. Format is
2683 ``projects/{project}/subscriptions/{sub}``.
2684 """
2685
2686 subscription: str = proto.Field(
2687 proto.STRING,
2688 number=1,
2689 )
2690
2691
2692class ModifyPushConfigRequest(proto.Message):
2693 r"""Request for the ModifyPushConfig method.
2694
2695 Attributes:
2696 subscription (str):
2697 Required. The name of the subscription. Format is
2698 ``projects/{project}/subscriptions/{sub}``.
2699 push_config (google.pubsub_v1.types.PushConfig):
2700 Required. The push configuration for future deliveries.
2701
2702 An empty ``pushConfig`` indicates that the Pub/Sub system
2703 should stop pushing messages from the given subscription and
2704 allow messages to be pulled and acknowledged - effectively
2705 pausing the subscription if ``Pull`` or ``StreamingPull`` is
2706 not called.
2707 """
2708
2709 subscription: str = proto.Field(
2710 proto.STRING,
2711 number=1,
2712 )
2713 push_config: "PushConfig" = proto.Field(
2714 proto.MESSAGE,
2715 number=2,
2716 message="PushConfig",
2717 )
2718
2719
2720class PullRequest(proto.Message):
2721 r"""Request for the ``Pull`` method.
2722
2723 Attributes:
2724 subscription (str):
2725 Required. The subscription from which messages should be
2726 pulled. Format is
2727 ``projects/{project}/subscriptions/{sub}``.
2728 return_immediately (bool):
2729 Optional. If this field set to true, the system will respond
2730 immediately even if it there are no messages available to
2731 return in the ``Pull`` response. Otherwise, the system may
2732 wait (for a bounded amount of time) until at least one
2733 message is available, rather than returning no messages.
2734 Warning: setting this field to ``true`` is discouraged
2735 because it adversely impacts the performance of ``Pull``
2736 operations. We recommend that users do not set this field.
2737 max_messages (int):
2738 Required. The maximum number of messages to
2739 return for this request. Must be a positive
2740 integer. The Pub/Sub system may return fewer
2741 than the number specified.
2742 """
2743
2744 subscription: str = proto.Field(
2745 proto.STRING,
2746 number=1,
2747 )
2748 return_immediately: bool = proto.Field(
2749 proto.BOOL,
2750 number=2,
2751 )
2752 max_messages: int = proto.Field(
2753 proto.INT32,
2754 number=3,
2755 )
2756
2757
2758class PullResponse(proto.Message):
2759 r"""Response for the ``Pull`` method.
2760
2761 Attributes:
2762 received_messages (MutableSequence[google.pubsub_v1.types.ReceivedMessage]):
2763 Optional. Received Pub/Sub messages. The list will be empty
2764 if there are no more messages available in the backlog, or
2765 if no messages could be returned before the request timeout.
2766 For JSON, the response can be entirely empty. The Pub/Sub
2767 system may return fewer than the ``maxMessages`` requested
2768 even if there are more messages available in the backlog.
2769 """
2770
2771 received_messages: MutableSequence["ReceivedMessage"] = proto.RepeatedField(
2772 proto.MESSAGE,
2773 number=1,
2774 message="ReceivedMessage",
2775 )
2776
2777
2778class ModifyAckDeadlineRequest(proto.Message):
2779 r"""Request for the ModifyAckDeadline method.
2780
2781 Attributes:
2782 subscription (str):
2783 Required. The name of the subscription. Format is
2784 ``projects/{project}/subscriptions/{sub}``.
2785 ack_ids (MutableSequence[str]):
2786 Required. List of acknowledgment IDs.
2787 ack_deadline_seconds (int):
2788 Required. The new ack deadline with respect to the time this
2789 request was sent to the Pub/Sub system. For example, if the
2790 value is 10, the new ack deadline will expire 10 seconds
2791 after the ``ModifyAckDeadline`` call was made. Specifying
2792 zero might immediately make the message available for
2793 delivery to another subscriber client. This typically
2794 results in an increase in the rate of message redeliveries
2795 (that is, duplicates). The minimum deadline you can specify
2796 is 0 seconds. The maximum deadline you can specify in a
2797 single request is 600 seconds (10 minutes).
2798 """
2799
2800 subscription: str = proto.Field(
2801 proto.STRING,
2802 number=1,
2803 )
2804 ack_ids: MutableSequence[str] = proto.RepeatedField(
2805 proto.STRING,
2806 number=4,
2807 )
2808 ack_deadline_seconds: int = proto.Field(
2809 proto.INT32,
2810 number=3,
2811 )
2812
2813
2814class AcknowledgeRequest(proto.Message):
2815 r"""Request for the Acknowledge method.
2816
2817 Attributes:
2818 subscription (str):
2819 Required. The subscription whose message is being
2820 acknowledged. Format is
2821 ``projects/{project}/subscriptions/{sub}``.
2822 ack_ids (MutableSequence[str]):
2823 Required. The acknowledgment ID for the messages being
2824 acknowledged that was returned by the Pub/Sub system in the
2825 ``Pull`` response. Must not be empty.
2826 """
2827
2828 subscription: str = proto.Field(
2829 proto.STRING,
2830 number=1,
2831 )
2832 ack_ids: MutableSequence[str] = proto.RepeatedField(
2833 proto.STRING,
2834 number=2,
2835 )
2836
2837
2838class StreamingPullRequest(proto.Message):
2839 r"""Request for the ``StreamingPull`` streaming RPC method. This request
2840 is used to establish the initial stream as well as to stream
2841 acknowledgements and ack deadline modifications from the client to
2842 the server.
2843
2844 Attributes:
2845 subscription (str):
2846 Required. The subscription for which to initialize the new
2847 stream. This must be provided in the first request on the
2848 stream, and must not be set in subsequent requests from
2849 client to server. Format is
2850 ``projects/{project}/subscriptions/{sub}``.
2851 ack_ids (MutableSequence[str]):
2852 Optional. List of acknowledgement IDs for acknowledging
2853 previously received messages (received on this stream or a
2854 different stream). If an ack ID has expired, the
2855 corresponding message may be redelivered later.
2856 Acknowledging a message more than once will not result in an
2857 error. If the acknowledgement ID is malformed, the stream
2858 will be aborted with status ``INVALID_ARGUMENT``.
2859 modify_deadline_seconds (MutableSequence[int]):
2860 Optional. The list of new ack deadlines for the IDs listed
2861 in ``modify_deadline_ack_ids``. The size of this list must
2862 be the same as the size of ``modify_deadline_ack_ids``. If
2863 it differs the stream will be aborted with
2864 ``INVALID_ARGUMENT``. Each element in this list is applied
2865 to the element in the same position in
2866 ``modify_deadline_ack_ids``. The new ack deadline is with
2867 respect to the time this request was sent to the Pub/Sub
2868 system. Must be >= 0. For example, if the value is 10, the
2869 new ack deadline will expire 10 seconds after this request
2870 is received. If the value is 0, the message is immediately
2871 made available for another streaming or non-streaming pull
2872 request. If the value is < 0 (an error), the stream will be
2873 aborted with status ``INVALID_ARGUMENT``.
2874 modify_deadline_ack_ids (MutableSequence[str]):
2875 Optional. List of acknowledgement IDs whose deadline will be
2876 modified based on the corresponding element in
2877 ``modify_deadline_seconds``. This field can be used to
2878 indicate that more time is needed to process a message by
2879 the subscriber, or to make the message available for
2880 redelivery if the processing was interrupted.
2881 stream_ack_deadline_seconds (int):
2882 Required. The ack deadline to use for the
2883 stream. This must be provided in the first
2884 request on the stream, but it can also be
2885 updated on subsequent requests from client to
2886 server. The minimum deadline you can specify is
2887 10 seconds. The maximum deadline you can specify
2888 is 600 seconds (10 minutes).
2889 client_id (str):
2890 Optional. A unique identifier that is used to distinguish
2891 client instances from each other. Only needs to be provided
2892 on the initial request. When a stream disconnects and
2893 reconnects for the same stream, the client_id should be set
2894 to the same value so that state associated with the old
2895 stream can be transferred to the new stream. The same
2896 client_id should not be used for different client instances.
2897 max_outstanding_messages (int):
2898 Optional. Flow control settings for the maximum number of
2899 outstanding messages. When there are
2900 ``max_outstanding_messages`` currently sent to the streaming
2901 pull client that have not yet been acked or nacked, the
2902 server stops sending more messages. The sending of messages
2903 resumes once the number of outstanding messages is less than
2904 this value. If the value is <= 0, there is no limit to the
2905 number of outstanding messages. This property can only be
2906 set on the initial StreamingPullRequest. If it is set on a
2907 subsequent request, the stream will be aborted with status
2908 ``INVALID_ARGUMENT``.
2909 max_outstanding_bytes (int):
2910 Optional. Flow control settings for the maximum number of
2911 outstanding bytes. When there are ``max_outstanding_bytes``
2912 or more worth of messages currently sent to the streaming
2913 pull client that have not yet been acked or nacked, the
2914 server will stop sending more messages. The sending of
2915 messages resumes once the number of outstanding bytes is
2916 less than this value. If the value is <= 0, there is no
2917 limit to the number of outstanding bytes. This property can
2918 only be set on the initial StreamingPullRequest. If it is
2919 set on a subsequent request, the stream will be aborted with
2920 status ``INVALID_ARGUMENT``.
2921 """
2922
2923 subscription: str = proto.Field(
2924 proto.STRING,
2925 number=1,
2926 )
2927 ack_ids: MutableSequence[str] = proto.RepeatedField(
2928 proto.STRING,
2929 number=2,
2930 )
2931 modify_deadline_seconds: MutableSequence[int] = proto.RepeatedField(
2932 proto.INT32,
2933 number=3,
2934 )
2935 modify_deadline_ack_ids: MutableSequence[str] = proto.RepeatedField(
2936 proto.STRING,
2937 number=4,
2938 )
2939 stream_ack_deadline_seconds: int = proto.Field(
2940 proto.INT32,
2941 number=5,
2942 )
2943 client_id: str = proto.Field(
2944 proto.STRING,
2945 number=6,
2946 )
2947 max_outstanding_messages: int = proto.Field(
2948 proto.INT64,
2949 number=7,
2950 )
2951 max_outstanding_bytes: int = proto.Field(
2952 proto.INT64,
2953 number=8,
2954 )
2955
2956
2957class StreamingPullResponse(proto.Message):
2958 r"""Response for the ``StreamingPull`` method. This response is used to
2959 stream messages from the server to the client.
2960
2961 Attributes:
2962 received_messages (MutableSequence[google.pubsub_v1.types.ReceivedMessage]):
2963 Optional. Received Pub/Sub messages. This
2964 will not be empty.
2965 acknowledge_confirmation (google.pubsub_v1.types.StreamingPullResponse.AcknowledgeConfirmation):
2966 Optional. This field will only be set if
2967 ``enable_exactly_once_delivery`` is set to ``true``.
2968 modify_ack_deadline_confirmation (google.pubsub_v1.types.StreamingPullResponse.ModifyAckDeadlineConfirmation):
2969 Optional. This field will only be set if
2970 ``enable_exactly_once_delivery`` is set to ``true``.
2971 subscription_properties (google.pubsub_v1.types.StreamingPullResponse.SubscriptionProperties):
2972 Optional. Properties associated with this
2973 subscription.
2974 """
2975
2976 class AcknowledgeConfirmation(proto.Message):
2977 r"""Acknowledgement IDs sent in one or more previous requests to
2978 acknowledge a previously received message.
2979
2980 Attributes:
2981 ack_ids (MutableSequence[str]):
2982 Optional. Successfully processed
2983 acknowledgement IDs.
2984 invalid_ack_ids (MutableSequence[str]):
2985 Optional. List of acknowledgement IDs that
2986 were malformed or whose acknowledgement deadline
2987 has expired.
2988 unordered_ack_ids (MutableSequence[str]):
2989 Optional. List of acknowledgement IDs that
2990 were out of order.
2991 temporary_failed_ack_ids (MutableSequence[str]):
2992 Optional. List of acknowledgement IDs that
2993 failed processing with temporary issues.
2994 """
2995
2996 ack_ids: MutableSequence[str] = proto.RepeatedField(
2997 proto.STRING,
2998 number=1,
2999 )
3000 invalid_ack_ids: MutableSequence[str] = proto.RepeatedField(
3001 proto.STRING,
3002 number=2,
3003 )
3004 unordered_ack_ids: MutableSequence[str] = proto.RepeatedField(
3005 proto.STRING,
3006 number=3,
3007 )
3008 temporary_failed_ack_ids: MutableSequence[str] = proto.RepeatedField(
3009 proto.STRING,
3010 number=4,
3011 )
3012
3013 class ModifyAckDeadlineConfirmation(proto.Message):
3014 r"""Acknowledgement IDs sent in one or more previous requests to
3015 modify the deadline for a specific message.
3016
3017 Attributes:
3018 ack_ids (MutableSequence[str]):
3019 Optional. Successfully processed
3020 acknowledgement IDs.
3021 invalid_ack_ids (MutableSequence[str]):
3022 Optional. List of acknowledgement IDs that
3023 were malformed or whose acknowledgement deadline
3024 has expired.
3025 temporary_failed_ack_ids (MutableSequence[str]):
3026 Optional. List of acknowledgement IDs that
3027 failed processing with temporary issues.
3028 """
3029
3030 ack_ids: MutableSequence[str] = proto.RepeatedField(
3031 proto.STRING,
3032 number=1,
3033 )
3034 invalid_ack_ids: MutableSequence[str] = proto.RepeatedField(
3035 proto.STRING,
3036 number=2,
3037 )
3038 temporary_failed_ack_ids: MutableSequence[str] = proto.RepeatedField(
3039 proto.STRING,
3040 number=3,
3041 )
3042
3043 class SubscriptionProperties(proto.Message):
3044 r"""Subscription properties sent as part of the response.
3045
3046 Attributes:
3047 exactly_once_delivery_enabled (bool):
3048 Optional. True iff exactly once delivery is
3049 enabled for this subscription.
3050 message_ordering_enabled (bool):
3051 Optional. True iff message ordering is
3052 enabled for this subscription.
3053 """
3054
3055 exactly_once_delivery_enabled: bool = proto.Field(
3056 proto.BOOL,
3057 number=1,
3058 )
3059 message_ordering_enabled: bool = proto.Field(
3060 proto.BOOL,
3061 number=2,
3062 )
3063
3064 received_messages: MutableSequence["ReceivedMessage"] = proto.RepeatedField(
3065 proto.MESSAGE,
3066 number=1,
3067 message="ReceivedMessage",
3068 )
3069 acknowledge_confirmation: AcknowledgeConfirmation = proto.Field(
3070 proto.MESSAGE,
3071 number=5,
3072 message=AcknowledgeConfirmation,
3073 )
3074 modify_ack_deadline_confirmation: ModifyAckDeadlineConfirmation = proto.Field(
3075 proto.MESSAGE,
3076 number=3,
3077 message=ModifyAckDeadlineConfirmation,
3078 )
3079 subscription_properties: SubscriptionProperties = proto.Field(
3080 proto.MESSAGE,
3081 number=4,
3082 message=SubscriptionProperties,
3083 )
3084
3085
3086class CreateSnapshotRequest(proto.Message):
3087 r"""Request for the ``CreateSnapshot`` method.
3088
3089 Attributes:
3090 name (str):
3091 Required. User-provided name for this snapshot. If the name
3092 is not provided in the request, the server will assign a
3093 random name for this snapshot on the same project as the
3094 subscription. Note that for REST API requests, you must
3095 specify a name. See the `resource name
3096 rules <https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names>`__.
3097 Format is ``projects/{project}/snapshots/{snap}``.
3098 subscription (str):
3099 Required. The subscription whose backlog the snapshot
3100 retains. Specifically, the created snapshot is guaranteed to
3101 retain: (a) The existing backlog on the subscription. More
3102 precisely, this is defined as the messages in the
3103 subscription's backlog that are unacknowledged upon the
3104 successful completion of the ``CreateSnapshot`` request; as
3105 well as: (b) Any messages published to the subscription's
3106 topic following the successful completion of the
3107 CreateSnapshot request. Format is
3108 ``projects/{project}/subscriptions/{sub}``.
3109 labels (MutableMapping[str, str]):
3110 Optional. See `Creating and managing
3111 labels <https://cloud.google.com/pubsub/docs/labels>`__.
3112 """
3113
3114 name: str = proto.Field(
3115 proto.STRING,
3116 number=1,
3117 )
3118 subscription: str = proto.Field(
3119 proto.STRING,
3120 number=2,
3121 )
3122 labels: MutableMapping[str, str] = proto.MapField(
3123 proto.STRING,
3124 proto.STRING,
3125 number=3,
3126 )
3127
3128
3129class UpdateSnapshotRequest(proto.Message):
3130 r"""Request for the UpdateSnapshot method.
3131
3132 Attributes:
3133 snapshot (google.pubsub_v1.types.Snapshot):
3134 Required. The updated snapshot object.
3135 update_mask (google.protobuf.field_mask_pb2.FieldMask):
3136 Required. Indicates which fields in the
3137 provided snapshot to update. Must be specified
3138 and non-empty.
3139 """
3140
3141 snapshot: "Snapshot" = proto.Field(
3142 proto.MESSAGE,
3143 number=1,
3144 message="Snapshot",
3145 )
3146 update_mask: field_mask_pb2.FieldMask = proto.Field(
3147 proto.MESSAGE,
3148 number=2,
3149 message=field_mask_pb2.FieldMask,
3150 )
3151
3152
3153class Snapshot(proto.Message):
3154 r"""A snapshot resource. Snapshots are used in
3155 `Seek <https://cloud.google.com/pubsub/docs/replay-overview>`__
3156 operations, which allow you to manage message acknowledgments in
3157 bulk. That is, you can set the acknowledgment state of messages in
3158 an existing subscription to the state captured by a snapshot.
3159
3160 Attributes:
3161 name (str):
3162 Optional. The name of the snapshot.
3163 topic (str):
3164 Optional. The name of the topic from which
3165 this snapshot is retaining messages.
3166 expire_time (google.protobuf.timestamp_pb2.Timestamp):
3167 Optional. The snapshot is guaranteed to exist up until this
3168 time. A newly-created snapshot expires no later than 7 days
3169 from the time of its creation. Its exact lifetime is
3170 determined at creation by the existing backlog in the source
3171 subscription. Specifically, the lifetime of the snapshot is
3172 ``7 days - (age of oldest unacked message in the subscription)``.
3173 For example, consider a subscription whose oldest unacked
3174 message is 3 days old. If a snapshot is created from this
3175 subscription, the snapshot -- which will always capture this
3176 3-day-old backlog as long as the snapshot exists -- will
3177 expire in 4 days. The service will refuse to create a
3178 snapshot that would expire in less than 1 hour after
3179 creation.
3180 labels (MutableMapping[str, str]):
3181 Optional. See [Creating and managing labels]
3182 (https://cloud.google.com/pubsub/docs/labels).
3183 """
3184
3185 name: str = proto.Field(
3186 proto.STRING,
3187 number=1,
3188 )
3189 topic: str = proto.Field(
3190 proto.STRING,
3191 number=2,
3192 )
3193 expire_time: timestamp_pb2.Timestamp = proto.Field(
3194 proto.MESSAGE,
3195 number=3,
3196 message=timestamp_pb2.Timestamp,
3197 )
3198 labels: MutableMapping[str, str] = proto.MapField(
3199 proto.STRING,
3200 proto.STRING,
3201 number=4,
3202 )
3203
3204
3205class GetSnapshotRequest(proto.Message):
3206 r"""Request for the GetSnapshot method.
3207
3208 Attributes:
3209 snapshot (str):
3210 Required. The name of the snapshot to get. Format is
3211 ``projects/{project}/snapshots/{snap}``.
3212 """
3213
3214 snapshot: str = proto.Field(
3215 proto.STRING,
3216 number=1,
3217 )
3218
3219
3220class ListSnapshotsRequest(proto.Message):
3221 r"""Request for the ``ListSnapshots`` method.
3222
3223 Attributes:
3224 project (str):
3225 Required. The name of the project in which to list
3226 snapshots. Format is ``projects/{project-id}``.
3227 page_size (int):
3228 Optional. Maximum number of snapshots to
3229 return.
3230 page_token (str):
3231 Optional. The value returned by the last
3232 ``ListSnapshotsResponse``; indicates that this is a
3233 continuation of a prior ``ListSnapshots`` call, and that the
3234 system should return the next page of data.
3235 """
3236
3237 project: str = proto.Field(
3238 proto.STRING,
3239 number=1,
3240 )
3241 page_size: int = proto.Field(
3242 proto.INT32,
3243 number=2,
3244 )
3245 page_token: str = proto.Field(
3246 proto.STRING,
3247 number=3,
3248 )
3249
3250
3251class ListSnapshotsResponse(proto.Message):
3252 r"""Response for the ``ListSnapshots`` method.
3253
3254 Attributes:
3255 snapshots (MutableSequence[google.pubsub_v1.types.Snapshot]):
3256 Optional. The resulting snapshots.
3257 next_page_token (str):
3258 Optional. If not empty, indicates that there may be more
3259 snapshot that match the request; this value should be passed
3260 in a new ``ListSnapshotsRequest``.
3261 """
3262
3263 @property
3264 def raw_page(self):
3265 return self
3266
3267 snapshots: MutableSequence["Snapshot"] = proto.RepeatedField(
3268 proto.MESSAGE,
3269 number=1,
3270 message="Snapshot",
3271 )
3272 next_page_token: str = proto.Field(
3273 proto.STRING,
3274 number=2,
3275 )
3276
3277
3278class DeleteSnapshotRequest(proto.Message):
3279 r"""Request for the ``DeleteSnapshot`` method.
3280
3281 Attributes:
3282 snapshot (str):
3283 Required. The name of the snapshot to delete. Format is
3284 ``projects/{project}/snapshots/{snap}``.
3285 """
3286
3287 snapshot: str = proto.Field(
3288 proto.STRING,
3289 number=1,
3290 )
3291
3292
3293class SeekRequest(proto.Message):
3294 r"""Request for the ``Seek`` method.
3295
3296 This message has `oneof`_ fields (mutually exclusive fields).
3297 For each oneof, at most one member field can be set at the same time.
3298 Setting any member of the oneof automatically clears all other
3299 members.
3300
3301 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
3302
3303 Attributes:
3304 subscription (str):
3305 Required. The subscription to affect.
3306 time (google.protobuf.timestamp_pb2.Timestamp):
3307 Optional. The time to seek to. Messages retained in the
3308 subscription that were published before this time are marked
3309 as acknowledged, and messages retained in the subscription
3310 that were published after this time are marked as
3311 unacknowledged. Note that this operation affects only those
3312 messages retained in the subscription (configured by the
3313 combination of ``message_retention_duration`` and
3314 ``retain_acked_messages``). For example, if ``time``
3315 corresponds to a point before the message retention window
3316 (or to a point before the system's notion of the
3317 subscription creation time), only retained messages will be
3318 marked as unacknowledged, and already-expunged messages will
3319 not be restored.
3320
3321 This field is a member of `oneof`_ ``target``.
3322 snapshot (str):
3323 Optional. The snapshot to seek to. The snapshot's topic must
3324 be the same as that of the provided subscription. Format is
3325 ``projects/{project}/snapshots/{snap}``.
3326
3327 This field is a member of `oneof`_ ``target``.
3328 """
3329
3330 subscription: str = proto.Field(
3331 proto.STRING,
3332 number=1,
3333 )
3334 time: timestamp_pb2.Timestamp = proto.Field(
3335 proto.MESSAGE,
3336 number=2,
3337 oneof="target",
3338 message=timestamp_pb2.Timestamp,
3339 )
3340 snapshot: str = proto.Field(
3341 proto.STRING,
3342 number=3,
3343 oneof="target",
3344 )
3345
3346
3347class SeekResponse(proto.Message):
3348 r"""Response for the ``Seek`` method (this response is empty)."""
3349
3350
3351__all__ = tuple(sorted(__protobuf__.manifest))